paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a2__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.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +417 -133
- paid/contacts/raw_client.py +1048 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +394 -1112
- paid/customers/raw_client.py +656 -1054
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/{plans → invoices}/raw_client.py +312 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +281 -471
- paid/orders/raw_client.py +552 -537
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +565 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +58 -110
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +33 -51
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +3 -1
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent_update.py → update_contact_request.py} +10 -9
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/METADATA +23 -8
- paid_python-1.0.0a2.dist-info/RECORD +110 -0
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/customers/types/__init__.py +0 -8
- paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -403
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent.py +0 -31
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/cancel_renewal_response.py +0 -49
- paid/types/charge_type.py +0 -5
- paid/types/contact_create_for_customer.py +0 -37
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/payment_method.py +0 -58
- paid/types/payment_method_card.py +0 -49
- paid/types/payment_method_type.py +0 -5
- paid/types/payment_method_us_bank_account.py +0 -36
- paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -41
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/plan_with_features.py +0 -69
- paid/types/plan_with_features_features_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/proration_attribute_update.py +0 -44
- paid/types/proration_detail.py +0 -49
- paid/types/proration_upgrade_response.py +0 -73
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-1.0.0a0.dist-info/RECORD +0 -152
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/WHEEL +0 -0
paid/contacts/raw_client.py
CHANGED
|
@@ -9,8 +9,16 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
9
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
10
|
from ..core.pydantic_utilities import parse_obj_as
|
|
11
11
|
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
+
from ..errors.bad_request_error import BadRequestError
|
|
14
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
15
|
+
from ..errors.internal_server_error import InternalServerError
|
|
16
|
+
from ..errors.not_found_error import NotFoundError
|
|
12
17
|
from ..types.contact import Contact
|
|
13
|
-
from ..types.
|
|
18
|
+
from ..types.contact_billing_address import ContactBillingAddress
|
|
19
|
+
from ..types.contact_list_response import ContactListResponse
|
|
20
|
+
from ..types.empty_response import EmptyResponse
|
|
21
|
+
from ..types.error_response import ErrorResponse
|
|
14
22
|
|
|
15
23
|
# this is used as the default value for optional parameters
|
|
16
24
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -20,60 +28,105 @@ class RawContactsClient:
|
|
|
20
28
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
29
|
self._client_wrapper = client_wrapper
|
|
22
30
|
|
|
23
|
-
def
|
|
31
|
+
def list_contacts(
|
|
32
|
+
self,
|
|
33
|
+
*,
|
|
34
|
+
limit: typing.Optional[int] = None,
|
|
35
|
+
offset: typing.Optional[int] = None,
|
|
36
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
37
|
+
) -> HttpResponse[ContactListResponse]:
|
|
24
38
|
"""
|
|
39
|
+
Get a list of contacts for the organization
|
|
40
|
+
|
|
25
41
|
Parameters
|
|
26
42
|
----------
|
|
43
|
+
limit : typing.Optional[int]
|
|
44
|
+
|
|
45
|
+
offset : typing.Optional[int]
|
|
46
|
+
|
|
27
47
|
request_options : typing.Optional[RequestOptions]
|
|
28
48
|
Request-specific configuration.
|
|
29
49
|
|
|
30
50
|
Returns
|
|
31
51
|
-------
|
|
32
|
-
HttpResponse[
|
|
33
|
-
|
|
52
|
+
HttpResponse[ContactListResponse]
|
|
53
|
+
200
|
|
34
54
|
"""
|
|
35
55
|
_response = self._client_wrapper.httpx_client.request(
|
|
36
|
-
"contacts",
|
|
56
|
+
"contacts/",
|
|
37
57
|
method="GET",
|
|
58
|
+
params={
|
|
59
|
+
"limit": limit,
|
|
60
|
+
"offset": offset,
|
|
61
|
+
},
|
|
38
62
|
request_options=request_options,
|
|
39
63
|
)
|
|
40
64
|
try:
|
|
41
65
|
if 200 <= _response.status_code < 300:
|
|
42
66
|
_data = typing.cast(
|
|
43
|
-
|
|
67
|
+
ContactListResponse,
|
|
44
68
|
parse_obj_as(
|
|
45
|
-
type_=
|
|
69
|
+
type_=ContactListResponse, # type: ignore
|
|
46
70
|
object_=_response.json(),
|
|
47
71
|
),
|
|
48
72
|
)
|
|
49
73
|
return HttpResponse(response=_response, data=_data)
|
|
74
|
+
if _response.status_code == 400:
|
|
75
|
+
raise BadRequestError(
|
|
76
|
+
headers=dict(_response.headers),
|
|
77
|
+
body=typing.cast(
|
|
78
|
+
ErrorResponse,
|
|
79
|
+
parse_obj_as(
|
|
80
|
+
type_=ErrorResponse, # type: ignore
|
|
81
|
+
object_=_response.json(),
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
if _response.status_code == 403:
|
|
86
|
+
raise ForbiddenError(
|
|
87
|
+
headers=dict(_response.headers),
|
|
88
|
+
body=typing.cast(
|
|
89
|
+
ErrorResponse,
|
|
90
|
+
parse_obj_as(
|
|
91
|
+
type_=ErrorResponse, # type: ignore
|
|
92
|
+
object_=_response.json(),
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
if _response.status_code == 500:
|
|
97
|
+
raise InternalServerError(
|
|
98
|
+
headers=dict(_response.headers),
|
|
99
|
+
body=typing.cast(
|
|
100
|
+
ErrorResponse,
|
|
101
|
+
parse_obj_as(
|
|
102
|
+
type_=ErrorResponse, # type: ignore
|
|
103
|
+
object_=_response.json(),
|
|
104
|
+
),
|
|
105
|
+
),
|
|
106
|
+
)
|
|
50
107
|
_response_json = _response.json()
|
|
51
108
|
except JSONDecodeError:
|
|
52
109
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
53
110
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
54
111
|
|
|
55
|
-
def
|
|
112
|
+
def create_contact(
|
|
56
113
|
self,
|
|
57
114
|
*,
|
|
58
|
-
|
|
115
|
+
customer_id: str,
|
|
59
116
|
first_name: str,
|
|
60
117
|
last_name: str,
|
|
61
118
|
email: str,
|
|
62
|
-
external_id: typing.Optional[str] = OMIT,
|
|
63
|
-
customer_id: typing.Optional[str] = OMIT,
|
|
64
|
-
customer_external_id: typing.Optional[str] = OMIT,
|
|
65
119
|
phone: typing.Optional[str] = OMIT,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
billing_state_province: typing.Optional[str] = OMIT,
|
|
69
|
-
billing_country: typing.Optional[str] = OMIT,
|
|
70
|
-
billing_postal_code: typing.Optional[str] = OMIT,
|
|
120
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
121
|
+
external_id: typing.Optional[str] = OMIT,
|
|
71
122
|
request_options: typing.Optional[RequestOptions] = None,
|
|
72
123
|
) -> HttpResponse[Contact]:
|
|
73
124
|
"""
|
|
125
|
+
Creates a new contact for the organization
|
|
126
|
+
|
|
74
127
|
Parameters
|
|
75
128
|
----------
|
|
76
|
-
|
|
129
|
+
customer_id : str
|
|
77
130
|
|
|
78
131
|
first_name : str
|
|
79
132
|
|
|
@@ -81,23 +134,11 @@ class RawContactsClient:
|
|
|
81
134
|
|
|
82
135
|
email : str
|
|
83
136
|
|
|
84
|
-
external_id : typing.Optional[str]
|
|
85
|
-
|
|
86
|
-
customer_id : typing.Optional[str]
|
|
87
|
-
|
|
88
|
-
customer_external_id : typing.Optional[str]
|
|
89
|
-
|
|
90
137
|
phone : typing.Optional[str]
|
|
91
138
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
billing_city : typing.Optional[str]
|
|
95
|
-
|
|
96
|
-
billing_state_province : typing.Optional[str]
|
|
139
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
97
140
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
billing_postal_code : typing.Optional[str]
|
|
141
|
+
external_id : typing.Optional[str]
|
|
101
142
|
|
|
102
143
|
request_options : typing.Optional[RequestOptions]
|
|
103
144
|
Request-specific configuration.
|
|
@@ -105,25 +146,21 @@ class RawContactsClient:
|
|
|
105
146
|
Returns
|
|
106
147
|
-------
|
|
107
148
|
HttpResponse[Contact]
|
|
108
|
-
|
|
149
|
+
201
|
|
109
150
|
"""
|
|
110
151
|
_response = self._client_wrapper.httpx_client.request(
|
|
111
|
-
"contacts",
|
|
152
|
+
"contacts/",
|
|
112
153
|
method="POST",
|
|
113
154
|
json={
|
|
114
|
-
"externalId": external_id,
|
|
115
155
|
"customerId": customer_id,
|
|
116
|
-
"customerExternalId": customer_external_id,
|
|
117
|
-
"salutation": salutation,
|
|
118
156
|
"firstName": first_name,
|
|
119
157
|
"lastName": last_name,
|
|
120
158
|
"email": email,
|
|
121
159
|
"phone": phone,
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
"
|
|
126
|
-
"billingPostalCode": billing_postal_code,
|
|
160
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
161
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
162
|
+
),
|
|
163
|
+
"externalId": external_id,
|
|
127
164
|
},
|
|
128
165
|
headers={
|
|
129
166
|
"content-type": "application/json",
|
|
@@ -141,16 +178,53 @@ class RawContactsClient:
|
|
|
141
178
|
),
|
|
142
179
|
)
|
|
143
180
|
return HttpResponse(response=_response, data=_data)
|
|
181
|
+
if _response.status_code == 400:
|
|
182
|
+
raise BadRequestError(
|
|
183
|
+
headers=dict(_response.headers),
|
|
184
|
+
body=typing.cast(
|
|
185
|
+
ErrorResponse,
|
|
186
|
+
parse_obj_as(
|
|
187
|
+
type_=ErrorResponse, # type: ignore
|
|
188
|
+
object_=_response.json(),
|
|
189
|
+
),
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
if _response.status_code == 403:
|
|
193
|
+
raise ForbiddenError(
|
|
194
|
+
headers=dict(_response.headers),
|
|
195
|
+
body=typing.cast(
|
|
196
|
+
ErrorResponse,
|
|
197
|
+
parse_obj_as(
|
|
198
|
+
type_=ErrorResponse, # type: ignore
|
|
199
|
+
object_=_response.json(),
|
|
200
|
+
),
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
if _response.status_code == 500:
|
|
204
|
+
raise InternalServerError(
|
|
205
|
+
headers=dict(_response.headers),
|
|
206
|
+
body=typing.cast(
|
|
207
|
+
ErrorResponse,
|
|
208
|
+
parse_obj_as(
|
|
209
|
+
type_=ErrorResponse, # type: ignore
|
|
210
|
+
object_=_response.json(),
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
)
|
|
144
214
|
_response_json = _response.json()
|
|
145
215
|
except JSONDecodeError:
|
|
146
216
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
147
217
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
148
218
|
|
|
149
|
-
def
|
|
219
|
+
def get_contact_by_id(
|
|
220
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
221
|
+
) -> HttpResponse[Contact]:
|
|
150
222
|
"""
|
|
223
|
+
Get a contact by its ID
|
|
224
|
+
|
|
151
225
|
Parameters
|
|
152
226
|
----------
|
|
153
|
-
|
|
227
|
+
id : str
|
|
154
228
|
|
|
155
229
|
request_options : typing.Optional[RequestOptions]
|
|
156
230
|
Request-specific configuration.
|
|
@@ -158,10 +232,10 @@ class RawContactsClient:
|
|
|
158
232
|
Returns
|
|
159
233
|
-------
|
|
160
234
|
HttpResponse[Contact]
|
|
161
|
-
|
|
235
|
+
200
|
|
162
236
|
"""
|
|
163
237
|
_response = self._client_wrapper.httpx_client.request(
|
|
164
|
-
f"contacts/{jsonable_encoder(
|
|
238
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
165
239
|
method="GET",
|
|
166
240
|
request_options=request_options,
|
|
167
241
|
)
|
|
@@ -175,41 +249,242 @@ class RawContactsClient:
|
|
|
175
249
|
),
|
|
176
250
|
)
|
|
177
251
|
return HttpResponse(response=_response, data=_data)
|
|
252
|
+
if _response.status_code == 403:
|
|
253
|
+
raise ForbiddenError(
|
|
254
|
+
headers=dict(_response.headers),
|
|
255
|
+
body=typing.cast(
|
|
256
|
+
ErrorResponse,
|
|
257
|
+
parse_obj_as(
|
|
258
|
+
type_=ErrorResponse, # type: ignore
|
|
259
|
+
object_=_response.json(),
|
|
260
|
+
),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
if _response.status_code == 404:
|
|
264
|
+
raise NotFoundError(
|
|
265
|
+
headers=dict(_response.headers),
|
|
266
|
+
body=typing.cast(
|
|
267
|
+
ErrorResponse,
|
|
268
|
+
parse_obj_as(
|
|
269
|
+
type_=ErrorResponse, # type: ignore
|
|
270
|
+
object_=_response.json(),
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
)
|
|
274
|
+
if _response.status_code == 500:
|
|
275
|
+
raise InternalServerError(
|
|
276
|
+
headers=dict(_response.headers),
|
|
277
|
+
body=typing.cast(
|
|
278
|
+
ErrorResponse,
|
|
279
|
+
parse_obj_as(
|
|
280
|
+
type_=ErrorResponse, # type: ignore
|
|
281
|
+
object_=_response.json(),
|
|
282
|
+
),
|
|
283
|
+
),
|
|
284
|
+
)
|
|
178
285
|
_response_json = _response.json()
|
|
179
286
|
except JSONDecodeError:
|
|
180
287
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
181
288
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
182
289
|
|
|
183
|
-
def
|
|
290
|
+
def update_contact_by_id(
|
|
291
|
+
self,
|
|
292
|
+
id: str,
|
|
293
|
+
*,
|
|
294
|
+
customer_id: typing.Optional[str] = OMIT,
|
|
295
|
+
first_name: typing.Optional[str] = OMIT,
|
|
296
|
+
last_name: typing.Optional[str] = OMIT,
|
|
297
|
+
email: typing.Optional[str] = OMIT,
|
|
298
|
+
phone: typing.Optional[str] = OMIT,
|
|
299
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
300
|
+
external_id: typing.Optional[str] = OMIT,
|
|
301
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
302
|
+
) -> HttpResponse[Contact]:
|
|
184
303
|
"""
|
|
304
|
+
Update a contact by its ID
|
|
305
|
+
|
|
185
306
|
Parameters
|
|
186
307
|
----------
|
|
187
|
-
|
|
308
|
+
id : str
|
|
309
|
+
|
|
310
|
+
customer_id : typing.Optional[str]
|
|
311
|
+
|
|
312
|
+
first_name : typing.Optional[str]
|
|
313
|
+
|
|
314
|
+
last_name : typing.Optional[str]
|
|
315
|
+
|
|
316
|
+
email : typing.Optional[str]
|
|
317
|
+
|
|
318
|
+
phone : typing.Optional[str]
|
|
319
|
+
|
|
320
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
321
|
+
|
|
322
|
+
external_id : typing.Optional[str]
|
|
188
323
|
|
|
189
324
|
request_options : typing.Optional[RequestOptions]
|
|
190
325
|
Request-specific configuration.
|
|
191
326
|
|
|
192
327
|
Returns
|
|
193
328
|
-------
|
|
194
|
-
HttpResponse[
|
|
329
|
+
HttpResponse[Contact]
|
|
330
|
+
200
|
|
195
331
|
"""
|
|
196
332
|
_response = self._client_wrapper.httpx_client.request(
|
|
197
|
-
f"contacts/{jsonable_encoder(
|
|
333
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
334
|
+
method="PUT",
|
|
335
|
+
json={
|
|
336
|
+
"customerId": customer_id,
|
|
337
|
+
"firstName": first_name,
|
|
338
|
+
"lastName": last_name,
|
|
339
|
+
"email": email,
|
|
340
|
+
"phone": phone,
|
|
341
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
342
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
343
|
+
),
|
|
344
|
+
"externalId": external_id,
|
|
345
|
+
},
|
|
346
|
+
headers={
|
|
347
|
+
"content-type": "application/json",
|
|
348
|
+
},
|
|
349
|
+
request_options=request_options,
|
|
350
|
+
omit=OMIT,
|
|
351
|
+
)
|
|
352
|
+
try:
|
|
353
|
+
if 200 <= _response.status_code < 300:
|
|
354
|
+
_data = typing.cast(
|
|
355
|
+
Contact,
|
|
356
|
+
parse_obj_as(
|
|
357
|
+
type_=Contact, # type: ignore
|
|
358
|
+
object_=_response.json(),
|
|
359
|
+
),
|
|
360
|
+
)
|
|
361
|
+
return HttpResponse(response=_response, data=_data)
|
|
362
|
+
if _response.status_code == 400:
|
|
363
|
+
raise BadRequestError(
|
|
364
|
+
headers=dict(_response.headers),
|
|
365
|
+
body=typing.cast(
|
|
366
|
+
ErrorResponse,
|
|
367
|
+
parse_obj_as(
|
|
368
|
+
type_=ErrorResponse, # type: ignore
|
|
369
|
+
object_=_response.json(),
|
|
370
|
+
),
|
|
371
|
+
),
|
|
372
|
+
)
|
|
373
|
+
if _response.status_code == 403:
|
|
374
|
+
raise ForbiddenError(
|
|
375
|
+
headers=dict(_response.headers),
|
|
376
|
+
body=typing.cast(
|
|
377
|
+
ErrorResponse,
|
|
378
|
+
parse_obj_as(
|
|
379
|
+
type_=ErrorResponse, # type: ignore
|
|
380
|
+
object_=_response.json(),
|
|
381
|
+
),
|
|
382
|
+
),
|
|
383
|
+
)
|
|
384
|
+
if _response.status_code == 404:
|
|
385
|
+
raise NotFoundError(
|
|
386
|
+
headers=dict(_response.headers),
|
|
387
|
+
body=typing.cast(
|
|
388
|
+
ErrorResponse,
|
|
389
|
+
parse_obj_as(
|
|
390
|
+
type_=ErrorResponse, # type: ignore
|
|
391
|
+
object_=_response.json(),
|
|
392
|
+
),
|
|
393
|
+
),
|
|
394
|
+
)
|
|
395
|
+
if _response.status_code == 500:
|
|
396
|
+
raise InternalServerError(
|
|
397
|
+
headers=dict(_response.headers),
|
|
398
|
+
body=typing.cast(
|
|
399
|
+
ErrorResponse,
|
|
400
|
+
parse_obj_as(
|
|
401
|
+
type_=ErrorResponse, # type: ignore
|
|
402
|
+
object_=_response.json(),
|
|
403
|
+
),
|
|
404
|
+
),
|
|
405
|
+
)
|
|
406
|
+
_response_json = _response.json()
|
|
407
|
+
except JSONDecodeError:
|
|
408
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
409
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
410
|
+
|
|
411
|
+
def delete_contact_by_id(
|
|
412
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
413
|
+
) -> HttpResponse[EmptyResponse]:
|
|
414
|
+
"""
|
|
415
|
+
Delete a contact by its ID
|
|
416
|
+
|
|
417
|
+
Parameters
|
|
418
|
+
----------
|
|
419
|
+
id : str
|
|
420
|
+
|
|
421
|
+
request_options : typing.Optional[RequestOptions]
|
|
422
|
+
Request-specific configuration.
|
|
423
|
+
|
|
424
|
+
Returns
|
|
425
|
+
-------
|
|
426
|
+
HttpResponse[EmptyResponse]
|
|
427
|
+
200
|
|
428
|
+
"""
|
|
429
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
430
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
198
431
|
method="DELETE",
|
|
199
432
|
request_options=request_options,
|
|
200
433
|
)
|
|
201
434
|
try:
|
|
202
435
|
if 200 <= _response.status_code < 300:
|
|
203
|
-
|
|
436
|
+
_data = typing.cast(
|
|
437
|
+
EmptyResponse,
|
|
438
|
+
parse_obj_as(
|
|
439
|
+
type_=EmptyResponse, # type: ignore
|
|
440
|
+
object_=_response.json(),
|
|
441
|
+
),
|
|
442
|
+
)
|
|
443
|
+
return HttpResponse(response=_response, data=_data)
|
|
444
|
+
if _response.status_code == 403:
|
|
445
|
+
raise ForbiddenError(
|
|
446
|
+
headers=dict(_response.headers),
|
|
447
|
+
body=typing.cast(
|
|
448
|
+
ErrorResponse,
|
|
449
|
+
parse_obj_as(
|
|
450
|
+
type_=ErrorResponse, # type: ignore
|
|
451
|
+
object_=_response.json(),
|
|
452
|
+
),
|
|
453
|
+
),
|
|
454
|
+
)
|
|
455
|
+
if _response.status_code == 404:
|
|
456
|
+
raise NotFoundError(
|
|
457
|
+
headers=dict(_response.headers),
|
|
458
|
+
body=typing.cast(
|
|
459
|
+
ErrorResponse,
|
|
460
|
+
parse_obj_as(
|
|
461
|
+
type_=ErrorResponse, # type: ignore
|
|
462
|
+
object_=_response.json(),
|
|
463
|
+
),
|
|
464
|
+
),
|
|
465
|
+
)
|
|
466
|
+
if _response.status_code == 500:
|
|
467
|
+
raise InternalServerError(
|
|
468
|
+
headers=dict(_response.headers),
|
|
469
|
+
body=typing.cast(
|
|
470
|
+
ErrorResponse,
|
|
471
|
+
parse_obj_as(
|
|
472
|
+
type_=ErrorResponse, # type: ignore
|
|
473
|
+
object_=_response.json(),
|
|
474
|
+
),
|
|
475
|
+
),
|
|
476
|
+
)
|
|
204
477
|
_response_json = _response.json()
|
|
205
478
|
except JSONDecodeError:
|
|
206
479
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
207
480
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
208
481
|
|
|
209
|
-
def
|
|
482
|
+
def get_contact_by_external_id(
|
|
210
483
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
211
484
|
) -> HttpResponse[Contact]:
|
|
212
485
|
"""
|
|
486
|
+
Get a contact by its external ID
|
|
487
|
+
|
|
213
488
|
Parameters
|
|
214
489
|
----------
|
|
215
490
|
external_id : str
|
|
@@ -220,7 +495,7 @@ class RawContactsClient:
|
|
|
220
495
|
Returns
|
|
221
496
|
-------
|
|
222
497
|
HttpResponse[Contact]
|
|
223
|
-
|
|
498
|
+
200
|
|
224
499
|
"""
|
|
225
500
|
_response = self._client_wrapper.httpx_client.request(
|
|
226
501
|
f"contacts/external/{jsonable_encoder(external_id)}",
|
|
@@ -237,15 +512,171 @@ class RawContactsClient:
|
|
|
237
512
|
),
|
|
238
513
|
)
|
|
239
514
|
return HttpResponse(response=_response, data=_data)
|
|
515
|
+
if _response.status_code == 403:
|
|
516
|
+
raise ForbiddenError(
|
|
517
|
+
headers=dict(_response.headers),
|
|
518
|
+
body=typing.cast(
|
|
519
|
+
ErrorResponse,
|
|
520
|
+
parse_obj_as(
|
|
521
|
+
type_=ErrorResponse, # type: ignore
|
|
522
|
+
object_=_response.json(),
|
|
523
|
+
),
|
|
524
|
+
),
|
|
525
|
+
)
|
|
526
|
+
if _response.status_code == 404:
|
|
527
|
+
raise NotFoundError(
|
|
528
|
+
headers=dict(_response.headers),
|
|
529
|
+
body=typing.cast(
|
|
530
|
+
ErrorResponse,
|
|
531
|
+
parse_obj_as(
|
|
532
|
+
type_=ErrorResponse, # type: ignore
|
|
533
|
+
object_=_response.json(),
|
|
534
|
+
),
|
|
535
|
+
),
|
|
536
|
+
)
|
|
537
|
+
if _response.status_code == 500:
|
|
538
|
+
raise InternalServerError(
|
|
539
|
+
headers=dict(_response.headers),
|
|
540
|
+
body=typing.cast(
|
|
541
|
+
ErrorResponse,
|
|
542
|
+
parse_obj_as(
|
|
543
|
+
type_=ErrorResponse, # type: ignore
|
|
544
|
+
object_=_response.json(),
|
|
545
|
+
),
|
|
546
|
+
),
|
|
547
|
+
)
|
|
548
|
+
_response_json = _response.json()
|
|
549
|
+
except JSONDecodeError:
|
|
550
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
551
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
552
|
+
|
|
553
|
+
def update_contact_by_external_id(
|
|
554
|
+
self,
|
|
555
|
+
external_id_: str,
|
|
556
|
+
*,
|
|
557
|
+
customer_id: typing.Optional[str] = OMIT,
|
|
558
|
+
first_name: typing.Optional[str] = OMIT,
|
|
559
|
+
last_name: typing.Optional[str] = OMIT,
|
|
560
|
+
email: typing.Optional[str] = OMIT,
|
|
561
|
+
phone: typing.Optional[str] = OMIT,
|
|
562
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
563
|
+
external_id: typing.Optional[str] = OMIT,
|
|
564
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
565
|
+
) -> HttpResponse[Contact]:
|
|
566
|
+
"""
|
|
567
|
+
Update a contact by its external ID
|
|
568
|
+
|
|
569
|
+
Parameters
|
|
570
|
+
----------
|
|
571
|
+
external_id_ : str
|
|
572
|
+
|
|
573
|
+
customer_id : typing.Optional[str]
|
|
574
|
+
|
|
575
|
+
first_name : typing.Optional[str]
|
|
576
|
+
|
|
577
|
+
last_name : typing.Optional[str]
|
|
578
|
+
|
|
579
|
+
email : typing.Optional[str]
|
|
580
|
+
|
|
581
|
+
phone : typing.Optional[str]
|
|
582
|
+
|
|
583
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
584
|
+
|
|
585
|
+
external_id : typing.Optional[str]
|
|
586
|
+
|
|
587
|
+
request_options : typing.Optional[RequestOptions]
|
|
588
|
+
Request-specific configuration.
|
|
589
|
+
|
|
590
|
+
Returns
|
|
591
|
+
-------
|
|
592
|
+
HttpResponse[Contact]
|
|
593
|
+
200
|
|
594
|
+
"""
|
|
595
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
596
|
+
f"contacts/external/{jsonable_encoder(external_id_)}",
|
|
597
|
+
method="PUT",
|
|
598
|
+
json={
|
|
599
|
+
"customerId": customer_id,
|
|
600
|
+
"firstName": first_name,
|
|
601
|
+
"lastName": last_name,
|
|
602
|
+
"email": email,
|
|
603
|
+
"phone": phone,
|
|
604
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
605
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
606
|
+
),
|
|
607
|
+
"externalId": external_id,
|
|
608
|
+
},
|
|
609
|
+
headers={
|
|
610
|
+
"content-type": "application/json",
|
|
611
|
+
},
|
|
612
|
+
request_options=request_options,
|
|
613
|
+
omit=OMIT,
|
|
614
|
+
)
|
|
615
|
+
try:
|
|
616
|
+
if 200 <= _response.status_code < 300:
|
|
617
|
+
_data = typing.cast(
|
|
618
|
+
Contact,
|
|
619
|
+
parse_obj_as(
|
|
620
|
+
type_=Contact, # type: ignore
|
|
621
|
+
object_=_response.json(),
|
|
622
|
+
),
|
|
623
|
+
)
|
|
624
|
+
return HttpResponse(response=_response, data=_data)
|
|
625
|
+
if _response.status_code == 400:
|
|
626
|
+
raise BadRequestError(
|
|
627
|
+
headers=dict(_response.headers),
|
|
628
|
+
body=typing.cast(
|
|
629
|
+
ErrorResponse,
|
|
630
|
+
parse_obj_as(
|
|
631
|
+
type_=ErrorResponse, # type: ignore
|
|
632
|
+
object_=_response.json(),
|
|
633
|
+
),
|
|
634
|
+
),
|
|
635
|
+
)
|
|
636
|
+
if _response.status_code == 403:
|
|
637
|
+
raise ForbiddenError(
|
|
638
|
+
headers=dict(_response.headers),
|
|
639
|
+
body=typing.cast(
|
|
640
|
+
ErrorResponse,
|
|
641
|
+
parse_obj_as(
|
|
642
|
+
type_=ErrorResponse, # type: ignore
|
|
643
|
+
object_=_response.json(),
|
|
644
|
+
),
|
|
645
|
+
),
|
|
646
|
+
)
|
|
647
|
+
if _response.status_code == 404:
|
|
648
|
+
raise NotFoundError(
|
|
649
|
+
headers=dict(_response.headers),
|
|
650
|
+
body=typing.cast(
|
|
651
|
+
ErrorResponse,
|
|
652
|
+
parse_obj_as(
|
|
653
|
+
type_=ErrorResponse, # type: ignore
|
|
654
|
+
object_=_response.json(),
|
|
655
|
+
),
|
|
656
|
+
),
|
|
657
|
+
)
|
|
658
|
+
if _response.status_code == 500:
|
|
659
|
+
raise InternalServerError(
|
|
660
|
+
headers=dict(_response.headers),
|
|
661
|
+
body=typing.cast(
|
|
662
|
+
ErrorResponse,
|
|
663
|
+
parse_obj_as(
|
|
664
|
+
type_=ErrorResponse, # type: ignore
|
|
665
|
+
object_=_response.json(),
|
|
666
|
+
),
|
|
667
|
+
),
|
|
668
|
+
)
|
|
240
669
|
_response_json = _response.json()
|
|
241
670
|
except JSONDecodeError:
|
|
242
671
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
243
672
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
244
673
|
|
|
245
|
-
def
|
|
674
|
+
def delete_contact_by_external_id(
|
|
246
675
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
247
|
-
) -> HttpResponse[
|
|
676
|
+
) -> HttpResponse[EmptyResponse]:
|
|
248
677
|
"""
|
|
678
|
+
Delete a contact by its external ID
|
|
679
|
+
|
|
249
680
|
Parameters
|
|
250
681
|
----------
|
|
251
682
|
external_id : str
|
|
@@ -255,7 +686,8 @@ class RawContactsClient:
|
|
|
255
686
|
|
|
256
687
|
Returns
|
|
257
688
|
-------
|
|
258
|
-
HttpResponse[
|
|
689
|
+
HttpResponse[EmptyResponse]
|
|
690
|
+
200
|
|
259
691
|
"""
|
|
260
692
|
_response = self._client_wrapper.httpx_client.request(
|
|
261
693
|
f"contacts/external/{jsonable_encoder(external_id)}",
|
|
@@ -264,7 +696,47 @@ class RawContactsClient:
|
|
|
264
696
|
)
|
|
265
697
|
try:
|
|
266
698
|
if 200 <= _response.status_code < 300:
|
|
267
|
-
|
|
699
|
+
_data = typing.cast(
|
|
700
|
+
EmptyResponse,
|
|
701
|
+
parse_obj_as(
|
|
702
|
+
type_=EmptyResponse, # type: ignore
|
|
703
|
+
object_=_response.json(),
|
|
704
|
+
),
|
|
705
|
+
)
|
|
706
|
+
return HttpResponse(response=_response, data=_data)
|
|
707
|
+
if _response.status_code == 403:
|
|
708
|
+
raise ForbiddenError(
|
|
709
|
+
headers=dict(_response.headers),
|
|
710
|
+
body=typing.cast(
|
|
711
|
+
ErrorResponse,
|
|
712
|
+
parse_obj_as(
|
|
713
|
+
type_=ErrorResponse, # type: ignore
|
|
714
|
+
object_=_response.json(),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
)
|
|
718
|
+
if _response.status_code == 404:
|
|
719
|
+
raise NotFoundError(
|
|
720
|
+
headers=dict(_response.headers),
|
|
721
|
+
body=typing.cast(
|
|
722
|
+
ErrorResponse,
|
|
723
|
+
parse_obj_as(
|
|
724
|
+
type_=ErrorResponse, # type: ignore
|
|
725
|
+
object_=_response.json(),
|
|
726
|
+
),
|
|
727
|
+
),
|
|
728
|
+
)
|
|
729
|
+
if _response.status_code == 500:
|
|
730
|
+
raise InternalServerError(
|
|
731
|
+
headers=dict(_response.headers),
|
|
732
|
+
body=typing.cast(
|
|
733
|
+
ErrorResponse,
|
|
734
|
+
parse_obj_as(
|
|
735
|
+
type_=ErrorResponse, # type: ignore
|
|
736
|
+
object_=_response.json(),
|
|
737
|
+
),
|
|
738
|
+
),
|
|
739
|
+
)
|
|
268
740
|
_response_json = _response.json()
|
|
269
741
|
except JSONDecodeError:
|
|
270
742
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -275,62 +747,105 @@ class AsyncRawContactsClient:
|
|
|
275
747
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
276
748
|
self._client_wrapper = client_wrapper
|
|
277
749
|
|
|
278
|
-
async def
|
|
279
|
-
self,
|
|
280
|
-
|
|
750
|
+
async def list_contacts(
|
|
751
|
+
self,
|
|
752
|
+
*,
|
|
753
|
+
limit: typing.Optional[int] = None,
|
|
754
|
+
offset: typing.Optional[int] = None,
|
|
755
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
756
|
+
) -> AsyncHttpResponse[ContactListResponse]:
|
|
281
757
|
"""
|
|
758
|
+
Get a list of contacts for the organization
|
|
759
|
+
|
|
282
760
|
Parameters
|
|
283
761
|
----------
|
|
762
|
+
limit : typing.Optional[int]
|
|
763
|
+
|
|
764
|
+
offset : typing.Optional[int]
|
|
765
|
+
|
|
284
766
|
request_options : typing.Optional[RequestOptions]
|
|
285
767
|
Request-specific configuration.
|
|
286
768
|
|
|
287
769
|
Returns
|
|
288
770
|
-------
|
|
289
|
-
AsyncHttpResponse[
|
|
290
|
-
|
|
771
|
+
AsyncHttpResponse[ContactListResponse]
|
|
772
|
+
200
|
|
291
773
|
"""
|
|
292
774
|
_response = await self._client_wrapper.httpx_client.request(
|
|
293
|
-
"contacts",
|
|
775
|
+
"contacts/",
|
|
294
776
|
method="GET",
|
|
777
|
+
params={
|
|
778
|
+
"limit": limit,
|
|
779
|
+
"offset": offset,
|
|
780
|
+
},
|
|
295
781
|
request_options=request_options,
|
|
296
782
|
)
|
|
297
783
|
try:
|
|
298
784
|
if 200 <= _response.status_code < 300:
|
|
299
785
|
_data = typing.cast(
|
|
300
|
-
|
|
786
|
+
ContactListResponse,
|
|
301
787
|
parse_obj_as(
|
|
302
|
-
type_=
|
|
788
|
+
type_=ContactListResponse, # type: ignore
|
|
303
789
|
object_=_response.json(),
|
|
304
790
|
),
|
|
305
791
|
)
|
|
306
792
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
793
|
+
if _response.status_code == 400:
|
|
794
|
+
raise BadRequestError(
|
|
795
|
+
headers=dict(_response.headers),
|
|
796
|
+
body=typing.cast(
|
|
797
|
+
ErrorResponse,
|
|
798
|
+
parse_obj_as(
|
|
799
|
+
type_=ErrorResponse, # type: ignore
|
|
800
|
+
object_=_response.json(),
|
|
801
|
+
),
|
|
802
|
+
),
|
|
803
|
+
)
|
|
804
|
+
if _response.status_code == 403:
|
|
805
|
+
raise ForbiddenError(
|
|
806
|
+
headers=dict(_response.headers),
|
|
807
|
+
body=typing.cast(
|
|
808
|
+
ErrorResponse,
|
|
809
|
+
parse_obj_as(
|
|
810
|
+
type_=ErrorResponse, # type: ignore
|
|
811
|
+
object_=_response.json(),
|
|
812
|
+
),
|
|
813
|
+
),
|
|
814
|
+
)
|
|
815
|
+
if _response.status_code == 500:
|
|
816
|
+
raise InternalServerError(
|
|
817
|
+
headers=dict(_response.headers),
|
|
818
|
+
body=typing.cast(
|
|
819
|
+
ErrorResponse,
|
|
820
|
+
parse_obj_as(
|
|
821
|
+
type_=ErrorResponse, # type: ignore
|
|
822
|
+
object_=_response.json(),
|
|
823
|
+
),
|
|
824
|
+
),
|
|
825
|
+
)
|
|
307
826
|
_response_json = _response.json()
|
|
308
827
|
except JSONDecodeError:
|
|
309
828
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
310
829
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
311
830
|
|
|
312
|
-
async def
|
|
831
|
+
async def create_contact(
|
|
313
832
|
self,
|
|
314
833
|
*,
|
|
315
|
-
|
|
834
|
+
customer_id: str,
|
|
316
835
|
first_name: str,
|
|
317
836
|
last_name: str,
|
|
318
837
|
email: str,
|
|
319
|
-
external_id: typing.Optional[str] = OMIT,
|
|
320
|
-
customer_id: typing.Optional[str] = OMIT,
|
|
321
|
-
customer_external_id: typing.Optional[str] = OMIT,
|
|
322
838
|
phone: typing.Optional[str] = OMIT,
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
billing_state_province: typing.Optional[str] = OMIT,
|
|
326
|
-
billing_country: typing.Optional[str] = OMIT,
|
|
327
|
-
billing_postal_code: typing.Optional[str] = OMIT,
|
|
839
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
840
|
+
external_id: typing.Optional[str] = OMIT,
|
|
328
841
|
request_options: typing.Optional[RequestOptions] = None,
|
|
329
842
|
) -> AsyncHttpResponse[Contact]:
|
|
330
843
|
"""
|
|
844
|
+
Creates a new contact for the organization
|
|
845
|
+
|
|
331
846
|
Parameters
|
|
332
847
|
----------
|
|
333
|
-
|
|
848
|
+
customer_id : str
|
|
334
849
|
|
|
335
850
|
first_name : str
|
|
336
851
|
|
|
@@ -338,23 +853,11 @@ class AsyncRawContactsClient:
|
|
|
338
853
|
|
|
339
854
|
email : str
|
|
340
855
|
|
|
341
|
-
external_id : typing.Optional[str]
|
|
342
|
-
|
|
343
|
-
customer_id : typing.Optional[str]
|
|
344
|
-
|
|
345
|
-
customer_external_id : typing.Optional[str]
|
|
346
|
-
|
|
347
856
|
phone : typing.Optional[str]
|
|
348
857
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
billing_city : typing.Optional[str]
|
|
858
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
352
859
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
billing_country : typing.Optional[str]
|
|
356
|
-
|
|
357
|
-
billing_postal_code : typing.Optional[str]
|
|
860
|
+
external_id : typing.Optional[str]
|
|
358
861
|
|
|
359
862
|
request_options : typing.Optional[RequestOptions]
|
|
360
863
|
Request-specific configuration.
|
|
@@ -362,25 +865,21 @@ class AsyncRawContactsClient:
|
|
|
362
865
|
Returns
|
|
363
866
|
-------
|
|
364
867
|
AsyncHttpResponse[Contact]
|
|
365
|
-
|
|
868
|
+
201
|
|
366
869
|
"""
|
|
367
870
|
_response = await self._client_wrapper.httpx_client.request(
|
|
368
|
-
"contacts",
|
|
871
|
+
"contacts/",
|
|
369
872
|
method="POST",
|
|
370
873
|
json={
|
|
371
|
-
"externalId": external_id,
|
|
372
874
|
"customerId": customer_id,
|
|
373
|
-
"customerExternalId": customer_external_id,
|
|
374
|
-
"salutation": salutation,
|
|
375
875
|
"firstName": first_name,
|
|
376
876
|
"lastName": last_name,
|
|
377
877
|
"email": email,
|
|
378
878
|
"phone": phone,
|
|
379
|
-
"
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
"
|
|
383
|
-
"billingPostalCode": billing_postal_code,
|
|
879
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
880
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
881
|
+
),
|
|
882
|
+
"externalId": external_id,
|
|
384
883
|
},
|
|
385
884
|
headers={
|
|
386
885
|
"content-type": "application/json",
|
|
@@ -398,18 +897,53 @@ class AsyncRawContactsClient:
|
|
|
398
897
|
),
|
|
399
898
|
)
|
|
400
899
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
900
|
+
if _response.status_code == 400:
|
|
901
|
+
raise BadRequestError(
|
|
902
|
+
headers=dict(_response.headers),
|
|
903
|
+
body=typing.cast(
|
|
904
|
+
ErrorResponse,
|
|
905
|
+
parse_obj_as(
|
|
906
|
+
type_=ErrorResponse, # type: ignore
|
|
907
|
+
object_=_response.json(),
|
|
908
|
+
),
|
|
909
|
+
),
|
|
910
|
+
)
|
|
911
|
+
if _response.status_code == 403:
|
|
912
|
+
raise ForbiddenError(
|
|
913
|
+
headers=dict(_response.headers),
|
|
914
|
+
body=typing.cast(
|
|
915
|
+
ErrorResponse,
|
|
916
|
+
parse_obj_as(
|
|
917
|
+
type_=ErrorResponse, # type: ignore
|
|
918
|
+
object_=_response.json(),
|
|
919
|
+
),
|
|
920
|
+
),
|
|
921
|
+
)
|
|
922
|
+
if _response.status_code == 500:
|
|
923
|
+
raise InternalServerError(
|
|
924
|
+
headers=dict(_response.headers),
|
|
925
|
+
body=typing.cast(
|
|
926
|
+
ErrorResponse,
|
|
927
|
+
parse_obj_as(
|
|
928
|
+
type_=ErrorResponse, # type: ignore
|
|
929
|
+
object_=_response.json(),
|
|
930
|
+
),
|
|
931
|
+
),
|
|
932
|
+
)
|
|
401
933
|
_response_json = _response.json()
|
|
402
934
|
except JSONDecodeError:
|
|
403
935
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
404
936
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
405
937
|
|
|
406
|
-
async def
|
|
407
|
-
self,
|
|
938
|
+
async def get_contact_by_id(
|
|
939
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
408
940
|
) -> AsyncHttpResponse[Contact]:
|
|
409
941
|
"""
|
|
942
|
+
Get a contact by its ID
|
|
943
|
+
|
|
410
944
|
Parameters
|
|
411
945
|
----------
|
|
412
|
-
|
|
946
|
+
id : str
|
|
413
947
|
|
|
414
948
|
request_options : typing.Optional[RequestOptions]
|
|
415
949
|
Request-specific configuration.
|
|
@@ -417,10 +951,10 @@ class AsyncRawContactsClient:
|
|
|
417
951
|
Returns
|
|
418
952
|
-------
|
|
419
953
|
AsyncHttpResponse[Contact]
|
|
420
|
-
|
|
954
|
+
200
|
|
421
955
|
"""
|
|
422
956
|
_response = await self._client_wrapper.httpx_client.request(
|
|
423
|
-
f"contacts/{jsonable_encoder(
|
|
957
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
424
958
|
method="GET",
|
|
425
959
|
request_options=request_options,
|
|
426
960
|
)
|
|
@@ -434,43 +968,242 @@ class AsyncRawContactsClient:
|
|
|
434
968
|
),
|
|
435
969
|
)
|
|
436
970
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
971
|
+
if _response.status_code == 403:
|
|
972
|
+
raise ForbiddenError(
|
|
973
|
+
headers=dict(_response.headers),
|
|
974
|
+
body=typing.cast(
|
|
975
|
+
ErrorResponse,
|
|
976
|
+
parse_obj_as(
|
|
977
|
+
type_=ErrorResponse, # type: ignore
|
|
978
|
+
object_=_response.json(),
|
|
979
|
+
),
|
|
980
|
+
),
|
|
981
|
+
)
|
|
982
|
+
if _response.status_code == 404:
|
|
983
|
+
raise NotFoundError(
|
|
984
|
+
headers=dict(_response.headers),
|
|
985
|
+
body=typing.cast(
|
|
986
|
+
ErrorResponse,
|
|
987
|
+
parse_obj_as(
|
|
988
|
+
type_=ErrorResponse, # type: ignore
|
|
989
|
+
object_=_response.json(),
|
|
990
|
+
),
|
|
991
|
+
),
|
|
992
|
+
)
|
|
993
|
+
if _response.status_code == 500:
|
|
994
|
+
raise InternalServerError(
|
|
995
|
+
headers=dict(_response.headers),
|
|
996
|
+
body=typing.cast(
|
|
997
|
+
ErrorResponse,
|
|
998
|
+
parse_obj_as(
|
|
999
|
+
type_=ErrorResponse, # type: ignore
|
|
1000
|
+
object_=_response.json(),
|
|
1001
|
+
),
|
|
1002
|
+
),
|
|
1003
|
+
)
|
|
1004
|
+
_response_json = _response.json()
|
|
1005
|
+
except JSONDecodeError:
|
|
1006
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1007
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1008
|
+
|
|
1009
|
+
async def update_contact_by_id(
|
|
1010
|
+
self,
|
|
1011
|
+
id: str,
|
|
1012
|
+
*,
|
|
1013
|
+
customer_id: typing.Optional[str] = OMIT,
|
|
1014
|
+
first_name: typing.Optional[str] = OMIT,
|
|
1015
|
+
last_name: typing.Optional[str] = OMIT,
|
|
1016
|
+
email: typing.Optional[str] = OMIT,
|
|
1017
|
+
phone: typing.Optional[str] = OMIT,
|
|
1018
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
1019
|
+
external_id: typing.Optional[str] = OMIT,
|
|
1020
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1021
|
+
) -> AsyncHttpResponse[Contact]:
|
|
1022
|
+
"""
|
|
1023
|
+
Update a contact by its ID
|
|
1024
|
+
|
|
1025
|
+
Parameters
|
|
1026
|
+
----------
|
|
1027
|
+
id : str
|
|
1028
|
+
|
|
1029
|
+
customer_id : typing.Optional[str]
|
|
1030
|
+
|
|
1031
|
+
first_name : typing.Optional[str]
|
|
1032
|
+
|
|
1033
|
+
last_name : typing.Optional[str]
|
|
1034
|
+
|
|
1035
|
+
email : typing.Optional[str]
|
|
1036
|
+
|
|
1037
|
+
phone : typing.Optional[str]
|
|
1038
|
+
|
|
1039
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
1040
|
+
|
|
1041
|
+
external_id : typing.Optional[str]
|
|
1042
|
+
|
|
1043
|
+
request_options : typing.Optional[RequestOptions]
|
|
1044
|
+
Request-specific configuration.
|
|
1045
|
+
|
|
1046
|
+
Returns
|
|
1047
|
+
-------
|
|
1048
|
+
AsyncHttpResponse[Contact]
|
|
1049
|
+
200
|
|
1050
|
+
"""
|
|
1051
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1052
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
1053
|
+
method="PUT",
|
|
1054
|
+
json={
|
|
1055
|
+
"customerId": customer_id,
|
|
1056
|
+
"firstName": first_name,
|
|
1057
|
+
"lastName": last_name,
|
|
1058
|
+
"email": email,
|
|
1059
|
+
"phone": phone,
|
|
1060
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
1061
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
1062
|
+
),
|
|
1063
|
+
"externalId": external_id,
|
|
1064
|
+
},
|
|
1065
|
+
headers={
|
|
1066
|
+
"content-type": "application/json",
|
|
1067
|
+
},
|
|
1068
|
+
request_options=request_options,
|
|
1069
|
+
omit=OMIT,
|
|
1070
|
+
)
|
|
1071
|
+
try:
|
|
1072
|
+
if 200 <= _response.status_code < 300:
|
|
1073
|
+
_data = typing.cast(
|
|
1074
|
+
Contact,
|
|
1075
|
+
parse_obj_as(
|
|
1076
|
+
type_=Contact, # type: ignore
|
|
1077
|
+
object_=_response.json(),
|
|
1078
|
+
),
|
|
1079
|
+
)
|
|
1080
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1081
|
+
if _response.status_code == 400:
|
|
1082
|
+
raise BadRequestError(
|
|
1083
|
+
headers=dict(_response.headers),
|
|
1084
|
+
body=typing.cast(
|
|
1085
|
+
ErrorResponse,
|
|
1086
|
+
parse_obj_as(
|
|
1087
|
+
type_=ErrorResponse, # type: ignore
|
|
1088
|
+
object_=_response.json(),
|
|
1089
|
+
),
|
|
1090
|
+
),
|
|
1091
|
+
)
|
|
1092
|
+
if _response.status_code == 403:
|
|
1093
|
+
raise ForbiddenError(
|
|
1094
|
+
headers=dict(_response.headers),
|
|
1095
|
+
body=typing.cast(
|
|
1096
|
+
ErrorResponse,
|
|
1097
|
+
parse_obj_as(
|
|
1098
|
+
type_=ErrorResponse, # type: ignore
|
|
1099
|
+
object_=_response.json(),
|
|
1100
|
+
),
|
|
1101
|
+
),
|
|
1102
|
+
)
|
|
1103
|
+
if _response.status_code == 404:
|
|
1104
|
+
raise NotFoundError(
|
|
1105
|
+
headers=dict(_response.headers),
|
|
1106
|
+
body=typing.cast(
|
|
1107
|
+
ErrorResponse,
|
|
1108
|
+
parse_obj_as(
|
|
1109
|
+
type_=ErrorResponse, # type: ignore
|
|
1110
|
+
object_=_response.json(),
|
|
1111
|
+
),
|
|
1112
|
+
),
|
|
1113
|
+
)
|
|
1114
|
+
if _response.status_code == 500:
|
|
1115
|
+
raise InternalServerError(
|
|
1116
|
+
headers=dict(_response.headers),
|
|
1117
|
+
body=typing.cast(
|
|
1118
|
+
ErrorResponse,
|
|
1119
|
+
parse_obj_as(
|
|
1120
|
+
type_=ErrorResponse, # type: ignore
|
|
1121
|
+
object_=_response.json(),
|
|
1122
|
+
),
|
|
1123
|
+
),
|
|
1124
|
+
)
|
|
437
1125
|
_response_json = _response.json()
|
|
438
1126
|
except JSONDecodeError:
|
|
439
1127
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
440
1128
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
441
1129
|
|
|
442
|
-
async def
|
|
443
|
-
self,
|
|
444
|
-
) -> AsyncHttpResponse[
|
|
1130
|
+
async def delete_contact_by_id(
|
|
1131
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1132
|
+
) -> AsyncHttpResponse[EmptyResponse]:
|
|
445
1133
|
"""
|
|
1134
|
+
Delete a contact by its ID
|
|
1135
|
+
|
|
446
1136
|
Parameters
|
|
447
1137
|
----------
|
|
448
|
-
|
|
1138
|
+
id : str
|
|
449
1139
|
|
|
450
1140
|
request_options : typing.Optional[RequestOptions]
|
|
451
1141
|
Request-specific configuration.
|
|
452
1142
|
|
|
453
1143
|
Returns
|
|
454
1144
|
-------
|
|
455
|
-
AsyncHttpResponse[
|
|
1145
|
+
AsyncHttpResponse[EmptyResponse]
|
|
1146
|
+
200
|
|
456
1147
|
"""
|
|
457
1148
|
_response = await self._client_wrapper.httpx_client.request(
|
|
458
|
-
f"contacts/{jsonable_encoder(
|
|
1149
|
+
f"contacts/{jsonable_encoder(id)}",
|
|
459
1150
|
method="DELETE",
|
|
460
1151
|
request_options=request_options,
|
|
461
1152
|
)
|
|
462
1153
|
try:
|
|
463
1154
|
if 200 <= _response.status_code < 300:
|
|
464
|
-
|
|
1155
|
+
_data = typing.cast(
|
|
1156
|
+
EmptyResponse,
|
|
1157
|
+
parse_obj_as(
|
|
1158
|
+
type_=EmptyResponse, # type: ignore
|
|
1159
|
+
object_=_response.json(),
|
|
1160
|
+
),
|
|
1161
|
+
)
|
|
1162
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1163
|
+
if _response.status_code == 403:
|
|
1164
|
+
raise ForbiddenError(
|
|
1165
|
+
headers=dict(_response.headers),
|
|
1166
|
+
body=typing.cast(
|
|
1167
|
+
ErrorResponse,
|
|
1168
|
+
parse_obj_as(
|
|
1169
|
+
type_=ErrorResponse, # type: ignore
|
|
1170
|
+
object_=_response.json(),
|
|
1171
|
+
),
|
|
1172
|
+
),
|
|
1173
|
+
)
|
|
1174
|
+
if _response.status_code == 404:
|
|
1175
|
+
raise NotFoundError(
|
|
1176
|
+
headers=dict(_response.headers),
|
|
1177
|
+
body=typing.cast(
|
|
1178
|
+
ErrorResponse,
|
|
1179
|
+
parse_obj_as(
|
|
1180
|
+
type_=ErrorResponse, # type: ignore
|
|
1181
|
+
object_=_response.json(),
|
|
1182
|
+
),
|
|
1183
|
+
),
|
|
1184
|
+
)
|
|
1185
|
+
if _response.status_code == 500:
|
|
1186
|
+
raise InternalServerError(
|
|
1187
|
+
headers=dict(_response.headers),
|
|
1188
|
+
body=typing.cast(
|
|
1189
|
+
ErrorResponse,
|
|
1190
|
+
parse_obj_as(
|
|
1191
|
+
type_=ErrorResponse, # type: ignore
|
|
1192
|
+
object_=_response.json(),
|
|
1193
|
+
),
|
|
1194
|
+
),
|
|
1195
|
+
)
|
|
465
1196
|
_response_json = _response.json()
|
|
466
1197
|
except JSONDecodeError:
|
|
467
1198
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
468
1199
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
469
1200
|
|
|
470
|
-
async def
|
|
1201
|
+
async def get_contact_by_external_id(
|
|
471
1202
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
472
1203
|
) -> AsyncHttpResponse[Contact]:
|
|
473
1204
|
"""
|
|
1205
|
+
Get a contact by its external ID
|
|
1206
|
+
|
|
474
1207
|
Parameters
|
|
475
1208
|
----------
|
|
476
1209
|
external_id : str
|
|
@@ -481,7 +1214,7 @@ class AsyncRawContactsClient:
|
|
|
481
1214
|
Returns
|
|
482
1215
|
-------
|
|
483
1216
|
AsyncHttpResponse[Contact]
|
|
484
|
-
|
|
1217
|
+
200
|
|
485
1218
|
"""
|
|
486
1219
|
_response = await self._client_wrapper.httpx_client.request(
|
|
487
1220
|
f"contacts/external/{jsonable_encoder(external_id)}",
|
|
@@ -498,15 +1231,171 @@ class AsyncRawContactsClient:
|
|
|
498
1231
|
),
|
|
499
1232
|
)
|
|
500
1233
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1234
|
+
if _response.status_code == 403:
|
|
1235
|
+
raise ForbiddenError(
|
|
1236
|
+
headers=dict(_response.headers),
|
|
1237
|
+
body=typing.cast(
|
|
1238
|
+
ErrorResponse,
|
|
1239
|
+
parse_obj_as(
|
|
1240
|
+
type_=ErrorResponse, # type: ignore
|
|
1241
|
+
object_=_response.json(),
|
|
1242
|
+
),
|
|
1243
|
+
),
|
|
1244
|
+
)
|
|
1245
|
+
if _response.status_code == 404:
|
|
1246
|
+
raise NotFoundError(
|
|
1247
|
+
headers=dict(_response.headers),
|
|
1248
|
+
body=typing.cast(
|
|
1249
|
+
ErrorResponse,
|
|
1250
|
+
parse_obj_as(
|
|
1251
|
+
type_=ErrorResponse, # type: ignore
|
|
1252
|
+
object_=_response.json(),
|
|
1253
|
+
),
|
|
1254
|
+
),
|
|
1255
|
+
)
|
|
1256
|
+
if _response.status_code == 500:
|
|
1257
|
+
raise InternalServerError(
|
|
1258
|
+
headers=dict(_response.headers),
|
|
1259
|
+
body=typing.cast(
|
|
1260
|
+
ErrorResponse,
|
|
1261
|
+
parse_obj_as(
|
|
1262
|
+
type_=ErrorResponse, # type: ignore
|
|
1263
|
+
object_=_response.json(),
|
|
1264
|
+
),
|
|
1265
|
+
),
|
|
1266
|
+
)
|
|
1267
|
+
_response_json = _response.json()
|
|
1268
|
+
except JSONDecodeError:
|
|
1269
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1270
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1271
|
+
|
|
1272
|
+
async def update_contact_by_external_id(
|
|
1273
|
+
self,
|
|
1274
|
+
external_id_: str,
|
|
1275
|
+
*,
|
|
1276
|
+
customer_id: typing.Optional[str] = OMIT,
|
|
1277
|
+
first_name: typing.Optional[str] = OMIT,
|
|
1278
|
+
last_name: typing.Optional[str] = OMIT,
|
|
1279
|
+
email: typing.Optional[str] = OMIT,
|
|
1280
|
+
phone: typing.Optional[str] = OMIT,
|
|
1281
|
+
billing_address: typing.Optional[ContactBillingAddress] = OMIT,
|
|
1282
|
+
external_id: typing.Optional[str] = OMIT,
|
|
1283
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1284
|
+
) -> AsyncHttpResponse[Contact]:
|
|
1285
|
+
"""
|
|
1286
|
+
Update a contact by its external ID
|
|
1287
|
+
|
|
1288
|
+
Parameters
|
|
1289
|
+
----------
|
|
1290
|
+
external_id_ : str
|
|
1291
|
+
|
|
1292
|
+
customer_id : typing.Optional[str]
|
|
1293
|
+
|
|
1294
|
+
first_name : typing.Optional[str]
|
|
1295
|
+
|
|
1296
|
+
last_name : typing.Optional[str]
|
|
1297
|
+
|
|
1298
|
+
email : typing.Optional[str]
|
|
1299
|
+
|
|
1300
|
+
phone : typing.Optional[str]
|
|
1301
|
+
|
|
1302
|
+
billing_address : typing.Optional[ContactBillingAddress]
|
|
1303
|
+
|
|
1304
|
+
external_id : typing.Optional[str]
|
|
1305
|
+
|
|
1306
|
+
request_options : typing.Optional[RequestOptions]
|
|
1307
|
+
Request-specific configuration.
|
|
1308
|
+
|
|
1309
|
+
Returns
|
|
1310
|
+
-------
|
|
1311
|
+
AsyncHttpResponse[Contact]
|
|
1312
|
+
200
|
|
1313
|
+
"""
|
|
1314
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1315
|
+
f"contacts/external/{jsonable_encoder(external_id_)}",
|
|
1316
|
+
method="PUT",
|
|
1317
|
+
json={
|
|
1318
|
+
"customerId": customer_id,
|
|
1319
|
+
"firstName": first_name,
|
|
1320
|
+
"lastName": last_name,
|
|
1321
|
+
"email": email,
|
|
1322
|
+
"phone": phone,
|
|
1323
|
+
"billingAddress": convert_and_respect_annotation_metadata(
|
|
1324
|
+
object_=billing_address, annotation=typing.Optional[ContactBillingAddress], direction="write"
|
|
1325
|
+
),
|
|
1326
|
+
"externalId": external_id,
|
|
1327
|
+
},
|
|
1328
|
+
headers={
|
|
1329
|
+
"content-type": "application/json",
|
|
1330
|
+
},
|
|
1331
|
+
request_options=request_options,
|
|
1332
|
+
omit=OMIT,
|
|
1333
|
+
)
|
|
1334
|
+
try:
|
|
1335
|
+
if 200 <= _response.status_code < 300:
|
|
1336
|
+
_data = typing.cast(
|
|
1337
|
+
Contact,
|
|
1338
|
+
parse_obj_as(
|
|
1339
|
+
type_=Contact, # type: ignore
|
|
1340
|
+
object_=_response.json(),
|
|
1341
|
+
),
|
|
1342
|
+
)
|
|
1343
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1344
|
+
if _response.status_code == 400:
|
|
1345
|
+
raise BadRequestError(
|
|
1346
|
+
headers=dict(_response.headers),
|
|
1347
|
+
body=typing.cast(
|
|
1348
|
+
ErrorResponse,
|
|
1349
|
+
parse_obj_as(
|
|
1350
|
+
type_=ErrorResponse, # type: ignore
|
|
1351
|
+
object_=_response.json(),
|
|
1352
|
+
),
|
|
1353
|
+
),
|
|
1354
|
+
)
|
|
1355
|
+
if _response.status_code == 403:
|
|
1356
|
+
raise ForbiddenError(
|
|
1357
|
+
headers=dict(_response.headers),
|
|
1358
|
+
body=typing.cast(
|
|
1359
|
+
ErrorResponse,
|
|
1360
|
+
parse_obj_as(
|
|
1361
|
+
type_=ErrorResponse, # type: ignore
|
|
1362
|
+
object_=_response.json(),
|
|
1363
|
+
),
|
|
1364
|
+
),
|
|
1365
|
+
)
|
|
1366
|
+
if _response.status_code == 404:
|
|
1367
|
+
raise NotFoundError(
|
|
1368
|
+
headers=dict(_response.headers),
|
|
1369
|
+
body=typing.cast(
|
|
1370
|
+
ErrorResponse,
|
|
1371
|
+
parse_obj_as(
|
|
1372
|
+
type_=ErrorResponse, # type: ignore
|
|
1373
|
+
object_=_response.json(),
|
|
1374
|
+
),
|
|
1375
|
+
),
|
|
1376
|
+
)
|
|
1377
|
+
if _response.status_code == 500:
|
|
1378
|
+
raise InternalServerError(
|
|
1379
|
+
headers=dict(_response.headers),
|
|
1380
|
+
body=typing.cast(
|
|
1381
|
+
ErrorResponse,
|
|
1382
|
+
parse_obj_as(
|
|
1383
|
+
type_=ErrorResponse, # type: ignore
|
|
1384
|
+
object_=_response.json(),
|
|
1385
|
+
),
|
|
1386
|
+
),
|
|
1387
|
+
)
|
|
501
1388
|
_response_json = _response.json()
|
|
502
1389
|
except JSONDecodeError:
|
|
503
1390
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
504
1391
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
505
1392
|
|
|
506
|
-
async def
|
|
1393
|
+
async def delete_contact_by_external_id(
|
|
507
1394
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
508
|
-
) -> AsyncHttpResponse[
|
|
1395
|
+
) -> AsyncHttpResponse[EmptyResponse]:
|
|
509
1396
|
"""
|
|
1397
|
+
Delete a contact by its external ID
|
|
1398
|
+
|
|
510
1399
|
Parameters
|
|
511
1400
|
----------
|
|
512
1401
|
external_id : str
|
|
@@ -516,7 +1405,8 @@ class AsyncRawContactsClient:
|
|
|
516
1405
|
|
|
517
1406
|
Returns
|
|
518
1407
|
-------
|
|
519
|
-
AsyncHttpResponse[
|
|
1408
|
+
AsyncHttpResponse[EmptyResponse]
|
|
1409
|
+
200
|
|
520
1410
|
"""
|
|
521
1411
|
_response = await self._client_wrapper.httpx_client.request(
|
|
522
1412
|
f"contacts/external/{jsonable_encoder(external_id)}",
|
|
@@ -525,7 +1415,47 @@ class AsyncRawContactsClient:
|
|
|
525
1415
|
)
|
|
526
1416
|
try:
|
|
527
1417
|
if 200 <= _response.status_code < 300:
|
|
528
|
-
|
|
1418
|
+
_data = typing.cast(
|
|
1419
|
+
EmptyResponse,
|
|
1420
|
+
parse_obj_as(
|
|
1421
|
+
type_=EmptyResponse, # type: ignore
|
|
1422
|
+
object_=_response.json(),
|
|
1423
|
+
),
|
|
1424
|
+
)
|
|
1425
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1426
|
+
if _response.status_code == 403:
|
|
1427
|
+
raise ForbiddenError(
|
|
1428
|
+
headers=dict(_response.headers),
|
|
1429
|
+
body=typing.cast(
|
|
1430
|
+
ErrorResponse,
|
|
1431
|
+
parse_obj_as(
|
|
1432
|
+
type_=ErrorResponse, # type: ignore
|
|
1433
|
+
object_=_response.json(),
|
|
1434
|
+
),
|
|
1435
|
+
),
|
|
1436
|
+
)
|
|
1437
|
+
if _response.status_code == 404:
|
|
1438
|
+
raise NotFoundError(
|
|
1439
|
+
headers=dict(_response.headers),
|
|
1440
|
+
body=typing.cast(
|
|
1441
|
+
ErrorResponse,
|
|
1442
|
+
parse_obj_as(
|
|
1443
|
+
type_=ErrorResponse, # type: ignore
|
|
1444
|
+
object_=_response.json(),
|
|
1445
|
+
),
|
|
1446
|
+
),
|
|
1447
|
+
)
|
|
1448
|
+
if _response.status_code == 500:
|
|
1449
|
+
raise InternalServerError(
|
|
1450
|
+
headers=dict(_response.headers),
|
|
1451
|
+
body=typing.cast(
|
|
1452
|
+
ErrorResponse,
|
|
1453
|
+
parse_obj_as(
|
|
1454
|
+
type_=ErrorResponse, # type: ignore
|
|
1455
|
+
object_=_response.json(),
|
|
1456
|
+
),
|
|
1457
|
+
),
|
|
1458
|
+
)
|
|
529
1459
|
_response_json = _response.json()
|
|
530
1460
|
except JSONDecodeError:
|
|
531
1461
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|