prelude-python-sdk 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- prelude_python_sdk/__init__.py +84 -0
- prelude_python_sdk/_base_client.py +2051 -0
- prelude_python_sdk/_client.py +413 -0
- prelude_python_sdk/_compat.py +219 -0
- prelude_python_sdk/_constants.py +14 -0
- prelude_python_sdk/_exceptions.py +108 -0
- prelude_python_sdk/_files.py +123 -0
- prelude_python_sdk/_models.py +795 -0
- prelude_python_sdk/_qs.py +150 -0
- prelude_python_sdk/_resource.py +43 -0
- prelude_python_sdk/_response.py +832 -0
- prelude_python_sdk/_streaming.py +333 -0
- prelude_python_sdk/_types.py +217 -0
- prelude_python_sdk/_utils/__init__.py +57 -0
- prelude_python_sdk/_utils/_logs.py +25 -0
- prelude_python_sdk/_utils/_proxy.py +62 -0
- prelude_python_sdk/_utils/_reflection.py +42 -0
- prelude_python_sdk/_utils/_streams.py +12 -0
- prelude_python_sdk/_utils/_sync.py +71 -0
- prelude_python_sdk/_utils/_transform.py +392 -0
- prelude_python_sdk/_utils/_typing.py +149 -0
- prelude_python_sdk/_utils/_utils.py +414 -0
- prelude_python_sdk/_version.py +4 -0
- prelude_python_sdk/lib/.keep +4 -0
- prelude_python_sdk/py.typed +0 -0
- prelude_python_sdk/resources/__init__.py +47 -0
- prelude_python_sdk/resources/transactional.py +244 -0
- prelude_python_sdk/resources/verification.py +319 -0
- prelude_python_sdk/resources/watch.py +297 -0
- prelude_python_sdk/types/__init__.py +14 -0
- prelude_python_sdk/types/transactional_send_params.py +41 -0
- prelude_python_sdk/types/transactional_send_response.py +39 -0
- prelude_python_sdk/types/verification_check_params.py +23 -0
- prelude_python_sdk/types/verification_check_response.py +25 -0
- prelude_python_sdk/types/verification_create_params.py +126 -0
- prelude_python_sdk/types/verification_create_response.py +28 -0
- prelude_python_sdk/types/watch_feed_back_params.py +34 -0
- prelude_python_sdk/types/watch_feed_back_response.py +11 -0
- prelude_python_sdk/types/watch_predict_params.py +44 -0
- prelude_python_sdk/types/watch_predict_response.py +29 -0
- prelude_python_sdk-0.1.0.dist-info/METADATA +398 -0
- prelude_python_sdk-0.1.0.dist-info/RECORD +44 -0
- prelude_python_sdk-0.1.0.dist-info/WHEEL +4 -0
- prelude_python_sdk-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import watch_predict_params, watch_feed_back_params
|
|
8
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
9
|
+
from .._utils import (
|
|
10
|
+
maybe_transform,
|
|
11
|
+
async_maybe_transform,
|
|
12
|
+
)
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from .._base_client import make_request_options
|
|
22
|
+
from ..types.watch_predict_response import WatchPredictResponse
|
|
23
|
+
from ..types.watch_feed_back_response import WatchFeedBackResponse
|
|
24
|
+
|
|
25
|
+
__all__ = ["WatchResource", "AsyncWatchResource"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class WatchResource(SyncAPIResource):
|
|
29
|
+
@cached_property
|
|
30
|
+
def with_raw_response(self) -> WatchResourceWithRawResponse:
|
|
31
|
+
"""
|
|
32
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
33
|
+
the raw response object instead of the parsed content.
|
|
34
|
+
|
|
35
|
+
For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
|
|
36
|
+
"""
|
|
37
|
+
return WatchResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> WatchResourceWithStreamingResponse:
|
|
41
|
+
"""
|
|
42
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
|
|
45
|
+
"""
|
|
46
|
+
return WatchResourceWithStreamingResponse(self)
|
|
47
|
+
|
|
48
|
+
def feed_back(
|
|
49
|
+
self,
|
|
50
|
+
*,
|
|
51
|
+
feedback: watch_feed_back_params.Feedback,
|
|
52
|
+
target: watch_feed_back_params.Target,
|
|
53
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
54
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
55
|
+
extra_headers: Headers | None = None,
|
|
56
|
+
extra_query: Query | None = None,
|
|
57
|
+
extra_body: Body | None = None,
|
|
58
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
59
|
+
) -> WatchFeedBackResponse:
|
|
60
|
+
"""
|
|
61
|
+
Once the user with a trustworthy phone number demonstrates authentic behavior,
|
|
62
|
+
call this endpoint to report their authenticity to our systems.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
feedback: You should send a feedback event back to Watch API when your user demonstrates
|
|
66
|
+
authentic behavior.
|
|
67
|
+
|
|
68
|
+
target: The target. Currently this can only be an E.164 formatted phone number.
|
|
69
|
+
|
|
70
|
+
extra_headers: Send extra headers
|
|
71
|
+
|
|
72
|
+
extra_query: Add additional query parameters to the request
|
|
73
|
+
|
|
74
|
+
extra_body: Add additional JSON properties to the request
|
|
75
|
+
|
|
76
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
77
|
+
"""
|
|
78
|
+
return self._post(
|
|
79
|
+
"/v2/watch/feedback",
|
|
80
|
+
body=maybe_transform(
|
|
81
|
+
{
|
|
82
|
+
"feedback": feedback,
|
|
83
|
+
"target": target,
|
|
84
|
+
},
|
|
85
|
+
watch_feed_back_params.WatchFeedBackParams,
|
|
86
|
+
),
|
|
87
|
+
options=make_request_options(
|
|
88
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
89
|
+
),
|
|
90
|
+
cast_to=WatchFeedBackResponse,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
def predict(
|
|
94
|
+
self,
|
|
95
|
+
*,
|
|
96
|
+
target: watch_predict_params.Target,
|
|
97
|
+
signals: watch_predict_params.Signals | NotGiven = NOT_GIVEN,
|
|
98
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
99
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
100
|
+
extra_headers: Headers | None = None,
|
|
101
|
+
extra_query: Query | None = None,
|
|
102
|
+
extra_body: Body | None = None,
|
|
103
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
104
|
+
) -> WatchPredictResponse:
|
|
105
|
+
"""
|
|
106
|
+
Identify trustworthy phone numbers to mitigate fake traffic or traffic involved
|
|
107
|
+
in fraud and international revenue share fraud (IRSF) patterns. This endpoint
|
|
108
|
+
must be implemented in conjunction with the `watch/feedback` endpoint.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
target: The target. Currently this can only be an E.164 formatted phone number.
|
|
112
|
+
|
|
113
|
+
signals: It is highly recommended that you provide the signals to increase prediction
|
|
114
|
+
performance.
|
|
115
|
+
|
|
116
|
+
extra_headers: Send extra headers
|
|
117
|
+
|
|
118
|
+
extra_query: Add additional query parameters to the request
|
|
119
|
+
|
|
120
|
+
extra_body: Add additional JSON properties to the request
|
|
121
|
+
|
|
122
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
|
+
"""
|
|
124
|
+
return self._post(
|
|
125
|
+
"/v2/watch/predict",
|
|
126
|
+
body=maybe_transform(
|
|
127
|
+
{
|
|
128
|
+
"target": target,
|
|
129
|
+
"signals": signals,
|
|
130
|
+
},
|
|
131
|
+
watch_predict_params.WatchPredictParams,
|
|
132
|
+
),
|
|
133
|
+
options=make_request_options(
|
|
134
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
135
|
+
),
|
|
136
|
+
cast_to=WatchPredictResponse,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AsyncWatchResource(AsyncAPIResource):
|
|
141
|
+
@cached_property
|
|
142
|
+
def with_raw_response(self) -> AsyncWatchResourceWithRawResponse:
|
|
143
|
+
"""
|
|
144
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
145
|
+
the raw response object instead of the parsed content.
|
|
146
|
+
|
|
147
|
+
For more information, see https://www.github.com/prelude-so/python-sdk#accessing-raw-response-data-eg-headers
|
|
148
|
+
"""
|
|
149
|
+
return AsyncWatchResourceWithRawResponse(self)
|
|
150
|
+
|
|
151
|
+
@cached_property
|
|
152
|
+
def with_streaming_response(self) -> AsyncWatchResourceWithStreamingResponse:
|
|
153
|
+
"""
|
|
154
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
155
|
+
|
|
156
|
+
For more information, see https://www.github.com/prelude-so/python-sdk#with_streaming_response
|
|
157
|
+
"""
|
|
158
|
+
return AsyncWatchResourceWithStreamingResponse(self)
|
|
159
|
+
|
|
160
|
+
async def feed_back(
|
|
161
|
+
self,
|
|
162
|
+
*,
|
|
163
|
+
feedback: watch_feed_back_params.Feedback,
|
|
164
|
+
target: watch_feed_back_params.Target,
|
|
165
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
166
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
167
|
+
extra_headers: Headers | None = None,
|
|
168
|
+
extra_query: Query | None = None,
|
|
169
|
+
extra_body: Body | None = None,
|
|
170
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
171
|
+
) -> WatchFeedBackResponse:
|
|
172
|
+
"""
|
|
173
|
+
Once the user with a trustworthy phone number demonstrates authentic behavior,
|
|
174
|
+
call this endpoint to report their authenticity to our systems.
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
feedback: You should send a feedback event back to Watch API when your user demonstrates
|
|
178
|
+
authentic behavior.
|
|
179
|
+
|
|
180
|
+
target: The target. Currently this can only be an E.164 formatted phone number.
|
|
181
|
+
|
|
182
|
+
extra_headers: Send extra headers
|
|
183
|
+
|
|
184
|
+
extra_query: Add additional query parameters to the request
|
|
185
|
+
|
|
186
|
+
extra_body: Add additional JSON properties to the request
|
|
187
|
+
|
|
188
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
189
|
+
"""
|
|
190
|
+
return await self._post(
|
|
191
|
+
"/v2/watch/feedback",
|
|
192
|
+
body=await async_maybe_transform(
|
|
193
|
+
{
|
|
194
|
+
"feedback": feedback,
|
|
195
|
+
"target": target,
|
|
196
|
+
},
|
|
197
|
+
watch_feed_back_params.WatchFeedBackParams,
|
|
198
|
+
),
|
|
199
|
+
options=make_request_options(
|
|
200
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
201
|
+
),
|
|
202
|
+
cast_to=WatchFeedBackResponse,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
async def predict(
|
|
206
|
+
self,
|
|
207
|
+
*,
|
|
208
|
+
target: watch_predict_params.Target,
|
|
209
|
+
signals: watch_predict_params.Signals | NotGiven = NOT_GIVEN,
|
|
210
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
211
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
212
|
+
extra_headers: Headers | None = None,
|
|
213
|
+
extra_query: Query | None = None,
|
|
214
|
+
extra_body: Body | None = None,
|
|
215
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
216
|
+
) -> WatchPredictResponse:
|
|
217
|
+
"""
|
|
218
|
+
Identify trustworthy phone numbers to mitigate fake traffic or traffic involved
|
|
219
|
+
in fraud and international revenue share fraud (IRSF) patterns. This endpoint
|
|
220
|
+
must be implemented in conjunction with the `watch/feedback` endpoint.
|
|
221
|
+
|
|
222
|
+
Args:
|
|
223
|
+
target: The target. Currently this can only be an E.164 formatted phone number.
|
|
224
|
+
|
|
225
|
+
signals: It is highly recommended that you provide the signals to increase prediction
|
|
226
|
+
performance.
|
|
227
|
+
|
|
228
|
+
extra_headers: Send extra headers
|
|
229
|
+
|
|
230
|
+
extra_query: Add additional query parameters to the request
|
|
231
|
+
|
|
232
|
+
extra_body: Add additional JSON properties to the request
|
|
233
|
+
|
|
234
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
235
|
+
"""
|
|
236
|
+
return await self._post(
|
|
237
|
+
"/v2/watch/predict",
|
|
238
|
+
body=await async_maybe_transform(
|
|
239
|
+
{
|
|
240
|
+
"target": target,
|
|
241
|
+
"signals": signals,
|
|
242
|
+
},
|
|
243
|
+
watch_predict_params.WatchPredictParams,
|
|
244
|
+
),
|
|
245
|
+
options=make_request_options(
|
|
246
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
247
|
+
),
|
|
248
|
+
cast_to=WatchPredictResponse,
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class WatchResourceWithRawResponse:
|
|
253
|
+
def __init__(self, watch: WatchResource) -> None:
|
|
254
|
+
self._watch = watch
|
|
255
|
+
|
|
256
|
+
self.feed_back = to_raw_response_wrapper(
|
|
257
|
+
watch.feed_back,
|
|
258
|
+
)
|
|
259
|
+
self.predict = to_raw_response_wrapper(
|
|
260
|
+
watch.predict,
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class AsyncWatchResourceWithRawResponse:
|
|
265
|
+
def __init__(self, watch: AsyncWatchResource) -> None:
|
|
266
|
+
self._watch = watch
|
|
267
|
+
|
|
268
|
+
self.feed_back = async_to_raw_response_wrapper(
|
|
269
|
+
watch.feed_back,
|
|
270
|
+
)
|
|
271
|
+
self.predict = async_to_raw_response_wrapper(
|
|
272
|
+
watch.predict,
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
class WatchResourceWithStreamingResponse:
|
|
277
|
+
def __init__(self, watch: WatchResource) -> None:
|
|
278
|
+
self._watch = watch
|
|
279
|
+
|
|
280
|
+
self.feed_back = to_streamed_response_wrapper(
|
|
281
|
+
watch.feed_back,
|
|
282
|
+
)
|
|
283
|
+
self.predict = to_streamed_response_wrapper(
|
|
284
|
+
watch.predict,
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class AsyncWatchResourceWithStreamingResponse:
|
|
289
|
+
def __init__(self, watch: AsyncWatchResource) -> None:
|
|
290
|
+
self._watch = watch
|
|
291
|
+
|
|
292
|
+
self.feed_back = async_to_streamed_response_wrapper(
|
|
293
|
+
watch.feed_back,
|
|
294
|
+
)
|
|
295
|
+
self.predict = async_to_streamed_response_wrapper(
|
|
296
|
+
watch.predict,
|
|
297
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .watch_predict_params import WatchPredictParams as WatchPredictParams
|
|
6
|
+
from .watch_feed_back_params import WatchFeedBackParams as WatchFeedBackParams
|
|
7
|
+
from .watch_predict_response import WatchPredictResponse as WatchPredictResponse
|
|
8
|
+
from .watch_feed_back_response import WatchFeedBackResponse as WatchFeedBackResponse
|
|
9
|
+
from .transactional_send_params import TransactionalSendParams as TransactionalSendParams
|
|
10
|
+
from .verification_check_params import VerificationCheckParams as VerificationCheckParams
|
|
11
|
+
from .verification_create_params import VerificationCreateParams as VerificationCreateParams
|
|
12
|
+
from .transactional_send_response import TransactionalSendResponse as TransactionalSendResponse
|
|
13
|
+
from .verification_check_response import VerificationCheckResponse as VerificationCheckResponse
|
|
14
|
+
from .verification_create_response import VerificationCreateResponse as VerificationCreateResponse
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict
|
|
6
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
7
|
+
|
|
8
|
+
from .._utils import PropertyInfo
|
|
9
|
+
|
|
10
|
+
__all__ = ["TransactionalSendParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TransactionalSendParams(TypedDict, total=False):
|
|
14
|
+
template_id: Required[str]
|
|
15
|
+
"""The template identifier."""
|
|
16
|
+
|
|
17
|
+
to: Required[str]
|
|
18
|
+
"""The recipient's phone number."""
|
|
19
|
+
|
|
20
|
+
callback_url: str
|
|
21
|
+
"""The callback URL."""
|
|
22
|
+
|
|
23
|
+
correlation_id: str
|
|
24
|
+
"""A unique, user-defined identifier that will be included in webhook events."""
|
|
25
|
+
|
|
26
|
+
expires_at: str
|
|
27
|
+
"""The message expiration date."""
|
|
28
|
+
|
|
29
|
+
from_: Annotated[str, PropertyInfo(alias="from")]
|
|
30
|
+
"""The Sender ID."""
|
|
31
|
+
|
|
32
|
+
locale: str
|
|
33
|
+
"""
|
|
34
|
+
A BCP-47 formatted locale string with the language the text message will be sent
|
|
35
|
+
to. If there's no locale set, the language will be determined by the country
|
|
36
|
+
code of the phone number. If the language specified doesn't exist, the default
|
|
37
|
+
set on the template will be used.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
variables: Dict[str, str]
|
|
41
|
+
"""The variables to be replaced in the template."""
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
|
|
10
|
+
__all__ = ["TransactionalSendResponse"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TransactionalSendResponse(BaseModel):
|
|
14
|
+
id: str
|
|
15
|
+
"""The message identifier."""
|
|
16
|
+
|
|
17
|
+
created_at: datetime
|
|
18
|
+
"""The message creation date."""
|
|
19
|
+
|
|
20
|
+
expires_at: datetime
|
|
21
|
+
"""The message expiration date."""
|
|
22
|
+
|
|
23
|
+
template_id: str
|
|
24
|
+
"""The template identifier."""
|
|
25
|
+
|
|
26
|
+
to: str
|
|
27
|
+
"""The recipient's phone number."""
|
|
28
|
+
|
|
29
|
+
variables: Dict[str, str]
|
|
30
|
+
"""The variables to be replaced in the template."""
|
|
31
|
+
|
|
32
|
+
callback_url: Optional[str] = None
|
|
33
|
+
"""The callback URL."""
|
|
34
|
+
|
|
35
|
+
correlation_id: Optional[str] = None
|
|
36
|
+
"""A unique, user-defined identifier that will be included in webhook events."""
|
|
37
|
+
|
|
38
|
+
from_: Optional[str] = FieldInfo(alias="from", default=None)
|
|
39
|
+
"""The Sender ID."""
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["VerificationCheckParams", "Target"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VerificationCheckParams(TypedDict, total=False):
|
|
11
|
+
code: Required[str]
|
|
12
|
+
"""The OTP code to validate."""
|
|
13
|
+
|
|
14
|
+
target: Required[Target]
|
|
15
|
+
"""The target. Currently this can only be an E.164 formatted phone number."""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Target(TypedDict, total=False):
|
|
19
|
+
type: Required[Literal["phone_number"]]
|
|
20
|
+
"""The type of the target. Currently this can only be "phone_number"."""
|
|
21
|
+
|
|
22
|
+
value: Required[str]
|
|
23
|
+
"""An E.164 formatted phone number to verify."""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["VerificationCheckResponse", "Metadata"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Metadata(BaseModel):
|
|
12
|
+
correlation_id: Optional[str] = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class VerificationCheckResponse(BaseModel):
|
|
16
|
+
status: Literal["success", "failure", "expired_or_not_found"]
|
|
17
|
+
"""The status of the check."""
|
|
18
|
+
|
|
19
|
+
id: Optional[str] = None
|
|
20
|
+
"""The verification identifier."""
|
|
21
|
+
|
|
22
|
+
metadata: Optional[Metadata] = None
|
|
23
|
+
"""The metadata for this verification."""
|
|
24
|
+
|
|
25
|
+
request_id: Optional[str] = None
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["VerificationCreateParams", "Target", "Metadata", "Options", "OptionsAppRealm", "Signals"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VerificationCreateParams(TypedDict, total=False):
|
|
11
|
+
target: Required[Target]
|
|
12
|
+
"""The target. Currently this can only be an E.164 formatted phone number."""
|
|
13
|
+
|
|
14
|
+
dispatch_id: str
|
|
15
|
+
"""The identifier of the dispatch that came from the front-end SDK."""
|
|
16
|
+
|
|
17
|
+
metadata: Metadata
|
|
18
|
+
"""The metadata for this verification.
|
|
19
|
+
|
|
20
|
+
This object will be returned with every response or webhook sent that refers to
|
|
21
|
+
this verification.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
options: Options
|
|
25
|
+
"""Verification options"""
|
|
26
|
+
|
|
27
|
+
signals: Signals
|
|
28
|
+
"""The signals used for anti-fraud."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Target(TypedDict, total=False):
|
|
32
|
+
type: Required[Literal["phone_number"]]
|
|
33
|
+
"""The type of the target. Currently this can only be "phone_number"."""
|
|
34
|
+
|
|
35
|
+
value: Required[str]
|
|
36
|
+
"""An E.164 formatted phone number to verify."""
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Metadata(TypedDict, total=False):
|
|
40
|
+
correlation_id: str
|
|
41
|
+
"""A user-defined identifier to correlate this verification with."""
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class OptionsAppRealm(TypedDict, total=False):
|
|
45
|
+
platform: Required[Literal["android"]]
|
|
46
|
+
"""The platform the SMS will be sent to.
|
|
47
|
+
|
|
48
|
+
We are currently only supporting "android".
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
value: Required[str]
|
|
52
|
+
"""The Android SMS Retriever API hash code that identifies your app."""
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Options(TypedDict, total=False):
|
|
56
|
+
app_realm: OptionsAppRealm
|
|
57
|
+
"""This allows you to automatically retrieve and fill the OTP code on mobile apps.
|
|
58
|
+
|
|
59
|
+
Currently only Android devices are supported.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
code_size: int
|
|
63
|
+
"""The size of the code generated.
|
|
64
|
+
|
|
65
|
+
It should be between 4 and 8. Defaults to the code size specified from the
|
|
66
|
+
Dashboard.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
custom_code: str
|
|
70
|
+
"""The custom code to use for OTP verification.
|
|
71
|
+
|
|
72
|
+
This feature is only available for compatibility purposes and subject to
|
|
73
|
+
Prelude’s approval. Contact us to discuss your use case. For more details, refer
|
|
74
|
+
to [Multi Routing](/concepts/multi-routing).
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
locale: str
|
|
78
|
+
"""
|
|
79
|
+
A BCP-47 formatted locale string with the language the text message will be sent
|
|
80
|
+
to. If there's no locale set, the language will be determined by the country
|
|
81
|
+
code of the phone number. If the language specified doesn't exist, it defaults
|
|
82
|
+
to US English.
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
sender_id: str
|
|
86
|
+
"""The Sender ID to use for this message.
|
|
87
|
+
|
|
88
|
+
The Sender ID needs to be enabled by Prelude.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
template_id: str
|
|
92
|
+
"""The identifier of a verification settings template.
|
|
93
|
+
|
|
94
|
+
It is used to be able to switch behavior for specific use cases. Contact us if
|
|
95
|
+
you need to use this functionality.
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class Signals(TypedDict, total=False):
|
|
100
|
+
app_version: str
|
|
101
|
+
"""The version of your application."""
|
|
102
|
+
|
|
103
|
+
device_id: str
|
|
104
|
+
"""The unique identifier for the user's device.
|
|
105
|
+
|
|
106
|
+
For Android, this corresponds to the `ANDROID_ID` and for iOS, this corresponds
|
|
107
|
+
to the `identifierForVendor`.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
device_model: str
|
|
111
|
+
"""The model of the user's device."""
|
|
112
|
+
|
|
113
|
+
device_platform: Literal["android", "ios", "ipados", "tvos", "web"]
|
|
114
|
+
"""The type of the user's device."""
|
|
115
|
+
|
|
116
|
+
ip: str
|
|
117
|
+
"""The IP address of the user's device."""
|
|
118
|
+
|
|
119
|
+
is_trusted_user: bool
|
|
120
|
+
"""
|
|
121
|
+
This signal should provide a higher level of trust, indicating that the user is
|
|
122
|
+
genuine. For more details, refer to [Signals](/guides/prevent-fraud#signals).
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
os_version: str
|
|
126
|
+
"""The version of the user's device operating system."""
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["VerificationCreateResponse", "Metadata"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Metadata(BaseModel):
|
|
12
|
+
correlation_id: Optional[str] = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class VerificationCreateResponse(BaseModel):
|
|
16
|
+
id: str
|
|
17
|
+
"""The verification identifier."""
|
|
18
|
+
|
|
19
|
+
method: Literal["message"]
|
|
20
|
+
"""The method used for verifying this phone number."""
|
|
21
|
+
|
|
22
|
+
status: Literal["success", "retry", "blocked"]
|
|
23
|
+
"""The status of the verification."""
|
|
24
|
+
|
|
25
|
+
metadata: Optional[Metadata] = None
|
|
26
|
+
"""The metadata for this verification."""
|
|
27
|
+
|
|
28
|
+
request_id: Optional[str] = None
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["WatchFeedBackParams", "Feedback", "Target"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WatchFeedBackParams(TypedDict, total=False):
|
|
11
|
+
feedback: Required[Feedback]
|
|
12
|
+
"""
|
|
13
|
+
You should send a feedback event back to Watch API when your user demonstrates
|
|
14
|
+
authentic behavior.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
target: Required[Target]
|
|
18
|
+
"""The target. Currently this can only be an E.164 formatted phone number."""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Feedback(TypedDict, total=False):
|
|
22
|
+
type: Required[Literal["CONFIRM_TARGET"]]
|
|
23
|
+
"""
|
|
24
|
+
`CONFIRM_TARGET` should be sent when you are sure that the user with this target
|
|
25
|
+
(e.g. phone number) is trustworthy.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Target(TypedDict, total=False):
|
|
30
|
+
type: Required[Literal["phone_number"]]
|
|
31
|
+
"""The type of the target. Currently this can only be "phone_number"."""
|
|
32
|
+
|
|
33
|
+
value: Required[str]
|
|
34
|
+
"""An E.164 formatted phone number to verify."""
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
from .._models import BaseModel
|
|
5
|
+
|
|
6
|
+
__all__ = ["WatchFeedBackResponse"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WatchFeedBackResponse(BaseModel):
|
|
10
|
+
id: str
|
|
11
|
+
"""A unique identifier for your feedback request."""
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["WatchPredictParams", "Target", "Signals"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WatchPredictParams(TypedDict, total=False):
|
|
11
|
+
target: Required[Target]
|
|
12
|
+
"""The target. Currently this can only be an E.164 formatted phone number."""
|
|
13
|
+
|
|
14
|
+
signals: Signals
|
|
15
|
+
"""
|
|
16
|
+
It is highly recommended that you provide the signals to increase prediction
|
|
17
|
+
performance.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Target(TypedDict, total=False):
|
|
22
|
+
type: Required[Literal["phone_number"]]
|
|
23
|
+
"""The type of the target. Currently this can only be "phone_number"."""
|
|
24
|
+
|
|
25
|
+
value: Required[str]
|
|
26
|
+
"""An E.164 formatted phone number to verify."""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Signals(TypedDict, total=False):
|
|
30
|
+
device_id: str
|
|
31
|
+
"""The unique identifier for the user's device.
|
|
32
|
+
|
|
33
|
+
For Android, this corresponds to the `ANDROID_ID` and for iOS, this corresponds
|
|
34
|
+
to the `identifierForVendor`.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
device_model: str
|
|
38
|
+
"""The model of the user's device."""
|
|
39
|
+
|
|
40
|
+
device_type: str
|
|
41
|
+
"""The type of the user's device."""
|
|
42
|
+
|
|
43
|
+
ip: str
|
|
44
|
+
"""The IPv4 address of the user's device"""
|