Skip to content

Commit

Permalink
Change optional fields to use None type (#139)
Browse files Browse the repository at this point in the history
Change optional fields in BringAuthResponse and related classes to use None type
  • Loading branch information
tr4nt0r authored Jan 30, 2025
1 parent 17be5ac commit 76dbb1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions bring_api/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ class BringAuthResponse(DataClassORJSONMixin):
refresh_token: str
token_type: str
expires_in: int
photoPath: str = ""
email: str = ""
name: str = ""
photoPath: str | None = None
email: str | None = None
name: str | None = None


@dataclass(kw_only=True)
Expand Down Expand Up @@ -232,8 +232,8 @@ class BringSyncCurrentUserResponse(DataClassORJSONMixin):
publicUserUuid: str
userLocale: UserLocale
userUuid: str
name: str = ""
photoPath: str = ""
name: str | None = None
photoPath: str | None = None


class BringAttribute(TypedDict):
Expand Down Expand Up @@ -319,9 +319,9 @@ class BringUser:
plusTryOut: bool
country: str
language: str
name: str = ""
email: str = ""
photoPath: str = ""
name: str | None = None
email: str | None = None
photoPath: str | None = None


@dataclass(kw_only=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/test_bring.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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=[])]))
# ---
# name: TestGetListUsers.test_get_lists_users
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='')])
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=None, email=None, photoPath=None)])
# ---
# name: TestGetUserAccount.test_get_user_account
BringSyncCurrentUserResponse(email='{email}', emailVerified=True, premiumConfiguration={'hasPremium': False, 'hideSponsoredProducts': False, 'hideSponsoredTemplates': False, 'hideSponsoredPosts': False, 'hideSponsoredCategories': False, 'hideOffersOnMain': False}, publicUserUuid='00000000-0000-0000-0000-000000000000', userLocale=UserLocale(language='de', country='DE'), userUuid='00000000-0000-0000-0000-000000000000', name='{user_name}', photoPath='bring/user/portrait/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx')
Expand Down

0 comments on commit 76dbb1f

Please sign in to comment.