inttegro.otp
Models, requests, and enums for Inttegro otp operations.
Import public types from the singular inttegro.otp namespace. Related request types, response shapes, and string-backed enums are grouped here for discovery.
1"""Models, requests, and enums for Inttegro otp operations. 2 3Import public types from the singular ``inttegro.otp`` namespace. Related request types, response shapes, and string-backed enums are grouped here for discovery.""" 4 5from importlib import import_module 6from typing import TYPE_CHECKING, Any 7 8if TYPE_CHECKING: 9 from .alphabet_type import AlphabetType as AlphabetType 10 from .initiate_request import InitiateRequest as InitiateRequest 11 from .initiate_response import InitiateResponse as InitiateResponse 12 from .lookup_request import LookupRequest as LookupRequest 13 from .lookup_response import LookupResponse as LookupResponse 14 from .purpose import Purpose as Purpose 15 from .status import Status as Status 16 from .transaction import Transaction as Transaction 17 from .transmission import Transmission as Transmission 18 from .transmission_status import TransmissionStatus as TransmissionStatus 19 from .verification import Verification as Verification 20 from .verification_attempt import VerificationAttempt as VerificationAttempt 21 from .verification_attempt_result import VerificationAttemptResult as VerificationAttemptResult 22 from .verification_verdict import VerificationVerdict as VerificationVerdict 23 from .verify_request import VerifyRequest as VerifyRequest 24 25 26_EXPORTS: dict[str, tuple[str, str]] = { 27 "AlphabetType": ("inttegro.otp.alphabet_type", "AlphabetType"), 28 "InitiateRequest": ("inttegro.otp.initiate_request", "InitiateRequest"), 29 "InitiateResponse": ("inttegro.otp.initiate_response", "InitiateResponse"), 30 "LookupRequest": ("inttegro.otp.lookup_request", "LookupRequest"), 31 "LookupResponse": ("inttegro.otp.lookup_response", "LookupResponse"), 32 "Purpose": ("inttegro.otp.purpose", "Purpose"), 33 "Status": ("inttegro.otp.status", "Status"), 34 "Transaction": ("inttegro.otp.transaction", "Transaction"), 35 "Transmission": ("inttegro.otp.transmission", "Transmission"), 36 "TransmissionStatus": ("inttegro.otp.transmission_status", "TransmissionStatus"), 37 "Verification": ("inttegro.otp.verification", "Verification"), 38 "VerificationAttempt": ("inttegro.otp.verification_attempt", "VerificationAttempt"), 39 "VerificationAttemptResult": ("inttegro.otp.verification_attempt_result", "VerificationAttemptResult"), 40 "VerificationVerdict": ("inttegro.otp.verification_verdict", "VerificationVerdict"), 41 "VerifyRequest": ("inttegro.otp.verify_request", "VerifyRequest"), 42} 43 44__all__ = [ 45 "AlphabetType", 46 "InitiateRequest", 47 "InitiateResponse", 48 "LookupRequest", 49 "LookupResponse", 50 "Purpose", 51 "Status", 52 "Transaction", 53 "Transmission", 54 "TransmissionStatus", 55 "Verification", 56 "VerificationAttempt", 57 "VerificationAttemptResult", 58 "VerificationVerdict", 59 "VerifyRequest", 60] 61 62 63def __getattr__(name: str) -> Any: 64 """Load a public resource type on first access.""" 65 try: 66 module_name, attribute_name = _EXPORTS[name] 67 except KeyError: 68 raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None 69 value = getattr(import_module(module_name), attribute_name) 70 globals()[name] = value 71 return value
11class AlphabetType(WireEnum): 12 """Predefined alphabet type (mutually exclusive with token_alphabet). 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``OTPAlphabetType``. 18 """ 19 NUMERIC = "numeric" 20 """Wire value ``numeric`` (numeric) for predefined alphabet type (mutually exclusive with token_alphabet)""" 21 ALPHA = "alpha" 22 """Wire value ``alpha`` (alpha) for predefined alphabet type (mutually exclusive with token_alphabet)""" 23 ALPHANUMERIC = "alphanumeric" 24 """Wire value ``alphanumeric`` (alphanumeric) for predefined alphabet type (mutually exclusive with token_alphabet)"""
Predefined alphabet type (mutually exclusive with token_alphabet).
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: OTPAlphabetType.
Wire value numeric (numeric) for predefined alphabet type (mutually exclusive with token_alphabet)
Wire value alpha (alpha) for predefined alphabet type (mutually exclusive with token_alphabet)
Wire value alphanumeric (alphanumeric) for predefined alphabet type (mutually exclusive with token_alphabet)
13@dataclass(frozen=True, slots=True, kw_only=True) 14class InitiateRequest(ApiRequest): 15 """Parameters accepted by the initiate request operation. 16 17 This is an immutable, keyword-only request object. ``to_dict()`` uses 18 the documented wire names, omits fields left as ``UNSET``, serializes 19 string-backed enums by value, and requires timezone-aware datetimes. 20 21 API contract schema: ``InitiateOTPRequest``. 22 """ 23 async_delivery: bool | UnsetType = field(default=UNSET) 24 """Return after accepting the transaction while SMS delivery continues asynchronously. Optional. Python type: ``bool``; wire name: ``async_delivery``; JSON type: boolean""" 25 message_template: str | UnsetType = field(default=UNSET) 26 """SMS text containing the required `{token}` placeholder and optional `{service}` placeholder. Optional. Python type: ``str``; wire name: ``message_template``; JSON type: string""" 27 purpose: Literal['account_creation', 'account_recovery', 'email_verification', 'financial_account_verification', 'password_reset', 'payment_confirmation', 'payment_method_verification', 'payout_confirmation', 'phone_verification', 'sensitive_action', 'sign_in', 'transaction_confirmation', 'unspecified', OTPPurpose.ACCOUNT_CREATION, OTPPurpose.ACCOUNT_RECOVERY, OTPPurpose.EMAIL_VERIFICATION, OTPPurpose.FINANCIAL_ACCOUNT_VERIFICATION, OTPPurpose.PASSWORD_RESET, OTPPurpose.PAYMENT_CONFIRMATION, OTPPurpose.PAYMENT_METHOD_VERIFICATION, OTPPurpose.PAYOUT_CONFIRMATION, OTPPurpose.PHONE_VERIFICATION, OTPPurpose.SENSITIVE_ACTION, OTPPurpose.SIGN_IN, OTPPurpose.TRANSACTION_CONFIRMATION, OTPPurpose.UNSPECIFIED] 28 """Customer action protected by the OTP. Required. Python type: ``Literal[Purpose values]``; wire name: ``purpose``; JSON type: string""" 29 sender: str | UnsetType = field(default=UNSET) 30 """Optional sender identifier shown to the recipient (3-12 characters). Optional. Python type: ``str``; wire name: ``sender``; JSON type: string. Constraints: minimum length 3; maximum length 12""" 31 token_alphabet: str | UnsetType = field(default=UNSET) 32 """Custom alphabet for token generation (mutually exclusive with token_alphabet_type). Optional. Python type: ``str``; wire name: ``token_alphabet``; JSON type: string""" 33 token_alphabet_type: Literal['numeric', 'alpha', 'alphanumeric', OTPAlphabetType.NUMERIC, OTPAlphabetType.ALPHA, OTPAlphabetType.ALPHANUMERIC] | UnsetType = field(default=UNSET) 34 """Predefined alphabet type (mutually exclusive with token_alphabet). Optional. Python type: ``Literal['numeric', 'alpha', 'alphanumeric', OTPAlphabetType.NUMERIC, OTPAlphabetType.ALPHA, OTPAlphabetType.ALPHANUMERIC]``; wire name: ``token_alphabet_type``; JSON type: string. Constraints: allowed values ``numeric``, ``alpha``, ``alphanumeric``""" 35 validity_duration_in_minutes: int | UnsetType = field(default=UNSET) 36 """How long the token remains valid (3-10080 minutes). Optional. Python type: ``int``; wire name: ``validity_duration_in_minutes``; JSON type: integer. Constraints: minimum 3; maximum 10080""" 37 recipient: str 38 """Phone number in international format (E.164). Required. Python type: ``str``; wire name: ``recipient``; JSON type: string""" 39 service_name: str 40 """Service name substituted for `{service}` (2-20 characters). Required. Python type: ``str``; wire name: ``service_name``; JSON type: string. Constraints: minimum length 2; maximum length 20""" 41 token_size: int 42 """Length of generated token (5-10 characters). Required. Python type: ``int``; wire name: ``token_size``; JSON type: integer. Constraints: minimum 5; maximum 10"""
Parameters accepted by the initiate request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: InitiateOTPRequest.
Return after accepting the transaction while SMS delivery continues asynchronously. Optional. Python type: bool; wire name: async_delivery; JSON type: boolean
SMS text containing the required {token} placeholder and optional {service} placeholder. Optional. Python type: str; wire name: message_template; JSON type: string
Customer action protected by the OTP. Required. Python type: Literal[Purpose values]; wire name: purpose; JSON type: string
Optional sender identifier shown to the recipient (3-12 characters). Optional. Python type: str; wire name: sender; JSON type: string. Constraints: minimum length 3; maximum length 12
Custom alphabet for token generation (mutually exclusive with token_alphabet_type). Optional. Python type: str; wire name: token_alphabet; JSON type: string
Predefined alphabet type (mutually exclusive with token_alphabet). Optional. Python type: Literal['numeric', 'alpha', 'alphanumeric', OTPAlphabetType.NUMERIC, OTPAlphabetType.ALPHA, OTPAlphabetType.ALPHANUMERIC]; wire name: token_alphabet_type; JSON type: string. Constraints: allowed values numeric, alpha, alphanumeric
How long the token remains valid (3-10080 minutes). Optional. Python type: int; wire name: validity_duration_in_minutes; JSON type: integer. Constraints: minimum 3; maximum 10080
Phone number in international format (E.164). Required. Python type: str; wire name: recipient; JSON type: string
Service name substituted for {service} (2-20 characters). Required. Python type: str; wire name: service_name; JSON type: string. Constraints: minimum length 2; maximum length 20
Length of generated token (5-10 characters). Required. Python type: int; wire name: token_size; JSON type: integer. Constraints: minimum 5; maximum 10
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class InitiateResponse(ApiModel): 14 """Typed response returned by the initiate operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``InitiateOTPResponse``. 23 """ 24 transaction: OTPTransaction = field(init=False) 25 """OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: ``OTPTransaction``; wire name: ``transaction``; JSON type: object (OTPTransaction)"""
Typed response returned by the initiate operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: InitiateOTPResponse.
OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: OTPTransaction; wire name: transaction; JSON type: object (OTPTransaction)
12@dataclass(frozen=True, slots=True, kw_only=True) 13class LookupRequest(ApiRequest): 14 """Parameters accepted by the lookup request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``LookupOTPRequest``. 21 """ 22 transaction_id: str 23 """ID of the OTP transaction to lookup (with ot_ prefix). Required. Python type: ``str``; wire name: ``transaction_id``; JSON type: string"""
Parameters accepted by the lookup request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: LookupOTPRequest.
ID of the OTP transaction to lookup (with ot_ prefix). Required. Python type: str; wire name: transaction_id; JSON type: string
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class LookupResponse(ApiModel): 14 """Typed response returned by the lookup operation. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``LookupOTPResponse``. 23 """ 24 transaction: OTPTransaction = field(init=False) 25 """OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: ``OTPTransaction``; wire name: ``transaction``; JSON type: object (OTPTransaction)"""
Typed response returned by the lookup operation.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: LookupOTPResponse.
OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: OTPTransaction; wire name: transaction; JSON type: object (OTPTransaction)
11class Purpose(WireEnum): 12 """Customer action protected by an OTP.""" 13 14 ACCOUNT_CREATION = "account_creation" 15 """Wire value ``account_creation`` for a new-account verification flow.""" 16 ACCOUNT_RECOVERY = "account_recovery" 17 """Wire value ``account_recovery`` for an account-recovery flow.""" 18 EMAIL_VERIFICATION = "email_verification" 19 """Wire value ``email_verification`` for email ownership verification.""" 20 FINANCIAL_ACCOUNT_VERIFICATION = "financial_account_verification" 21 """Wire value ``financial_account_verification`` for financial-account verification.""" 22 PASSWORD_RESET = "password_reset" 23 """Wire value ``password_reset`` for a password-reset flow.""" 24 PAYMENT_CONFIRMATION = "payment_confirmation" 25 """Wire value ``payment_confirmation`` for payment confirmation.""" 26 PAYMENT_METHOD_VERIFICATION = "payment_method_verification" 27 """Wire value ``payment_method_verification`` for payment-method verification.""" 28 PAYOUT_CONFIRMATION = "payout_confirmation" 29 """Wire value ``payout_confirmation`` for payout confirmation.""" 30 PHONE_VERIFICATION = "phone_verification" 31 """Wire value ``phone_verification`` for phone ownership verification.""" 32 SENSITIVE_ACTION = "sensitive_action" 33 """Wire value ``sensitive_action`` for a sensitive account action.""" 34 SIGN_IN = "sign_in" 35 """Wire value ``sign_in`` for sign-in verification.""" 36 TRANSACTION_CONFIRMATION = "transaction_confirmation" 37 """Wire value ``transaction_confirmation`` for transaction confirmation.""" 38 UNSPECIFIED = "unspecified" 39 """Wire value ``unspecified`` when no narrower verification purpose applies."""
Customer action protected by an OTP.
Wire value account_creation for a new-account verification flow.
Wire value account_recovery for an account-recovery flow.
Wire value email_verification for email ownership verification.
Wire value financial_account_verification for financial-account verification.
Wire value password_reset for a password-reset flow.
Wire value payment_confirmation for payment confirmation.
Wire value payment_method_verification for payment-method verification.
Wire value payout_confirmation for payout confirmation.
Wire value phone_verification for phone ownership verification.
Wire value sensitive_action for a sensitive account action.
Wire value transaction_confirmation for transaction confirmation.
Wire value unspecified when no narrower verification purpose applies.
11class Status(WireEnum): 12 """Typed status data in the otp resource namespace. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``OTPStatus``. 18 """ 19 CANCELED = "canceled" 20 """Wire value ``canceled`` (canceled)""" 21 EXPIRED = "expired" 22 """Wire value ``expired`` (expired)""" 23 PENDING = "pending" 24 """Wire value ``pending`` (pending)""" 25 PENDING_DELIVERY = "pending_delivery" 26 """Wire value ``pending_delivery`` (pending delivery)""" 27 PENDING_VERIFICATION = "pending_verification" 28 """Wire value ``pending_verification`` (pending verification)""" 29 VERIFIED = "verified" 30 """Wire value ``verified`` (verified)"""
Typed status data in the otp resource namespace.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: OTPStatus.
Wire value pending_delivery (pending delivery)
Wire value pending_verification (pending verification)
14@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 15class Transaction(ApiModel): 16 """OTP transaction object returned by initiate, verify, and lookup endpoints. 17 18 Instances are immutable API responses. ``from_dict()`` decodes nested 19 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 20 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 21 Fields not returned by the API remain absent and can still be queried 22 through mapping-style access. 23 24 API contract schema: ``OTPTransaction``. 25 """ 26 cancel_reason: str | None = field(init=False) 27 """Omitted unless the transaction was canceled. Optional; nullable. Python type: ``str | None``; wire name: ``cancel_reason``; JSON type: string""" 28 canceled_at: datetime | None = field(init=False) 29 """Omitted unless the transaction was canceled. Optional; nullable. Python type: ``datetime | None``; wire name: ``canceled_at``; JSON type: string (date-time)""" 30 expires_at: datetime = field(init=False) 31 """Timestamp for expires at. Required. Python type: ``datetime``; wire name: ``expires_at``; JSON type: string (date-time)""" 32 full_message: str = field(init=False) 33 """Message text with the `{token}` placeholder preserved; no generated token is returned. Required. Python type: ``str``; wire name: ``full_message``; JSON type: string""" 34 id: str = field(init=False) 35 """Unique identifier with ot_ prefix. Required. Python type: ``str``; wire name: ``id``; JSON type: string""" 36 initiated_at: datetime = field(init=False) 37 """Timestamp for initiated at. Required. Python type: ``datetime``; wire name: ``initiated_at``; JSON type: string (date-time)""" 38 status: Literal['canceled', 'expired', 'pending', 'pending_delivery', 'pending_verification', 'verified'] = field(init=False) 39 """Current lifecycle status of the transaction. Required. Python type: ``Literal['canceled', 'expired', 'pending', 'pending_delivery', 'pending_verification', 'verified']``; wire name: ``status``; JSON type: string. Constraints: allowed values ``canceled``, ``expired``, ``pending``, ``pending_delivery``, ``pending_verification``, ``verified``""" 40 transmission: OTPTransmission | None = field(init=False) 41 """The transmission associated with this transaction. Optional; nullable. Python type: ``OTPTransmission | None``; wire name: ``transmission``; JSON type: object (OTPTransmission)"""
OTP transaction object returned by initiate, verify, and lookup endpoints.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: OTPTransaction.
Omitted unless the transaction was canceled. Optional; nullable. Python type: str | None; wire name: cancel_reason; JSON type: string
Omitted unless the transaction was canceled. Optional; nullable. Python type: datetime | None; wire name: canceled_at; JSON type: string (date-time)
Timestamp for expires at. Required. Python type: datetime; wire name: expires_at; JSON type: string (date-time)
Message text with the {token} placeholder preserved; no generated token is returned. Required. Python type: str; wire name: full_message; JSON type: string
Unique identifier with ot_ prefix. Required. Python type: str; wire name: id; JSON type: string
Timestamp for initiated at. Required. Python type: datetime; wire name: initiated_at; JSON type: string (date-time)
Current lifecycle status of the transaction. Required. Python type: Literal['canceled', 'expired', 'pending', 'pending_delivery', 'pending_verification', 'verified']; wire name: status; JSON type: string. Constraints: allowed values canceled, expired, pending, pending_delivery, pending_verification, verified
The transmission associated with this transaction. Optional; nullable. Python type: OTPTransmission | None; wire name: transmission; JSON type: object (OTPTransmission)
14@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 15class Transmission(ApiModel): 16 """Typed transmission data in the otp resource namespace. 17 18 Instances are immutable API responses. ``from_dict()`` decodes nested 19 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 20 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 21 Fields not returned by the API remain absent and can still be queried 22 through mapping-style access. 23 24 API contract schema: ``OTPTransmission``. 25 """ 26 recipient: str = field(init=False) 27 """The recipient associated with this transmission. Required. Python type: ``str``; wire name: ``recipient``; JSON type: string""" 28 sender_id: str = field(init=False) 29 """Identifier of the related sender. Required. Python type: ``str``; wire name: ``sender_id``; JSON type: string""" 30 sent_at: datetime | None = field(init=False) 31 """Timestamp for sent at. Optional; nullable. Python type: ``datetime | None``; wire name: ``sent_at``; JSON type: string (date-time)""" 32 sent_via: Literal['sms'] | None = field(init=False) 33 """The sent via associated with this transmission. Optional; nullable. Python type: ``Literal['sms'] | None``; wire name: ``sent_via``; JSON type: string. Constraints: allowed values ``sms``""" 34 status: Literal['delivered', 'failed', 'submitted'] | None = field(init=False) 35 """Current lifecycle status of the transmission. Optional; nullable. Python type: ``Literal['delivered', 'failed', 'submitted'] | None``; wire name: ``status``; JSON type: string. Constraints: allowed values ``delivered``, ``failed``, ``submitted``"""
Typed transmission data in the otp resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: OTPTransmission.
The recipient associated with this transmission. Required. Python type: str; wire name: recipient; JSON type: string
Identifier of the related sender. Required. Python type: str; wire name: sender_id; JSON type: string
Timestamp for sent at. Optional; nullable. Python type: datetime | None; wire name: sent_at; JSON type: string (date-time)
The sent via associated with this transmission. Optional; nullable. Python type: Literal['sms'] | None; wire name: sent_via; JSON type: string. Constraints: allowed values sms
Current lifecycle status of the transmission. Optional; nullable. Python type: Literal['delivered', 'failed', 'submitted'] | None; wire name: status; JSON type: string. Constraints: allowed values delivered, failed, submitted
11class TransmissionStatus(WireEnum): 12 """Typed transmission status data in the otp resource namespace. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``OTPTransmissionStatus``. 18 """ 19 DELIVERED = "delivered" 20 """Wire value ``delivered`` (delivered)""" 21 FAILED = "failed" 22 """Wire value ``failed`` (failed)""" 23 SUBMITTED = "submitted" 24 """Wire value ``submitted`` (submitted)"""
Typed transmission status data in the otp resource namespace.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: OTPTransmissionStatus.
12@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 13class Verification(ApiModel): 14 """Typed verification data in the otp resource namespace. 15 16 Instances are immutable API responses. ``from_dict()`` decodes nested 17 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 18 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 19 Fields not returned by the API remain absent and can still be queried 20 through mapping-style access. 21 22 API contract schema: ``OTPVerification``. 23 """ 24 transaction: OTPTransaction = field(init=False) 25 """OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: ``OTPTransaction``; wire name: ``transaction``; JSON type: object (OTPTransaction)""" 26 verification_attempt: OTPVerificationAttempt = field(init=False) 27 """Details of a verification attempt. Required. Python type: ``OTPVerificationAttempt``; wire name: ``verification_attempt``; JSON type: object (OTPVerificationAttempt)"""
Typed verification data in the otp resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: OTPVerification.
OTP transaction object returned by initiate, verify, and lookup endpoints. Required. Python type: OTPTransaction; wire name: transaction; JSON type: object (OTPTransaction)
Details of a verification attempt. Required. Python type: OTPVerificationAttempt; wire name: verification_attempt; JSON type: object (OTPVerificationAttempt)
13@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 14class VerificationAttempt(ApiModel): 15 """Details of a verification attempt. 16 17 Instances are immutable API responses. ``from_dict()`` decodes nested 18 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 19 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 20 Fields not returned by the API remain absent and can still be queried 21 through mapping-style access. 22 23 API contract schema: ``OTPVerificationAttempt``. 24 """ 25 attempted_at: datetime = field(init=False) 26 """Timestamp for attempted at. Required. Python type: ``datetime``; wire name: ``attempted_at``; JSON type: string (date-time)""" 27 id: str = field(init=False) 28 """Unique identifier for this verification attempt. Required. Python type: ``str``; wire name: ``id``; JSON type: string""" 29 presented_token: str = field(init=False) 30 """Token submitted for this verification attempt. Required. Python type: ``str``; wire name: ``presented_token``; JSON type: string""" 31 recipient: str = field(init=False) 32 """The recipient associated with this verification attempt. Required. Python type: ``str``; wire name: ``recipient``; JSON type: string""" 33 result: OTPVerificationAttemptResult = field(init=False) 34 """The result associated with this verification attempt. Required. Python type: ``OTPVerificationAttemptResult``; wire name: ``result``; JSON type: object"""
Details of a verification attempt.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: OTPVerificationAttempt.
Timestamp for attempted at. Required. Python type: datetime; wire name: attempted_at; JSON type: string (date-time)
Unique identifier for this verification attempt. Required. Python type: str; wire name: id; JSON type: string
Token submitted for this verification attempt. Required. Python type: str; wire name: presented_token; JSON type: string
The recipient associated with this verification attempt. Required. Python type: str; wire name: recipient; JSON type: string
The result associated with this verification attempt. Required. Python type: OTPVerificationAttemptResult; wire name: result; JSON type: object
13@dataclass(frozen=True, slots=True, init=False, repr=False, eq=False) 14class VerificationAttemptResult(ApiModel): 15 """Typed verification attempt result data in the otp resource namespace. 16 17 Instances are immutable API responses. ``from_dict()`` decodes nested 18 objects, string-backed enums, and timezone-aware ISO-8601 timestamps; 19 ``to_dict()`` returns the corresponding JSON-compatible wire shape. 20 Fields not returned by the API remain absent and can still be queried 21 through mapping-style access. 22 23 API contract schema: ``OTPVerificationAttemptResult``. 24 """ 25 detail: str | None = field(init=False) 26 """Omitted when no detail is available. Optional; nullable. Python type: ``str | None``; wire name: ``detail``; JSON type: string""" 27 verdict: Literal['fail', 'pass'] = field(init=False) 28 """The verdict associated with this verification attempt result. Required. Python type: ``Literal['fail', 'pass']``; wire name: ``verdict``; JSON type: string. Constraints: allowed values ``fail``, ``pass``"""
Typed verification attempt result data in the otp resource namespace.
Instances are immutable API responses. from_dict() decodes nested
objects, string-backed enums, and timezone-aware ISO-8601 timestamps;
to_dict() returns the corresponding JSON-compatible wire shape.
Fields not returned by the API remain absent and can still be queried
through mapping-style access.
API contract schema: OTPVerificationAttemptResult.
Omitted when no detail is available. Optional; nullable. Python type: str | None; wire name: detail; JSON type: string
The verdict associated with this verification attempt result. Required. Python type: Literal['fail', 'pass']; wire name: verdict; JSON type: string. Constraints: allowed values fail, pass
11class VerificationVerdict(WireEnum): 12 """Typed verification verdict data in the otp resource namespace. 13 14 Members are strings as well as enum values, so they compare naturally 15 with API payloads and serialize to the lowercase wire value shown below. 16 17 API contract schema: ``OTPVerificationVerdict``. 18 """ 19 FAIL = "fail" 20 """Wire value ``fail`` (fail)""" 21 PASS = "pass" 22 """Wire value ``pass`` (pass)"""
Typed verification verdict data in the otp resource namespace.
Members are strings as well as enum values, so they compare naturally with API payloads and serialize to the lowercase wire value shown below.
API contract schema: OTPVerificationVerdict.
12@dataclass(frozen=True, slots=True, kw_only=True) 13class VerifyRequest(ApiRequest): 14 """Parameters accepted by the verify request operation. 15 16 This is an immutable, keyword-only request object. ``to_dict()`` uses 17 the documented wire names, omits fields left as ``UNSET``, serializes 18 string-backed enums by value, and requires timezone-aware datetimes. 19 20 API contract schema: ``VerifyOTPRequest``. 21 """ 22 transaction_id: str 23 """ID of the OTP transaction to verify (with ot_ prefix). Required. Python type: ``str``; wire name: ``transaction_id``; JSON type: string""" 24 recipient: str 25 """Phone number that received the OTP. Required. Python type: ``str``; wire name: ``recipient``; JSON type: string""" 26 token: str 27 """OTP token submitted by the user. Required. Python type: ``str``; wire name: ``token``; JSON type: string"""
Parameters accepted by the verify request operation.
This is an immutable, keyword-only request object. to_dict() uses
the documented wire names, omits fields left as UNSET, serializes
string-backed enums by value, and requires timezone-aware datetimes.
API contract schema: VerifyOTPRequest.
ID of the OTP transaction to verify (with ot_ prefix). Required. Python type: str; wire name: transaction_id; JSON type: string
Phone number that received the OTP. Required. Python type: str; wire name: recipient; JSON type: string
OTP token submitted by the user. Required. Python type: str; wire name: token; JSON type: string