Skip to content

Commit 3ab486a

Browse files
authored
Merge pull request #6 from PyBotDevs/define-type-for-api-endpoint-returns
Explicitly define API endpoint returns as `dict`
2 parents ec2c2b2 + ec120fb commit 3ab486a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def get_uuid(self, player_name: str) -> str:
1414
return content["id"]
1515

1616
# API Retrieval Commands
17-
def get_auctions(self, page: int = 0):
17+
def get_auctions(self, page: int = 0) -> dict:
1818
"""
1919
Returns a `dict` of the 1000 latest auctions in Skyblock.
2020
@@ -25,7 +25,7 @@ def get_auctions(self, page: int = 0):
2525
auctions = json.loads(api_request)
2626
return auctions
2727

28-
def get_player_auctions(self, player_name: str):
28+
def get_player_auctions(self, player_name: str) -> dict:
2929
"""
3030
Returns a `dict` of all Skyblock auctions from a particular player.
3131
"""
@@ -34,23 +34,23 @@ def get_player_auctions(self, player_name: str):
3434
player_auctions = json.loads(api_request)
3535
return player_auctions
3636

37-
def get_news(self):
37+
def get_news(self) -> dict:
3838
"""
3939
Returns a `dict` of the latest Skyblock news from Hypixel.
4040
"""
4141
api_request = requests.get(f"https://api.hypixel.net/skyblock/news?key={self.api_key}").content
4242
news = json.loads(api_request)
4343
return news
4444

45-
def get_bazaar_data(self):
45+
def get_bazaar_data(self) -> dict:
4646
"""
4747
Returns a `dict` of Skyblock bazaar data.
4848
"""
4949
api_request = requests.get(f"https://api.hypixel.net/skyblock/bazaar?key={self.api_key}").content
5050
bazaar_data = json.loads(api_request)
5151
return bazaar_data
5252

53-
def get_player_profile(self, player_name: str):
53+
def get_player_profile(self, player_name: str) -> dict:
5454
"""
5555
Returns a `dict` of profile data on a player.
5656
"""
@@ -59,31 +59,31 @@ def get_player_profile(self, player_name: str):
5959
player_profile_data = json.loads(api_request)
6060
return player_profile_data
6161

62-
def get_collections(self):
62+
def get_collections(self) -> dict:
6363
"""
6464
Returns a `dict` of information related to Skyblock Collections.
6565
"""
6666
api_request = requests.get("https://api.hypixel.net/resources/skyblock/collections").content
6767
collections_data = json.loads(api_request)
6868
return collections_data
6969

70-
def get_skills(self):
70+
def get_skills(self) -> dict:
7171
"""
7272
Returns a `dict` of information related to Skyblock Skills.
7373
"""
7474
api_request = requests.get("https://api.hypixel.net/resources/skyblock/skills").content
7575
collections_data = json.loads(api_request)
7676
return collections_data
7777

78-
def get_items(self):
78+
def get_items(self) -> dict:
7979
"""
8080
Returns a `dict` of information related to Skyblock items.
8181
"""
8282
api_request = requests.get("https://api.hypixel.net/resources/skyblock/items").content
8383
items_data = json.loads(api_request)
8484
return items_data
8585

86-
def get_mayor_information(self):
86+
def get_mayor_information(self) -> dict:
8787
"""
8888
Returns a `dict` of information regarding the current mayor in Skyblock.
8989
"""
@@ -92,7 +92,7 @@ def get_mayor_information(self):
9292
del mayor_info["current"]
9393
return mayor_info
9494

95-
def get_current_election(self):
95+
def get_current_election(self) -> dict:
9696
"""
9797
Returns a `dict` of information regarding the current election in Skyblock.
9898
"""

0 commit comments

Comments
 (0)