@@ -57,6 +57,7 @@ class ApiBase { | |||
* @param array $query | |||
* @param array $headers | |||
* @return resource|string | |||
* @throws \InvalidArgumentException | |||
*/ | |||
protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { | |||
$fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url; |
@@ -28,8 +28,11 @@ use OCP\Remote\ICredentials; | |||
use OCP\Remote\IInstance; | |||
class ApiCollection implements IApiCollection { | |||
/** @var IInstance */ | |||
private $instance; | |||
/** @var ICredentials */ | |||
private $credentials; | |||
/** @var IClientService */ | |||
private $clientService; | |||
public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) { |
@@ -28,6 +28,7 @@ use OCP\Remote\ICredentials; | |||
use OCP\Remote\IInstance; | |||
class ApiFactory implements IApiFactory { | |||
/** @var IClientService */ | |||
private $clientService; | |||
public function __construct(IClientService $clientService) { |
@@ -39,6 +39,7 @@ class Instance implements IInstance { | |||
/** @var IClientService */ | |||
private $clientService; | |||
/** @var array|null */ | |||
private $status; | |||
/** | |||
@@ -93,6 +94,10 @@ class Instance implements IInstance { | |||
return $status['installed'] && !$status['maintenance']; | |||
} | |||
/** | |||
* @return array | |||
* @throws NotFoundException | |||
*/ | |||
private function getStatus() { | |||
if ($this->status) { | |||
return $this->status; | |||
@@ -120,6 +125,10 @@ class Instance implements IInstance { | |||
return $status; | |||
} | |||
/** | |||
* @param string $url | |||
* @return bool|string | |||
*/ | |||
private function downloadStatus($url) { | |||
try { | |||
$request = $this->clientService->newClient()->get($url); |
@@ -27,7 +27,9 @@ use OCP\ICache; | |||
use OCP\Remote\IInstanceFactory; | |||
class InstanceFactory implements IInstanceFactory { | |||
/** @var ICache */ | |||
private $cache; | |||
/** @var IClientService */ | |||
private $clientService; | |||
public function __construct(ICache $cache, IClientService $clientService) { |
@@ -26,7 +26,7 @@ namespace OCP\Remote; | |||
*/ | |||
interface IInstanceFactory { | |||
/** | |||
* @param $url | |||
* @param string $url | |||
* @return IInstance | |||
* | |||
* @since 13.0.0 |