Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 4afb4ea

Browse files
authored
fix: Merge pull request #23 from seamapi/connected-account-errors
2 parents 531236c + 3b14e60 commit 4afb4ea

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

seamapi/connected_accounts.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
)
77

88
import requests
9-
from typing import List, Optional, Union
9+
from typing import Any, Dict, List, Union
1010
from seamapi.utils.convert_to_id import to_connected_account_id
1111

1212

@@ -61,13 +61,14 @@ def list(self) -> List[ConnectedAccount]:
6161
)
6262
if not res.ok:
6363
raise Exception(res.text)
64-
json_accounts = res.json()["connected_accounts"]
64+
json_accounts: List[Dict[str, Any]] = res.json()["connected_accounts"]
6565
return [
6666
ConnectedAccount(
6767
connected_account_id=json_account["connected_account_id"],
6868
created_at=json_account["created_at"],
6969
user_identifier=json_account["user_identifier"],
7070
account_type=json_account["account_type"],
71+
errors=json_account.get("errors", []),
7172
)
7273
for json_account in json_accounts
7374
]
@@ -101,10 +102,11 @@ def get(
101102
)
102103
if not res.ok:
103104
raise Exception(res.text)
104-
json_account = res.json()["connected_account"]
105+
json_account: Dict[str, Any] = res.json()["connected_account"]
105106
return ConnectedAccount(
106107
connected_account_id=json_account["connected_account_id"],
107108
created_at=json_account["created_at"],
108109
user_identifier=json_account["user_identifier"],
109110
account_type=json_account["account_type"],
111+
errors=json_account.get("errors", []),
110112
)

seamapi/types.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class ConnectedAccount:
9494
created_at: str
9595
user_identifier: str
9696
account_type: str
97+
errors: List[str]
9798

9899

99100
@dataclass_json
@@ -231,7 +232,9 @@ def list(self) -> List[ConnectedAccount]:
231232
raise NotImplementedError
232233

233234
@abc.abstractmethod
234-
def get(self, connected_account_id: str) -> ConnectedAccount:
235+
def get(
236+
self, connected_account: Union[ConnectedAccountId, ConnectedAccount]
237+
) -> ConnectedAccount:
235238
raise NotImplementedError
236239

237240

0 commit comments

Comments
 (0)