diff --git a/src/prelude_python_sdk/resources/verification.py b/src/prelude_python_sdk/resources/verification.py index 735a7cc..7367e88 100644 --- a/src/prelude_python_sdk/resources/verification.py +++ b/src/prelude_python_sdk/resources/verification.py @@ -67,7 +67,8 @@ def create( this endpoint will perform a retry instead. Args: - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. dispatch_id: The identifier of the dispatch that came from the front-end SDK. @@ -76,7 +77,8 @@ def create( options: Verification options - signals: The signals used for anti-fraud. + signals: The signals used for anti-fraud. For more details, refer to + [Signals](/guides/prevent-fraud#signals). extra_headers: Send extra headers @@ -122,7 +124,8 @@ def check( Args: code: The OTP code to validate. - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. extra_headers: Send extra headers @@ -190,7 +193,8 @@ async def create( this endpoint will perform a retry instead. Args: - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. dispatch_id: The identifier of the dispatch that came from the front-end SDK. @@ -199,7 +203,8 @@ async def create( options: Verification options - signals: The signals used for anti-fraud. + signals: The signals used for anti-fraud. For more details, refer to + [Signals](/guides/prevent-fraud#signals). extra_headers: Send extra headers @@ -245,7 +250,8 @@ async def check( Args: code: The OTP code to validate. - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. extra_headers: Send extra headers diff --git a/src/prelude_python_sdk/resources/watch.py b/src/prelude_python_sdk/resources/watch.py index 0233667..0907e8b 100644 --- a/src/prelude_python_sdk/resources/watch.py +++ b/src/prelude_python_sdk/resources/watch.py @@ -65,7 +65,8 @@ def feed_back( feedback: You should send a feedback event back to Watch API when your user demonstrates authentic behavior. - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. extra_headers: Send extra headers @@ -108,7 +109,8 @@ def predict( must be implemented in conjunction with the `watch/feedback` endpoint. Args: - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. signals: It is highly recommended that you provide the signals to increase prediction performance. @@ -177,7 +179,8 @@ async def feed_back( feedback: You should send a feedback event back to Watch API when your user demonstrates authentic behavior. - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. extra_headers: Send extra headers @@ -220,7 +223,8 @@ async def predict( must be implemented in conjunction with the `watch/feedback` endpoint. Args: - target: The target. Currently this can only be an E.164 formatted phone number. + target: The verification target. Either a phone number or an email address. To use the + email verification feature contact us to discuss your use case. signals: It is highly recommended that you provide the signals to increase prediction performance. diff --git a/src/prelude_python_sdk/types/verification_check_params.py b/src/prelude_python_sdk/types/verification_check_params.py index ad7b8eb..dea9702 100644 --- a/src/prelude_python_sdk/types/verification_check_params.py +++ b/src/prelude_python_sdk/types/verification_check_params.py @@ -12,12 +12,16 @@ class VerificationCheckParams(TypedDict, total=False): """The OTP code to validate.""" target: Required[Target] - """The target. Currently this can only be an E.164 formatted phone number.""" + """The verification target. + + Either a phone number or an email address. To use the email verification feature + contact us to discuss your use case. + """ class Target(TypedDict, total=False): - type: Required[Literal["phone_number"]] - """The type of the target. Currently this can only be "phone_number".""" + type: Required[Literal["phone_number", "email_address"]] + """The type of the target. Either "phone_number" or "email_address".""" value: Required[str] - """An E.164 formatted phone number to verify.""" + """An E.164 formatted phone number or an email address.""" diff --git a/src/prelude_python_sdk/types/verification_create_params.py b/src/prelude_python_sdk/types/verification_create_params.py index 9ea69a7..15a83b6 100644 --- a/src/prelude_python_sdk/types/verification_create_params.py +++ b/src/prelude_python_sdk/types/verification_create_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Dict from typing_extensions import Literal, Required, TypedDict __all__ = ["VerificationCreateParams", "Target", "Metadata", "Options", "OptionsAppRealm", "Signals"] @@ -9,7 +10,11 @@ class VerificationCreateParams(TypedDict, total=False): target: Required[Target] - """The target. Currently this can only be an E.164 formatted phone number.""" + """The verification target. + + Either a phone number or an email address. To use the email verification feature + contact us to discuss your use case. + """ dispatch_id: str """The identifier of the dispatch that came from the front-end SDK.""" @@ -25,15 +30,18 @@ class VerificationCreateParams(TypedDict, total=False): """Verification options""" signals: Signals - """The signals used for anti-fraud.""" + """The signals used for anti-fraud. + + For more details, refer to [Signals](/guides/prevent-fraud#signals). + """ class Target(TypedDict, total=False): - type: Required[Literal["phone_number"]] - """The type of the target. Currently this can only be "phone_number".""" + type: Required[Literal["phone_number", "email_address"]] + """The type of the target. Either "phone_number" or "email_address".""" value: Required[str] - """An E.164 formatted phone number to verify.""" + """An E.164 formatted phone number or an email address.""" class Metadata(TypedDict, total=False): @@ -59,6 +67,13 @@ class Options(TypedDict, total=False): Currently only Android devices are supported. """ + callback_url: str + """ + The URL where webhooks will be sent when verification events occur, including + verification creation, attempt creation, and delivery status changes. For more + details, refer to [Webhook](/api-reference/v2/verify/webhook). + """ + code_size: int """The size of the code generated. @@ -89,12 +104,15 @@ class Options(TypedDict, total=False): """ template_id: str - """The identifier of a verification settings template. + """The identifier of a verification template. - It is used to be able to switch behavior for specific use cases. Contact us if - you need to use this functionality. + It applies use case-specific settings, such as the message content or certain + verification parameters. """ + variables: Dict[str, str] + """The variables to be replaced in the template.""" + class Signals(TypedDict, total=False): app_version: str @@ -124,3 +142,11 @@ class Signals(TypedDict, total=False): os_version: str """The version of the user's device operating system.""" + + user_agent: str + """The user agent of the user's device. + + If the individual fields (os_version, device_platform, device_model) are + provided, we will prioritize those values instead of parsing them from the user + agent string. + """ diff --git a/src/prelude_python_sdk/types/watch_feed_back_params.py b/src/prelude_python_sdk/types/watch_feed_back_params.py index a7853fa..c4cc330 100644 --- a/src/prelude_python_sdk/types/watch_feed_back_params.py +++ b/src/prelude_python_sdk/types/watch_feed_back_params.py @@ -15,7 +15,11 @@ class WatchFeedBackParams(TypedDict, total=False): """ target: Required[Target] - """The target. Currently this can only be an E.164 formatted phone number.""" + """The verification target. + + Either a phone number or an email address. To use the email verification feature + contact us to discuss your use case. + """ class Feedback(TypedDict, total=False): @@ -27,8 +31,8 @@ class Feedback(TypedDict, total=False): class Target(TypedDict, total=False): - type: Required[Literal["phone_number"]] - """The type of the target. Currently this can only be "phone_number".""" + type: Required[Literal["phone_number", "email_address"]] + """The type of the target. Either "phone_number" or "email_address".""" value: Required[str] - """An E.164 formatted phone number to verify.""" + """An E.164 formatted phone number or an email address.""" diff --git a/src/prelude_python_sdk/types/watch_predict_params.py b/src/prelude_python_sdk/types/watch_predict_params.py index 7d8a645..6ef2093 100644 --- a/src/prelude_python_sdk/types/watch_predict_params.py +++ b/src/prelude_python_sdk/types/watch_predict_params.py @@ -9,7 +9,11 @@ class WatchPredictParams(TypedDict, total=False): target: Required[Target] - """The target. Currently this can only be an E.164 formatted phone number.""" + """The verification target. + + Either a phone number or an email address. To use the email verification feature + contact us to discuss your use case. + """ signals: Signals """ @@ -19,11 +23,11 @@ class WatchPredictParams(TypedDict, total=False): class Target(TypedDict, total=False): - type: Required[Literal["phone_number"]] - """The type of the target. Currently this can only be "phone_number".""" + type: Required[Literal["phone_number", "email_address"]] + """The type of the target. Either "phone_number" or "email_address".""" value: Required[str] - """An E.164 formatted phone number to verify.""" + """An E.164 formatted phone number or an email address.""" class Signals(TypedDict, total=False): diff --git a/tests/api_resources/test_verification.py b/tests/api_resources/test_verification.py index 6170e67..d88eca4 100644 --- a/tests/api_resources/test_verification.py +++ b/tests/api_resources/test_verification.py @@ -44,11 +44,13 @@ def test_method_create_with_all_params(self, client: Prelude) -> None: "platform": "android", "value": "value", }, + "callback_url": "callback_url", "code_size": 5, "custom_code": "custom_code", "locale": "el-GR", "sender_id": "sender_id", - "template_id": "template_id", + "template_id": "prelude:psd2", + "variables": {"foo": "bar"}, }, signals={ "app_version": "1.2.34", @@ -58,6 +60,7 @@ def test_method_create_with_all_params(self, client: Prelude) -> None: "ip": "192.0.2.1", "is_trusted_user": False, "os_version": "18.0.1", + "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, ) assert_matches_type(VerificationCreateResponse, verification, path=["response"]) @@ -163,11 +166,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncPrelude) - "platform": "android", "value": "value", }, + "callback_url": "callback_url", "code_size": 5, "custom_code": "custom_code", "locale": "el-GR", "sender_id": "sender_id", - "template_id": "template_id", + "template_id": "prelude:psd2", + "variables": {"foo": "bar"}, }, signals={ "app_version": "1.2.34", @@ -177,6 +182,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncPrelude) - "ip": "192.0.2.1", "is_trusted_user": False, "os_version": "18.0.1", + "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1", }, ) assert_matches_type(VerificationCreateResponse, verification, path=["response"])