|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace BlizzardApi\Service; |
|
4
|
|
|
|
|
5
|
|
|
use GuzzleHttp\Psr7\Response; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* GameData class |
|
9
|
|
|
* |
|
10
|
|
|
* @author Oleg Kachinsky <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
class GameData extends Service |
|
13
|
|
|
{ |
|
14
|
|
|
// region Game data API |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Get season index |
|
18
|
|
|
* |
|
19
|
|
|
* Returns base information about available seasons |
|
20
|
|
|
* |
|
21
|
|
|
* @param array $options Options |
|
22
|
|
|
* |
|
23
|
|
|
* @return Response |
|
24
|
|
|
*/ |
|
25
|
|
|
public function getSeasonIndex(array $options = []) |
|
26
|
|
|
{ |
|
27
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
28
|
|
|
|
|
29
|
|
|
return $this->request('/data/d3/season/', $options); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Get season by ID |
|
34
|
|
|
* |
|
35
|
|
|
* Returns a leaderboard list for a particular season |
|
36
|
|
|
* |
|
37
|
|
|
* @param int $id The season to lookup |
|
38
|
|
|
* @param array $options Options |
|
39
|
|
|
* |
|
40
|
|
|
* @return Response |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getSeasonById($id, array $options = []) |
|
43
|
|
|
{ |
|
44
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
45
|
|
|
|
|
46
|
|
|
return $this->request('/data/d3/season/'.(int) $id, $options); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Get season leaderboard by ID and leaderboard |
|
51
|
|
|
* |
|
52
|
|
|
* Returns a leaderboard list for a particular season |
|
53
|
|
|
* |
|
54
|
|
|
* @param int $id The season to lookup |
|
55
|
|
|
* @param string $leaderboard The leaderboard to lookup, you can find these strings in the Season API call |
|
56
|
|
|
* @param array $options Options |
|
57
|
|
|
* |
|
58
|
|
|
* @return Response |
|
59
|
|
|
*/ |
|
60
|
|
|
public function getSeasonLeaderboardById($id, $leaderboard, array $options = []) |
|
61
|
|
|
{ |
|
62
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
63
|
|
|
|
|
64
|
|
|
return $this->request('/data/d3/season/'.(int) $id.'/leaderboard/'.(string) $leaderboard, $options); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* Get era index |
|
69
|
|
|
* |
|
70
|
|
|
* Returns base information about available eras |
|
71
|
|
|
* |
|
72
|
|
|
* @param array $options Options |
|
73
|
|
|
* |
|
74
|
|
|
* @return Response |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getEraIndex(array $options = []) |
|
77
|
|
|
{ |
|
78
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
79
|
|
|
|
|
80
|
|
|
return $this->request('/data/d3/era/', $options); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Get era index by ID |
|
85
|
|
|
* |
|
86
|
|
|
* Returns a leaderboard list for a particular era |
|
87
|
|
|
* |
|
88
|
|
|
* @param int $id The era to lookup |
|
89
|
|
|
* @param array $options Options |
|
90
|
|
|
* |
|
91
|
|
|
* @return Response |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getEraIndexById($id, array $options = []) |
|
94
|
|
|
{ |
|
95
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
96
|
|
|
|
|
97
|
|
|
return $this->request('/data/d3/era/'.(int) $id, $options); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* Get era leaderboard by ID and leaderboard |
|
102
|
|
|
* |
|
103
|
|
|
* Returns a leaderboard |
|
104
|
|
|
* |
|
105
|
|
|
* @param int $id The era to lookup |
|
106
|
|
|
* @param string $leaderboard The leaderboard to lookup, you can find these strings in the Era API call |
|
107
|
|
|
* @param array $options Options |
|
108
|
|
|
* |
|
109
|
|
|
* @return Response |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getEraLeaderboard($id, $leaderboard, array $options = []) |
|
112
|
|
|
{ |
|
113
|
|
|
$options['access_token'] = $this->blizzardClient->getAccessToken(); |
|
114
|
|
|
|
|
115
|
|
|
return $this->request('/data/d3/era/'.(int) $id.'/leaderboard/'.(string) $leaderboard, $options); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
// endregion Game data API |
|
119
|
|
|
} |
|
120
|
|
|
|