summaryrefslogtreecommitdiffstats
path: root/lib/private/Remote/Api
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Remote/Api')
-rw-r--r--lib/private/Remote/Api/ApiBase.php10
-rw-r--r--lib/private/Remote/Api/ApiCollection.php48
-rw-r--r--lib/private/Remote/Api/ApiFactory.php40
-rw-r--r--lib/private/Remote/Api/OCS.php4
4 files changed, 96 insertions, 6 deletions
diff --git a/lib/private/Remote/Api/ApiBase.php b/lib/private/Remote/Api/ApiBase.php
index 907d88a11d9..64153a9311f 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 00000000000..41b1bac0e08
--- /dev/null
+++ b/lib/private/Remote/Api/ApiCollection.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+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 00000000000..ea084c188f1
--- /dev/null
+++ b/lib/private/Remote/Api/ApiFactory.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * @copyright Copyright (c) 2017 Robin Appelman <robin@icewind.nl>
+ *
+ * @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 <http://www.gnu.org/licenses/>.
+ *
+ */
+
+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 f02538ad03b..427a5adcd96 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