ValorantAsset   C
last analyzed

Complexity

Total Complexity 55

Size/Duplication

Total Lines 738
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 55
eloc 58
c 0
b 0
f 0
dl 0
loc 738
rs 6

54 Methods

Rating   Name   Duplication   Size   Complexity  
A sprayLevels() 0 3 1
A seasons() 0 3 1
A buddyLevels() 0 3 1
A currencies() 0 3 1
A buddies() 0 3 1
A agentByUuid() 0 3 1
A playerTitleByUuid() 0 3 1
A buddyByUuid() 0 3 1
A levelborders() 0 3 1
A gamemodeByUuid() 0 3 1
A weaponSkinChromas() 0 3 1
A gamemodeEquippables() 0 3 1
A themeByUuid() 0 3 1
A weaponSkinChromaByUuid() 0 3 1
A contractByUuid() 0 3 1
A contentTierByUuid() 0 3 1
A playerCards() 0 3 1
A playerCardByUuid() 0 3 1
A contentTiers() 0 3 1
A gear() 0 3 1
A version() 0 3 1
A weaponByUuid() 0 3 1
A seasonByUuid() 0 3 1
A gamemodes() 0 3 1
A ceremonyByUuid() 0 3 1
A maps() 0 3 1
A currencyByUuid() 0 3 1
A weaponSkins() 0 3 1
A weapons() 0 3 1
A levelBorderByUuid() 0 3 1
A gearByUuid() 0 3 1
A bundleByUuid() 0 3 1
A competitiveTiers() 0 3 1
A mapByUuid() 0 3 1
A ceremonies() 0 3 1
A events() 0 3 1
A bundles() 0 3 1
A gamemodeEquippableByUuid() 0 3 1
A competitiveTierByUuid() 0 3 1
A competitiveSeasons() 0 3 1
A themes() 0 3 1
A sprayLevelByUuid() 0 3 1
A request() 0 13 1
A playerTitles() 0 3 1
A weaponSkinLevels() 0 3 1
A weaponSkinByUuid() 0 3 1
A contracts() 0 3 1
A buddyLevelByUuid() 0 3 1
A eventByUuid() 0 3 1
A sprays() 0 3 1
A agents() 0 3 2
A competitiveSeasonByUuid() 0 3 1
A sprayByUuid() 0 3 1
A weaponSkinLevelByUuid() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like ValorantAsset often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use ValorantAsset, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
namespace Seaony\ValorantApi;
4
5
use GuzzleHttp\Client;
6
use Illuminate\Support\Arr;
7
8
/**
9
 * --------------------------------------------------------------------------
10
 * Valorant-API
11
 * --------------------------------------------------------------------------
12
 *
13
 * Valorant-API 是一个非官方的 Valorant 资产获取 API,
14
 * 不受 Riot Games 支持,可以使用它来获取游戏中的大部分物品、资源等。
15
 *
16
 * @website https://valorant-api.com
17
 * @document https://dash.valorant-api.com/docs
18
 */
