From 1e3166594692bf16881da59a5595f44c89fc4b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=20Garc=C3=ADa=20Salom=C3=B3n?= Date: Mon, 21 Aug 2023 11:57:17 +0200 Subject: [PATCH] feat: add flow_id parameter when creating users --- alice/onboarding/onboarding.py | 8 +++++++- alice/onboarding/onboarding_client.py | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/alice/onboarding/onboarding.py b/alice/onboarding/onboarding.py index 1bd1be1..da4906c 100644 --- a/alice/onboarding/onboarding.py +++ b/alice/onboarding/onboarding.py @@ -95,6 +95,7 @@ def create_user( self, user_info: Union[UserInfo, None] = None, device_info: Union[DeviceInfo, None] = None, + flow_id: Union[str, None] = None, verbose: Optional[bool] = False, ) -> Result[str, Union[OnboardingError, AuthError]]: """ @@ -109,6 +110,8 @@ def create_user( Object with optional values with info about the User. device_info Object with optional values with info about the User's Device. + flow_id + Optional identifier of the onboarding flow verbose Used for print service response as well as the time elapsed @@ -120,7 +123,10 @@ def create_user( """ verbose = self.verbose or verbose response = self.onboarding_client.create_user( - user_info=user_info, device_info=device_info, verbose=verbose + user_info=user_info, + device_info=device_info, + flow_id=flow_id, + verbose=verbose, ).unwrap_or_return() if response.status_code == 200: diff --git a/alice/onboarding/onboarding_client.py b/alice/onboarding/onboarding_client.py index 526856b..700b78f 100644 --- a/alice/onboarding/onboarding_client.py +++ b/alice/onboarding/onboarding_client.py @@ -85,6 +85,7 @@ def create_user( self, user_info: Union[UserInfo, None] = None, device_info: Union[DeviceInfo, None] = None, + flow_id: Union[str, None] = None, verbose: Optional[bool] = False, ) -> Result[Response, Error]: """ @@ -99,6 +100,8 @@ def create_user( Object with optional values with info about the User. device_info Object with optional values with info about the User's Device. + flow_id + Optional identifier of the onboarding flow verbose Used for print service response as well as the time elapsed @@ -122,6 +125,9 @@ def create_user( if device_info: data = data if data is not None else {} data.update(device_info.dict()) + if flow_id: + data = data if data is not None else {} + data.update({"flow_id": flow_id}) try: response = self.session.post( f"{self.url}/user", headers=headers, data=data, timeout=self.timeout