From 01be89cf854fa1d244f448f1ab41113c166f6340 Mon Sep 17 00:00:00 2001 From: Evan Sosenko Date: Thu, 9 Mar 2023 12:38:21 -0800 Subject: [PATCH] feat: Add custom_metadata (#75) --- seamapi/connect_webviews.py | 4 ++++ seamapi/connected_accounts.py | 2 ++ seamapi/types.py | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/seamapi/connect_webviews.py b/seamapi/connect_webviews.py index 96e4553..fe1ed57 100644 --- a/seamapi/connect_webviews.py +++ b/seamapi/connect_webviews.py @@ -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. @@ -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 ------ @@ -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", diff --git a/seamapi/connected_accounts.py b/seamapi/connected_accounts.py index fd7fc82..8581dc2 100644 --- a/seamapi/connected_accounts.py +++ b/seamapi/connected_accounts.py @@ -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 ] @@ -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 diff --git a/seamapi/types.py b/seamapi/types.py index 6a8f82a..b787ed5 100644 --- a/seamapi/types.py +++ b/seamapi/types.py @@ -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 @@ -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