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