blizzardapi2 1.1.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/PKG-INFO +1 -1
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/battlenet/battlenet_api.py +2 -2
- blizzardapi2-1.1.1/blizzardapi2/battlenet/battlenet_oauth_api.py +39 -0
- blizzardapi2-1.1.1/blizzardapi2/diablo3/diablo3_community_api.py +270 -0
- blizzardapi2-1.1.1/blizzardapi2/diablo3/diablo3_game_data_api.py +111 -0
- blizzardapi2-1.1.1/blizzardapi2/hearthstone/hearthstone_game_data_api.py +145 -0
- blizzardapi2-1.1.1/blizzardapi2/starcraft2/starcraft2_community_api.py +187 -0
- blizzardapi2-1.1.1/blizzardapi2/starcraft2/starcraft2_game_data_api.py +42 -0
- blizzardapi2-1.1.1/blizzardapi2/wow/wow_game_data_api.py +2513 -0
- blizzardapi2-1.1.1/blizzardapi2/wow/wow_profile_api.py +861 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/pyproject.toml +1 -1
- blizzardapi2-1.1.0/blizzardapi2/battlenet/battlenet_oauth_api.py +0 -26
- blizzardapi2-1.1.0/blizzardapi2/diablo3/diablo3_community_api.py +0 -135
- blizzardapi2-1.1.0/blizzardapi2/diablo3/diablo3_game_data_api.py +0 -53
- blizzardapi2-1.1.0/blizzardapi2/hearthstone/hearthstone_game_data_api.py +0 -77
- blizzardapi2-1.1.0/blizzardapi2/starcraft2/starcraft2_community_api.py +0 -93
- blizzardapi2-1.1.0/blizzardapi2/starcraft2/starcraft2_game_data_api.py +0 -33
- blizzardapi2-1.1.0/blizzardapi2/wow/wow_game_data_api.py +0 -1164
- blizzardapi2-1.1.0/blizzardapi2/wow/wow_profile_api.py +0 -446
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/LICENSE +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/README.md +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/api.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/battlenet/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/blizzard_api.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/diablo3/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/diablo3/diablo3_api.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/hearthstone/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/hearthstone/hearthstone_api.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/starcraft2/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/starcraft2/starcraft2_api.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/wow/__init__.py +0 -0
- {blizzardapi2-1.1.0 → blizzardapi2-1.1.1}/blizzardapi2/wow/wow_api.py +0 -0
|
@@ -8,8 +8,8 @@ class BattlenetApi:
|
|
|
8
8
|
"""Battle.net API class.
|
|
9
9
|
|
|
10
10
|
Attributes:
|
|
11
|
-
client_id: A string client id supplied by Blizzard.
|
|
12
|
-
client_secret: A string client secret supplied by Blizzard.
|
|
11
|
+
client_id (str): A string client id supplied by Blizzard.
|
|
12
|
+
client_secret (str): A string client secret supplied by Blizzard.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
def __init__(self, client_id: str, client_secret: str) -> Dict[str, Any]:
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""battlenet_oauth_api.py file."""
|
|
2
|
+
|
|
3
|
+
from ..api import Api
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BattlenetOauthApi(Api):
|
|
7
|
+
"""All Battle.net OAuth API methods.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
client_id (str): A string client ID supplied by Blizzard.
|
|
11
|
+
client_secret (str): A string client secret supplied by Blizzard.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def __init__(self, client_id: str, client_secret: str) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Initialize the BattlenetOauthApi class.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
client_id (str): The client ID supplied by Blizzard.
|
|
20
|
+
client_secret (str): The client secret supplied by Blizzard.
|
|
21
|
+
"""
|
|
22
|
+
super().__init__(client_id, client_secret)
|
|
23
|
+
|
|
24
|
+
def get_user_info(self, region: str, access_token: str) -> dict:
|
|
25
|
+
"""
|
|
26
|
+
Return basic information about the user associated with the current bearer token.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
region (str): The region to query (e.g., "us", "eu").
|
|
30
|
+
access_token (str): The OAuth access token.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
dict: A dictionary containing user information.
|
|
34
|
+
"""
|
|
35
|
+
resource = "/oauth/userinfo"
|
|
36
|
+
query_params = {
|
|
37
|
+
"access_token": access_token,
|
|
38
|
+
}
|
|
39
|
+
return super().get_oauth_resource(resource, region, query_params)
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
from typing import Dict, Any
|
|
2
|
+
from ..api import Api
|
|
3
|
+
|
|
4
|
+
"""diablo3_community_api.py file."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Diablo3CommunityApi(Api):
|
|
8
|
+
"""All Diablo 3 Community API methods.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
client_id (str): A string client ID supplied by Blizzard.
|
|
12
|
+
client_secret (str): A string client secret supplied by Blizzard.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, client_id: str, client_secret: str) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Initialize the Diablo3CommunityApi class.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
client_id (str): The client ID supplied by Blizzard.
|
|
21
|
+
client_secret (str): The client secret supplied by Blizzard.
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(client_id, client_secret)
|
|
24
|
+
|
|
25
|
+
def get_act_index(self, region: str, locale: str) -> Dict[str, Any]:
|
|
26
|
+
"""
|
|
27
|
+
Return an index of acts.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
region (str): The region to query (e.g., "us", "eu").
|
|
31
|
+
locale (str): The locale to use for the response.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Dict[str, Any]: A dictionary containing the index of acts.
|
|
35
|
+
"""
|
|
36
|
+
resource = "/d3/data/act"
|
|
37
|
+
query_params = {"locale": locale}
|
|
38
|
+
return super().get_resource(resource, region, query_params)
|
|
39
|
+
|
|
40
|
+
def get_act(self, region: str, locale: str, act_id: int) -> Dict[str, Any]:
|
|
41
|
+
"""
|
|
42
|
+
Return a single act by ID.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
region (str): The region to query.
|
|
46
|
+
locale (str): The locale to use for the response.
|
|
47
|
+
act_id (int): The ID of the act to retrieve.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
Dict[str, Any]: A dictionary containing the act details.
|
|
51
|
+
"""
|
|
52
|
+
resource = f"/d3/data/act/{act_id}"
|
|
53
|
+
query_params = {"locale": locale}
|
|
54
|
+
return super().get_resource(resource, region, query_params)
|
|
55
|
+
|
|
56
|
+
def get_artisan(
|
|
57
|
+
self, region: str, locale: str, artisan_slug: str
|
|
58
|
+
) -> Dict[str, Any]:
|
|
59
|
+
"""
|
|
60
|
+
Return a single artisan by slug.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
region (str): The region to query.
|
|
64
|
+
locale (str): The locale to use for the response.
|
|
65
|
+
artisan_slug (str): The slug of the artisan to retrieve.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
Dict[str, Any]: A dictionary containing the artisan details.
|
|
69
|
+
"""
|
|
70
|
+
resource = f"/d3/data/artisan/{artisan_slug}"
|
|
71
|
+
query_params = {"locale": locale}
|
|
72
|
+
return super().get_resource(resource, region, query_params)
|
|
73
|
+
|
|
74
|
+
def get_recipe(
|
|
75
|
+
self, region: str, locale: str, artisan_slug: str, recipe_slug: str
|
|
76
|
+
) -> Dict[str, Any]:
|
|
77
|
+
"""
|
|
78
|
+
Return a single recipe by slug for the specified artisan.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
region (str): The region to query.
|
|
82
|
+
locale (str): The locale to use for the response.
|
|
83
|
+
artisan_slug (str): The slug of the artisan.
|
|
84
|
+
recipe_slug (str): The slug of the recipe to retrieve.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Dict[str, Any]: A dictionary containing the recipe details.
|
|
88
|
+
"""
|
|
89
|
+
resource = f"/d3/data/artisan/{artisan_slug}/recipe/{recipe_slug}"
|
|
90
|
+
query_params = {"locale": locale}
|
|
91
|
+
return super().get_resource(resource, region, query_params)
|
|
92
|
+
|
|
93
|
+
def get_follower(
|
|
94
|
+
self, region: str, locale: str, follower_slug: str
|
|
95
|
+
) -> Dict[str, Any]:
|
|
96
|
+
"""
|
|
97
|
+
Return a single follower by slug.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
region (str): The region to query.
|
|
101
|
+
locale (str): The locale to use for the response.
|
|
102
|
+
follower_slug (str): The slug of the follower to retrieve.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
Dict[str, Any]: A dictionary containing the follower details.
|
|
106
|
+
"""
|
|
107
|
+
resource = f"/d3/data/follower/{follower_slug}"
|
|
108
|
+
query_params = {"locale": locale}
|
|
109
|
+
return super().get_resource(resource, region, query_params)
|
|
110
|
+
|
|
111
|
+
def get_character_class(
|
|
112
|
+
self, region: str, locale: str, class_slug: str
|
|
113
|
+
) -> Dict[str, Any]:
|
|
114
|
+
"""
|
|
115
|
+
Return a single character class by slug.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
region (str): The region to query.
|
|
119
|
+
locale (str): The locale to use for the response.
|
|
120
|
+
class_slug (str): The slug of the character class to retrieve.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Dict[str, Any]: A dictionary containing the character class details.
|
|
124
|
+
"""
|
|
125
|
+
resource = f"/d3/data/hero/{class_slug}"
|
|
126
|
+
query_params = {"locale": locale}
|
|
127
|
+
return super().get_resource(resource, region, query_params)
|
|
128
|
+
|
|
129
|
+
def get_api_skill(
|
|
130
|
+
self, region: str, locale: str, class_slug: str, skill_slug: str
|
|
131
|
+
) -> Dict[str, Any]:
|
|
132
|
+
"""
|
|
133
|
+
Return a single skill by slug for a specific character class.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
region (str): The region to query.
|
|
137
|
+
locale (str): The locale to use for the response.
|
|
138
|
+
class_slug (str): The slug of the character class.
|
|
139
|
+
skill_slug (str): The slug of the skill to retrieve.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Dict[str, Any]: A dictionary containing the skill details.
|
|
143
|
+
"""
|
|
144
|
+
resource = f"/d3/data/hero/{class_slug}/skill/{skill_slug}"
|
|
145
|
+
query_params = {"locale": locale}
|
|
146
|
+
return super().get_resource(resource, region, query_params)
|
|
147
|
+
|
|
148
|
+
def get_item_type_index(self, region: str, locale: str) -> Dict[str, Any]:
|
|
149
|
+
"""
|
|
150
|
+
Return an index of item types.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
region (str): The region to query.
|
|
154
|
+
locale (str): The locale to use for the response.
|
|
155
|
+
|
|
156
|
+
Returns:
|
|
157
|
+
Dict[str, Any]: A dictionary containing the index of item types.
|
|
158
|
+
"""
|
|
159
|
+
resource = "/d3/data/item-type"
|
|
160
|
+
query_params = {"locale": locale}
|
|
161
|
+
return super().get_resource(resource, region, query_params)
|
|
162
|
+
|
|
163
|
+
def get_item_type(
|
|
164
|
+
self, region: str, locale: str, item_type_slug: str
|
|
165
|
+
) -> Dict[str, Any]:
|
|
166
|
+
"""
|
|
167
|
+
Return a single item type by slug.
|
|
168
|
+
|
|
169
|
+
Args:
|
|
170
|
+
region (str): The region to query.
|
|
171
|
+
locale (str): The locale to use for the response.
|
|
172
|
+
item_type_slug (str): The slug of the item type to retrieve.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
Dict[str, Any]: A dictionary containing the item type details.
|
|
176
|
+
"""
|
|
177
|
+
resource = f"/d3/data/item-type/{item_type_slug}"
|
|
178
|
+
query_params = {"locale": locale}
|
|
179
|
+
return super().get_resource(resource, region, query_params)
|
|
180
|
+
|
|
181
|
+
def get_item(self, region: str, locale: str, item_slug_id: str) -> Dict[str, Any]:
|
|
182
|
+
"""
|
|
183
|
+
Return a single item by item slug and ID.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
region (str): The region to query.
|
|
187
|
+
locale (str): The locale to use for the response.
|
|
188
|
+
item_slug_id (str): The slug and ID of the item to retrieve.
|
|
189
|
+
|
|
190
|
+
Returns:
|
|
191
|
+
Dict[str, Any]: A dictionary containing the item details.
|
|
192
|
+
"""
|
|
193
|
+
resource = f"/d3/data/item/{item_slug_id}"
|
|
194
|
+
query_params = {"locale": locale}
|
|
195
|
+
return super().get_resource(resource, region, query_params)
|
|
196
|
+
|
|
197
|
+
def get_api_account(
|
|
198
|
+
self, region: str, locale: str, account_id: str
|
|
199
|
+
) -> Dict[str, Any]:
|
|
200
|
+
"""
|
|
201
|
+
Return the specified account profile.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
region (str): The region to query.
|
|
205
|
+
locale (str): The locale to use for the response.
|
|
206
|
+
account_id (str): The ID of the account to retrieve.
|
|
207
|
+
|
|
208
|
+
Returns:
|
|
209
|
+
Dict[str, Any]: A dictionary containing the account profile details.
|
|
210
|
+
"""
|
|
211
|
+
resource = f"/d3/profile/{account_id}/"
|
|
212
|
+
query_params = {"locale": locale}
|
|
213
|
+
return super().get_resource(resource, region, query_params)
|
|
214
|
+
|
|
215
|
+
def get_api_hero(
|
|
216
|
+
self, region: str, locale: str, account_id: str, hero_id: int
|
|
217
|
+
) -> Dict[str, Any]:
|
|
218
|
+
"""
|
|
219
|
+
Return a single hero.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
region (str): The region to query.
|
|
223
|
+
locale (str): The locale to use for the response.
|
|
224
|
+
account_id (str): The ID of the account.
|
|
225
|
+
hero_id (int): The ID of the hero to retrieve.
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
Dict[str, Any]: A dictionary containing the hero details.
|
|
229
|
+
"""
|
|
230
|
+
resource = f"/d3/profile/{account_id}/hero/{hero_id}"
|
|
231
|
+
query_params = {"locale": locale}
|
|
232
|
+
return super().get_resource(resource, region, query_params)
|
|
233
|
+
|
|
234
|
+
def get_api_detailed_hero_items(
|
|
235
|
+
self, region: str, locale: str, account_id: str, hero_id: int
|
|
236
|
+
) -> Dict[str, Any]:
|
|
237
|
+
"""
|
|
238
|
+
Return a list of items for the specified hero.
|
|
239
|
+
|
|
240
|
+
Args:
|
|
241
|
+
region (str): The region to query.
|
|
242
|
+
locale (str): The locale to use for the response.
|
|
243
|
+
account_id (str): The ID of the account.
|
|
244
|
+
hero_id (int): The ID of the hero.
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
Dict[str, Any]: A dictionary containing the list of items for the hero.
|
|
248
|
+
"""
|
|
249
|
+
resource = f"/d3/profile/{account_id}/hero/{hero_id}/items"
|
|
250
|
+
query_params = {"locale": locale}
|
|
251
|
+
return super().get_resource(resource, region, query_params)
|
|
252
|
+
|
|
253
|
+
def get_api_detailed_follower_items(
|
|
254
|
+
self, region: str, locale: str, account_id: str, hero_id: int
|
|
255
|
+
) -> Dict[str, Any]:
|
|
256
|
+
"""
|
|
257
|
+
Return a single item by item slug and ID.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
region (str): The region to query.
|
|
261
|
+
locale (str): The locale to use for the response.
|
|
262
|
+
account_id (str): The ID of the account.
|
|
263
|
+
hero_id (int): The ID of the hero.
|
|
264
|
+
|
|
265
|
+
Returns:
|
|
266
|
+
Dict[str, Any]: A dictionary containing the item details.
|
|
267
|
+
"""
|
|
268
|
+
resource = f"/d3/profile/{account_id}/hero/{hero_id}/follower-items"
|
|
269
|
+
query_params = {"locale": locale}
|
|
270
|
+
return super().get_resource(resource, region, query_params)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
from typing import List, Dict
|
|
2
|
+
from ..api import Api
|
|
3
|
+
|
|
4
|
+
"""diablo3_game_data_api.py file."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Diablo3GameDataApi(Api):
|
|
8
|
+
"""All Diablo 3 Game Data API methods.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
client_id (str): A string client ID supplied by Blizzard.
|
|
12
|
+
client_secret (str): A string client secret supplied by Blizzard.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, client_id: str, client_secret: str) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Initialize the Diablo3GameDataApi class.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
client_id (str): The client ID supplied by Blizzard.
|
|
21
|
+
client_secret (str): The client secret supplied by Blizzard.
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(client_id, client_secret)
|
|
24
|
+
|
|
25
|
+
def get_season_index(self, region: str) -> Dict:
|
|
26
|
+
"""
|
|
27
|
+
Return an index of available seasons.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
region (str): The region to query (e.g., "us", "eu").
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Dict: A dictionary containing the index of seasons.
|
|
34
|
+
"""
|
|
35
|
+
resource = "/data/d3/season/"
|
|
36
|
+
return super().get_resource(resource, region)
|
|
37
|
+
|
|
38
|
+
def get_season(self, region: str, season_id: int) -> Dict:
|
|
39
|
+
"""
|
|
40
|
+
Return a leaderboard list for the specified season.
|
|
41
|
+
|
|
42
|
+
Args:
|
|
43
|
+
region (str): The region to query.
|
|
44
|
+
season_id (int): The ID of the season to retrieve.
|
|
45
|
+
|
|
46
|
+
Returns:
|
|
47
|
+
Dict: A dictionary containing the leaderboard list for the season.
|
|
48
|
+
"""
|
|
49
|
+
resource = f"/data/d3/season/{season_id}"
|
|
50
|
+
return super().get_resource(resource, region)
|
|
51
|
+
|
|
52
|
+
def get_season_leaderboard(
|
|
53
|
+
self, region: str, season_id: int, leaderboard_id: int
|
|
54
|
+
) -> Dict:
|
|
55
|
+
"""
|
|
56
|
+
Return the specified leaderboard for the specified season.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
region (str): The region to query.
|
|
60
|
+
season_id (int): The ID of the season.
|
|
61
|
+
leaderboard_id (int): The ID of the leaderboard to retrieve.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Dict: A dictionary containing the leaderboard details.
|
|
65
|
+
"""
|
|
66
|
+
resource = f"/data/d3/season/{season_id}/leaderboard/{leaderboard_id}"
|
|
67
|
+
return super().get_resource(resource, region)
|
|
68
|
+
|
|
69
|
+
def get_era_index(self, region: str) -> Dict:
|
|
70
|
+
"""
|
|
71
|
+
Return an index of available eras.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
region (str): The region to query.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Dict: A dictionary containing the index of eras.
|
|
78
|
+
"""
|
|
79
|
+
resource = "/data/d3/era/"
|
|
80
|
+
return super().get_resource(resource, region)
|
|
81
|
+
|
|
82
|
+
def get_era(self, region: str, era_id: int) -> Dict:
|
|
83
|
+
"""
|
|
84
|
+
Return a leaderboard list for a particular era.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
region (str): The region to query.
|
|
88
|
+
era_id (int): The ID of the era to retrieve.
|
|
89
|
+
|
|
90
|
+
Returns:
|
|
91
|
+
Dict: A dictionary containing the leaderboard list for the era.
|
|
92
|
+
"""
|
|
93
|
+
resource = f"/data/d3/era/{era_id}"
|
|
94
|
+
return super().get_resource(resource, region)
|
|
95
|
+
|
|
96
|
+
def get_era_leaderboard(
|
|
97
|
+
self, region: str, era_id: int, leaderboard_id: int
|
|
98
|
+
) -> Dict:
|
|
99
|
+
"""
|
|
100
|
+
Return the specified leaderboard for the specified era.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
region (str): The region to query.
|
|
104
|
+
era_id (int): The ID of the era.
|
|
105
|
+
leaderboard_id (int): The ID of the leaderboard to retrieve.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Dict: A dictionary containing the leaderboard details.
|
|
109
|
+
"""
|
|
110
|
+
resource = f"/data/d3/era/{era_id}/leaderboard/{leaderboard_id}"
|
|
111
|
+
return super().get_resource(resource, region)
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
from typing import Any, Dict
|
|
2
|
+
from ..api import Api
|
|
3
|
+
|
|
4
|
+
"""hearthstone_game_data_api.py file."""
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class HearthstoneGameDataApi(Api):
|
|
8
|
+
"""All Hearthstone Game Data API methods.
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
client_id (str): A string client ID supplied by Blizzard.
|
|
12
|
+
client_secret (str): A string client secret supplied by Blizzard.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, client_id: str, client_secret: str) -> None:
|
|
16
|
+
"""
|
|
17
|
+
Initialize the HearthstoneGameDataApi class.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
client_id (str): The client ID supplied by Blizzard.
|
|
21
|
+
client_secret (str): The client secret supplied by Blizzard.
|
|
22
|
+
"""
|
|
23
|
+
super().__init__(client_id, client_secret)
|
|
24
|
+
|
|
25
|
+
def search_cards(
|
|
26
|
+
self, region: str, locale: str, **query_params: Any
|
|
27
|
+
) -> Dict[str, Any]:
|
|
28
|
+
"""
|
|
29
|
+
Return an up-to-date list of all cards matching the search criteria.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
region (str): The region to query (e.g., "us", "eu").
|
|
33
|
+
locale (str): The locale to use for the response.
|
|
34
|
+
**query_params (Any): Additional search parameters.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Dict[str, Any]: A dictionary containing the list of matching cards.
|
|
38
|
+
"""
|
|
39
|
+
resource = "/hearthstone/cards"
|
|
40
|
+
query_params.update({"locale": locale})
|
|
41
|
+
return super().get_resource(resource, region, query_params)
|
|
42
|
+
|
|
43
|
+
def get_card(
|
|
44
|
+
self, region: str, locale: str, id_or_slug: str, game_mode: str = "constructed"
|
|
45
|
+
) -> Dict[str, Any]:
|
|
46
|
+
"""
|
|
47
|
+
Return the card with an ID or slug that matches the one you specify.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
region (str): The region to query.
|
|
51
|
+
locale (str): The locale to use for the response.
|
|
52
|
+
id_or_slug (str): The ID or slug of the card to retrieve.
|
|
53
|
+
game_mode (str, optional): The game mode (default is "constructed").
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Dict[str, Any]: A dictionary containing the card details.
|
|
57
|
+
"""
|
|
58
|
+
resource = f"/hearthstone/cards/{id_or_slug}"
|
|
59
|
+
query_params = {"locale": locale, "game_mode": game_mode}
|
|
60
|
+
return super().get_resource(resource, region, query_params)
|
|
61
|
+
|
|
62
|
+
def search_card_backs(
|
|
63
|
+
self, region: str, locale: str, **query_params: Any
|
|
64
|
+
) -> Dict[str, Any]:
|
|
65
|
+
"""
|
|
66
|
+
Return an up-to-date list of all card backs matching the search criteria.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
region (str): The region to query.
|
|
70
|
+
locale (str): The locale to use for the response.
|
|
71
|
+
**query_params (Any): Additional search parameters.
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Dict[str, Any]: A dictionary containing the list of matching card backs.
|
|
75
|
+
"""
|
|
76
|
+
resource = "/hearthstone/cardbacks"
|
|
77
|
+
query_params.update({"locale": locale})
|
|
78
|
+
return super().get_resource(resource, region, query_params)
|
|
79
|
+
|
|
80
|
+
def get_card_back(
|
|
81
|
+
self, region: str, locale: str, id_or_slug: str
|
|
82
|
+
) -> Dict[str, Any]:
|
|
83
|
+
"""
|
|
84
|
+
Return a specific card back by using card back ID or slug.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
region (str): The region to query.
|
|
88
|
+
locale (str): The locale to use for the response.
|
|
89
|
+
id_or_slug (str): The ID or slug of the card back to retrieve.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
Dict[str, Any]: A dictionary containing the card back details.
|
|
93
|
+
"""
|
|
94
|
+
resource = f"/hearthstone/cardbacks/{id_or_slug}"
|
|
95
|
+
query_params = {"locale": locale}
|
|
96
|
+
return super().get_resource(resource, region, query_params)
|
|
97
|
+
|
|
98
|
+
def get_deck(self, region: str, locale: str, **query_params: Any) -> Dict[str, Any]:
|
|
99
|
+
"""
|
|
100
|
+
Find a deck by list of cards or code, including the hero.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
region (str): The region to query.
|
|
104
|
+
locale (str): The locale to use for the response.
|
|
105
|
+
**query_params (Any): Additional search parameters.
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Dict[str, Any]: A dictionary containing the deck details.
|
|
109
|
+
"""
|
|
110
|
+
resource = "/hearthstone/deck"
|
|
111
|
+
query_params = {"locale": locale}
|
|
112
|
+
return super().get_resource(resource, region, query_params)
|
|
113
|
+
|
|
114
|
+
def get_metadata(self, region: str, locale: str) -> Dict[str, Any]:
|
|
115
|
+
"""
|
|
116
|
+
Return information about the categorization of cards.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
region (str): The region to query.
|
|
120
|
+
locale (str): The locale to use for the response.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Dict[str, Any]: A dictionary containing the metadata.
|
|
124
|
+
"""
|
|
125
|
+
resource = "/hearthstone/metadata"
|
|
126
|
+
query_params = {"locale": locale}
|
|
127
|
+
return super().get_resource(resource, region, query_params)
|
|
128
|
+
|
|
129
|
+
def get_metadata_type(
|
|
130
|
+
self, region: str, locale: str, type_id: str
|
|
131
|
+
) -> Dict[str, Any]:
|
|
132
|
+
"""
|
|
133
|
+
Return information about just one type of metadata.
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
region (str): The region to query.
|
|
137
|
+
locale (str): The locale to use for the response.
|
|
138
|
+
type_id (str): The ID of the metadata type to retrieve.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Dict[str, Any]: A dictionary containing the metadata type details.
|
|
142
|
+
"""
|
|
143
|
+
resource = f"/hearthstone/metadata/{type_id}"
|
|
144
|
+
query_params = {"locale": locale}
|
|
145
|
+
return super().get_resource(resource, region, query_params)
|