Make otp type also selectable in the totp endpoint (#4529)

This commit is contained in:
Shuchang Zheng
2026-01-23 00:39:07 -08:00
committed by GitHub
parent e361edce8f
commit 965ff7c0b8
4 changed files with 30 additions and 12 deletions

View File

@@ -47,6 +47,11 @@ class TOTPCodeBase(BaseModel):
)
class OTPType(StrEnum):
TOTP = "totp"
MAGIC_LINK = "magic_link"
class TOTPCodeCreate(TOTPCodeBase):
totp_identifier: str = Field(
...,
@@ -58,6 +63,11 @@ class TOTPCodeCreate(TOTPCodeBase):
description="The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content.",
examples=["Hello, your verification code is 123456"],
)
type: OTPType | None = Field(
default=None,
description="Optional. If provided, forces extraction of this specific OTP type (totp or magic_link). Use this when the content contains multiple OTP types and you want to specify which one to extract.",
examples=["totp", "magic_link"],
)
@field_validator("content")
@classmethod
@@ -66,11 +76,6 @@ class TOTPCodeCreate(TOTPCodeBase):
return sanitize_postgres_text(value)
class OTPType(StrEnum):
TOTP = "totp"
MAGIC_LINK = "magic_link"
class TOTPCode(TOTPCodeCreate):
totp_code_id: str = Field(..., description="The skyvern ID of the TOTP code.")
code: str = Field(..., description="The TOTP code extracted from the content.")