1 | <?php |
||
30 | class HubicService implements SingletonInterface |
||
31 | { |
||
32 | const AUTHORIZATION_ENDPOINT = 'https://api.hubic.com/oauth/auth/'; |
||
33 | |||
34 | const TOKEN_ENDPOINT = 'https://api.hubic.com/oauth/token/'; |
||
35 | |||
36 | const DOMAIN_API = 'https://api.hubic.com/'; |
||
37 | |||
38 | const VERSION_API = '1.0'; |
||
39 | |||
40 | /** |
||
41 | * @var RequestFactory |
||
42 | */ |
||
43 | protected $requestFactory; |
||
44 | |||
45 | /** |
||
46 | * @var \TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager |
||
47 | */ |
||
48 | protected $persistenceManager; |
||
49 | |||
50 | /** |
||
51 | * @var \Filoucrackeur\Hubic\Domain\Repository\AccountRepository |
||
52 | */ |
||
53 | protected $accountRepository; |
||
54 | |||
55 | /** |
||
56 | * @var \Filoucrackeur\Hubic\Domain\Model\Account |
||
57 | */ |
||
58 | protected $account; |
||
59 | |||
60 | /** |
||
61 | * @param Account $account |
||
62 | * |
||
63 | * @return bool |
||
64 | * @throws \RuntimeException |
||
65 | */ |
||
66 | 1 | public function accessToken(Account $account): bool |
|
96 | |||
97 | /** |
||
98 | * @return string |
||
99 | */ |
||
100 | 2 | public function getHost(): string |
|
104 | |||
105 | /** |
||
106 | * @param Account $account |
||
107 | */ |
||
108 | public function redirectUrlRequestToken(Account $account) |
||
121 | |||
122 | /** |
||
123 | * @param Account $account |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | public function getRedirectUri(Account $account): string |
||
145 | |||
146 | /** |
||
147 | * @return ResponseInterface|string |
||
148 | */ |
||
149 | 1 | public function getAccount() |
|
153 | |||
154 | /** |
||
155 | * @param Account $account |
||
156 | */ |
||
157 | 7 | public function setAccount(Account $account) |
|
161 | |||
162 | /** |
||
163 | * @param string $path |
||
164 | * @param string $method |
||
165 | * @param array $arguments |
||
166 | * @return \Psr\Http\Message\ResponseInterface|string |
||
167 | */ |
||
168 | 1 | public function fetch(string $path, $method = 'GET', array $arguments = []) |
|
196 | |||
197 | /** |
||
198 | * @param Account $account |
||
199 | * @return bool |
||
200 | */ |
||
201 | 1 | public function refreshToken(Account $account): bool |
|
228 | |||
229 | /** |
||
230 | * @param Account $account |
||
231 | */ |
||
232 | 1 | public function delete(Account $account) |
|
237 | |||
238 | /** |
||
239 | * @param Account $account |
||
240 | */ |
||
241 | 1 | public function unlink(Account $account) |
|
248 | |||
249 | /** |
||
250 | * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface |
||
251 | */ |
||
252 | 1 | public function getAccounts() |
|
256 | |||
257 | /** |
||
258 | * Get hubiC account Quota. |
||
259 | * |
||
260 | * @see https://api.hubic.com/console/ |
||
261 | * |
||
262 | * @return ResponseInterface|null |
||
263 | */ |
||
264 | 1 | public function getAccountQuota() |
|
268 | |||
269 | /** |
||
270 | * Get hubiC agreements. |
||
271 | * |
||
272 | * @see https://api.hubic.com/console/ |
||
273 | * |
||
274 | * @return ResponseInterface|null |
||
275 | */ |
||
276 | 1 | public function getAgreement() |
|
280 | |||
281 | /** |
||
282 | * Get hubiC getAllLinks. |
||
283 | * |
||
284 | * @see https://api.hubic.com/console/ |
||
285 | * |
||
286 | * @return ResponseInterface|null |
||
287 | */ |
||
288 | 2 | public function getAllLinks() |
|
292 | |||
293 | /** |
||
294 | * Delete hubiC link. |
||
295 | * |
||
296 | * @see https://api.hubic.com/console/ |
||
297 | * |
||
298 | * @param Account $account |
||
299 | * @param string $uri |
||
300 | * @return ResponseInterface|null |
||
301 | */ |
||
302 | 1 | public function deleteLink(Account $account, string $uri) |
|
312 | |||
313 | /** |
||
314 | * @param RequestFactory $requestFactory |
||
315 | */ |
||
316 | 13 | public function injectRequestFactory(RequestFactory $requestFactory) |
|
320 | |||
321 | /** |
||
322 | * @param PersistenceManager $persistenceManager |
||
323 | */ |
||
324 | 12 | public function injectPersistenceManager(PersistenceManager $persistenceManager) |
|
328 | |||
329 | /** |
||
330 | * @param AccountRepository $accountRepository |
||
331 | */ |
||
332 | 1 | public function injectAccountRepository(AccountRepository $accountRepository) |
|
336 | } |
||
337 |