Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 5
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-ba7ca51ae8c674c16740d0254504bc208d0c3ea5f9970e347e49e70a22dd9072.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/prelude%2Fprelude-ca3f4103971d8bfdb9ea7c345b6112409a62e183460acd29da40a155192d2213.yml
14 changes: 0 additions & 14 deletions src/prelude_python_sdk/resources/transactional.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def send(
correlation_id: str | NotGiven = NOT_GIVEN,
expires_at: str | NotGiven = NOT_GIVEN,
from_: str | NotGiven = NOT_GIVEN,
locale: str | NotGiven = NOT_GIVEN,
variables: Dict[str, str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -80,11 +79,6 @@ def send(

from_: The Sender ID.

locale: A BCP-47 formatted locale string with the language the text message will be sent
to. If there's no locale set, the language will be determined by the country
code of the phone number. If the language specified doesn't exist, the default
set on the template will be used.

variables: The variables to be replaced in the template.

extra_headers: Send extra headers
Expand All @@ -105,7 +99,6 @@ def send(
"correlation_id": correlation_id,
"expires_at": expires_at,
"from_": from_,
"locale": locale,
"variables": variables,
},
transactional_send_params.TransactionalSendParams,
Expand Down Expand Up @@ -146,7 +139,6 @@ async def send(
correlation_id: str | NotGiven = NOT_GIVEN,
expires_at: str | NotGiven = NOT_GIVEN,
from_: str | NotGiven = NOT_GIVEN,
locale: str | NotGiven = NOT_GIVEN,
variables: Dict[str, str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -171,11 +163,6 @@ async def send(

from_: The Sender ID.

locale: A BCP-47 formatted locale string with the language the text message will be sent
to. If there's no locale set, the language will be determined by the country
code of the phone number. If the language specified doesn't exist, the default
set on the template will be used.

variables: The variables to be replaced in the template.

extra_headers: Send extra headers
Expand All @@ -196,7 +183,6 @@ async def send(
"correlation_id": correlation_id,
"expires_at": expires_at,
"from_": from_,
"locale": locale,
"variables": variables,
},
transactional_send_params.TransactionalSendParams,
Expand Down
8 changes: 0 additions & 8 deletions src/prelude_python_sdk/resources/verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def create(
self,
*,
target: verification_create_params.Target,
dispatch_id: str | NotGiven = NOT_GIVEN,
metadata: verification_create_params.Metadata | NotGiven = NOT_GIVEN,
options: verification_create_params.Options | NotGiven = NOT_GIVEN,
signals: verification_create_params.Signals | NotGiven = NOT_GIVEN,
Expand All @@ -69,8 +68,6 @@ def create(
Args:
target: The target. Currently this can only be an E.164 formatted phone number.

dispatch_id: The identifier of the dispatch that came from the front-end SDK.

metadata: The metadata for this verification. This object will be returned with every
response or webhook sent that refers to this verification.

Expand All @@ -91,7 +88,6 @@ def create(
body=maybe_transform(
{
"target": target,
"dispatch_id": dispatch_id,
"metadata": metadata,
"options": options,
"signals": signals,
Expand Down Expand Up @@ -172,7 +168,6 @@ async def create(
self,
*,
target: verification_create_params.Target,
dispatch_id: str | NotGiven = NOT_GIVEN,
metadata: verification_create_params.Metadata | NotGiven = NOT_GIVEN,
options: verification_create_params.Options | NotGiven = NOT_GIVEN,
signals: verification_create_params.Signals | NotGiven = NOT_GIVEN,
Expand All @@ -192,8 +187,6 @@ async def create(
Args:
target: The target. Currently this can only be an E.164 formatted phone number.

dispatch_id: The identifier of the dispatch that came from the front-end SDK.

metadata: The metadata for this verification. This object will be returned with every
response or webhook sent that refers to this verification.

Expand All @@ -214,7 +207,6 @@ async def create(
body=await async_maybe_transform(
{
"target": target,
"dispatch_id": dispatch_id,
"metadata": metadata,
"options": options,
"signals": signals,
Expand Down
8 changes: 0 additions & 8 deletions src/prelude_python_sdk/types/transactional_send_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,5 @@ class TransactionalSendParams(TypedDict, total=False):
from_: Annotated[str, PropertyInfo(alias="from")]
"""The Sender ID."""

locale: str
"""
A BCP-47 formatted locale string with the language the text message will be sent
to. If there's no locale set, the language will be determined by the country
code of the phone number. If the language specified doesn't exist, the default
set on the template will be used.
"""

variables: Dict[str, str]
"""The variables to be replaced in the template."""
6 changes: 3 additions & 3 deletions src/prelude_python_sdk/types/verification_check_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Metadata(BaseModel):


class VerificationCheckResponse(BaseModel):
status: Literal["success", "failure", "expired_or_not_found"]
"""The status of the check."""

id: Optional[str] = None
"""The verification identifier."""

metadata: Optional[Metadata] = None
"""The metadata for this verification."""

request_id: Optional[str] = None

status: Optional[Literal["success", "failure", "expired"]] = None
"""The status of the check."""
42 changes: 7 additions & 35 deletions src/prelude_python_sdk/types/verification_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@

from typing_extensions import Literal, Required, TypedDict

__all__ = ["VerificationCreateParams", "Target", "Metadata", "Options", "OptionsAppRealm", "Signals"]
__all__ = ["VerificationCreateParams", "Target", "Metadata", "Options", "Signals"]


class VerificationCreateParams(TypedDict, total=False):
target: Required[Target]
"""The target. Currently this can only be an E.164 formatted phone number."""

dispatch_id: str
"""The identifier of the dispatch that came from the front-end SDK."""

metadata: Metadata
"""The metadata for this verification.

Expand Down Expand Up @@ -41,37 +38,12 @@ class Metadata(TypedDict, total=False):
"""A user-defined identifier to correlate this verification with."""


class OptionsAppRealm(TypedDict, total=False):
platform: Required[Literal["android"]]
"""The platform the SMS will be sent to.

We are currently only supporting "android".
"""

value: Required[str]
"""The Android SMS Retriever API hash code that identifies your app."""


class Options(TypedDict, total=False):
app_realm: OptionsAppRealm
"""This allows you to automatically retrieve and fill the OTP code on mobile apps.

Currently only Android devices are supported.
"""

code_size: int
"""The size of the code generated.

It should be between 4 and 8. Defaults to the code size specified from the
Dashboard.
"""

custom_code: str
"""The custom code to use for OTP verification.
app_realm: str
"""The Android SMS Retriever API hash code that identifies your app.

This feature is only available for compatibility purposes and subject to
Prelude’s approval. Contact us to discuss your use case. For more details, refer
to [Multi Routing](/concepts/multi-routing).
This allows you to automatically retrieve and fill the OTP code on Android
devices.
"""

locale: str
Expand Down Expand Up @@ -110,13 +82,13 @@ class Signals(TypedDict, total=False):
device_model: str
"""The model of the user's device."""

device_platform: Literal["android", "ios", "ipados", "tvos", "web"]
device_platform: Literal["android", "ios", "web"]
"""The type of the user's device."""

ip: str
"""The IP address of the user's device."""

is_trusted_user: bool
is_trusted_user: str
"""
This signal should provide a higher level of trust, indicating that the user is
genuine. For more details, refer to [Signals](/guides/prevent-fraud#signals).
Expand Down
14 changes: 7 additions & 7 deletions src/prelude_python_sdk/types/verification_create_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class Metadata(BaseModel):


class VerificationCreateResponse(BaseModel):
id: str
id: Optional[str] = None
"""The verification identifier."""

method: Literal["message"]
"""The method used for verifying this phone number."""

status: Literal["success", "retry", "blocked"]
"""The status of the verification."""

metadata: Optional[Metadata] = None
"""The metadata for this verification."""

method: Optional[Literal["message"]] = None
"""The method used for verifying this phone number."""

request_id: Optional[str] = None

status: Optional[Literal["success", "retry", "blocked"]] = None
"""The status of the verification."""
3 changes: 2 additions & 1 deletion src/prelude_python_sdk/types/watch_feed_back_response.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional

from .._models import BaseModel

__all__ = ["WatchFeedBackResponse"]


class WatchFeedBackResponse(BaseModel):
id: str
id: Optional[str] = None
"""A unique identifier for your feedback request."""
6 changes: 3 additions & 3 deletions src/prelude_python_sdk/types/watch_predict_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class Reasoning(BaseModel):


class WatchPredictResponse(BaseModel):
id: str
id: Optional[str] = None
"""A unique identifier for your prediction request."""

prediction: Literal["allow", "block"]
prediction: Optional[Literal["allow", "block"]] = None
"""A label indicating the trustworthiness of the phone number."""

reasoning: Reasoning
reasoning: Optional[Reasoning] = None
38 changes: 18 additions & 20 deletions tests/api_resources/test_transactional.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class TestTransactional:
@parametrize
def test_method_send(self, client: Prelude) -> None:
transactional = client.transactional.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
)
assert_matches_type(TransactionalSendResponse, transactional, path=["response"])

Expand All @@ -34,14 +34,13 @@ def test_method_send(self, client: Prelude) -> None:
@parametrize
def test_method_send_with_all_params(self, client: Prelude) -> None:
transactional = client.transactional.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
callback_url="callback_url",
correlation_id="correlation_id",
expires_at="expires_at",
from_="from",
locale="el-GR",
variables={"foo": "bar"},
variables={"foo": "string"},
)
assert_matches_type(TransactionalSendResponse, transactional, path=["response"])

Expand All @@ -51,8 +50,8 @@ def test_method_send_with_all_params(self, client: Prelude) -> None:
@parametrize
def test_raw_response_send(self, client: Prelude) -> None:
response = client.transactional.with_raw_response.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
)

assert response.is_closed is True
Expand All @@ -66,8 +65,8 @@ def test_raw_response_send(self, client: Prelude) -> None:
@parametrize
def test_streaming_response_send(self, client: Prelude) -> None:
with client.transactional.with_streaming_response.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -87,8 +86,8 @@ class TestAsyncTransactional:
@parametrize
async def test_method_send(self, async_client: AsyncPrelude) -> None:
transactional = await async_client.transactional.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
)
assert_matches_type(TransactionalSendResponse, transactional, path=["response"])

Expand All @@ -98,14 +97,13 @@ async def test_method_send(self, async_client: AsyncPrelude) -> None:
@parametrize
async def test_method_send_with_all_params(self, async_client: AsyncPrelude) -> None:
transactional = await async_client.transactional.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
callback_url="callback_url",
correlation_id="correlation_id",
expires_at="expires_at",
from_="from",
locale="el-GR",
variables={"foo": "bar"},
variables={"foo": "string"},
)
assert_matches_type(TransactionalSendResponse, transactional, path=["response"])

Expand All @@ -115,8 +113,8 @@ async def test_method_send_with_all_params(self, async_client: AsyncPrelude) ->
@parametrize
async def test_raw_response_send(self, async_client: AsyncPrelude) -> None:
response = await async_client.transactional.with_raw_response.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
)

assert response.is_closed is True
Expand All @@ -130,8 +128,8 @@ async def test_raw_response_send(self, async_client: AsyncPrelude) -> None:
@parametrize
async def test_streaming_response_send(self, async_client: AsyncPrelude) -> None:
async with async_client.transactional.with_streaming_response.send(
template_id="template_01jd1xq0cffycayqtdkdbv4d61",
to="+30123456789",
template_id="template_id",
to="to",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down
Loading