Skip to content

Commit

Permalink
Revert "Fix/update reasons"
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-lorenzo committed Jun 29, 2023
1 parent cd44ca3 commit 812d1a3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
18 changes: 15 additions & 3 deletions alice/onboarding/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,7 @@ def identify_user(
self,
target_user_id: str,
probe_user_ids: List[str],
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[bool, Union[OnboardingError, AuthError]]:
"""
Expand All @@ -1204,6 +1205,8 @@ def identify_user(
User identifier (Target)
probe_user_ids
List of user identifier to match against (N Probes)
version
Set Identify version
verbose
Used for print service response as well as the time elapsed
Returns
Expand All @@ -1215,6 +1218,7 @@ def identify_user(
response = self.onboarding_client.identify_user(
target_user_id=target_user_id,
probe_user_ids=probe_user_ids,
version=version,
verbose=verbose,
).unwrap_or_return()

Expand Down Expand Up @@ -1410,6 +1414,7 @@ def get_authentications(
page: int = 1,
page_size: int = 0,
descending: bool = True,
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[List[Dict[str, Any]], Union[OnboardingError, AuthError]]:
"""
Expand All @@ -1428,6 +1433,8 @@ def get_authentications(
Numbers of authentications per page that will be returned. To return all the authentications select 0.
descending
Order of the authentications according to their creation date.
version
Set Authentication Version
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1443,6 +1450,7 @@ def get_authentications(
page_size=page_size,
page=page,
descending=descending,
version=version,
verbose=verbose,
).unwrap_or_return()

Expand All @@ -1460,6 +1468,7 @@ def get_authentication(
self,
user_id: str,
authentication_id: str,
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[Dict[str, Any], Union[OnboardingError, AuthError]]:
"""
Expand All @@ -1472,6 +1481,8 @@ def get_authentication(
User identifier
authentication_id
Authentication identifier
version
Set Authentication Version
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1485,6 +1496,7 @@ def get_authentication(
response = self.onboarding_client.get_authentication(
user_id=user_id,
authentication_id=authentication_id,
version=version,
verbose=verbose,
).unwrap_or_return()

Expand Down Expand Up @@ -1688,7 +1700,7 @@ def update_user_state(
user_id: str,
user_state: UserState,
operator: str = "auto",
update_reasons: Optional[List[Dict[str, str]]] = None,
state_update_reasons: Optional[List[Dict[str, str]]] = None,
verbose: bool = False,
) -> Result[bool, OnboardingError]:
"""
Expand All @@ -1701,7 +1713,7 @@ def update_user_state(
User identifier
operator
Who is accepting the user
update_reasons
state_update_reasons
List of reasons for status update
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1715,7 +1727,7 @@ def update_user_state(
user_id=user_id,
user_state=user_state,
operator=operator,
update_reasons=update_reasons,
state_update_reasons=state_update_reasons,
verbose=verbose,
).unwrap_or_return()

Expand Down
18 changes: 15 additions & 3 deletions alice/onboarding/onboarding_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,7 @@ def identify_user(
self,
target_user_id: str,
probe_user_ids: List[str],
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[Response, Error]:
"""
Expand All @@ -1372,6 +1373,8 @@ def identify_user(
User identifier (Target)
probe_user_ids
List of user identifier to match against (N Probes)
version
Set Identify Version
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1388,6 +1391,7 @@ def identify_user(
print_token("backend_token_with_user", backend_user_token, verbose=verbose)

headers = self._auth_headers(backend_user_token)
headers["Alice-Identify-Version"] = version.value

data = {"user_ids": probe_user_ids}

Expand Down Expand Up @@ -1624,6 +1628,7 @@ def get_authentications(
page: int = 1,
page_size: int = 0,
descending: bool = True,
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[Response, Error]:
"""
Expand All @@ -1640,6 +1645,8 @@ def get_authentications(
Numbers of authentications that will be returned for each page. To return all the authentications select 0.
descending
Order of the authentications according to their creation date.
version
Set Authentication Version
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1656,6 +1663,7 @@ def get_authentications(
print_token("backend_token_with_user", backend_user_token, verbose=verbose)

headers = self._auth_headers(backend_user_token)
headers["Alice-Authentication-Version"] = version.value

url_query_params = (
f"?page={str(page)}&page_size={str(page_size)}&descending={str(descending)}"
Expand All @@ -1679,6 +1687,7 @@ def get_authentication(
self,
user_id: str,
authentication_id: str,
version: Version = Version.DEFAULT,
verbose: bool = False,
) -> Result[Response, Error]:
"""
Expand All @@ -1691,6 +1700,8 @@ def get_authentication(
User identifier
authentication_id
Authentication identifier.
version
Set Authentication Version
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1707,6 +1718,7 @@ def get_authentication(
print_token("backend_token_with_user", backend_user_token, verbose=verbose)

headers = self._auth_headers(backend_user_token)
headers["Alice-Authentication-Version"] = version.value

try:
response = self.session.get(
Expand Down Expand Up @@ -1942,7 +1954,7 @@ def update_user_state(
user_id: str,
user_state: UserState,
operator: str = "auto",
update_reasons: Optional[List[Dict[str, str]]] = None,
state_update_reasons: Optional[List[Dict[str, str]]] = None,
verbose: bool = False,
) -> Result[Response, Error]:
"""
Expand All @@ -1956,7 +1968,7 @@ def update_user_state(
User identifier
operator
Who is accepting the user
update_reasons
state_update_reasons
List of reasons for status update
verbose
Used for print service response as well as the time elapsed
Expand All @@ -1980,7 +1992,7 @@ def update_user_state(
headers=headers,
json={
"state": user_state.value,
"update_reasons": update_reasons,
"state_update_reasons": state_update_reasons,
"operator": operator,
},
timeout=self.timeout,
Expand Down

0 comments on commit 812d1a3

Please sign in to comment.