diff --git a/api/commands.py b/api/commands.py index 8b4a654..0543667 100644 --- a/api/commands.py +++ b/api/commands.py @@ -291,16 +291,35 @@ def add_item(item_name, quantity, diamond_price, shop_name=None, discord_uuid=No @command("GET") -def selling(item_name, sort="-date_restocked"): +def selling(item_name): ''' :request: GET :param item_name: Item name to search for :param sort: Field to sort shop results by, default is date_restocked :return: List of top matching shops, sorted by the :raises: ItemNotFound - :help: Lists shops selling an item. + :help: Lists shops selling an item. Sorted by when they were last restocked. ''' + return get_selling(item_name, sort="-date_restocked") + + +@command("GET") +def selling(item_name): + ''' + :request: GET + :param item_name: Item name to search for + :param sort: Field to sort shop results by, default is date_restocked + :return: List of top matching shops, sorted by the + :raises: ItemNotFound + :help: Lists shops selling an item. Sorted lowest price to highest price. + ''' + + return get_selling(item_name, sort="-normalized_price") + + +def get_selling(item_name, sort="-date_restocked"): + items = [] if len(item_name) == 0: raise EmptryString @@ -600,7 +619,7 @@ def remove_resident(resident_name, town_name, discord_uuid=None, mc_uuid=None): :param town_name: Name of the town, can be blank if the owner has one town :param discord_uuid: Owner discord uuid :param mc_uuid: Owner mc uuid - :raises: PlayerNotFound, LocationLookupError, IsResidentError, ResidentNotFoundError + :raises: PlayerNotFound, LocationLookupError, ResidentNotFoundError :return: Updated town :help: Removes a resident from a town '''