diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 129d36c7da..b3fb04ff6d 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -246,6 +246,14 @@ return array(
'OCP\\OCS\\IDiscoveryService' => $baseDir . '/lib/public/OCS/IDiscoveryService.php',
'OCP\\PreConditionNotMetException' => $baseDir . '/lib/public/PreConditionNotMetException.php',
'OCP\\Preview\\IProvider' => $baseDir . '/lib/public/Preview/IProvider.php',
+ 'OCP\\Remote\\Api\\IApiCollection' => $baseDir . '/lib/public/Remote/Api/IApiCollection.php',
+ 'OCP\\Remote\\Api\\IApiFactory' => $baseDir . '/lib/public/Remote/Api/IApiFactory.php',
+ 'OCP\\Remote\\Api\\ICapabilitiesApi' => $baseDir . '/lib/public/Remote/Api/ICapabilitiesApi.php',
+ 'OCP\\Remote\\Api\\IUserApi' => $baseDir . '/lib/public/Remote/Api/IUserApi.php',
+ 'OCP\\Remote\\ICredentials' => $baseDir . '/lib/public/Remote/ICredentials.php',
+ 'OCP\\Remote\\IInstance' => $baseDir . '/lib/public/Remote/IInstance.php',
+ 'OCP\\Remote\\IInstanceFactory' => $baseDir . '/lib/public/Remote/IInstanceFactory.php',
+ 'OCP\\Remote\\IUser' => $baseDir . '/lib/public/Remote/IUser.php',
'OCP\\Response' => $baseDir . '/lib/public/Response.php',
'OCP\\RichObjectStrings\\Definitions' => $baseDir . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IValidator' => $baseDir . '/lib/public/RichObjectStrings/IValidator.php',
@@ -780,10 +788,13 @@ return array(
'OC\\Preview\\XBitmap' => $baseDir . '/lib/private/Preview/XBitmap.php',
'OC\\RedisFactory' => $baseDir . '/lib/private/RedisFactory.php',
'OC\\Remote\\Api\\ApiBase' => $baseDir . '/lib/private/Remote/Api/ApiBase.php',
+ 'OC\\Remote\\Api\\ApiCollection' => $baseDir . '/lib/private/Remote/Api/ApiCollection.php',
+ 'OC\\Remote\\Api\\ApiFactory' => $baseDir . '/lib/private/Remote/Api/ApiFactory.php',
'OC\\Remote\\Api\\NotFoundException' => $baseDir . '/lib/private/Remote/Api/NotFoundException.php',
'OC\\Remote\\Api\\OCS' => $baseDir . '/lib/private/Remote/Api/OCS.php',
'OC\\Remote\\Credentials' => $baseDir . '/lib/private/Remote/Credentials.php',
'OC\\Remote\\Instance' => $baseDir . '/lib/private/Remote/Instance.php',
+ 'OC\\Remote\\InstanceFactory' => $baseDir . '/lib/private/Remote/InstanceFactory.php',
'OC\\Remote\\User' => $baseDir . '/lib/private/Remote/User.php',
'OC\\Repair' => $baseDir . '/lib/private/Repair.php',
'OC\\RepairException' => $baseDir . '/lib/private/RepairException.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index e7eafdeb42..a905134ce9 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -276,6 +276,14 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OCP\\OCS\\IDiscoveryService' => __DIR__ . '/../../..' . '/lib/public/OCS/IDiscoveryService.php',
'OCP\\PreConditionNotMetException' => __DIR__ . '/../../..' . '/lib/public/PreConditionNotMetException.php',
'OCP\\Preview\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Preview/IProvider.php',
+ 'OCP\\Remote\\Api\\IApiCollection' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IApiCollection.php',
+ 'OCP\\Remote\\Api\\IApiFactory' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IApiFactory.php',
+ 'OCP\\Remote\\Api\\ICapabilitiesApi' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/ICapabilitiesApi.php',
+ 'OCP\\Remote\\Api\\IUserApi' => __DIR__ . '/../../..' . '/lib/public/Remote/Api/IUserApi.php',
+ 'OCP\\Remote\\ICredentials' => __DIR__ . '/../../..' . '/lib/public/Remote/ICredentials.php',
+ 'OCP\\Remote\\IInstance' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstance.php',
+ 'OCP\\Remote\\IInstanceFactory' => __DIR__ . '/../../..' . '/lib/public/Remote/IInstanceFactory.php',
+ 'OCP\\Remote\\IUser' => __DIR__ . '/../../..' . '/lib/public/Remote/IUser.php',
'OCP\\Response' => __DIR__ . '/../../..' . '/lib/public/Response.php',
'OCP\\RichObjectStrings\\Definitions' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/Definitions.php',
'OCP\\RichObjectStrings\\IValidator' => __DIR__ . '/../../..' . '/lib/public/RichObjectStrings/IValidator.php',
@@ -810,10 +818,13 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
'OC\\Preview\\XBitmap' => __DIR__ . '/../../..' . '/lib/private/Preview/XBitmap.php',
'OC\\RedisFactory' => __DIR__ . '/../../..' . '/lib/private/RedisFactory.php',
'OC\\Remote\\Api\\ApiBase' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiBase.php',
+ 'OC\\Remote\\Api\\ApiCollection' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiCollection.php',
+ 'OC\\Remote\\Api\\ApiFactory' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/ApiFactory.php',
'OC\\Remote\\Api\\NotFoundException' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/NotFoundException.php',
'OC\\Remote\\Api\\OCS' => __DIR__ . '/../../..' . '/lib/private/Remote/Api/OCS.php',
'OC\\Remote\\Credentials' => __DIR__ . '/../../..' . '/lib/private/Remote/Credentials.php',
'OC\\Remote\\Instance' => __DIR__ . '/../../..' . '/lib/private/Remote/Instance.php',
+ 'OC\\Remote\\InstanceFactory' => __DIR__ . '/../../..' . '/lib/private/Remote/InstanceFactory.php',
'OC\\Remote\\User' => __DIR__ . '/../../..' . '/lib/private/Remote/User.php',
'OC\\Repair' => __DIR__ . '/../../..' . '/lib/private/Repair.php',
'OC\\RepairException' => __DIR__ . '/../../..' . '/lib/private/RepairException.php',
diff --git a/lib/private/Remote/Api/ApiBase.php b/lib/private/Remote/Api/ApiBase.php
index 907d88a11d..64153a9311 100644
--- a/lib/private/Remote/Api/ApiBase.php
+++ b/lib/private/Remote/Api/ApiBase.php
@@ -21,19 +21,19 @@
namespace OC\Remote\Api;
-use OC\Remote\Credentials;
-use OC\Remote\Instance;
use OCP\Http\Client\IClientService;
+use OCP\Remote\ICredentials;
+use OCP\Remote\IInstance;
class ApiBase {
- /** @var Instance */
+ /** @var IInstance */
private $instance;
- /** @var Credentials */
+ /** @var ICredentials */
private $credentials;
/** @var IClientService */
private $clientService;
- public function __construct(Instance $instance, Credentials $credentials, IClientService $clientService) {
+ public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
$this->instance = $instance;
$this->credentials = $credentials;
$this->clientService = $clientService;
diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php
new file mode 100644
index 0000000000..41b1bac0e0
--- /dev/null
+++ b/lib/private/Remote/Api/ApiCollection.php
@@ -0,0 +1,48 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OC\Remote\Api;
+
+
+use OCP\Http\Client\IClientService;
+use OCP\Remote\Api\IApiCollection;
+use OCP\Remote\ICredentials;
+use OCP\Remote\IInstance;
+
+class ApiCollection implements IApiCollection {
+ private $instance;
+ private $credentials;
+ private $clientService;
+
+ public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) {
+ $this->instance = $instance;
+ $this->credentials = $credentials;
+ $this->clientService = $clientService;
+ }
+
+ public function getCapabilitiesApi() {
+ return new OCS($this->instance, $this->credentials, $this->clientService);
+ }
+
+ public function getUserApi() {
+ return new OCS($this->instance, $this->credentials, $this->clientService);
+ }
+}
diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php
new file mode 100644
index 0000000000..ea084c188f
--- /dev/null
+++ b/lib/private/Remote/Api/ApiFactory.php
@@ -0,0 +1,40 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OC\Remote\Api;
+
+
+use OCP\Http\Client\IClientService;
+use OCP\Remote\Api\IApiFactory;
+use OCP\Remote\ICredentials;
+use OCP\Remote\IInstance;
+
+class ApiFactory implements IApiFactory {
+ private $clientService;
+
+ public function __construct(IClientService $clientService) {
+ $this->clientService = $clientService;
+ }
+
+ public function getApiCollection(IInstance $instance, ICredentials $credentials) {
+ return new ApiCollection($instance, $credentials, $this->clientService);
+ }
+}
diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php
index f02538ad03..427a5adcd9 100644
--- a/lib/private/Remote/Api/OCS.php
+++ b/lib/private/Remote/Api/OCS.php
@@ -26,8 +26,10 @@ use GuzzleHttp\Exception\ClientException;
use OC\ForbiddenException;
use OC\Remote\User;
use OCP\API;
+use OCP\Remote\Api\ICapabilitiesApi;
+use OCP\Remote\Api\IUserApi;
-class OCS extends ApiBase {
+class OCS extends ApiBase implements ICapabilitiesApi, IUserApi {
/**
* @param string $method
* @param string $url
diff --git a/lib/private/Remote/Credentials.php b/lib/private/Remote/Credentials.php
index 3537df3fdc..419b8b21c9 100644
--- a/lib/private/Remote/Credentials.php
+++ b/lib/private/Remote/Credentials.php
@@ -22,7 +22,9 @@
namespace OC\Remote;
-class Credentials {
+use OCP\Remote\ICredentials;
+
+class Credentials implements ICredentials {
/** @var string */
private $user;
/** @var string */
diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php
index f61fbe202a..ab0081d86c 100644
--- a/lib/private/Remote/Instance.php
+++ b/lib/private/Remote/Instance.php
@@ -24,11 +24,12 @@ namespace OC\Remote;
use OC\Remote\Api\NotFoundException;
use OCP\Http\Client\IClientService;
use OCP\ICache;
+use OCP\Remote\IInstance;
/**
* Provides some basic info about a remote Nextcloud instance
*/
-class Instance {
+class Instance implements IInstance {
/** @var string */
private $url;
diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php
new file mode 100644
index 0000000000..3b99bc6182
--- /dev/null
+++ b/lib/private/Remote/InstanceFactory.php
@@ -0,0 +1,41 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OC\Remote;
+
+
+use OCP\Http\Client\IClientService;
+use OCP\ICache;
+use OCP\Remote\IInstanceFactory;
+
+class InstanceFactory implements IInstanceFactory {
+ private $cache;
+ private $clientService;
+
+ public function __construct(ICache $cache, IClientService $clientService) {
+ $this->cache = $cache;
+ $this->clientService = $clientService;
+ }
+
+ public function getInstance($url) {
+ return new Instance($url, $this->cache, $this->clientService);
+ }
+}
diff --git a/lib/private/Remote/User.php b/lib/private/Remote/User.php
index 1fd0521f60..f8d278afda 100644
--- a/lib/private/Remote/User.php
+++ b/lib/private/Remote/User.php
@@ -22,7 +22,9 @@
namespace OC\Remote;
-class User {
+use OCP\Remote\IUser;
+
+class User implements IUser {
/** @var array */
private $data;
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 0c6338f6a4..f4f7cb75ad 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -89,6 +89,8 @@ use OC\Memcache\ArrayCache;
use OC\Memcache\Factory;
use OC\Notification\Manager;
use OC\OCS\DiscoveryService;
+use OC\Remote\Api\ApiFactory;
+use OC\Remote\InstanceFactory;
use OC\Repair\NC11\CleanPreviewsBackgroundJob;
use OC\RichObjectStrings\Validator;
use OC\Security\Bruteforce\Throttler;
@@ -123,6 +125,8 @@ use OCP\IServerContainer;
use OCP\ITempManager;
use OCP\Contacts\ContactsMenu\IActionFactory;
use OCP\Lock\ILockingProvider;
+use OCP\Remote\Api\IApiFactory;
+use OCP\Remote\IInstanceFactory;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share;
@@ -1109,6 +1113,15 @@ class Server extends ServerContainer implements IServerContainer {
$c->getConfig()
);
});
+
+ $this->registerService(IApiFactory::class, function(Server $c) {
+ return new ApiFactory($c->getHTTPClientService());
+ });
+
+ $this->registerService(IInstanceFactory::class, function(Server $c) {
+ $memcacheFactory = $c->getMemCacheFactory();
+ return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
+ });
}
/**
@@ -1878,4 +1891,18 @@ class Server extends ServerContainer implements IServerContainer {
public function getCloudIdManager() {
return $this->query(ICloudIdManager::class);
}
+
+ /**
+ * @return \OCP\Remote\Api\IApiFactory
+ */
+ public function getRemoteApiFactory() {
+ return $this->query(IApiFactory::class);
+ }
+
+ /**
+ * @return \OCP\Remote\IInstanceFactory
+ */
+ public function getRemoteInstanceFactory() {
+ return $this->query(IInstanceFactory::class);
+ }
}
diff --git a/lib/public/IServerContainer.php b/lib/public/IServerContainer.php
index 8c33a765d5..851a3c7e2b 100644
--- a/lib/public/IServerContainer.php
+++ b/lib/public/IServerContainer.php
@@ -541,4 +541,16 @@ interface IServerContainer extends IContainer {
* @since 12.0.0
*/
public function getCloudIdManager();
+
+ /**
+ * @return \OCP\Remote\Api\IApiFactory
+ * @since 13.0.0
+ */
+ public function getRemoteApiFactory();
+
+ /**
+ * @return \OCP\Remote\IInstanceFactory
+ * @since 13.0.0
+ */
+ public function getRemoteInstanceFactory();
}
diff --git a/lib/public/Remote/Api/IApiCollection.php b/lib/public/Remote/Api/IApiCollection.php
new file mode 100644
index 0000000000..c2bb11114d
--- /dev/null
+++ b/lib/public/Remote/Api/IApiCollection.php
@@ -0,0 +1,43 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote\Api;
+
+/**
+ * Provides access to the various apis of a remote instance
+ *
+ * @since 13.0.0
+ */
+interface IApiCollection {
+ /**
+ * @return IUserApi
+ *
+ * @since 13.0.0
+ */
+ public function getUserApi();
+
+ /**
+ * @return ICapabilitiesApi
+ *
+ * @since 13.0.0
+ */
+ public function getCapabilitiesApi();
+}
diff --git a/lib/public/Remote/Api/IApiFactory.php b/lib/public/Remote/Api/IApiFactory.php
new file mode 100644
index 0000000000..f1830f4c04
--- /dev/null
+++ b/lib/public/Remote/Api/IApiFactory.php
@@ -0,0 +1,39 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote\Api;
+
+use OCP\Remote\ICredentials;
+use OCP\Remote\IInstance;
+
+/**
+ * @since 13.0.0
+ */
+interface IApiFactory {
+ /**
+ * @param IInstance $instance
+ * @param ICredentials $credentials
+ * @return IApiCollection
+ *
+ * @since 13.0.0
+ */
+ public function getApiCollection(IInstance $instance, ICredentials $credentials);
+}
diff --git a/lib/public/Remote/Api/ICapabilitiesApi.php b/lib/public/Remote/Api/ICapabilitiesApi.php
new file mode 100644
index 0000000000..855be7b520
--- /dev/null
+++ b/lib/public/Remote/Api/ICapabilitiesApi.php
@@ -0,0 +1,34 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote\Api;
+
+/**
+ * @since 13.0.0
+ */
+interface ICapabilitiesApi {
+ /**
+ * @return array The capabilities in the form of [$appId => [$capability => $value]]
+ *
+ * @since 13.0.0
+ */
+ public function getCapabilities();
+}
diff --git a/lib/public/Remote/Api/IUserApi.php b/lib/public/Remote/Api/IUserApi.php
new file mode 100644
index 0000000000..9fa05dee01
--- /dev/null
+++ b/lib/public/Remote/Api/IUserApi.php
@@ -0,0 +1,37 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote\Api;
+
+use OCP\Remote\IUser;
+
+/**
+ * @since 13.0.0
+ */
+interface IUserApi {
+ /**
+ * @param string $userId
+ * @return IUser
+ *
+ * @since 13.0.0
+ */
+ public function getUser($userId);
+}
diff --git a/lib/public/Remote/ICredentials.php b/lib/public/Remote/ICredentials.php
new file mode 100644
index 0000000000..587bb4d593
--- /dev/null
+++ b/lib/public/Remote/ICredentials.php
@@ -0,0 +1,43 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote;
+
+/**
+ * The credentials for a remote user
+ *
+ * @since 13.0.0
+ */
+interface ICredentials {
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getUsername();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getPassword();
+}
diff --git a/lib/public/Remote/IInstance.php b/lib/public/Remote/IInstance.php
new file mode 100644
index 0000000000..08973308ab
--- /dev/null
+++ b/lib/public/Remote/IInstance.php
@@ -0,0 +1,66 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote;
+
+/**
+ * Provides some basic info about a remote Nextcloud instance
+ *
+ * @since 13.0.0
+ */
+interface IInstance {
+ /**
+ * @return string The url of the remote server without protocol
+ *
+ * @since 13.0.0
+ */
+ public function getUrl();
+
+ /**
+ * @return string The of of the remote server with protocol
+ *
+ * @since 13.0.0
+ */
+ public function getFullUrl();
+
+ /**
+ * @return string The full version string in '13.1.2.3' format
+ *
+ * @since 13.0.0
+ */
+ public function getVersion();
+
+ /**
+ * @return string 'http' or 'https'
+ *
+ * @since 13.0.0
+ */
+ public function getProtocol();
+
+ /**
+ * Check that the remote server is installed and not in maintenance mode
+ *
+ * @since 13.0.0
+ *
+ * @return bool
+ */
+ public function isActive();
+}
diff --git a/lib/public/Remote/IInstanceFactory.php b/lib/public/Remote/IInstanceFactory.php
new file mode 100644
index 0000000000..22ac85563f
--- /dev/null
+++ b/lib/public/Remote/IInstanceFactory.php
@@ -0,0 +1,35 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote;
+
+/**
+ * @since 13.0.0
+ */
+interface IInstanceFactory {
+ /**
+ * @param $url
+ * @return IInstance
+ *
+ * @since 13.0.0
+ */
+ public function getInstance($url);
+}
diff --git a/lib/public/Remote/IUser.php b/lib/public/Remote/IUser.php
new file mode 100644
index 0000000000..c34531d384
--- /dev/null
+++ b/lib/public/Remote/IUser.php
@@ -0,0 +1,120 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCP\Remote;
+
+/**
+ * User info for a remote user
+ *
+ * @since 13.0.0
+ */
+interface IUser {
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getUserId();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getEmail();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getDisplayName();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getPhone();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getAddress();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getWebsite();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getTwitter();
+
+ /**
+ * @return string[]
+ *
+ * @since 13.0.0
+ */
+ public function getGroups();
+
+ /**
+ * @return string
+ *
+ * @since 13.0.0
+ */
+ public function getLanguage();
+
+ /**
+ * @return int
+ *
+ * @since 13.0.0
+ */
+ public function getUsedSpace();
+
+ /**
+ * @return int
+ *
+ * @since 13.0.0
+ */
+ public function getFreeSpace();
+
+ /**
+ * @return int
+ *
+ * @since 13.0.0
+ */
+ public function getTotalSpace();
+
+ /**
+ * @return int
+ *
+ * @since 13.0.0
+ */
+ public function getQuota();
+}