1 | <?php |
||
9 | class Client |
||
10 | { |
||
11 | /** |
||
12 | * @var string|null |
||
13 | */ |
||
14 | protected $accessToken = null; |
||
15 | |||
16 | /** |
||
17 | * @var \GuzzleHttp\Client |
||
18 | */ |
||
19 | protected $httpClient; |
||
20 | |||
21 | /** |
||
22 | * Poniverse.net Client ID. |
||
23 | * |
||
24 | * @var string |
||
25 | */ |
||
26 | private $clientId; |
||
27 | |||
28 | /** |
||
29 | * Poniverse.net Client Secret. |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $clientSecret; |
||
34 | |||
35 | protected $poniverseUrl = 'http://api.poniverse.local'; |
||
36 | protected $ponyfmUrl = 'https://pony.fm'; |
||
37 | |||
38 | /** |
||
39 | * Initializes the Poniverse Api client. |
||
40 | * |
||
41 | * @param string $clientId |
||
42 | * @param string $clientSecret |
||
43 | * @param \GuzzleHttp\Client $httpClient |
||
44 | */ |
||
45 | public function __construct($clientId, $clientSecret, HttpClient $httpClient) |
||
51 | |||
52 | /** |
||
53 | * Returns the set access key. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function getAccessToken() |
||
61 | |||
62 | /** |
||
63 | * Sets the access token to communicate to the api with. |
||
64 | * |
||
65 | * @param $accessToken |
||
66 | * |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function setAccessToken(AccessToken $accessToken) |
||
75 | |||
76 | /** |
||
77 | * Returns the http client. |
||
78 | * |
||
79 | * @return \GuzzleHttp\Client |
||
80 | */ |
||
81 | public function getHttpClient() |
||
85 | |||
86 | public function getAuthHeader() |
||
90 | |||
91 | public function getPoniverseUrl() |
||
95 | |||
96 | public function getPonyfmUrl() |
||
100 | |||
101 | /** |
||
102 | * Returns the Poniverse OAuth Provider class. |
||
103 | * |
||
104 | * @param array $options |
||
105 | * @return PoniverseProvider |
||
106 | */ |
||
107 | public function getOAuthProvider(array $options = []) |
||
116 | } |
||
117 |