Skip to content

Commit f81604d

Browse files
authored
Use enum for status in BringItemsResponse (#135)
1 parent b52fbd7 commit f81604d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

bring_api/types.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ class BringItemOperation(StrEnum):
5151
ATTRIBUTE_UPDATE = "ATTRIBUTE_UPDATE"
5252

5353

54+
class Status(StrEnum):
55+
"""List status."""
56+
57+
REGISTERED = "REGISTERED"
58+
UNREGISTERED = "UNREGISTERED"
59+
SHARED = "SHARED"
60+
INVITATION = "INVITATION"
61+
62+
5463
@dataclass(kw_only=True)
5564
class BringList(DataClassORJSONMixin):
5665
"""A list class. Represents a single list."""
@@ -140,7 +149,7 @@ class BringItemsResponse(DataClassORJSONMixin):
140149
"""An items response class."""
141150

142151
uuid: str
143-
status: str
152+
status: Status
144153
items: Items
145154

146155

tests/__snapshots__/test_bring.ambr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
BringUserSettingsResponse(usersettings=[BringUserSettingsEntry(key='autoPush', value='ON'), BringUserSettingsEntry(key='purchaseStyle', value='grouped'), BringUserSettingsEntry(key='premiumHideSponsoredCategories', value='OFF'), BringUserSettingsEntry(key='premiumHideInspirationsBadge', value='OFF'), BringUserSettingsEntry(key='premiumHideOffersBadge', value='OFF'), BringUserSettingsEntry(key='premiumHideOffersOnMain', value='OFF'), BringUserSettingsEntry(key='defaultListUUID', value='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx'), BringUserSettingsEntry(key='discountActivatorOnMainEnabled', value='OFF'), BringUserSettingsEntry(key='onboardClient', value='android')], userlistsettings=[BringUserListSettingEntry(listUuid='00000000-0000-0000-0000-000000000000', usersettings=[BringUserSettingsEntry(key='listSectionOrder', value='["Früchte & Gemüse","Brot & Gebäck","Milch & Käse","Fleisch & Fisch","Zutaten & Gewürze","Fertig- & Tiefkühlprodukte","Getreideprodukte","Snacks & Süsswaren","Getränke & Tabak","Haushalt & Gesundheit","Pflege & Gesundheit","Tierbedarf","Baumarkt & Garten","Eigene Artikel"]'), BringUserSettingsEntry(key='listArticleLanguage', value='de-DE')])])
1010
# ---
1111
# name: TestGetList.test_get_list
12-
BringItemsResponse(uuid='00000000-0000-0000-0000-000000000000', status='SHARED', items=Items(purchase=[BringPurchase(uuid='43bdd5a2-740a-4230-8b27-d0bbde886da7', itemId='Paprika', specification='grün', attributes=[]), BringPurchase(uuid='2de9d1c0-c211-4129-b6c5-c1260c3fc735', itemId='Zucchetti', specification='gelb', attributes=[])], recently=[BringPurchase(uuid='5681ed79-c8e4-4c8b-95ec-112999d016c0', itemId='Paprika', specification='rot', attributes=[]), BringPurchase(uuid='01eea2cd-f433-4263-ad08-3d71317c4298', itemId='Pouletbrüstli', specification='', attributes=[])]))
12+
BringItemsResponse(uuid='00000000-0000-0000-0000-000000000000', status=<Status.SHARED: 'SHARED'>, items=Items(purchase=[BringPurchase(uuid='43bdd5a2-740a-4230-8b27-d0bbde886da7', itemId='Paprika', specification='grün', attributes=[]), BringPurchase(uuid='2de9d1c0-c211-4129-b6c5-c1260c3fc735', itemId='Zucchetti', specification='gelb', attributes=[])], recently=[BringPurchase(uuid='5681ed79-c8e4-4c8b-95ec-112999d016c0', itemId='Paprika', specification='rot', attributes=[]), BringPurchase(uuid='01eea2cd-f433-4263-ad08-3d71317c4298', itemId='Pouletbrüstli', specification='', attributes=[])]))
1313
# ---
1414
# name: TestGetListUsers.test_get_lists_users
1515
BringUsersResponse(users=[BringUser(publicUuid='98615d7e-0a7d-4a7e-8f73-a9cbb9f1bc32', pushEnabled=True, plusTryOut=False, country='DE', language='de', name='NAME', email='EMAIL', photoPath=''), BringUser(publicUuid='73af455f-c158-4004-a5e0-79f4f8a6d4bd', pushEnabled=True, plusTryOut=False, country='US', language='en', name='NAME', email='EMAIL', photoPath=''), BringUser(publicUuid='7d5e9d08-877a-4c36-8740-a9bf74ec690a', pushEnabled=True, plusTryOut=False, country='US', language='en', name='', email='', photoPath='')])

0 commit comments

Comments
 (0)