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

Commit

Permalink
feat: Add custom_metadata (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
razor-x authored Mar 9, 2023
1 parent c5c6cf5 commit 01be89c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions seamapi/connect_webviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ def create(
custom_redirect_url: Optional[str] = None,
custom_redirect_failure_url: Optional[str] = None,
device_selection_mode: Optional[str] = None,
custom_metadata: Optional[dict] = None,
) -> ConnectWebview:
"""Creates a connect webview.
Expand All @@ -122,6 +123,7 @@ def create(
Custom redirect failure url
device_selection_mode : str, optional
Selection mode: 'none', 'single' or 'multiple'
custom_metadata : dict, optional
Raises
------
Expand All @@ -140,6 +142,8 @@ def create(
create_payload["custom_redirect_failure_url"] = custom_redirect_failure_url
if device_selection_mode is not None:
create_payload["device_selection_mode"] = device_selection_mode
if custom_metadata is not None:
create_payload["custom_metadata"] = custom_metadata

res = self.seam.make_request(
"POST",
Expand Down
2 changes: 2 additions & 0 deletions seamapi/connected_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def list(self) -> List[ConnectedAccount]:
user_identifier=json_account["user_identifier"],
account_type=json_account["account_type"],
errors=json_account.get("errors", []),
custom_metadata=json_account.get("custom_metadata", {})
)
for json_account in json_accounts
]
Expand Down Expand Up @@ -130,6 +131,7 @@ def get(
user_identifier=json_account["user_identifier"],
account_type=json_account["account_type"],
errors=json_account.get("errors", []),
custom_metadata=json_account.get("custom_metadata", {}),
)

@report_error
Expand Down
3 changes: 2 additions & 1 deletion seamapi/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class ConnectWebview:
any_provider_allowed: bool
any_device_allowed: bool
created_at: str
custom_metadata: Dict[str, Union[str, int, bool, None]]
connected_account_id: Optional[str] = None
authorized_at: Optional[str] = None
custom_redirect_url: Optional[str] = None
Expand All @@ -149,7 +150,7 @@ class ConnectedAccount:
user_identifier: str
account_type: str
errors: List[str]

custom_metadata: Dict[str, Union[str, int, bool, None]]

@dataclass_json
@dataclass
Expand Down

0 comments on commit 01be89c

Please sign in to comment.