|
2 | 2 |
|
3 | 3 | namespace FortniteApi\Components\Endpoints; |
4 | 4 |
|
5 | | -use FortniteApi\Components\HttpClient; |
6 | 5 | use FortniteApi\Components\Objects\Cosmetic; |
7 | 6 | use FortniteApi\Components\Tasks\CosmeticArrayTask; |
8 | 7 | use FortniteApi\Components\Tasks\CosmeticTask; |
9 | 8 | use FortniteApi\FortniteApi; |
10 | 9 | use FortniteApi\FortniteApiError; |
11 | 10 |
|
| 11 | +use GuzzleHttp\Client; |
| 12 | + |
12 | 13 | /** |
13 | 14 | * Provides access to the /cosmetics/ endpoint |
14 | 15 | */ |
15 | 16 | class CosmeticsEndpoint |
16 | 17 | { |
| 18 | + /** |
| 19 | + * Undocumented variable |
| 20 | + * |
| 21 | + * @var Client |
| 22 | + */ |
| 23 | + private $httpClient; |
| 24 | + |
| 25 | + public function __construct($httpClient) |
| 26 | + { |
| 27 | + $this->httpClient = $httpClient; |
| 28 | + } |
| 29 | + |
17 | 30 | /** |
18 | 31 | * Returns the requested cosmetic. |
19 | 32 | * |
@@ -64,9 +77,9 @@ public function getAsync($cosmeticId, $language = null) |
64 | 77 | } |
65 | 78 |
|
66 | 79 | if (count($query) == 0) { |
67 | | - $promise = HttpClient::getInstance()->getAsync($path); |
| 80 | + $promise = $this->httpClient->getAsync($path); |
68 | 81 | } else { |
69 | | - $promise = HttpClient::getInstance()->getAsync($path, [ |
| 82 | + $promise = $this->httpClient->getAsync($path, [ |
70 | 83 | "query" => $query |
71 | 84 | ]); |
72 | 85 | } |
@@ -116,9 +129,9 @@ public function getAllAsync($language = null) |
116 | 129 | } |
117 | 130 |
|
118 | 131 | if (count($query) == 0) { |
119 | | - $promise = HttpClient::getInstance()->getAsync($path); |
| 132 | + $promise = $this->httpClient->getAsync($path); |
120 | 133 | } else { |
121 | | - $promise = HttpClient::getInstance()->getAsync($path, [ |
| 134 | + $promise = $this->httpClient->getAsync($path, [ |
122 | 135 | "query" => $query |
123 | 136 | ]); |
124 | 137 | } |
@@ -167,7 +180,7 @@ public function searchAsync($query, $language = null) |
167 | 180 | $query["language"] = $language; |
168 | 181 | } |
169 | 182 |
|
170 | | - $promise = HttpClient::getInstance()->getAsync($path, [ |
| 183 | + $promise = $this->httpClient->getAsync($path, [ |
171 | 184 | "query" => $query |
172 | 185 | ]); |
173 | 186 |
|
@@ -215,7 +228,7 @@ public function searchAllAsync($query, $language = null) |
215 | 228 | $query["language"] = $language; |
216 | 229 | } |
217 | 230 |
|
218 | | - $promise = HttpClient::getInstance()->getAsync($path, [ |
| 231 | + $promise = $this->httpClient->getAsync($path, [ |
219 | 232 | "query" => $query |
220 | 233 | ]); |
221 | 234 |
|
@@ -277,7 +290,7 @@ public function searchIdsAsync($ids, $language = null) |
277 | 290 | $query["language"] = $language; |
278 | 291 | } |
279 | 292 |
|
280 | | - $promise = HttpClient::getInstance()->getAsync($path, [ |
| 293 | + $promise = $this->httpClient->getAsync($path, [ |
281 | 294 | "query" => $query |
282 | 295 | ]); |
283 | 296 |
|
|
0 commit comments