truagents 0.0.0.dev0__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.
- truagents/__init__.py +18 -0
- truagents/__version__.py +1 -0
- truagents/auth.py +293 -0
- truagents/client.py +304 -0
- truagents/errors.py +193 -0
- truagents/generated/__init__.py +8 -0
- truagents/generated/api/__init__.py +1 -0
- truagents/generated/api/email_unsubscribe/__init__.py +1 -0
- truagents/generated/api/email_unsubscribe/list_email_unsubscribes.py +290 -0
- truagents/generated/api/email_unsubscribe/push_email_unsubscribes.py +236 -0
- truagents/generated/api/o_auth/__init__.py +1 -0
- truagents/generated/api/o_auth/issue_o_auth_token.py +241 -0
- truagents/generated/api/sms_unsubscribe/__init__.py +1 -0
- truagents/generated/api/sms_unsubscribe/list_sms_unsubscribes.py +290 -0
- truagents/generated/api/sms_unsubscribe/push_sms_unsubscribes.py +232 -0
- truagents/generated/api/voice_unsubscribe/__init__.py +1 -0
- truagents/generated/api/voice_unsubscribe/list_phone_unsubscribes.py +298 -0
- truagents/generated/api/voice_unsubscribe/push_phone_unsubscribes.py +232 -0
- truagents/generated/client.py +282 -0
- truagents/generated/errors.py +16 -0
- truagents/generated/models/__init__.py +65 -0
- truagents/generated/models/email_skipped_item.py +83 -0
- truagents/generated/models/email_skipped_item_reason.py +11 -0
- truagents/generated/models/email_source_enum.py +11 -0
- truagents/generated/models/email_unsubscribe_batch_request.py +93 -0
- truagents/generated/models/email_unsubscribe_batch_response.py +119 -0
- truagents/generated/models/email_unsubscribe_item.py +50 -0
- truagents/generated/models/email_unsubscribe_list_response.py +113 -0
- truagents/generated/models/email_unsubscribe_record.py +98 -0
- truagents/generated/models/email_unsubscribe_updated_entry.py +79 -0
- truagents/generated/models/o_auth_client_credentials_request.py +87 -0
- truagents/generated/models/o_auth_client_credentials_request_grant_type.py +8 -0
- truagents/generated/models/o_auth_error_response.py +83 -0
- truagents/generated/models/o_auth_error_response_error.py +11 -0
- truagents/generated/models/o_auth_refresh_token_request.py +75 -0
- truagents/generated/models/o_auth_refresh_token_request_grant_type.py +8 -0
- truagents/generated/models/o_auth_token_response.py +97 -0
- truagents/generated/models/o_auth_token_response_token_type.py +8 -0
- truagents/generated/models/phone_skipped_item.py +83 -0
- truagents/generated/models/phone_skipped_item_reason.py +11 -0
- truagents/generated/models/phone_source_enum.py +11 -0
- truagents/generated/models/phone_unsubscribe_batch_request.py +92 -0
- truagents/generated/models/phone_unsubscribe_batch_response.py +118 -0
- truagents/generated/models/phone_unsubscribe_item.py +51 -0
- truagents/generated/models/phone_unsubscribe_list_response.py +111 -0
- truagents/generated/models/phone_unsubscribe_record.py +99 -0
- truagents/generated/models/phone_unsubscribe_updated_entry.py +79 -0
- truagents/generated/models/rest_error_response.py +74 -0
- truagents/generated/models/unauthorized_organization_error.py +90 -0
- truagents/generated/models/unauthorized_organization_error_error.py +8 -0
- truagents/generated/types.py +54 -0
- truagents/observability.py +70 -0
- truagents/retry.py +64 -0
- truagents-0.0.0.dev0.dist-info/METADATA +171 -0
- truagents-0.0.0.dev0.dist-info/RECORD +56 -0
- truagents-0.0.0.dev0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from http import HTTPStatus
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.phone_unsubscribe_list_response import PhoneUnsubscribeListResponse
|
|
10
|
+
from ...models.rest_error_response import RestErrorResponse
|
|
11
|
+
from ...models.unauthorized_organization_error import UnauthorizedOrganizationError
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
org_slug: str | Unset = UNSET,
|
|
18
|
+
since: datetime.datetime | Unset = UNSET,
|
|
19
|
+
until: datetime.datetime | Unset = UNSET,
|
|
20
|
+
cursor: str | Unset = UNSET,
|
|
21
|
+
limit: int | Unset = 100,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
|
|
24
|
+
params: dict[str, Any] = {}
|
|
25
|
+
|
|
26
|
+
params["org_slug"] = org_slug
|
|
27
|
+
|
|
28
|
+
json_since: str | Unset = UNSET
|
|
29
|
+
if not isinstance(since, Unset):
|
|
30
|
+
json_since = since.isoformat()
|
|
31
|
+
params["since"] = json_since
|
|
32
|
+
|
|
33
|
+
json_until: str | Unset = UNSET
|
|
34
|
+
if not isinstance(until, Unset):
|
|
35
|
+
json_until = until.isoformat()
|
|
36
|
+
params["until"] = json_until
|
|
37
|
+
|
|
38
|
+
params["cursor"] = cursor
|
|
39
|
+
|
|
40
|
+
params["limit"] = limit
|
|
41
|
+
|
|
42
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
43
|
+
|
|
44
|
+
_kwargs: dict[str, Any] = {
|
|
45
|
+
"method": "get",
|
|
46
|
+
"url": "/api/v1/unsubscribe/phone",
|
|
47
|
+
"params": params,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return _kwargs
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _parse_response(
|
|
54
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
55
|
+
) -> (
|
|
56
|
+
PhoneUnsubscribeListResponse
|
|
57
|
+
| RestErrorResponse
|
|
58
|
+
| UnauthorizedOrganizationError
|
|
59
|
+
| None
|
|
60
|
+
):
|
|
61
|
+
if response.status_code == 200:
|
|
62
|
+
response_200 = PhoneUnsubscribeListResponse.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_200
|
|
65
|
+
|
|
66
|
+
if response.status_code == 400:
|
|
67
|
+
response_400 = RestErrorResponse.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_400
|
|
70
|
+
|
|
71
|
+
if response.status_code == 401:
|
|
72
|
+
response_401 = RestErrorResponse.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_401
|
|
75
|
+
|
|
76
|
+
if response.status_code == 403:
|
|
77
|
+
response_403 = UnauthorizedOrganizationError.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_403
|
|
80
|
+
|
|
81
|
+
if response.status_code == 429:
|
|
82
|
+
response_429 = RestErrorResponse.from_dict(response.json())
|
|
83
|
+
|
|
84
|
+
return response_429
|
|
85
|
+
|
|
86
|
+
if client.raise_on_unexpected_status:
|
|
87
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
88
|
+
else:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _build_response(
|
|
93
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
94
|
+
) -> Response[
|
|
95
|
+
PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
96
|
+
]:
|
|
97
|
+
return Response(
|
|
98
|
+
status_code=HTTPStatus(response.status_code),
|
|
99
|
+
content=response.content,
|
|
100
|
+
headers=response.headers,
|
|
101
|
+
parsed=_parse_response(client=client, response=response),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def sync_detailed(
|
|
106
|
+
*,
|
|
107
|
+
client: AuthenticatedClient | Client,
|
|
108
|
+
org_slug: str | Unset = UNSET,
|
|
109
|
+
since: datetime.datetime | Unset = UNSET,
|
|
110
|
+
until: datetime.datetime | Unset = UNSET,
|
|
111
|
+
cursor: str | Unset = UNSET,
|
|
112
|
+
limit: int | Unset = 100,
|
|
113
|
+
) -> Response[
|
|
114
|
+
PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
115
|
+
]:
|
|
116
|
+
"""List voice (phone call) opt-out / opt-in records
|
|
117
|
+
|
|
118
|
+
Returns the current state of voice unsubscribe records for the organization addressed by `org_slug`
|
|
119
|
+
(or the `client_id`'s default organization when omitted), ordered by `updated_at` descending. Treat
|
|
120
|
+
the endpoint as a change stream: `since` / `until` bound the pagination window and `cursor` walks
|
|
121
|
+
toward older records. Rate limited to 60 requests per minute per `client_id`. If your TruAgents
|
|
122
|
+
administrator has unified the targeted organization's SMS and voice scopes, this endpoint and `/sms`
|
|
123
|
+
surface the same underlying records.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
org_slug (str | Unset):
|
|
127
|
+
since (datetime.datetime | Unset):
|
|
128
|
+
until (datetime.datetime | Unset):
|
|
129
|
+
cursor (str | Unset):
|
|
130
|
+
limit (int | Unset): Default: 100.
|
|
131
|
+
|
|
132
|
+
Raises:
|
|
133
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
134
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
Response[PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError]
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
kwargs = _get_kwargs(
|
|
141
|
+
org_slug=org_slug,
|
|
142
|
+
since=since,
|
|
143
|
+
until=until,
|
|
144
|
+
cursor=cursor,
|
|
145
|
+
limit=limit,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
response = client.get_httpx_client().request(
|
|
149
|
+
**kwargs,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
return _build_response(client=client, response=response)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def sync(
|
|
156
|
+
*,
|
|
157
|
+
client: AuthenticatedClient | Client,
|
|
158
|
+
org_slug: str | Unset = UNSET,
|
|
159
|
+
since: datetime.datetime | Unset = UNSET,
|
|
160
|
+
until: datetime.datetime | Unset = UNSET,
|
|
161
|
+
cursor: str | Unset = UNSET,
|
|
162
|
+
limit: int | Unset = 100,
|
|
163
|
+
) -> (
|
|
164
|
+
PhoneUnsubscribeListResponse
|
|
165
|
+
| RestErrorResponse
|
|
166
|
+
| UnauthorizedOrganizationError
|
|
167
|
+
| None
|
|
168
|
+
):
|
|
169
|
+
"""List voice (phone call) opt-out / opt-in records
|
|
170
|
+
|
|
171
|
+
Returns the current state of voice unsubscribe records for the organization addressed by `org_slug`
|
|
172
|
+
(or the `client_id`'s default organization when omitted), ordered by `updated_at` descending. Treat
|
|
173
|
+
the endpoint as a change stream: `since` / `until` bound the pagination window and `cursor` walks
|
|
174
|
+
toward older records. Rate limited to 60 requests per minute per `client_id`. If your TruAgents
|
|
175
|
+
administrator has unified the targeted organization's SMS and voice scopes, this endpoint and `/sms`
|
|
176
|
+
surface the same underlying records.
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
org_slug (str | Unset):
|
|
180
|
+
since (datetime.datetime | Unset):
|
|
181
|
+
until (datetime.datetime | Unset):
|
|
182
|
+
cursor (str | Unset):
|
|
183
|
+
limit (int | Unset): Default: 100.
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
return sync_detailed(
|
|
194
|
+
client=client,
|
|
195
|
+
org_slug=org_slug,
|
|
196
|
+
since=since,
|
|
197
|
+
until=until,
|
|
198
|
+
cursor=cursor,
|
|
199
|
+
limit=limit,
|
|
200
|
+
).parsed
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
async def asyncio_detailed(
|
|
204
|
+
*,
|
|
205
|
+
client: AuthenticatedClient | Client,
|
|
206
|
+
org_slug: str | Unset = UNSET,
|
|
207
|
+
since: datetime.datetime | Unset = UNSET,
|
|
208
|
+
until: datetime.datetime | Unset = UNSET,
|
|
209
|
+
cursor: str | Unset = UNSET,
|
|
210
|
+
limit: int | Unset = 100,
|
|
211
|
+
) -> Response[
|
|
212
|
+
PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
213
|
+
]:
|
|
214
|
+
"""List voice (phone call) opt-out / opt-in records
|
|
215
|
+
|
|
216
|
+
Returns the current state of voice unsubscribe records for the organization addressed by `org_slug`
|
|
217
|
+
(or the `client_id`'s default organization when omitted), ordered by `updated_at` descending. Treat
|
|
218
|
+
the endpoint as a change stream: `since` / `until` bound the pagination window and `cursor` walks
|
|
219
|
+
toward older records. Rate limited to 60 requests per minute per `client_id`. If your TruAgents
|
|
220
|
+
administrator has unified the targeted organization's SMS and voice scopes, this endpoint and `/sms`
|
|
221
|
+
surface the same underlying records.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
org_slug (str | Unset):
|
|
225
|
+
since (datetime.datetime | Unset):
|
|
226
|
+
until (datetime.datetime | Unset):
|
|
227
|
+
cursor (str | Unset):
|
|
228
|
+
limit (int | Unset): Default: 100.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
232
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
Response[PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError]
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
kwargs = _get_kwargs(
|
|
239
|
+
org_slug=org_slug,
|
|
240
|
+
since=since,
|
|
241
|
+
until=until,
|
|
242
|
+
cursor=cursor,
|
|
243
|
+
limit=limit,
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
247
|
+
|
|
248
|
+
return _build_response(client=client, response=response)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
async def asyncio(
|
|
252
|
+
*,
|
|
253
|
+
client: AuthenticatedClient | Client,
|
|
254
|
+
org_slug: str | Unset = UNSET,
|
|
255
|
+
since: datetime.datetime | Unset = UNSET,
|
|
256
|
+
until: datetime.datetime | Unset = UNSET,
|
|
257
|
+
cursor: str | Unset = UNSET,
|
|
258
|
+
limit: int | Unset = 100,
|
|
259
|
+
) -> (
|
|
260
|
+
PhoneUnsubscribeListResponse
|
|
261
|
+
| RestErrorResponse
|
|
262
|
+
| UnauthorizedOrganizationError
|
|
263
|
+
| None
|
|
264
|
+
):
|
|
265
|
+
"""List voice (phone call) opt-out / opt-in records
|
|
266
|
+
|
|
267
|
+
Returns the current state of voice unsubscribe records for the organization addressed by `org_slug`
|
|
268
|
+
(or the `client_id`'s default organization when omitted), ordered by `updated_at` descending. Treat
|
|
269
|
+
the endpoint as a change stream: `since` / `until` bound the pagination window and `cursor` walks
|
|
270
|
+
toward older records. Rate limited to 60 requests per minute per `client_id`. If your TruAgents
|
|
271
|
+
administrator has unified the targeted organization's SMS and voice scopes, this endpoint and `/sms`
|
|
272
|
+
surface the same underlying records.
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
org_slug (str | Unset):
|
|
276
|
+
since (datetime.datetime | Unset):
|
|
277
|
+
until (datetime.datetime | Unset):
|
|
278
|
+
cursor (str | Unset):
|
|
279
|
+
limit (int | Unset): Default: 100.
|
|
280
|
+
|
|
281
|
+
Raises:
|
|
282
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
283
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
284
|
+
|
|
285
|
+
Returns:
|
|
286
|
+
PhoneUnsubscribeListResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
287
|
+
"""
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
await asyncio_detailed(
|
|
291
|
+
client=client,
|
|
292
|
+
org_slug=org_slug,
|
|
293
|
+
since=since,
|
|
294
|
+
until=until,
|
|
295
|
+
cursor=cursor,
|
|
296
|
+
limit=limit,
|
|
297
|
+
)
|
|
298
|
+
).parsed
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.phone_unsubscribe_batch_request import PhoneUnsubscribeBatchRequest
|
|
9
|
+
from ...models.phone_unsubscribe_batch_response import PhoneUnsubscribeBatchResponse
|
|
10
|
+
from ...models.rest_error_response import RestErrorResponse
|
|
11
|
+
from ...models.unauthorized_organization_error import UnauthorizedOrganizationError
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
*,
|
|
17
|
+
body: PhoneUnsubscribeBatchRequest,
|
|
18
|
+
) -> dict[str, Any]:
|
|
19
|
+
headers: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
_kwargs: dict[str, Any] = {
|
|
22
|
+
"method": "post",
|
|
23
|
+
"url": "/api/v1/unsubscribe/phone",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> (
|
|
37
|
+
PhoneUnsubscribeBatchResponse
|
|
38
|
+
| RestErrorResponse
|
|
39
|
+
| UnauthorizedOrganizationError
|
|
40
|
+
| None
|
|
41
|
+
):
|
|
42
|
+
if response.status_code == 200:
|
|
43
|
+
response_200 = PhoneUnsubscribeBatchResponse.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_200
|
|
46
|
+
|
|
47
|
+
if response.status_code == 400:
|
|
48
|
+
response_400 = RestErrorResponse.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_400
|
|
51
|
+
|
|
52
|
+
if response.status_code == 401:
|
|
53
|
+
response_401 = RestErrorResponse.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_401
|
|
56
|
+
|
|
57
|
+
if response.status_code == 403:
|
|
58
|
+
response_403 = UnauthorizedOrganizationError.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_403
|
|
61
|
+
|
|
62
|
+
if response.status_code == 422:
|
|
63
|
+
response_422 = PhoneUnsubscribeBatchResponse.from_dict(response.json())
|
|
64
|
+
|
|
65
|
+
return response_422
|
|
66
|
+
|
|
67
|
+
if response.status_code == 429:
|
|
68
|
+
response_429 = RestErrorResponse.from_dict(response.json())
|
|
69
|
+
|
|
70
|
+
return response_429
|
|
71
|
+
|
|
72
|
+
if client.raise_on_unexpected_status:
|
|
73
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
74
|
+
else:
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _build_response(
|
|
79
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
80
|
+
) -> Response[
|
|
81
|
+
PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
82
|
+
]:
|
|
83
|
+
return Response(
|
|
84
|
+
status_code=HTTPStatus(response.status_code),
|
|
85
|
+
content=response.content,
|
|
86
|
+
headers=response.headers,
|
|
87
|
+
parsed=_parse_response(client=client, response=response),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def sync_detailed(
|
|
92
|
+
*,
|
|
93
|
+
client: AuthenticatedClient | Client,
|
|
94
|
+
body: PhoneUnsubscribeBatchRequest,
|
|
95
|
+
) -> Response[
|
|
96
|
+
PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
97
|
+
]:
|
|
98
|
+
"""Push voice (phone call) opt-out / opt-in changes
|
|
99
|
+
|
|
100
|
+
Apply a batch of `{ phone, unsubscribed }` state changes to one organization — the value supplied in
|
|
101
|
+
`org_slug` (top-level body field) or the `client_id`'s default organization when omitted. Items are
|
|
102
|
+
processed in array order; per-item failures do NOT roll back accepted items. Up to 10,000 items per
|
|
103
|
+
request. Idempotent. Rate limited to 60 requests per minute per `client_id`.
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
body (PhoneUnsubscribeBatchRequest): Example: {'org_slug': 'acme-corp', 'items':
|
|
107
|
+
[{'phone': '+15551234567', 'unsubscribed': True}]}.
|
|
108
|
+
|
|
109
|
+
Raises:
|
|
110
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
111
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
112
|
+
|
|
113
|
+
Returns:
|
|
114
|
+
Response[PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError]
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
kwargs = _get_kwargs(
|
|
118
|
+
body=body,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
response = client.get_httpx_client().request(
|
|
122
|
+
**kwargs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return _build_response(client=client, response=response)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def sync(
|
|
129
|
+
*,
|
|
130
|
+
client: AuthenticatedClient | Client,
|
|
131
|
+
body: PhoneUnsubscribeBatchRequest,
|
|
132
|
+
) -> (
|
|
133
|
+
PhoneUnsubscribeBatchResponse
|
|
134
|
+
| RestErrorResponse
|
|
135
|
+
| UnauthorizedOrganizationError
|
|
136
|
+
| None
|
|
137
|
+
):
|
|
138
|
+
"""Push voice (phone call) opt-out / opt-in changes
|
|
139
|
+
|
|
140
|
+
Apply a batch of `{ phone, unsubscribed }` state changes to one organization — the value supplied in
|
|
141
|
+
`org_slug` (top-level body field) or the `client_id`'s default organization when omitted. Items are
|
|
142
|
+
processed in array order; per-item failures do NOT roll back accepted items. Up to 10,000 items per
|
|
143
|
+
request. Idempotent. Rate limited to 60 requests per minute per `client_id`.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
body (PhoneUnsubscribeBatchRequest): Example: {'org_slug': 'acme-corp', 'items':
|
|
147
|
+
[{'phone': '+15551234567', 'unsubscribed': True}]}.
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
return sync_detailed(
|
|
158
|
+
client=client,
|
|
159
|
+
body=body,
|
|
160
|
+
).parsed
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
async def asyncio_detailed(
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient | Client,
|
|
166
|
+
body: PhoneUnsubscribeBatchRequest,
|
|
167
|
+
) -> Response[
|
|
168
|
+
PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
169
|
+
]:
|
|
170
|
+
"""Push voice (phone call) opt-out / opt-in changes
|
|
171
|
+
|
|
172
|
+
Apply a batch of `{ phone, unsubscribed }` state changes to one organization — the value supplied in
|
|
173
|
+
`org_slug` (top-level body field) or the `client_id`'s default organization when omitted. Items are
|
|
174
|
+
processed in array order; per-item failures do NOT roll back accepted items. Up to 10,000 items per
|
|
175
|
+
request. Idempotent. Rate limited to 60 requests per minute per `client_id`.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
body (PhoneUnsubscribeBatchRequest): Example: {'org_slug': 'acme-corp', 'items':
|
|
179
|
+
[{'phone': '+15551234567', 'unsubscribed': True}]}.
|
|
180
|
+
|
|
181
|
+
Raises:
|
|
182
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
183
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
184
|
+
|
|
185
|
+
Returns:
|
|
186
|
+
Response[PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError]
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
kwargs = _get_kwargs(
|
|
190
|
+
body=body,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
194
|
+
|
|
195
|
+
return _build_response(client=client, response=response)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
async def asyncio(
|
|
199
|
+
*,
|
|
200
|
+
client: AuthenticatedClient | Client,
|
|
201
|
+
body: PhoneUnsubscribeBatchRequest,
|
|
202
|
+
) -> (
|
|
203
|
+
PhoneUnsubscribeBatchResponse
|
|
204
|
+
| RestErrorResponse
|
|
205
|
+
| UnauthorizedOrganizationError
|
|
206
|
+
| None
|
|
207
|
+
):
|
|
208
|
+
"""Push voice (phone call) opt-out / opt-in changes
|
|
209
|
+
|
|
210
|
+
Apply a batch of `{ phone, unsubscribed }` state changes to one organization — the value supplied in
|
|
211
|
+
`org_slug` (top-level body field) or the `client_id`'s default organization when omitted. Items are
|
|
212
|
+
processed in array order; per-item failures do NOT roll back accepted items. Up to 10,000 items per
|
|
213
|
+
request. Idempotent. Rate limited to 60 requests per minute per `client_id`.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
body (PhoneUnsubscribeBatchRequest): Example: {'org_slug': 'acme-corp', 'items':
|
|
217
|
+
[{'phone': '+15551234567', 'unsubscribed': True}]}.
|
|
218
|
+
|
|
219
|
+
Raises:
|
|
220
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
221
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
222
|
+
|
|
223
|
+
Returns:
|
|
224
|
+
PhoneUnsubscribeBatchResponse | RestErrorResponse | UnauthorizedOrganizationError
|
|
225
|
+
"""
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
await asyncio_detailed(
|
|
229
|
+
client=client,
|
|
230
|
+
body=body,
|
|
231
|
+
)
|
|
232
|
+
).parsed
|