19
class ValorantAsset
20
{
21
    /**
22
     * Returns data and assets of all agents and their abilities
23
     * Info: Yes, there are 2 Sovas. Use the isPlayableCharacter=true filter to make sure you don't have a "duplicate" Sova.
24
     *
25
     * @param $isPlayableCharacter bool
26
     * @param $language string
27
     *
28
     * @return mixed
29
     * @throws \GuzzleHttp\Exception\GuzzleException
30
     */
31
    public static function agents(bool $isPlayableCharacter = true, string $language = 'en-US')
32
    {
33
        return self::request('agents', ['isPlayableCharacter' => $isPlayableCharacter ? 'True' : 'False', 'language' => $language]);
34
    }
35
36
    /**
37
     * Returns data and assets of the requested agent
38
     *
39
     * @param  string  $agentUuid
40
     * @param  string  $language
41
     *
42
     * @return mixed
43
     * @throws \GuzzleHttp\Exception\GuzzleException
44
     */
45
    public static function agentByUuid(string $agentUuid, string $language = 'en-US')
46
    {
47
        return self::request("agents/{$agentUuid}", ['language' => $language]);
48
    }
49
50
    /**
51
     * Returns data and assets of all weapon buddies
52
     *
53
     * @param  string  $language
54
     *
55
     * @return mixed
56
     * @throws \GuzzleHttp\Exception\GuzzleException
57
     */
58
    public static function buddies(string $language = 'en-US')
59
    {
60
        return self::request("buddies", ['language' => $language]);
61
    }
62
63
    /**
64
     * Returns data and assets of the requested weapon buddy
65
     *
66
     * @param  string  $buddyUuid
67
     * @param  string  $language
68
     *
69
     * @return mixed
70
     * @throws \GuzzleHttp\Exception\GuzzleException
71
     */
72
    public static function buddyByUuid(string $buddyUuid, string $language = 'en-US')
73
    {
74
        return self::request("buddies/{$buddyUuid}", ['language' => $language]);
75
    }
76
77
    /**
78
     * Returns data and assets of all weapon buddy levels
79
     *
80
     * @param  string  $language
81
     *
82
     * @return mixed
83
     * @throws \GuzzleHttp\Exception\GuzzleException
84
     */
85
    public static function buddyLevels(string $language = 'en-US')
86
    {
87
        return self::request("buddies/levels", ['language' => $language]);
88
    }
89
90
    /**
91
     * Returns data and assets of the requested weapon buddy level
92
     *
93
     * @param  string  $buddyLevelUuid
94
     * @param  string  $language
95
     *
96
     * @return mixed
97
     * @throws \GuzzleHttp\Exception\GuzzleException
98
     */
99
    public static function buddyLevelByUuid(string $buddyLevelUuid, string $language = 'en-US')
100
    {
101
        return self::request("buddies/levels/{$buddyLevelUuid}", ['language' => $language]);
102
    }
103
104
    /**
105
     * Returns data and assets of all bundles
106
     *
107
     * @param  string  $language
108
     *
109
     * @return mixed
110
     * @throws \GuzzleHttp\Exception\GuzzleException
111
     */
112
    public static function bundles(string $language = 'en-US')
113
    {
114
        return self::request('bundles', ['language' => $language]);
115
    }
116
117
    /**
118
     * Returns data and assets of the requested bundle
119
     *
120
     * @param  string  $bundleUuid
121
     * @param  string  $language
122
     *
123
     * @return mixed
124
     * @throws \GuzzleHttp\Exception\GuzzleException
125
     */
126
    public static function bundleByUuid(string $bundleUuid, string $language = 'en-US')
127
    {
128
        return self::request("bundles/{$bundleUuid}", ['language' => $language]);
129
    }
130
131
    /**
132
     * Returns data and assets of all ceremonies
133
     *
134
     * @param  string  $language
135
     *
136
     * @return mixed
137
     * @throws \GuzzleHttp\Exception\GuzzleException
138
     */
139
    public static function ceremonies(string $language = 'en-US')
140
    {
141
        return self::request('ceremonies', ['language' => $language]);
142
    }
143
144
    /**
145
     * Returns data and assets of the requested ceremony
146
     *
147
     * @param  string  $ceremoniesUuid
148
     * @param  string  $language
149
     *
150
     * @return mixed
151
     * @throws \GuzzleHttp\Exception\GuzzleException
152
     */
153
    public static function ceremonyByUuid(string $ceremoniesUuid, string $language = 'en-US')
154
    {
155
        return self::request("ceremonies/{$ceremoniesUuid}", ['language' => $language]);
156
    }
157
158
    /**
159
     * Returns data and assets of all competitive tiers
160
     *
161
     * @param  string  $language
162
     *
163
     * @return mixed
164
     * @throws \GuzzleHttp\Exception\GuzzleException
165
     */
166
    public static function competitiveTiers(string $language = 'en-US')
167
    {
168
        return self::request('competitivetiers', ['language' => $language]);
169
    }
170
171
    /**
172
     * Returns data and assets the requested competitive tier table
173
     *
174
     * @param  string  $competitivetierUuid
175
     * @param  string  $language
176
     *
177
     * @return mixed
178
     * @throws \GuzzleHttp\Exception\GuzzleException
179
     */
180
    public static function competitiveTierByUuid(string $competitivetierUuid, string $language = 'en-US')
181
    {
182
        return self::request("competitivetiers/{$competitivetierUuid}", ['language' => $language]);
183
    }
184
185
    /**
186
     * Returns data and assets of all content tiers
187
     *
188
     * @param  string  $language
189
     *
190
     * @return mixed
191
     * @throws \GuzzleHttp\Exception\GuzzleException
192
     */
193
    public static function contentTiers(string $language = 'en-US')
194
    {
195
        return self::request('contenttiers', ['language' => $language]);
196
    }
197
198
    /**
199
     * Returns data and assets the requested content tier
200
     *
201
     * @param  string  $contenttierUuid
202
     * @param  string  $language
203
     *
204
     * @return mixed
205
     * @throws \GuzzleHttp\Exception\GuzzleException
206
     */
207
    public static function contentTierByUuid(string $contenttierUuid, string $language = 'en-US')
208
    {
209
        return self::request("contenttiers/{$contenttierUuid}", ['language' => $language]);
210
    }
211
212
    /**
213
     * https://valorant-api.com/v1/contracts
214
     *
215
     * @param  string  $language
216
     *
217
     * @return mixed
218
     * @throws \GuzzleHttp\Exception\GuzzleException
219
     */
220
    public static function contracts(string $language = 'en-US')
221
    {
222
        return self::request('contracts', ['language' => $language]);
223
    }
224
225
    /**
226
     * Returns data and assets the requested contract
227
     *
228
     * @param  string  $contractUuid
229
     * @param  string  $language
230
     *
231
     * @return mixed
232
     * @throws \GuzzleHttp\Exception\GuzzleException
233
     */
234
    public static function contractByUuid(string $contractUuid, string $language = 'en-US')
235
    {
236
        return self::request("contracts/{$contractUuid}", ['language' => $language]);
237
    }
238
239
    /**
240
     * Returns data and assets of all in-game currencies
241
     *
242
     * @param  string  $language
243
     *
244
     * @return mixed
245
     * @throws \GuzzleHttp\Exception\GuzzleException
246
     */
247
    public static function currencies(string $language = 'en-US')
248
    {
249
        return self::request('currencies', ['language' => $language]);
250
    }
251
252
    /**
253
     * Returns data and assets the requested in-game currency
254
     *
255
     * @param  string  $currencyUuid
256
     * @param  string  $language
257
     *
258
     * @return mixed
259
     * @throws \GuzzleHttp\Exception\GuzzleException
260
     */
261
    public static function currencyByUuid(string $currencyUuid, string $language = 'en-US')
262
    {
263
        return self::request("currencies/{$currencyUuid}", ['language' => $language]);
264
    }
265
266
    /**
267
     * Returns data and assets of all events
268
     *
269
     * @param  string  $language
270
     *
271
     * @return mixed
272
     * @throws \GuzzleHttp\Exception\GuzzleException
273
     */
274
    public static function events(string $language = 'en-US')
275
    {
276
        return self::request('events', ['language' => $language]);
277
    }
278
279
    /**
280
     * Returns data and assets of all events
281
     *
282
     * @param  string  $eventUuid
283
     * @param  string  $language
284
     *
285
     * @return mixed
286
     * @throws \GuzzleHttp\Exception\GuzzleException
287
     */
288
    public static function eventByUuid(string $eventUuid, string $language = 'en-US')
289
    {
290
        return self::request("events/{$eventUuid}", ['language' => $language]);
291
    }
292
293
    /**
294
     * Returns data and assets of all gamemodes
295
     *
296
     * @param  string  $language
297
     *
298
     * @return mixed
299
     * @throws \GuzzleHttp\Exception\GuzzleException
300
     */
301
    public static function gamemodes(string $language = 'en-US')
302
    {
303
        return self::request('gamemodes', ['language' => $language]);
304
    }
305
306
    /**
307
     * Returns data and assets of the requested gamemode
308
     *
309
     * @param  string  $gamemodeUuid
310
     * @param  string  $language
311
     *
312
     * @return mixed
313
     * @throws \GuzzleHttp\Exception\GuzzleException
314
     */
315
    public static function gamemodeByUuid(string $gamemodeUuid, string $language = 'en-US')
316
    {
317
        return self::request("gamemodes/{$gamemodeUuid}", ['language' => $language]);
318
    }
319
320
    /**
321
     * Returns data and assets of all gamemode equippables
322
     *
323
     * @param  string  $language
324
     *
325
     * @return mixed
326
     * @throws \GuzzleHttp\Exception\GuzzleException
327
     */
328
    public static function gamemodeEquippables(string $language = 'en-US')
329
    {
330
        return self::request('gamemodes/equippables', ['language' => $language]);
331
    }
332
333
    /**
334
     * Returns data and assets of the requested gamemode equippable
335
     *
336
     * @param  string  $gamemodeequippableUuid
337
     * @param  string  $language
338
     *
339
     * @return mixed
340
     * @throws \GuzzleHttp\Exception\GuzzleException
341
     */
342
    public static function gamemodeEquippableByUuid(string $gamemodeequippableUuid, string $language = 'en-US')
343
    {
344
        return self::request("gamemodes/equippables/{$gamemodeequippableUuid}", ['language' => $language]);
345
    }
346
347
    /**
348
     * Returns data and assets of all gear
349
     *
350
     * @param  string  $language
351
     *
352
     * @return mixed
353
     * @throws \GuzzleHttp\Exception\GuzzleException
354
     */
355
    public static function gear(string $language = 'en-US')
356
    {
357
        return self::request('gear', ['language' => $language]);
358
    }
359
360
    /**
361
     * Returns data and assets of the requested gear
362
     *
363
     * @param  string  $gearUuid
364
     * @param  string  $language
365
     *
366
     * @return mixed
367
     * @throws \GuzzleHttp\Exception\GuzzleException
368
     */
369
    public static function gearByUuid(string $gearUuid, string $language = 'en-US')
370
    {
371
        return self::request("gear/{$gearUuid}", ['language' => $language]);
372
    }
373
374
    /**
375
     * Returns data and assets of all level borders
376
     *
377
     * @param  string  $language
378
     *
379
     * @return mixed
380
     * @throws \GuzzleHttp\Exception\GuzzleException
381
     */
382
    public static function levelborders(string $language = 'en-US')
383
    {
384
        return self::request('levelborders', ['language' => $language]);
385
    }
386
387
    /**
388
     * Returns data and assets of the requested level border
389
     *
390
     * @param  string  $levelborderUuid
391
     * @param  string  $language
392
     *
393
     * @return mixed
394
     * @throws \GuzzleHttp\Exception\GuzzleException
395
     */
396
    public static function levelBorderByUuid(string $levelborderUuid, string $language = 'en-US')
397
    {
398
        return self::request("levelborders/{$levelborderUuid}", ['language' => $language]);
399
    }
400
401
    /**
402
     * Returns data and assets of all maps
403
     *
404
     * @param  string  $language
405
     *
406
     * @return mixed
407
     * @throws \GuzzleHttp\Exception\GuzzleException
408
     */
409
    public static function maps(string $language = 'en-US')
410
    {
411
        return self::request('maps', ['language' => $language]);
412
    }
413
414
    /**
415
     * Returns data and assets of the requested map
416
     *
417
     * @param  string  $mapUuid
418
     * @param  string  $language
419
     *
420
     * @return mixed
421
     * @throws \GuzzleHttp\Exception\GuzzleException
422
     */
423
    public static function mapByUuid(string $mapUuid, string $language = 'en-US')
424
    {
425
        return self::request("maps/{$mapUuid}", ['language' => $language]);
426
    }
427
428
    /**
429
     * Returns data and assets of all player cards
430
     *
431
     * @param  string  $language
432
     *
433
     * @return mixed
434
     * @throws \GuzzleHttp\Exception\GuzzleException
435
     */
436
    public static function playerCards(string $language = 'en-US')
437
    {
438
        return self::request('playercards', ['language' => $language]);
439
    }
440
441
    /**
442
     * Returns data and assets of the requested player card
443
     *
444
     * @param  string  $playercardUuid
445
     * @param  string  $language
446
     *
447
     * @return mixed
448
     * @throws \GuzzleHttp\Exception\GuzzleException
449
     */
450
    public static function playerCardByUuid(string $playercardUuid, string $language = 'en-US')
451
    {
452
        return self::request("playercards/{$playercardUuid}", ['language' => $language]);
453
    }
454
455
    /**
456
     * Returns data of all player title
457
     *
458
     * @param  string  $language
459
     *
460
     * @return mixed
461
     * @throws \GuzzleHttp\Exception\GuzzleException
462
     */
463
    public static function playerTitles(string $language = 'en-US')
464
    {
465
        return self::request('playertitles', ['language' => $language]);
466
    }
467
468
    /**
469
     * Returns data of the requested player title
470
     *
471
     * @param  string  $playertitleUuid
472
     * @param  string  $language
473
     *
474
     * @return mixed
475
     * @throws \GuzzleHttp\Exception\GuzzleException
476
     */
477
    public static function playerTitleByUuid(string $playertitleUuid, string $language = 'en-US')
478
    {
479
        return self::request("playertitles/{$playertitleUuid}", ['language' => $language]);
480
    }
481
482
    /**
483
     * Returns data of all seasons
484
     *
485
     * @param  string  $language
486
     *
487
     * @return mixed
488
     * @throws \GuzzleHttp\Exception\GuzzleException
489
     */
490
    public static function seasons(string $language = 'en-US')
491
    {
492
        return self::request('seasons', ['language' => $language]);
493
    }
494
495
    /**
496
     * Returns data of the requested season
497
     *
498
     * @param  string  $seasonUuid
499
     * @param  string  $language
500
     *
501
     * @return mixed
502
     * @throws \GuzzleHttp\Exception\GuzzleException
503
     */
504
    public static function seasonByUuid(string $seasonUuid, string $language = 'en-US')
505
    {
506
        return self::request("seasons/{$seasonUuid}", ['language' => $language]);
507
    }
508
509
    /**
510
     * Returns data of the requested season
511
     *
512
     * @param  string  $language
513
     *
514
     * @return mixed
515
     * @throws \GuzzleHttp\Exception\GuzzleException
516
     */
517
    public static function competitiveSeasons(string $language = 'en-US')
518
    {
519
        return self::request('seasons/competitive', ['language' => $language]);
520
    }
521
522
    /**
523
     * Returns data of the requested competitive season
524
     *
525
     * @param  string  $competitiveSeasonUuid
526
     * @param  string  $language
527
     *
528
     * @return mixed
529
     * @throws \GuzzleHttp\Exception\GuzzleException
530
     */
531
    public static function competitiveSeasonByUuid(string $competitiveSeasonUuid, string $language = 'en-US')
532
    {
533
        return self::request("seasons/competitive/{$competitiveSeasonUuid}", ['language' => $language]);
534
    }
535
536
    /**
537
     * Returns data and assets of all sprays
538
     *
539
     * @param  string  $language
540
     *
541
     * @return mixed
542
     * @throws \GuzzleHttp\Exception\GuzzleException
543
     */
544
    public static function sprays(string $language = 'en-US')
545
    {
546
        return self::request('sprays', ['language' => $language]);
547
    }
548
549
    /**
550
     * Returns data and assets of the requested spray
551
     *
552
     * @param  string  $sprayUuid
553
     * @param  string  $language
554
     *
555
     * @return mixed
556
     * @throws \GuzzleHttp\Exception\GuzzleException
557
     */
558
    public static function sprayByUuid(string $sprayUuid, string $language = 'en-US')
559
    {
560
        return self::request("sprays/{$sprayUuid}", ['language' => $language]);
561
    }
562
563
    /**
564
     * Returns data and assets of the requested spray
565
     *
566
     * @param  string  $language
567
     *
568
     * @return mixed
569
     * @throws \GuzzleHttp\Exception\GuzzleException
570
     */
571
    public static function sprayLevels(string $language = 'en-US')
572
    {
573
        return self::request('sprays/levels', ['language' => $language]);
574
    }
575
576
    /**
577
     * Returns data and assets of the requested spray level
578
     *
579
     * @param  string  $sprayLevelUuid
580
     * @param  string  $language
581
     *
582
     * @return mixed
583
     * @throws \GuzzleHttp\Exception\GuzzleException
584
     */
585
    public static function sprayLevelByUuid(string $sprayLevelUuid, string $language = 'en-US')
586
    {
587
        return self::request("sprays/levels/{$sprayLevelUuid}", ['language' => $language]);
588
    }
589
590
    /**
591
     * Returns data and assets of all themes
592
     *
593
     * @param  string  $language
594
     *
595
     * @return mixed
596
     * @throws \GuzzleHttp\Exception\GuzzleException
597
     */
598
    public static function themes(string $language = 'en-US')
599
    {
600
        return self::request('themes', ['language' => $language]);
601
    }
602
603
    /**
604
     * Returns data and assets of the requested theme
605
     *
606
     * @param  string  $themeUuid
607
     * @param  string  $language
608
     *
609
     * @return mixed
610
     * @throws \GuzzleHttp\Exception\GuzzleException
611
     */
612
    public static function themeByUuid(string $themeUuid, string $language = 'en-US')
613
    {
614
        return self::request("themes/{$themeUuid}", ['language' => $language]);
615
    }
616
617
    /**
618
     * Returns data and assets of all weapons
619
     *
620
     * @param  string  $language
621
     *
622
     * @return mixed
623
     * @throws \GuzzleHttp\Exception\GuzzleException
624
     */
625
    public static function weapons(string $language = 'en-US')
626
    {
627
        return self::request('weapons', ['language' => $language]);
628
    }
629
630
    /**
631
     * Returns data and assets of the requeted weapon
632
     *
633
     * @param  string  $weaponUuid
634
     * @param  string  $language
635
     *
636
     * @return mixed
637
     * @throws \GuzzleHttp\Exception\GuzzleException
638
     */
639
    public static function weaponByUuid(string $weaponUuid, string $language = 'en-US')
640
    {
641
        return self::request("weapons/{$weaponUuid}", ['language' => $language]);
642
    }
643
644
    /**
645
     * Returns data and assets of all weapon skins
646
     *
647
     * @param  string  $language
648
     *
649
     * @return mixed
650
     * @throws \GuzzleHttp\Exception\GuzzleException
651
     */
652
    public static function weaponSkins(string $language = 'en-US')
653
    {
654
        return self::request('weapons/skins', ['language' => $language]);
655
    }
656
657
    /**
658
     * Returns data and assets of the requeted weapon skin
659
     *
660
     * @param  string  $weaponSkinUuid
661
     * @param  string  $language
662
     *
663
     * @return mixed
664
     * @throws \GuzzleHttp\Exception\GuzzleException
665
     */
666
    public static function weaponSkinByUuid(string $weaponSkinUuid, string $language = 'en-US')
667
    {
668
        return self::request("weapons/skins/{$weaponSkinUuid}", ['language' => $language]);
669
    }
670
671
    /**
672
     * Returns data and assets of all weapon skin chromas
673
     *
674
     * @param  string  $language
675
     *
676
     * @return mixed
677
     * @throws \GuzzleHttp\Exception\GuzzleException
678
     */
679
    public static function weaponSkinChromas(string $language = 'en-US')
680
    {
681
        return self::request('weapons/skinchromas', ['language' => $language]);
682
    }
683
684
    /**
685
     * Returns data and assets of the requeted weapon skin chroma
686
     *
687
     * @param  string  $weaponSkinChromaUuid
688
     * @param  string  $language
689
     *
690
     * @return mixed
691
     * @throws \GuzzleHttp\Exception\GuzzleException
692
     */
693
    public static function weaponSkinChromaByUuid(string $weaponSkinChromaUuid, string $language = 'en-US')
694
    {
695
        return self::request("weapons/skinchromas/{$weaponSkinChromaUuid}", ['language' => $language]);
696
    }
697
698
    /**
699
     * Returns data and assets of all weapon skin levels
700
     *
701
     * @param  string  $language
702
     *
703
     * @return mixed
704
     * @throws \GuzzleHttp\Exception\GuzzleException
705
     */
706
    public static function weaponSkinLevels(string $language = 'en-US')
707
    {
708
        return self::request('weapons/skinlevels', ['language' => $language]);
709
    }
710
711
    /**
712
     * Returns data and assets of the requeted weapon skin level
713
     *
714
     * @param  string  $weaponSkinLevelUuid
715
     * @param  string  $language
716
     *
717
     * @return mixed
718
     * @throws \GuzzleHttp\Exception\GuzzleException
719
     */
720
    public static function weaponSkinLevelByUuid(string $weaponSkinLevelUuid, string $language = 'en-US')
721
    {
722
        return self::request("weapons/skinlevels/{$weaponSkinLevelUuid}", ['language' => $language]);
723
    }
724
725
    /**
726
     * Returns data of the current manifest & version the API is running on
727
     *
728
     * @return mixed
729
     * @throws \GuzzleHttp\Exception\GuzzleException
730
     */
731
    public static function version()
732
    {
733
        return self::request('version');
734
    }
735
736
    /**
737
     * @param $path string request path
738
     * @param $query array query parameters
739
     * @param $method string http method
740
     *
741
     * @return mixed
742
     * @throws \GuzzleHttp\Exception\GuzzleException
743
     */
744
    public static function request($path, $query = [], $method = 'GET')
745
    {
746
        // 构建 GuzzleHttp\Client 实例
747
        $client = new Client(['base_uri' => config('valorant.asset_uri', 'https://valorant-api.com/v1/')]);
748
749
        // 发送请求
750
        $response = $client->request($method, $path, ['query' => $query]);
751
752
        // 拆包
753
        $data = json_decode($response->getBody()->getContents(), true);
754
755
        // 返回响应
756
        return Arr::get($data, 'data');
757
    }
758
}