1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Xklusive\BattlenetApi\Services; |
4
|
|
|
|
5
|
|
|
use Xklusive\BattlenetApi\BattlenetHttpClient; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @author Guillaume Meheust <[email protected]> |
9
|
|
|
*/ |
10
|
|
|
class WowService extends BattlenetHttpClient |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* {@inheritdoc} |
14
|
|
|
*/ |
15
|
|
|
protected $gameParam = '/wow'; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Get achievement information by id. |
19
|
|
|
* |
20
|
|
|
* This provides data about an individual achievement |
21
|
|
|
* |
22
|
|
|
* @param int $achievementId Id of the achievement to retrieve |
23
|
|
|
* @param array $options Options |
24
|
|
|
* |
25
|
|
|
* @return Illuminate\Support\Collection api response |
26
|
|
|
*/ |
27
|
|
|
public function getAchievement($achievementId, array $options = []) |
28
|
|
|
{ |
29
|
|
|
return $this->cache('/achievement/'.(int) $achievementId, $options, __FUNCTION__); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Get auction data. |
34
|
|
|
* |
35
|
|
|
* Auction APIs currently provide rolling batches of data about current auctions. Fetching auction dumps is a two |
36
|
|
|
* step process that involves checking a per-realm index file to determine if a recent dump has been generated and |
37
|
|
|
* then fetching the most recently generated dump file if necessary. |
38
|
|
|
* |
39
|
|
|
* This API resource provides a per-realm list of recently generated auction house data dumps |
40
|
|
|
* |
41
|
|
|
* @param string $realm Realm being requested |
42
|
|
|
* @param array $options Options |
43
|
|
|
* |
44
|
|
|
* @return Illuminate\Support\Collection api response |
45
|
|
|
*/ |
46
|
|
|
public function getAuctionDataStatus($realm, array $options = []) |
47
|
|
|
{ |
48
|
|
|
return $this->cache('/auction/data/'.(string) $realm, $options, __FUNCTION__); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get boss master list. |
53
|
|
|
* |
54
|
|
|
* A list of all supported bosses. A 'boss' in this context should be considered a boss encounter, which may include |
55
|
|
|
* more than one NPC. |
56
|
|
|
* |
57
|
|
|
* @param array $options Options |
58
|
|
|
* |
59
|
|
|
* @return Illuminate\Support\Collection api response |
60
|
|
|
*/ |
61
|
|
|
public function getBossMasterList(array $options = []) |
62
|
|
|
{ |
63
|
|
|
return $this->cache('/boss/', $options, __FUNCTION__); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Get boss information by id. |
68
|
|
|
* |
69
|
|
|
* The boss API provides information about bosses. A 'boss' in this context should be considered a boss encounter, |
70
|
|
|
* which may include more than one NPC. |
71
|
|
|
* |
72
|
|
|
* @param int $bossId Id of the boss you want to retrieve |
73
|
|
|
* @param array $options Options |
74
|
|
|
* |
75
|
|
|
* @return Illuminate\Support\Collection api response |
76
|
|
|
*/ |
77
|
|
|
public function getBoss($bossId, array $options = []) |
78
|
|
|
{ |
79
|
|
|
return $this->cache('/boss/'.(int) $bossId, $options, __FUNCTION__); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get realm leaderboards. |
84
|
|
|
* |
85
|
|
|
* The data in this request has data for all 9 challenge mode maps (currently). The map field includes the current |
86
|
|
|
* medal times for each dungeon. Inside each ladder we provide data about each character that was part of each run. |
87
|
|
|
* The character data includes the current cached spec of the character while the member field includes the spec of |
88
|
|
|
* the character during the challenge mode run. |
89
|
|
|
* |
90
|
|
|
* @param string $realm Realm's name being requested |
91
|
|
|
* @param array $options Options |
92
|
|
|
* |
93
|
|
|
* @return Illuminate\Support\Collection api response |
94
|
|
|
*/ |
95
|
|
|
public function getRealmLeaderboard($realm, array $options = []) |
96
|
|
|
{ |
97
|
|
|
return $this->cache('/challenge/'.(string) $realm, $options, __FUNCTION__); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Get region leaderboards. |
102
|
|
|
* |
103
|
|
|
* The region leaderboard has the exact same data format as the realm leaderboards except there is no realm field. |
104
|
|
|
* It is simply the top 100 results gathered for each map for all of the available realm leaderboards in a region. |
105
|
|
|
* |
106
|
|
|
* @param array $options Options |
107
|
|
|
* |
108
|
|
|
* @return Illuminate\Support\Collection api response |
109
|
|
|
*/ |
110
|
|
|
public function getRegionLeaderboard(array $options = []) |
111
|
|
|
{ |
112
|
|
|
return $this->cache('/challenge/region/', $options, __FUNCTION__); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Get character information. |
117
|
|
|
* |
118
|
|
|
* The Character Profile API is the primary way to access character information. This Character Profile API can be |
119
|
|
|
* used to fetch a single character at a time through an HTTP GET request to a URL describing the character profile |
120
|
|
|
* resource. By default, a basic dataset will be returned and with each request and zero or more additional fields |
121
|
|
|
* can be retrieved. To access this API, craft a resource URL pointing to the character who's information is to be |
122
|
|
|
* retrieved |
123
|
|
|
* |
124
|
|
|
* @param string $realm Character's realm. Can be provided as the proper realm name or the normalized realm name |
125
|
|
|
* @param string $characterName Name of the character you want to retrieve |
126
|
|
|
* @param array $options Options |
127
|
|
|
* |
128
|
|
|
* @return Illuminate\Support\Collection api response |
129
|
|
|
*/ |
130
|
|
|
public function getCharacter($realm, $characterName, array $options = []) |
131
|
|
|
{ |
132
|
|
|
return $this->cache('/character/'.(string) $realm.'/'.(string) $characterName, $options, __FUNCTION__); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Get guild profile. |
137
|
|
|
* |
138
|
|
|
* The guild profile API is the primary way to access guild information. This guild profile API can be used to fetch |
139
|
|
|
* a single guild at a time through an HTTP GET request to a url describing the guild profile resource. By default, |
140
|
|
|
* a basic dataset will be returned and with each request and zero or more additional fields can be retrieved. |
141
|
|
|
* |
142
|
|
|
* There are no required query string parameters when accessing this resource, although the fields query string |
143
|
|
|
* parameter can optionally be passed to indicate that one or more of the optional datasets is to be retrieved. |
144
|
|
|
* Those additional fields are listed in the method titled "Optional Fields". |
145
|
|
|
* |
146
|
|
|
* @param string $realm Realm the guild lives on |
147
|
|
|
* @param string $guildName Name of the guild being retrieved |
148
|
|
|
* @param array $options Options |
149
|
|
|
* |
150
|
|
|
* @return Illuminate\Support\Collection api response |
151
|
|
|
*/ |
152
|
|
|
public function getGuild($realm, $guildName, array $options = []) |
153
|
|
|
{ |
154
|
|
|
return $this->cache('/guild/'.(string) $realm.'/'.(string) $guildName, $options, __FUNCTION__); |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Get guild members. |
159
|
|
|
* |
160
|
|
|
* This provides a list of characters currently in the guild Roster. |
161
|
|
|
* This is a wrapper function for the getGuild data function for easier access. |
162
|
|
|
* |
163
|
|
|
* @param string $realm Realm the guild lives on |
164
|
|
|
* @param string $guildName Name of the guild being retrieved |
165
|
|
|
* @param array $options Options |
166
|
|
|
* |
167
|
|
|
* @return Illuminate\Support\Collection api response |
168
|
|
|
*/ |
169
|
|
|
public function getGuildMembers($realm, $guildName, array $options = []) |
170
|
|
|
{ |
171
|
|
|
if ( array_key_exists('fields', $options) && strpos($options['fields'], 'members') === false ) { |
172
|
|
|
$options['fields'] = implode(',',[$options['fields'],'members']); |
173
|
|
|
} else { |
174
|
|
|
$options['fields'] = 'members'; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
$options['query'] = $options; // this is a query options so we need to handle it like that. |
178
|
|
|
|
179
|
|
|
return $this->getGuild($realm, $guildName, $options); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Get item information by id. |
184
|
|
|
* |
185
|
|
|
* The item API provides detailed item information. This includes item set information if this item is part of a set. |
186
|
|
|
* |
187
|
|
|
* @param int $itemId Id of the item being retrieved |
188
|
|
|
* @param array $options Options |
189
|
|
|
* |
190
|
|
|
* @return Illuminate\Support\Collection api response |
191
|
|
|
*/ |
192
|
|
|
public function getItem($itemId, array $options = []) |
193
|
|
|
{ |
194
|
|
|
return $this->cache('/item/'.(int) $itemId, $options, __FUNCTION__); |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Get set information by id. |
199
|
|
|
* |
200
|
|
|
* The item API provides detailed item information. This includes item set information if this item is part of a set. |
201
|
|
|
* |
202
|
|
|
* @param int $setId Id of the set being requested |
203
|
|
|
* @param array $options Options |
204
|
|
|
* |
205
|
|
|
* @return Illuminate\Support\Collection api response |
206
|
|
|
*/ |
207
|
|
|
public function getItemSet($setId, array $options = []) |
208
|
|
|
{ |
209
|
|
|
return $this->cache('/item/set/'.(int) $setId, $options, __FUNCTION__); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Get mount master list. |
214
|
|
|
* |
215
|
|
|
* A list of all supported mounts |
216
|
|
|
* |
217
|
|
|
* @param array $options Options |
218
|
|
|
* |
219
|
|
|
* @return Illuminate\Support\Collection api response |
220
|
|
|
*/ |
221
|
|
|
public function getMountMasterList(array $options = []) |
222
|
|
|
{ |
223
|
|
|
return $this->cache('/mount/', $options, __FUNCTION__); |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get pet lists. |
228
|
|
|
* |
229
|
|
|
* A list of all supported battle and vanity pets |
230
|
|
|
* |
231
|
|
|
* @param array $options Options |
232
|
|
|
* |
233
|
|
|
* @return Illuminate\Support\Collection api response |
234
|
|
|
*/ |
235
|
|
|
public function getPetList(array $options = []) |
236
|
|
|
{ |
237
|
|
|
return $this->cache('/pet/', $options, __FUNCTION__); |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* Get pet ability information by id. |
242
|
|
|
* |
243
|
|
|
* This provides data about a individual battle pet ability ID. We do not provide the tooltip for the ability yet. |
244
|
|
|
* We are working on a better way to provide this since it depends on your pet's species, level and quality rolls. |
245
|
|
|
* |
246
|
|
|
* @param int $abilityId Id of the ability you want to retrieve |
247
|
|
|
* @param array $options Options |
248
|
|
|
* |
249
|
|
|
* @return Illuminate\Support\Collection api response |
250
|
|
|
*/ |
251
|
|
|
public function getPetAbility($abilityId, array $options = []) |
252
|
|
|
{ |
253
|
|
|
return $this->cache('/pet/ability/'.(int) $abilityId, $options, __FUNCTION__); |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Get pet species information by id. |
258
|
|
|
* |
259
|
|
|
* This provides the data about an individual pet species. The species IDs can be found your character profile |
260
|
|
|
* using the options pets field. Each species also has data about what it's 6 abilities are. |
261
|
|
|
* |
262
|
|
|
* @param int $speciesId The species you want to retrieve |
263
|
|
|
* @param array $options Options |
264
|
|
|
* |
265
|
|
|
* @return Illuminate\Support\Collection api response |
266
|
|
|
*/ |
267
|
|
|
public function getPetSpecies($speciesId, array $options = []) |
268
|
|
|
{ |
269
|
|
|
return $this->cache('/pet/species/'.(int) $speciesId, $options, __FUNCTION__); |
270
|
|
|
} |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Get pet stats by species id. |
274
|
|
|
* |
275
|
|
|
* Retrieve detailed information about a given species of pet |
276
|
|
|
* |
277
|
|
|
* @param int $speciesId Pet's species id. This can be found by querying a users' list of pets via the Character Profile API |
278
|
|
|
* @param array $options Options |
279
|
|
|
* |
280
|
|
|
* @return Illuminate\Support\Collection api response |
281
|
|
|
*/ |
282
|
|
|
public function getPetStats($speciesId, array $options = []) |
283
|
|
|
{ |
284
|
|
|
return $this->cache('/pet/stats/'.(int) $speciesId, $options, __FUNCTION__); |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Get leaderboards. |
289
|
|
|
* |
290
|
|
|
* The Leaderboard API endpoint provides leaderboard information for the 2v2, 3v3, 5v5 and Rated Battleground |
291
|
|
|
* leaderboards. |
292
|
|
|
* |
293
|
|
|
* @param int $bracket Type of leaderboard you want to retrieve. Example: 2v2, 3v3, 5v5, and rbg |
294
|
|
|
* @param array $options Options |
295
|
|
|
* |
296
|
|
|
* @return Illuminate\Support\Collection api response |
297
|
|
|
*/ |
298
|
|
|
public function getLeaderboards($bracket, array $options = []) |
299
|
|
|
{ |
300
|
|
|
return $this->cache('/leaderboard/'.(string) $bracket, $options, __FUNCTION__); |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
/** |
304
|
|
|
* Get quest information by id. |
305
|
|
|
* |
306
|
|
|
* Retrieve metadata for a given quest. |
307
|
|
|
* |
308
|
|
|
* @param int $questId Id of the quest you want to retrieve |
309
|
|
|
* @param array $options Options |
310
|
|
|
* |
311
|
|
|
* @return Illuminate\Support\Collection api response |
312
|
|
|
*/ |
313
|
|
|
public function getQuest($questId, array $options = []) |
314
|
|
|
{ |
315
|
|
|
return $this->cache('/quest/'.(int) $questId, $options, __FUNCTION__); |
316
|
|
|
} |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Get realm status. |
320
|
|
|
* |
321
|
|
|
* The realm status API allows developers to retrieve realm status information. This information is limited to |
322
|
|
|
* whether or not the realm is up, the type and state of the realm, the current population, and the status of the |
323
|
|
|
* two world PvP zones |
324
|
|
|
* |
325
|
|
|
* @param array $options Options |
326
|
|
|
* |
327
|
|
|
* @return Illuminate\Support\Collection api response |
328
|
|
|
*/ |
329
|
|
|
public function getRealmStatus(array $options = []) |
330
|
|
|
{ |
331
|
|
|
return $this->cache('/realm/', $options, __FUNCTION__); |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Get recipe information by id. |
336
|
|
|
* |
337
|
|
|
* The recipe API provides basic recipe information |
338
|
|
|
* |
339
|
|
|
* @param int $recipeId Id for the desired recipe |
340
|
|
|
* @param array $options Options |
341
|
|
|
* |
342
|
|
|
* @return Illuminate\Support\Collection api response |
343
|
|
|
*/ |
344
|
|
|
public function getRecipe($recipeId, array $options = []) |
345
|
|
|
{ |
346
|
|
|
return $this->cache('/recipe/'.(int) $recipeId, $options, __FUNCTION__); |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* Get spell information by id. |
351
|
|
|
* |
352
|
|
|
* The spell API provides some information about spells |
353
|
|
|
* |
354
|
|
|
* @param int $spellId Id of the desired spell |
355
|
|
|
* @param array $options Options |
356
|
|
|
* |
357
|
|
|
* @return Illuminate\Support\Collection api response |
358
|
|
|
*/ |
359
|
|
|
public function getSpell($spellId, array $options = []) |
360
|
|
|
{ |
361
|
|
|
return $this->cache('/spell/'.(int) $spellId, $options, __FUNCTION__); |
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
/** |
365
|
|
|
* Get zone master list. |
366
|
|
|
* |
367
|
|
|
* A list of all supported zones and their bosses. A 'zone' in this context should be considered a dungeon, or a |
368
|
|
|
* raid, not a zone as in a world zone. A 'boss' in this context should be considered a boss encounter, which may |
369
|
|
|
* include more than one NPC. |
370
|
|
|
* |
371
|
|
|
* @param array $options Options |
372
|
|
|
* |
373
|
|
|
* @return Illuminate\Support\Collection api response |
374
|
|
|
*/ |
375
|
|
|
public function getZonesMasterList(array $options = []) |
376
|
|
|
{ |
377
|
|
|
return $this->cache('/zone/', $options, __FUNCTION__); |
378
|
|
|
} |
379
|
|
|
|
380
|
|
|
/** |
381
|
|
|
* Get zone information by id. |
382
|
|
|
* |
383
|
|
|
* The Zone API provides some information about zones. |
384
|
|
|
* |
385
|
|
|
* @param int $zoneId Id of the zone you want to retrieve |
386
|
|
|
* @param array $options Options |
387
|
|
|
* |
388
|
|
|
* @return Illuminate\Support\Collection api response |
389
|
|
|
*/ |
390
|
|
|
public function getZone($zoneId, array $options = []) |
391
|
|
|
{ |
392
|
|
|
return $this->cache('/zone/'.(int) $zoneId, $options, __FUNCTION__); |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Get data battlegroups. |
397
|
|
|
* |
398
|
|
|
* The battlegroups data API provides the list of battlegroups for this region. Please note the trailing '/' on this URL |
399
|
|
|
* |
400
|
|
|
* @param array $options Options |
401
|
|
|
* |
402
|
|
|
* @return Illuminate\Support\Collection api response |
403
|
|
|
*/ |
404
|
|
|
public function getDataBattlegroups(array $options = []) |
405
|
|
|
{ |
406
|
|
|
$this->cache('/data/battlegroups/', $options, __FUNCTION__); |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* Get data character races. |
411
|
|
|
* |
412
|
|
|
* The character races data API provides a list of each race and their associated faction, name, unique ID, and skin |
413
|
|
|
* |
414
|
|
|
* @param array $options Options |
415
|
|
|
* |
416
|
|
|
* @return Illuminate\Support\Collection api response |
417
|
|
|
*/ |
418
|
|
|
public function getDataCharacterRaces(array $options = []) |
419
|
|
|
{ |
420
|
|
|
return $this->cache('/data/character/races', $options, __FUNCTION__); |
421
|
|
|
} |
422
|
|
|
|
423
|
|
|
/** |
424
|
|
|
* Get data character classes. |
425
|
|
|
* |
426
|
|
|
* The character classes data API provides a list of character classes |
427
|
|
|
* |
428
|
|
|
* @param array $options Options |
429
|
|
|
* |
430
|
|
|
* @return Illuminate\Support\Collection api response |
431
|
|
|
*/ |
432
|
|
|
public function getDataCharacterClasses(array $options = []) |
433
|
|
|
{ |
434
|
|
|
return $this->cache('/data/character/classes', $options, __FUNCTION__); |
435
|
|
|
} |
436
|
|
|
|
437
|
|
|
/** |
438
|
|
|
* Get data character achievements. |
439
|
|
|
* |
440
|
|
|
* The character achievements data API provides a list of all of the achievements that characters can earn as well |
441
|
|
|
* as the category structure and hierarchy |
442
|
|
|
* |
443
|
|
|
* @param array $options Options |
444
|
|
|
* |
445
|
|
|
* @return Illuminate\Support\Collection api response |
446
|
|
|
*/ |
447
|
|
|
public function getDataCharacterAchievements(array $options = []) |
448
|
|
|
{ |
449
|
|
|
return $this->cache('/data/character/achievements', $options, __FUNCTION__); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
/** |
453
|
|
|
* Get data guild rewards. |
454
|
|
|
* |
455
|
|
|
* The guild rewards data API provides a list of all guild rewards |
456
|
|
|
* |
457
|
|
|
* @param array $options Options |
458
|
|
|
* |
459
|
|
|
* @return Illuminate\Support\Collection api response |
460
|
|
|
*/ |
461
|
|
|
public function getDataGuildRewards(array $options = []) |
462
|
|
|
{ |
463
|
|
|
return $this->cache('/data/guild/rewards', $options, __FUNCTION__); |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* Get data guild perks. |
468
|
|
|
* |
469
|
|
|
* The guild perks data API provides a list of all guild perks |
470
|
|
|
* |
471
|
|
|
* @param array $options Options |
472
|
|
|
* |
473
|
|
|
* @return Illuminate\Support\Collection api response |
474
|
|
|
*/ |
475
|
|
|
public function getDataGuildPerks(array $options = []) |
476
|
|
|
{ |
477
|
|
|
return $this->cache('/data/guild/perks', $options, __FUNCTION__); |
478
|
|
|
} |
479
|
|
|
|
480
|
|
|
/** |
481
|
|
|
* Get data guild achievements. |
482
|
|
|
* |
483
|
|
|
* The guild achievements data API provides a list of all of the achievements that guilds can earn as well as the |
484
|
|
|
* category structure and hierarchy |
485
|
|
|
* |
486
|
|
|
* @param array $options Options |
487
|
|
|
* |
488
|
|
|
* @return Illuminate\Support\Collection api response |
489
|
|
|
*/ |
490
|
|
|
public function getDataGuildAchievements(array $options = []) |
491
|
|
|
{ |
492
|
|
|
return $this->cache('/data/guild/achievements', $options, __FUNCTION__); |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* Get data item classes. |
497
|
|
|
* |
498
|
|
|
* The item classes data API provides a list of item classes |
499
|
|
|
* |
500
|
|
|
* @param array $options Options |
501
|
|
|
* |
502
|
|
|
* @return Illuminate\Support\Collection api response |
503
|
|
|
*/ |
504
|
|
|
public function getDataItemClasses(array $options = []) |
505
|
|
|
{ |
506
|
|
|
return $this->cache('/data/item/classes', $options, __FUNCTION__); |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* Get data talents. |
511
|
|
|
* |
512
|
|
|
* The talents data API provides a list of talents, specs and glyphs for each class |
513
|
|
|
* |
514
|
|
|
* @param array $options Options |
515
|
|
|
* |
516
|
|
|
* @return Illuminate\Support\Collection api response |
517
|
|
|
*/ |
518
|
|
|
public function getDataTalents(array $options = []) |
519
|
|
|
{ |
520
|
|
|
return $this->cache('/data/talents', $options, __FUNCTION__); |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
/** |
524
|
|
|
* Get data pet types. |
525
|
|
|
* |
526
|
|
|
* The different bat pet types (including what they are strong and weak against) |
527
|
|
|
* |
528
|
|
|
* @param array $options Options |
529
|
|
|
* |
530
|
|
|
* @return Illuminate\Support\Collection api response |
531
|
|
|
*/ |
532
|
|
|
public function getDataPetTypes(array $options = []) |
533
|
|
|
{ |
534
|
|
|
return $this->cache('/data/pet/types', $options, __FUNCTION__); |
535
|
|
|
} |
536
|
|
|
|
537
|
|
|
/** |
538
|
|
|
* Get profile characters. |
539
|
|
|
* |
540
|
|
|
* This provides data about the current logged in OAuth user's - or the given user - WoW profile |
541
|
|
|
* |
542
|
|
|
* @param array $options Options |
543
|
|
|
* |
544
|
|
|
* @return Illuminate\Support\Collection api response |
545
|
|
|
*/ |
546
|
|
|
public function getProfileCharacters(array $options = []) |
547
|
|
|
{ |
548
|
|
|
$access_token = array_key_exists('access_token', $options) |
549
|
|
|
? $options['access_token'] |
550
|
|
|
: auth()->user()->bnet_token; |
|
|
|
|
551
|
|
|
|
552
|
|
|
$access_scope = array_key_exists('access_scope', $options) |
553
|
|
|
? $options['access_scope'] |
554
|
|
|
: auth()->user()->bnet_scope; |
555
|
|
|
|
556
|
|
|
$user_id = array_key_exists('user_id', $options) |
557
|
|
|
? $options['user_id'] |
558
|
|
|
: auth()->user()->id; |
559
|
|
|
|
560
|
|
|
$options['query']['access_token'] = $access_token; |
561
|
|
|
$options['cache']['user_id'] = $user_id; |
562
|
|
|
|
563
|
|
|
if (strpos($access_scope, 'wow.profile') === false) { |
564
|
|
|
// dd('We are not allowed to queyr this user WoW Profile, so there is no point to call the api hence returning NULL'); |
|
|
|
|
565
|
|
|
return null; |
566
|
|
|
} else { |
567
|
|
|
return $this->cache('/user/characters', $options, __FUNCTION__); |
568
|
|
|
} |
569
|
|
|
} |
570
|
|
|
} |
571
|
|
|
|
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: