Skip to content

Commit

Permalink
fix: typo TypedDict name
Browse files Browse the repository at this point in the history
  • Loading branch information
MalikAza committed May 2, 2024
1 parent 615312a commit b97cb90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyZUnivers/api_responses/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ class BestInventoryLog(__ItemMoreInfos):
source: str
deltaQuantity: int

class UserInvetoryObject(InventoryObject):
class UserInventoryObject(InventoryObject):
isFusion: bool
isFusionComponent: bool
4 changes: 2 additions & 2 deletions pyZUnivers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .insomniaque import Insomniaque
from .achievements import Achievements
from .api_responses import AdventCalendar as AdventCalendarType, LootInfos, Base
from .api_responses.items import UserInvetoryObject
from .api_responses.items import UserInventoryObject
from .utils import (
PLAYER_BASE_URL,
API_BASE_URL,
Expand Down Expand Up @@ -328,5 +328,5 @@ def today_trades(self) -> str:
def subscription_bonus(self) -> str:
return f"{self.__base_infos['subscriptionBonusCount']}/{self.__base_infos['subscriptionBonusLimit']}"

def get_inventory(self, search: str = None) -> List[UserInvetoryObject]:
def get_inventory(self, search: str = None) -> List[UserInventoryObject]:
return get_inventory(self.__parsed_name, search)
12 changes: 9 additions & 3 deletions pyZUnivers/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .api_responses import Ascension as AscensionType
from .api_responses.items import UserInvetoryObject
from .api_responses.items import UserInventoryObject

import requests
from typing import List, Dict, TypedDict
Expand Down Expand Up @@ -103,6 +103,12 @@ def get_inventory(username: str, search: str = None): # TODO: Add filters
base_url = f"{API_BASE_URL}/inventory/{parse_username(username)[-1]}"
if search: base_url += f'?search={search}'

result: List[UserInvetoryObject] = get_datas(base_url)
result: List[UserInventoryObject] = get_datas(base_url)

return result
return result

def best_inventory(username: str, limit: int = 10):
inventory = get_inventory(username)
inventory = sorted(inventory, key=lambda x: x["quantity"], reverse=True)

return inventory[:limit]

0 comments on commit b97cb90

Please sign in to comment.