handset 0.1.1__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.
- handset/__init__.py +8 -0
- handset/api/__init__.py +1 -0
- handset/api/compliance/__init__.py +1 -0
- handset/api/compliance/create_brand.py +210 -0
- handset/api/compliance/create_campaign.py +214 -0
- handset/api/compliance/create_e911_address.py +210 -0
- handset/api/compliance/get_brand.py +174 -0
- handset/api/compliance/get_campaign.py +174 -0
- handset/api/compliance/list_brands.py +198 -0
- handset/api/compliance/list_campaigns.py +233 -0
- handset/api/compliance/list_e911_addresses.py +213 -0
- handset/api/messaging/__init__.py +1 -0
- handset/api/messaging/get_conversation.py +174 -0
- handset/api/messaging/get_message.py +174 -0
- handset/api/messaging/list_conversations.py +240 -0
- handset/api/messaging/list_messages.py +248 -0
- handset/api/messaging/list_opt_outs.py +225 -0
- handset/api/messaging/send_message.py +210 -0
- handset/api/phone_numbers/__init__.py +1 -0
- handset/api/phone_numbers/get_number.py +174 -0
- handset/api/phone_numbers/list_numbers.py +213 -0
- handset/api/phone_numbers/purchase_number.py +198 -0
- handset/api/phone_numbers/release_number.py +178 -0
- handset/api/phone_numbers/search_available_numbers.py +228 -0
- handset/api/phone_numbers/update_number.py +194 -0
- handset/api/tenants/__init__.py +1 -0
- handset/api/tenants/create_tenant.py +198 -0
- handset/api/tenants/delete_tenant.py +182 -0
- handset/api/tenants/get_tenant.py +174 -0
- handset/api/tenants/list_tenants.py +213 -0
- handset/api/tenants/update_tenant.py +194 -0
- handset/api/usage/__init__.py +1 -0
- handset/api/usage/get_usage.py +225 -0
- handset/api/voice/__init__.py +1 -0
- handset/api/voice/create_routing_config.py +198 -0
- handset/api/voice/delete_routing_config.py +178 -0
- handset/api/voice/get_call.py +174 -0
- handset/api/voice/get_recording.py +174 -0
- handset/api/voice/get_routing_config.py +174 -0
- handset/api/voice/get_voicemail.py +174 -0
- handset/api/voice/list_calls.py +228 -0
- handset/api/voice/list_routing_configs.py +213 -0
- handset/api/voice/list_voicemails.py +213 -0
- handset/api/voice/update_routing_config.py +202 -0
- handset/api/webhooks/__init__.py +1 -0
- handset/api/webhooks/create_webhook_endpoint.py +198 -0
- handset/api/webhooks/delete_webhook_endpoint.py +170 -0
- handset/api/webhooks/list_webhook_endpoints.py +198 -0
- handset/api/webhooks/test_webhook_endpoint.py +197 -0
- handset/api/webhooks/update_webhook_endpoint.py +194 -0
- handset/client.py +271 -0
- handset/errors.py +14 -0
- handset/models/__init__.py +159 -0
- handset/models/available_number.py +156 -0
- handset/models/available_number_capabilities_item.py +9 -0
- handset/models/brand.py +223 -0
- handset/models/brand_create.py +170 -0
- handset/models/brand_create_entity_type.py +10 -0
- handset/models/brand_status.py +9 -0
- handset/models/call.py +294 -0
- handset/models/call_direction.py +7 -0
- handset/models/call_events_item.py +127 -0
- handset/models/call_events_item_detail_type_0.py +65 -0
- handset/models/call_status.py +12 -0
- handset/models/campaign.py +202 -0
- handset/models/campaign_create.py +126 -0
- handset/models/campaign_create_use_case.py +11 -0
- handset/models/campaign_status.py +11 -0
- handset/models/campaign_throughput.py +101 -0
- handset/models/conversation.py +144 -0
- handset/models/e911_address.py +163 -0
- handset/models/e911_address_create.py +131 -0
- handset/models/e911_address_status.py +8 -0
- handset/models/error_body.py +84 -0
- handset/models/error_body_error.py +116 -0
- handset/models/event_envelope.py +132 -0
- handset/models/event_envelope_data.py +66 -0
- handset/models/get_usage_response_200.py +141 -0
- handset/models/get_usage_response_200_data_item.py +88 -0
- handset/models/get_usage_response_200_data_item_kind.py +11 -0
- handset/models/get_usage_response_200_mode.py +8 -0
- handset/models/get_usage_response_200_object.py +7 -0
- handset/models/list_brands_response_200.py +124 -0
- handset/models/list_calls_response_200.py +124 -0
- handset/models/list_campaigns_response_200.py +124 -0
- handset/models/list_conversations_response_200.py +124 -0
- handset/models/list_e911_addresses_response_200.py +124 -0
- handset/models/list_messages_direction.py +8 -0
- handset/models/list_messages_response_200.py +124 -0
- handset/models/list_numbers_response_200.py +124 -0
- handset/models/list_opt_outs_response_200.py +124 -0
- handset/models/list_routing_configs_response_200.py +124 -0
- handset/models/list_tenants_response_200.py +124 -0
- handset/models/list_voicemails_response_200.py +124 -0
- handset/models/list_webhook_endpoints_response_200.py +124 -0
- handset/models/message.py +263 -0
- handset/models/message_direction.py +8 -0
- handset/models/message_status.py +12 -0
- handset/models/message_status_history_item.py +93 -0
- handset/models/metadata.py +66 -0
- handset/models/opt_out.py +119 -0
- handset/models/opt_out_source.py +9 -0
- handset/models/page.py +120 -0
- handset/models/phone_number.py +217 -0
- handset/models/phone_number_capabilities_item.py +9 -0
- handset/models/phone_number_status.py +10 -0
- handset/models/purchase_number_body.py +129 -0
- handset/models/recording.py +132 -0
- handset/models/ring_behavior.py +145 -0
- handset/models/ring_behavior_strategy.py +8 -0
- handset/models/routing_config.py +222 -0
- handset/models/routing_config_create.py +202 -0
- handset/models/routing_config_create_business_hours_type_0.py +101 -0
- handset/models/routing_config_create_business_hours_type_0_schedule_item.py +107 -0
- handset/models/routing_config_create_business_hours_type_0_schedule_item_days_item.py +13 -0
- handset/models/routing_config_create_recording.py +89 -0
- handset/models/search_available_numbers_response_200.py +94 -0
- handset/models/send_message_body.py +132 -0
- handset/models/tenant.py +151 -0
- handset/models/tenant_create.py +131 -0
- handset/models/tenant_update.py +132 -0
- handset/models/test_webhook_endpoint_body.py +78 -0
- handset/models/test_webhook_endpoint_response_200.py +121 -0
- handset/models/update_number_body.py +133 -0
- handset/models/voicemail.py +153 -0
- handset/models/voicemail_behavior.py +132 -0
- handset/models/webhook_endpoint.py +145 -0
- handset/models/webhook_endpoint_create.py +113 -0
- handset/models/webhook_endpoint_status.py +8 -0
- handset/models/webhook_endpoint_with_secret.py +154 -0
- handset/py.typed +1 -0
- handset/types.py +53 -0
- handset-0.1.1.dist-info/METADATA +144 -0
- handset-0.1.1.dist-info/RECORD +135 -0
- handset-0.1.1.dist-info/WHEEL +4 -0
handset/__init__.py
ADDED
handset/api/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.brand import Brand
|
|
12
|
+
from ...models.brand_create import BrandCreate
|
|
13
|
+
from ...models.error_body import ErrorBody
|
|
14
|
+
from ...types import UNSET, Unset
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
body: BrandCreate,
|
|
22
|
+
idempotency_key: str | Unset = UNSET,
|
|
23
|
+
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
headers: dict[str, Any] = {}
|
|
26
|
+
if not isinstance(idempotency_key, Unset):
|
|
27
|
+
headers["Idempotency-Key"] = idempotency_key
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
_kwargs: dict[str, Any] = {
|
|
36
|
+
"method": "post",
|
|
37
|
+
"url": "/brands",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_kwargs["json"] = body.to_dict()
|
|
41
|
+
|
|
42
|
+
headers["Content-Type"] = "application/json"
|
|
43
|
+
|
|
44
|
+
_kwargs["headers"] = headers
|
|
45
|
+
return _kwargs
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Brand | ErrorBody:
|
|
50
|
+
if response.status_code == 201:
|
|
51
|
+
response_201 = Brand.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return response_201
|
|
56
|
+
|
|
57
|
+
response_default = ErrorBody.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return response_default
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Brand | ErrorBody]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: BrandCreate,
|
|
78
|
+
idempotency_key: str | Unset = UNSET,
|
|
79
|
+
|
|
80
|
+
) -> Response[Brand | ErrorBody]:
|
|
81
|
+
""" Register a 10DLC brand
|
|
82
|
+
|
|
83
|
+
Registers your platform (or a tenant, for tenants with their own EIN) with The Campaign Registry.
|
|
84
|
+
Vetting typically takes minutes to days; track via `brand.status_changed`.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
idempotency_key (str | Unset):
|
|
88
|
+
body (BrandCreate):
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[Brand | ErrorBody]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
kwargs = _get_kwargs(
|
|
100
|
+
body=body,
|
|
101
|
+
idempotency_key=idempotency_key,
|
|
102
|
+
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
def sync(
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient | Client,
|
|
114
|
+
body: BrandCreate,
|
|
115
|
+
idempotency_key: str | Unset = UNSET,
|
|
116
|
+
|
|
117
|
+
) -> Brand | ErrorBody | None:
|
|
118
|
+
""" Register a 10DLC brand
|
|
119
|
+
|
|
120
|
+
Registers your platform (or a tenant, for tenants with their own EIN) with The Campaign Registry.
|
|
121
|
+
Vetting typically takes minutes to days; track via `brand.status_changed`.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
idempotency_key (str | Unset):
|
|
125
|
+
body (BrandCreate):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Brand | ErrorBody
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
return sync_detailed(
|
|
137
|
+
client=client,
|
|
138
|
+
body=body,
|
|
139
|
+
idempotency_key=idempotency_key,
|
|
140
|
+
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
async def asyncio_detailed(
|
|
144
|
+
*,
|
|
145
|
+
client: AuthenticatedClient | Client,
|
|
146
|
+
body: BrandCreate,
|
|
147
|
+
idempotency_key: str | Unset = UNSET,
|
|
148
|
+
|
|
149
|
+
) -> Response[Brand | ErrorBody]:
|
|
150
|
+
""" Register a 10DLC brand
|
|
151
|
+
|
|
152
|
+
Registers your platform (or a tenant, for tenants with their own EIN) with The Campaign Registry.
|
|
153
|
+
Vetting typically takes minutes to days; track via `brand.status_changed`.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
idempotency_key (str | Unset):
|
|
157
|
+
body (BrandCreate):
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Response[Brand | ErrorBody]
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
kwargs = _get_kwargs(
|
|
169
|
+
body=body,
|
|
170
|
+
idempotency_key=idempotency_key,
|
|
171
|
+
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
response = await client.get_async_httpx_client().request(
|
|
175
|
+
**kwargs
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
return _build_response(client=client, response=response)
|
|
179
|
+
|
|
180
|
+
async def asyncio(
|
|
181
|
+
*,
|
|
182
|
+
client: AuthenticatedClient | Client,
|
|
183
|
+
body: BrandCreate,
|
|
184
|
+
idempotency_key: str | Unset = UNSET,
|
|
185
|
+
|
|
186
|
+
) -> Brand | ErrorBody | None:
|
|
187
|
+
""" Register a 10DLC brand
|
|
188
|
+
|
|
189
|
+
Registers your platform (or a tenant, for tenants with their own EIN) with The Campaign Registry.
|
|
190
|
+
Vetting typically takes minutes to days; track via `brand.status_changed`.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
idempotency_key (str | Unset):
|
|
194
|
+
body (BrandCreate):
|
|
195
|
+
|
|
196
|
+
Raises:
|
|
197
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
198
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
Brand | ErrorBody
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
return (await asyncio_detailed(
|
|
206
|
+
client=client,
|
|
207
|
+
body=body,
|
|
208
|
+
idempotency_key=idempotency_key,
|
|
209
|
+
|
|
210
|
+
)).parsed
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.campaign import Campaign
|
|
12
|
+
from ...models.campaign_create import CampaignCreate
|
|
13
|
+
from ...models.error_body import ErrorBody
|
|
14
|
+
from ...types import UNSET, Unset
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
body: CampaignCreate,
|
|
22
|
+
idempotency_key: str | Unset = UNSET,
|
|
23
|
+
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
headers: dict[str, Any] = {}
|
|
26
|
+
if not isinstance(idempotency_key, Unset):
|
|
27
|
+
headers["Idempotency-Key"] = idempotency_key
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
_kwargs: dict[str, Any] = {
|
|
36
|
+
"method": "post",
|
|
37
|
+
"url": "/campaigns",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_kwargs["json"] = body.to_dict()
|
|
41
|
+
|
|
42
|
+
headers["Content-Type"] = "application/json"
|
|
43
|
+
|
|
44
|
+
_kwargs["headers"] = headers
|
|
45
|
+
return _kwargs
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Campaign | ErrorBody:
|
|
50
|
+
if response.status_code == 201:
|
|
51
|
+
response_201 = Campaign.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return response_201
|
|
56
|
+
|
|
57
|
+
response_default = ErrorBody.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return response_default
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Campaign | ErrorBody]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: CampaignCreate,
|
|
78
|
+
idempotency_key: str | Unset = UNSET,
|
|
79
|
+
|
|
80
|
+
) -> Response[Campaign | ErrorBody]:
|
|
81
|
+
""" Register a 10DLC campaign
|
|
82
|
+
|
|
83
|
+
Registers a messaging use case under an approved brand for a tenant. Carrier review typically takes
|
|
84
|
+
1–3 business days; sending is blocked until status is `approved`. Track via
|
|
85
|
+
`campaign.status_changed`.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
idempotency_key (str | Unset):
|
|
89
|
+
body (CampaignCreate):
|
|
90
|
+
|
|
91
|
+
Raises:
|
|
92
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Response[Campaign | ErrorBody]
|
|
97
|
+
"""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
kwargs = _get_kwargs(
|
|
101
|
+
body=body,
|
|
102
|
+
idempotency_key=idempotency_key,
|
|
103
|
+
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
*,
|
|
114
|
+
client: AuthenticatedClient | Client,
|
|
115
|
+
body: CampaignCreate,
|
|
116
|
+
idempotency_key: str | Unset = UNSET,
|
|
117
|
+
|
|
118
|
+
) -> Campaign | ErrorBody | None:
|
|
119
|
+
""" Register a 10DLC campaign
|
|
120
|
+
|
|
121
|
+
Registers a messaging use case under an approved brand for a tenant. Carrier review typically takes
|
|
122
|
+
1–3 business days; sending is blocked until status is `approved`. Track via
|
|
123
|
+
`campaign.status_changed`.
|
|
124
|
+
|
|
125
|
+
Args:
|
|
126
|
+
idempotency_key (str | Unset):
|
|
127
|
+
body (CampaignCreate):
|
|
128
|
+
|
|
129
|
+
Raises:
|
|
130
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
131
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
Campaign | ErrorBody
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
return sync_detailed(
|
|
139
|
+
client=client,
|
|
140
|
+
body=body,
|
|
141
|
+
idempotency_key=idempotency_key,
|
|
142
|
+
|
|
143
|
+
).parsed
|
|
144
|
+
|
|
145
|
+
async def asyncio_detailed(
|
|
146
|
+
*,
|
|
147
|
+
client: AuthenticatedClient | Client,
|
|
148
|
+
body: CampaignCreate,
|
|
149
|
+
idempotency_key: str | Unset = UNSET,
|
|
150
|
+
|
|
151
|
+
) -> Response[Campaign | ErrorBody]:
|
|
152
|
+
""" Register a 10DLC campaign
|
|
153
|
+
|
|
154
|
+
Registers a messaging use case under an approved brand for a tenant. Carrier review typically takes
|
|
155
|
+
1–3 business days; sending is blocked until status is `approved`. Track via
|
|
156
|
+
`campaign.status_changed`.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
idempotency_key (str | Unset):
|
|
160
|
+
body (CampaignCreate):
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
164
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
Response[Campaign | ErrorBody]
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
kwargs = _get_kwargs(
|
|
172
|
+
body=body,
|
|
173
|
+
idempotency_key=idempotency_key,
|
|
174
|
+
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
response = await client.get_async_httpx_client().request(
|
|
178
|
+
**kwargs
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
return _build_response(client=client, response=response)
|
|
182
|
+
|
|
183
|
+
async def asyncio(
|
|
184
|
+
*,
|
|
185
|
+
client: AuthenticatedClient | Client,
|
|
186
|
+
body: CampaignCreate,
|
|
187
|
+
idempotency_key: str | Unset = UNSET,
|
|
188
|
+
|
|
189
|
+
) -> Campaign | ErrorBody | None:
|
|
190
|
+
""" Register a 10DLC campaign
|
|
191
|
+
|
|
192
|
+
Registers a messaging use case under an approved brand for a tenant. Carrier review typically takes
|
|
193
|
+
1–3 business days; sending is blocked until status is `approved`. Track via
|
|
194
|
+
`campaign.status_changed`.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
idempotency_key (str | Unset):
|
|
198
|
+
body (CampaignCreate):
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
202
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
Campaign | ErrorBody
|
|
206
|
+
"""
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
return (await asyncio_detailed(
|
|
210
|
+
client=client,
|
|
211
|
+
body=body,
|
|
212
|
+
idempotency_key=idempotency_key,
|
|
213
|
+
|
|
214
|
+
)).parsed
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.e911_address import E911Address
|
|
12
|
+
from ...models.e911_address_create import E911AddressCreate
|
|
13
|
+
from ...models.error_body import ErrorBody
|
|
14
|
+
from ...types import UNSET, Unset
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
body: E911AddressCreate,
|
|
22
|
+
idempotency_key: str | Unset = UNSET,
|
|
23
|
+
|
|
24
|
+
) -> dict[str, Any]:
|
|
25
|
+
headers: dict[str, Any] = {}
|
|
26
|
+
if not isinstance(idempotency_key, Unset):
|
|
27
|
+
headers["Idempotency-Key"] = idempotency_key
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
_kwargs: dict[str, Any] = {
|
|
36
|
+
"method": "post",
|
|
37
|
+
"url": "/e911_addresses",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_kwargs["json"] = body.to_dict()
|
|
41
|
+
|
|
42
|
+
headers["Content-Type"] = "application/json"
|
|
43
|
+
|
|
44
|
+
_kwargs["headers"] = headers
|
|
45
|
+
return _kwargs
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> E911Address | ErrorBody:
|
|
50
|
+
if response.status_code == 201:
|
|
51
|
+
response_201 = E911Address.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return response_201
|
|
56
|
+
|
|
57
|
+
response_default = ErrorBody.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
return response_default
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[E911Address | ErrorBody]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
*,
|
|
76
|
+
client: AuthenticatedClient | Client,
|
|
77
|
+
body: E911AddressCreate,
|
|
78
|
+
idempotency_key: str | Unset = UNSET,
|
|
79
|
+
|
|
80
|
+
) -> Response[E911Address | ErrorBody]:
|
|
81
|
+
""" Validate and register an E911 address
|
|
82
|
+
|
|
83
|
+
Validates a dispatchable location and registers it for use with a tenant's numbers. Returns
|
|
84
|
+
`e911_address_invalid` with correction suggestions when validation fails.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
idempotency_key (str | Unset):
|
|
88
|
+
body (E911AddressCreate):
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
92
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
Response[E911Address | ErrorBody]
|
|
96
|
+
"""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
kwargs = _get_kwargs(
|
|
100
|
+
body=body,
|
|
101
|
+
idempotency_key=idempotency_key,
|
|
102
|
+
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
response = client.get_httpx_client().request(
|
|
106
|
+
**kwargs,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
return _build_response(client=client, response=response)
|
|
110
|
+
|
|
111
|
+
def sync(
|
|
112
|
+
*,
|
|
113
|
+
client: AuthenticatedClient | Client,
|
|
114
|
+
body: E911AddressCreate,
|
|
115
|
+
idempotency_key: str | Unset = UNSET,
|
|
116
|
+
|
|
117
|
+
) -> E911Address | ErrorBody | None:
|
|
118
|
+
""" Validate and register an E911 address
|
|
119
|
+
|
|
120
|
+
Validates a dispatchable location and registers it for use with a tenant's numbers. Returns
|
|
121
|
+
`e911_address_invalid` with correction suggestions when validation fails.
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
idempotency_key (str | Unset):
|
|
125
|
+
body (E911AddressCreate):
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
129
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
E911Address | ErrorBody
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
return sync_detailed(
|
|
137
|
+
client=client,
|
|
138
|
+
body=body,
|
|
139
|
+
idempotency_key=idempotency_key,
|
|
140
|
+
|
|
141
|
+
).parsed
|
|
142
|
+
|
|
143
|
+
async def asyncio_detailed(
|
|
144
|
+
*,
|
|
145
|
+
client: AuthenticatedClient | Client,
|
|
146
|
+
body: E911AddressCreate,
|
|
147
|
+
idempotency_key: str | Unset = UNSET,
|
|
148
|
+
|
|
149
|
+
) -> Response[E911Address | ErrorBody]:
|
|
150
|
+
""" Validate and register an E911 address
|
|
151
|
+
|
|
152
|
+
Validates a dispatchable location and registers it for use with a tenant's numbers. Returns
|
|
153
|
+
`e911_address_invalid` with correction suggestions when validation fails.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
idempotency_key (str | Unset):
|
|
157
|
+
body (E911AddressCreate):
|
|
158
|
+
|
|
159
|
+
Raises:
|
|
160
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
161
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
Response[E911Address | ErrorBody]
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
kwargs = _get_kwargs(
|
|
169
|
+
body=body,
|
|
170
|
+
idempotency_key=idempotency_key,
|
|
171
|
+
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
response = await client.get_async_httpx_client().request(
|
|
175
|
+
**kwargs
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
return _build_response(client=client, response=response)
|
|
179
|
+
|
|
180
|
+
async def asyncio(
|
|
181
|
+
*,
|
|
182
|
+
client: AuthenticatedClient | Client,
|
|
183
|
+
body: E911AddressCreate,
|
|
184
|
+
idempotency_key: str | Unset = UNSET,
|
|
185
|
+
|
|
186
|
+
) -> E911Address | ErrorBody | None:
|
|
187
|
+
""" Validate and register an E911 address
|
|
188
|
+
|
|
189
|
+
Validates a dispatchable location and registers it for use with a tenant's numbers. Returns
|
|
190
|
+
`e911_address_invalid` with correction suggestions when validation fails.
|
|
191
|
+
|
|
192
|
+
Args:
|
|
193
|
+
idempotency_key (str | Unset):
|
|
194
|
+
body (E911AddressCreate):
|
|
195
|
+
|
|
196
|
+
Raises:
|
|
197
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
198
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
E911Address | ErrorBody
|
|
202
|
+
"""
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
return (await asyncio_detailed(
|
|
206
|
+
client=client,
|
|
207
|
+
body=body,
|
|
208
|
+
idempotency_key=idempotency_key,
|
|
209
|
+
|
|
210
|
+
)).parsed
|