dub 0.26.12__py3-none-any.whl → 0.27.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dub/_version.py +3 -3
- dub/analytics.py +53 -78
- dub/basesdk.py +4 -4
- dub/commissions.py +105 -156
- dub/customers.py +261 -390
- dub/domains.py +309 -472
- dub/embed_tokens.py +53 -80
- dub/events.py +53 -78
- dub/folders.py +205 -316
- dub/links.py +511 -770
- dub/models/errors/__init__.py +9 -0
- dub/models/errors/badrequest.py +12 -6
- dub/models/errors/conflict.py +12 -6
- dub/models/errors/duberror.py +26 -0
- dub/models/errors/forbidden.py +12 -6
- dub/models/errors/internalservererror.py +12 -6
- dub/models/errors/inviteexpired.py +12 -6
- dub/models/errors/no_response_error.py +13 -0
- dub/models/errors/notfound.py +12 -6
- dub/models/errors/ratelimitexceeded.py +12 -6
- dub/models/errors/responsevalidationerror.py +25 -0
- dub/models/errors/sdkerror.py +30 -14
- dub/models/errors/unauthorized.py +12 -6
- dub/models/errors/unprocessableentity.py +12 -6
- dub/models/operations/createcustomer.py +3 -0
- dub/models/operations/getcustomer.py +3 -0
- dub/models/operations/getcustomers.py +3 -0
- dub/models/operations/tracklead.py +2 -2
- dub/models/operations/tracksale.py +2 -2
- dub/models/operations/updatecustomer.py +3 -0
- dub/partners.py +255 -384
- dub/qr_codes.py +49 -74
- dub/tags.py +205 -308
- dub/track.py +105 -156
- dub/utils/serializers.py +3 -2
- dub/utils/unmarshal_json_response.py +24 -0
- dub/workspaces.py +105 -156
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/METADATA +50 -56
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/RECORD +41 -37
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/LICENSE +0 -0
- {dub-0.26.12.dist-info → dub-0.27.1.dist-info}/WHEEL +0 -0
dub/customers.py
CHANGED
|
@@ -5,6 +5,7 @@ from dub import utils
|
|
|
5
5
|
from dub._hooks import HookContext
|
|
6
6
|
from dub.models import errors, operations
|
|
7
7
|
from dub.types import BaseModel, OptionalNullable, UNSET
|
|
8
|
+
from dub.utils.unmarshal_json_response import unmarshal_json_response
|
|
8
9
|
from typing import Any, List, Mapping, Optional, Union, cast
|
|
9
10
|
from typing_extensions import deprecated
|
|
10
11
|
|
|
@@ -96,63 +97,50 @@ class Customers(BaseSDK):
|
|
|
96
97
|
|
|
97
98
|
response_data: Any = None
|
|
98
99
|
if utils.match_response(http_res, "200", "application/json"):
|
|
99
|
-
return
|
|
100
|
-
|
|
100
|
+
return unmarshal_json_response(
|
|
101
|
+
Optional[List[operations.GetCustomersResponseBody]], http_res
|
|
101
102
|
)
|
|
102
103
|
if utils.match_response(http_res, "400", "application/json"):
|
|
103
|
-
response_data =
|
|
104
|
-
raise errors.BadRequest(
|
|
104
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
105
|
+
raise errors.BadRequest(response_data, http_res)
|
|
105
106
|
if utils.match_response(http_res, "401", "application/json"):
|
|
106
|
-
response_data =
|
|
107
|
-
raise errors.Unauthorized(
|
|
107
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
108
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
108
109
|
if utils.match_response(http_res, "403", "application/json"):
|
|
109
|
-
response_data =
|
|
110
|
-
raise errors.Forbidden(
|
|
110
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
111
|
+
raise errors.Forbidden(response_data, http_res)
|
|
111
112
|
if utils.match_response(http_res, "404", "application/json"):
|
|
112
|
-
response_data =
|
|
113
|
-
raise errors.NotFound(
|
|
113
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
114
|
+
raise errors.NotFound(response_data, http_res)
|
|
114
115
|
if utils.match_response(http_res, "409", "application/json"):
|
|
115
|
-
response_data =
|
|
116
|
-
raise errors.Conflict(
|
|
116
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
117
|
+
raise errors.Conflict(response_data, http_res)
|
|
117
118
|
if utils.match_response(http_res, "410", "application/json"):
|
|
118
|
-
response_data =
|
|
119
|
-
|
|
120
|
-
)
|
|
121
|
-
raise errors.InviteExpired(data=response_data)
|
|
119
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
120
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
122
121
|
if utils.match_response(http_res, "422", "application/json"):
|
|
123
|
-
response_data =
|
|
124
|
-
|
|
122
|
+
response_data = unmarshal_json_response(
|
|
123
|
+
errors.UnprocessableEntityData, http_res
|
|
125
124
|
)
|
|
126
|
-
raise errors.UnprocessableEntity(
|
|
125
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
127
126
|
if utils.match_response(http_res, "429", "application/json"):
|
|
128
|
-
response_data =
|
|
129
|
-
|
|
127
|
+
response_data = unmarshal_json_response(
|
|
128
|
+
errors.RateLimitExceededData, http_res
|
|
130
129
|
)
|
|
131
|
-
raise errors.RateLimitExceeded(
|
|
130
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
132
131
|
if utils.match_response(http_res, "500", "application/json"):
|
|
133
|
-
response_data =
|
|
134
|
-
|
|
132
|
+
response_data = unmarshal_json_response(
|
|
133
|
+
errors.InternalServerErrorData, http_res
|
|
135
134
|
)
|
|
136
|
-
raise errors.InternalServerError(
|
|
135
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
137
136
|
if utils.match_response(http_res, "4XX", "*"):
|
|
138
137
|
http_res_text = utils.stream_to_text(http_res)
|
|
139
|
-
raise errors.SDKError(
|
|
140
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
141
|
-
)
|
|
138
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
142
139
|
if utils.match_response(http_res, "5XX", "*"):
|
|
143
140
|
http_res_text = utils.stream_to_text(http_res)
|
|
144
|
-
raise errors.SDKError(
|
|
145
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
146
|
-
)
|
|
141
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
147
142
|
|
|
148
|
-
|
|
149
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
150
|
-
raise errors.SDKError(
|
|
151
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
152
|
-
http_res.status_code,
|
|
153
|
-
http_res_text,
|
|
154
|
-
http_res,
|
|
155
|
-
)
|
|
143
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
156
144
|
|
|
157
145
|
async def list_async(
|
|
158
146
|
self,
|
|
@@ -240,63 +228,50 @@ class Customers(BaseSDK):
|
|
|
240
228
|
|
|
241
229
|
response_data: Any = None
|
|
242
230
|
if utils.match_response(http_res, "200", "application/json"):
|
|
243
|
-
return
|
|
244
|
-
|
|
231
|
+
return unmarshal_json_response(
|
|
232
|
+
Optional[List[operations.GetCustomersResponseBody]], http_res
|
|
245
233
|
)
|
|
246
234
|
if utils.match_response(http_res, "400", "application/json"):
|
|
247
|
-
response_data =
|
|
248
|
-
raise errors.BadRequest(
|
|
235
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
236
|
+
raise errors.BadRequest(response_data, http_res)
|
|
249
237
|
if utils.match_response(http_res, "401", "application/json"):
|
|
250
|
-
response_data =
|
|
251
|
-
raise errors.Unauthorized(
|
|
238
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
239
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
252
240
|
if utils.match_response(http_res, "403", "application/json"):
|
|
253
|
-
response_data =
|
|
254
|
-
raise errors.Forbidden(
|
|
241
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
242
|
+
raise errors.Forbidden(response_data, http_res)
|
|
255
243
|
if utils.match_response(http_res, "404", "application/json"):
|
|
256
|
-
response_data =
|
|
257
|
-
raise errors.NotFound(
|
|
244
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
245
|
+
raise errors.NotFound(response_data, http_res)
|
|
258
246
|
if utils.match_response(http_res, "409", "application/json"):
|
|
259
|
-
response_data =
|
|
260
|
-
raise errors.Conflict(
|
|
247
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
248
|
+
raise errors.Conflict(response_data, http_res)
|
|
261
249
|
if utils.match_response(http_res, "410", "application/json"):
|
|
262
|
-
response_data =
|
|
263
|
-
|
|
264
|
-
)
|
|
265
|
-
raise errors.InviteExpired(data=response_data)
|
|
250
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
251
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
266
252
|
if utils.match_response(http_res, "422", "application/json"):
|
|
267
|
-
response_data =
|
|
268
|
-
|
|
253
|
+
response_data = unmarshal_json_response(
|
|
254
|
+
errors.UnprocessableEntityData, http_res
|
|
269
255
|
)
|
|
270
|
-
raise errors.UnprocessableEntity(
|
|
256
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
271
257
|
if utils.match_response(http_res, "429", "application/json"):
|
|
272
|
-
response_data =
|
|
273
|
-
|
|
258
|
+
response_data = unmarshal_json_response(
|
|
259
|
+
errors.RateLimitExceededData, http_res
|
|
274
260
|
)
|
|
275
|
-
raise errors.RateLimitExceeded(
|
|
261
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
276
262
|
if utils.match_response(http_res, "500", "application/json"):
|
|
277
|
-
response_data =
|
|
278
|
-
|
|
263
|
+
response_data = unmarshal_json_response(
|
|
264
|
+
errors.InternalServerErrorData, http_res
|
|
279
265
|
)
|
|
280
|
-
raise errors.InternalServerError(
|
|
266
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
281
267
|
if utils.match_response(http_res, "4XX", "*"):
|
|
282
268
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
283
|
-
raise errors.SDKError(
|
|
284
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
285
|
-
)
|
|
269
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
286
270
|
if utils.match_response(http_res, "5XX", "*"):
|
|
287
271
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
288
|
-
raise errors.SDKError(
|
|
289
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
290
|
-
)
|
|
272
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
291
273
|
|
|
292
|
-
|
|
293
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
294
|
-
raise errors.SDKError(
|
|
295
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
296
|
-
http_res.status_code,
|
|
297
|
-
http_res_text,
|
|
298
|
-
http_res,
|
|
299
|
-
)
|
|
274
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
300
275
|
|
|
301
276
|
@deprecated(
|
|
302
277
|
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
@@ -399,63 +374,50 @@ class Customers(BaseSDK):
|
|
|
399
374
|
|
|
400
375
|
response_data: Any = None
|
|
401
376
|
if utils.match_response(http_res, "201", "application/json"):
|
|
402
|
-
return
|
|
403
|
-
|
|
377
|
+
return unmarshal_json_response(
|
|
378
|
+
Optional[operations.CreateCustomerResponseBody], http_res
|
|
404
379
|
)
|
|
405
380
|
if utils.match_response(http_res, "400", "application/json"):
|
|
406
|
-
response_data =
|
|
407
|
-
raise errors.BadRequest(
|
|
381
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
382
|
+
raise errors.BadRequest(response_data, http_res)
|
|
408
383
|
if utils.match_response(http_res, "401", "application/json"):
|
|
409
|
-
response_data =
|
|
410
|
-
raise errors.Unauthorized(
|
|
384
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
385
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
411
386
|
if utils.match_response(http_res, "403", "application/json"):
|
|
412
|
-
response_data =
|
|
413
|
-
raise errors.Forbidden(
|
|
387
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
388
|
+
raise errors.Forbidden(response_data, http_res)
|
|
414
389
|
if utils.match_response(http_res, "404", "application/json"):
|
|
415
|
-
response_data =
|
|
416
|
-
raise errors.NotFound(
|
|
390
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
391
|
+
raise errors.NotFound(response_data, http_res)
|
|
417
392
|
if utils.match_response(http_res, "409", "application/json"):
|
|
418
|
-
response_data =
|
|
419
|
-
raise errors.Conflict(
|
|
393
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
394
|
+
raise errors.Conflict(response_data, http_res)
|
|
420
395
|
if utils.match_response(http_res, "410", "application/json"):
|
|
421
|
-
response_data =
|
|
422
|
-
|
|
423
|
-
)
|
|
424
|
-
raise errors.InviteExpired(data=response_data)
|
|
396
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
397
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
425
398
|
if utils.match_response(http_res, "422", "application/json"):
|
|
426
|
-
response_data =
|
|
427
|
-
|
|
399
|
+
response_data = unmarshal_json_response(
|
|
400
|
+
errors.UnprocessableEntityData, http_res
|
|
428
401
|
)
|
|
429
|
-
raise errors.UnprocessableEntity(
|
|
402
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
430
403
|
if utils.match_response(http_res, "429", "application/json"):
|
|
431
|
-
response_data =
|
|
432
|
-
|
|
404
|
+
response_data = unmarshal_json_response(
|
|
405
|
+
errors.RateLimitExceededData, http_res
|
|
433
406
|
)
|
|
434
|
-
raise errors.RateLimitExceeded(
|
|
407
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
435
408
|
if utils.match_response(http_res, "500", "application/json"):
|
|
436
|
-
response_data =
|
|
437
|
-
|
|
409
|
+
response_data = unmarshal_json_response(
|
|
410
|
+
errors.InternalServerErrorData, http_res
|
|
438
411
|
)
|
|
439
|
-
raise errors.InternalServerError(
|
|
412
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
440
413
|
if utils.match_response(http_res, "4XX", "*"):
|
|
441
414
|
http_res_text = utils.stream_to_text(http_res)
|
|
442
|
-
raise errors.SDKError(
|
|
443
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
444
|
-
)
|
|
415
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
445
416
|
if utils.match_response(http_res, "5XX", "*"):
|
|
446
417
|
http_res_text = utils.stream_to_text(http_res)
|
|
447
|
-
raise errors.SDKError(
|
|
448
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
449
|
-
)
|
|
418
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
450
419
|
|
|
451
|
-
|
|
452
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
453
|
-
raise errors.SDKError(
|
|
454
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
455
|
-
http_res.status_code,
|
|
456
|
-
http_res_text,
|
|
457
|
-
http_res,
|
|
458
|
-
)
|
|
420
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
459
421
|
|
|
460
422
|
@deprecated(
|
|
461
423
|
"warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
|
|
@@ -558,63 +520,50 @@ class Customers(BaseSDK):
|
|
|
558
520
|
|
|
559
521
|
response_data: Any = None
|
|
560
522
|
if utils.match_response(http_res, "201", "application/json"):
|
|
561
|
-
return
|
|
562
|
-
|
|
523
|
+
return unmarshal_json_response(
|
|
524
|
+
Optional[operations.CreateCustomerResponseBody], http_res
|
|
563
525
|
)
|
|
564
526
|
if utils.match_response(http_res, "400", "application/json"):
|
|
565
|
-
response_data =
|
|
566
|
-
raise errors.BadRequest(
|
|
527
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
528
|
+
raise errors.BadRequest(response_data, http_res)
|
|
567
529
|
if utils.match_response(http_res, "401", "application/json"):
|
|
568
|
-
response_data =
|
|
569
|
-
raise errors.Unauthorized(
|
|
530
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
531
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
570
532
|
if utils.match_response(http_res, "403", "application/json"):
|
|
571
|
-
response_data =
|
|
572
|
-
raise errors.Forbidden(
|
|
533
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
534
|
+
raise errors.Forbidden(response_data, http_res)
|
|
573
535
|
if utils.match_response(http_res, "404", "application/json"):
|
|
574
|
-
response_data =
|
|
575
|
-
raise errors.NotFound(
|
|
536
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
537
|
+
raise errors.NotFound(response_data, http_res)
|
|
576
538
|
if utils.match_response(http_res, "409", "application/json"):
|
|
577
|
-
response_data =
|
|
578
|
-
raise errors.Conflict(
|
|
539
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
540
|
+
raise errors.Conflict(response_data, http_res)
|
|
579
541
|
if utils.match_response(http_res, "410", "application/json"):
|
|
580
|
-
response_data =
|
|
581
|
-
|
|
582
|
-
)
|
|
583
|
-
raise errors.InviteExpired(data=response_data)
|
|
542
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
543
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
584
544
|
if utils.match_response(http_res, "422", "application/json"):
|
|
585
|
-
response_data =
|
|
586
|
-
|
|
545
|
+
response_data = unmarshal_json_response(
|
|
546
|
+
errors.UnprocessableEntityData, http_res
|
|
587
547
|
)
|
|
588
|
-
raise errors.UnprocessableEntity(
|
|
548
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
589
549
|
if utils.match_response(http_res, "429", "application/json"):
|
|
590
|
-
response_data =
|
|
591
|
-
|
|
550
|
+
response_data = unmarshal_json_response(
|
|
551
|
+
errors.RateLimitExceededData, http_res
|
|
592
552
|
)
|
|
593
|
-
raise errors.RateLimitExceeded(
|
|
553
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
594
554
|
if utils.match_response(http_res, "500", "application/json"):
|
|
595
|
-
response_data =
|
|
596
|
-
|
|
555
|
+
response_data = unmarshal_json_response(
|
|
556
|
+
errors.InternalServerErrorData, http_res
|
|
597
557
|
)
|
|
598
|
-
raise errors.InternalServerError(
|
|
558
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
599
559
|
if utils.match_response(http_res, "4XX", "*"):
|
|
600
560
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
601
|
-
raise errors.SDKError(
|
|
602
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
603
|
-
)
|
|
561
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
604
562
|
if utils.match_response(http_res, "5XX", "*"):
|
|
605
563
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
606
|
-
raise errors.SDKError(
|
|
607
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
608
|
-
)
|
|
564
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
609
565
|
|
|
610
|
-
|
|
611
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
612
|
-
raise errors.SDKError(
|
|
613
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
614
|
-
http_res.status_code,
|
|
615
|
-
http_res_text,
|
|
616
|
-
http_res,
|
|
617
|
-
)
|
|
566
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
618
567
|
|
|
619
568
|
def get(
|
|
620
569
|
self,
|
|
@@ -702,63 +651,50 @@ class Customers(BaseSDK):
|
|
|
702
651
|
|
|
703
652
|
response_data: Any = None
|
|
704
653
|
if utils.match_response(http_res, "200", "application/json"):
|
|
705
|
-
return
|
|
706
|
-
|
|
654
|
+
return unmarshal_json_response(
|
|
655
|
+
Optional[operations.GetCustomerResponseBody], http_res
|
|
707
656
|
)
|
|
708
657
|
if utils.match_response(http_res, "400", "application/json"):
|
|
709
|
-
response_data =
|
|
710
|
-
raise errors.BadRequest(
|
|
658
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
659
|
+
raise errors.BadRequest(response_data, http_res)
|
|
711
660
|
if utils.match_response(http_res, "401", "application/json"):
|
|
712
|
-
response_data =
|
|
713
|
-
raise errors.Unauthorized(
|
|
661
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
662
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
714
663
|
if utils.match_response(http_res, "403", "application/json"):
|
|
715
|
-
response_data =
|
|
716
|
-
raise errors.Forbidden(
|
|
664
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
665
|
+
raise errors.Forbidden(response_data, http_res)
|
|
717
666
|
if utils.match_response(http_res, "404", "application/json"):
|
|
718
|
-
response_data =
|
|
719
|
-
raise errors.NotFound(
|
|
667
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
668
|
+
raise errors.NotFound(response_data, http_res)
|
|
720
669
|
if utils.match_response(http_res, "409", "application/json"):
|
|
721
|
-
response_data =
|
|
722
|
-
raise errors.Conflict(
|
|
670
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
671
|
+
raise errors.Conflict(response_data, http_res)
|
|
723
672
|
if utils.match_response(http_res, "410", "application/json"):
|
|
724
|
-
response_data =
|
|
725
|
-
|
|
726
|
-
)
|
|
727
|
-
raise errors.InviteExpired(data=response_data)
|
|
673
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
674
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
728
675
|
if utils.match_response(http_res, "422", "application/json"):
|
|
729
|
-
response_data =
|
|
730
|
-
|
|
676
|
+
response_data = unmarshal_json_response(
|
|
677
|
+
errors.UnprocessableEntityData, http_res
|
|
731
678
|
)
|
|
732
|
-
raise errors.UnprocessableEntity(
|
|
679
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
733
680
|
if utils.match_response(http_res, "429", "application/json"):
|
|
734
|
-
response_data =
|
|
735
|
-
|
|
681
|
+
response_data = unmarshal_json_response(
|
|
682
|
+
errors.RateLimitExceededData, http_res
|
|
736
683
|
)
|
|
737
|
-
raise errors.RateLimitExceeded(
|
|
684
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
738
685
|
if utils.match_response(http_res, "500", "application/json"):
|
|
739
|
-
response_data =
|
|
740
|
-
|
|
686
|
+
response_data = unmarshal_json_response(
|
|
687
|
+
errors.InternalServerErrorData, http_res
|
|
741
688
|
)
|
|
742
|
-
raise errors.InternalServerError(
|
|
689
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
743
690
|
if utils.match_response(http_res, "4XX", "*"):
|
|
744
691
|
http_res_text = utils.stream_to_text(http_res)
|
|
745
|
-
raise errors.SDKError(
|
|
746
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
747
|
-
)
|
|
692
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
748
693
|
if utils.match_response(http_res, "5XX", "*"):
|
|
749
694
|
http_res_text = utils.stream_to_text(http_res)
|
|
750
|
-
raise errors.SDKError(
|
|
751
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
752
|
-
)
|
|
695
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
753
696
|
|
|
754
|
-
|
|
755
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
756
|
-
raise errors.SDKError(
|
|
757
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
758
|
-
http_res.status_code,
|
|
759
|
-
http_res_text,
|
|
760
|
-
http_res,
|
|
761
|
-
)
|
|
697
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
762
698
|
|
|
763
699
|
async def get_async(
|
|
764
700
|
self,
|
|
@@ -846,63 +782,50 @@ class Customers(BaseSDK):
|
|
|
846
782
|
|
|
847
783
|
response_data: Any = None
|
|
848
784
|
if utils.match_response(http_res, "200", "application/json"):
|
|
849
|
-
return
|
|
850
|
-
|
|
785
|
+
return unmarshal_json_response(
|
|
786
|
+
Optional[operations.GetCustomerResponseBody], http_res
|
|
851
787
|
)
|
|
852
788
|
if utils.match_response(http_res, "400", "application/json"):
|
|
853
|
-
response_data =
|
|
854
|
-
raise errors.BadRequest(
|
|
789
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
790
|
+
raise errors.BadRequest(response_data, http_res)
|
|
855
791
|
if utils.match_response(http_res, "401", "application/json"):
|
|
856
|
-
response_data =
|
|
857
|
-
raise errors.Unauthorized(
|
|
792
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
793
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
858
794
|
if utils.match_response(http_res, "403", "application/json"):
|
|
859
|
-
response_data =
|
|
860
|
-
raise errors.Forbidden(
|
|
795
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
796
|
+
raise errors.Forbidden(response_data, http_res)
|
|
861
797
|
if utils.match_response(http_res, "404", "application/json"):
|
|
862
|
-
response_data =
|
|
863
|
-
raise errors.NotFound(
|
|
798
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
799
|
+
raise errors.NotFound(response_data, http_res)
|
|
864
800
|
if utils.match_response(http_res, "409", "application/json"):
|
|
865
|
-
response_data =
|
|
866
|
-
raise errors.Conflict(
|
|
801
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
802
|
+
raise errors.Conflict(response_data, http_res)
|
|
867
803
|
if utils.match_response(http_res, "410", "application/json"):
|
|
868
|
-
response_data =
|
|
869
|
-
|
|
870
|
-
)
|
|
871
|
-
raise errors.InviteExpired(data=response_data)
|
|
804
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
805
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
872
806
|
if utils.match_response(http_res, "422", "application/json"):
|
|
873
|
-
response_data =
|
|
874
|
-
|
|
807
|
+
response_data = unmarshal_json_response(
|
|
808
|
+
errors.UnprocessableEntityData, http_res
|
|
875
809
|
)
|
|
876
|
-
raise errors.UnprocessableEntity(
|
|
810
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
877
811
|
if utils.match_response(http_res, "429", "application/json"):
|
|
878
|
-
response_data =
|
|
879
|
-
|
|
812
|
+
response_data = unmarshal_json_response(
|
|
813
|
+
errors.RateLimitExceededData, http_res
|
|
880
814
|
)
|
|
881
|
-
raise errors.RateLimitExceeded(
|
|
815
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
882
816
|
if utils.match_response(http_res, "500", "application/json"):
|
|
883
|
-
response_data =
|
|
884
|
-
|
|
817
|
+
response_data = unmarshal_json_response(
|
|
818
|
+
errors.InternalServerErrorData, http_res
|
|
885
819
|
)
|
|
886
|
-
raise errors.InternalServerError(
|
|
820
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
887
821
|
if utils.match_response(http_res, "4XX", "*"):
|
|
888
822
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
889
|
-
raise errors.SDKError(
|
|
890
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
891
|
-
)
|
|
823
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
892
824
|
if utils.match_response(http_res, "5XX", "*"):
|
|
893
825
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
894
|
-
raise errors.SDKError(
|
|
895
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
896
|
-
)
|
|
826
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
897
827
|
|
|
898
|
-
|
|
899
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
900
|
-
raise errors.SDKError(
|
|
901
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
902
|
-
http_res.status_code,
|
|
903
|
-
http_res_text,
|
|
904
|
-
http_res,
|
|
905
|
-
)
|
|
828
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
906
829
|
|
|
907
830
|
def update(
|
|
908
831
|
self,
|
|
@@ -997,63 +920,50 @@ class Customers(BaseSDK):
|
|
|
997
920
|
|
|
998
921
|
response_data: Any = None
|
|
999
922
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1000
|
-
return
|
|
1001
|
-
|
|
923
|
+
return unmarshal_json_response(
|
|
924
|
+
Optional[operations.UpdateCustomerResponseBody], http_res
|
|
1002
925
|
)
|
|
1003
926
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1004
|
-
response_data =
|
|
1005
|
-
raise errors.BadRequest(
|
|
927
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
928
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1006
929
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1007
|
-
response_data =
|
|
1008
|
-
raise errors.Unauthorized(
|
|
930
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
931
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1009
932
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1010
|
-
response_data =
|
|
1011
|
-
raise errors.Forbidden(
|
|
933
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
934
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1012
935
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1013
|
-
response_data =
|
|
1014
|
-
raise errors.NotFound(
|
|
936
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
937
|
+
raise errors.NotFound(response_data, http_res)
|
|
1015
938
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1016
|
-
response_data =
|
|
1017
|
-
raise errors.Conflict(
|
|
939
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
940
|
+
raise errors.Conflict(response_data, http_res)
|
|
1018
941
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1019
|
-
response_data =
|
|
1020
|
-
|
|
1021
|
-
)
|
|
1022
|
-
raise errors.InviteExpired(data=response_data)
|
|
942
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
943
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1023
944
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1024
|
-
response_data =
|
|
1025
|
-
|
|
945
|
+
response_data = unmarshal_json_response(
|
|
946
|
+
errors.UnprocessableEntityData, http_res
|
|
1026
947
|
)
|
|
1027
|
-
raise errors.UnprocessableEntity(
|
|
948
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1028
949
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1029
|
-
response_data =
|
|
1030
|
-
|
|
950
|
+
response_data = unmarshal_json_response(
|
|
951
|
+
errors.RateLimitExceededData, http_res
|
|
1031
952
|
)
|
|
1032
|
-
raise errors.RateLimitExceeded(
|
|
953
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1033
954
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1034
|
-
response_data =
|
|
1035
|
-
|
|
955
|
+
response_data = unmarshal_json_response(
|
|
956
|
+
errors.InternalServerErrorData, http_res
|
|
1036
957
|
)
|
|
1037
|
-
raise errors.InternalServerError(
|
|
958
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1038
959
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1039
960
|
http_res_text = utils.stream_to_text(http_res)
|
|
1040
|
-
raise errors.SDKError(
|
|
1041
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1042
|
-
)
|
|
961
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1043
962
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1044
963
|
http_res_text = utils.stream_to_text(http_res)
|
|
1045
|
-
raise errors.SDKError(
|
|
1046
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1047
|
-
)
|
|
964
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1048
965
|
|
|
1049
|
-
|
|
1050
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1051
|
-
raise errors.SDKError(
|
|
1052
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1053
|
-
http_res.status_code,
|
|
1054
|
-
http_res_text,
|
|
1055
|
-
http_res,
|
|
1056
|
-
)
|
|
966
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1057
967
|
|
|
1058
968
|
async def update_async(
|
|
1059
969
|
self,
|
|
@@ -1148,63 +1058,50 @@ class Customers(BaseSDK):
|
|
|
1148
1058
|
|
|
1149
1059
|
response_data: Any = None
|
|
1150
1060
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1151
|
-
return
|
|
1152
|
-
|
|
1061
|
+
return unmarshal_json_response(
|
|
1062
|
+
Optional[operations.UpdateCustomerResponseBody], http_res
|
|
1153
1063
|
)
|
|
1154
1064
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1155
|
-
response_data =
|
|
1156
|
-
raise errors.BadRequest(
|
|
1065
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1066
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1157
1067
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1158
|
-
response_data =
|
|
1159
|
-
raise errors.Unauthorized(
|
|
1068
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1069
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1160
1070
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1161
|
-
response_data =
|
|
1162
|
-
raise errors.Forbidden(
|
|
1071
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1072
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1163
1073
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1164
|
-
response_data =
|
|
1165
|
-
raise errors.NotFound(
|
|
1074
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1075
|
+
raise errors.NotFound(response_data, http_res)
|
|
1166
1076
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1167
|
-
response_data =
|
|
1168
|
-
raise errors.Conflict(
|
|
1077
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1078
|
+
raise errors.Conflict(response_data, http_res)
|
|
1169
1079
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1170
|
-
response_data =
|
|
1171
|
-
|
|
1172
|
-
)
|
|
1173
|
-
raise errors.InviteExpired(data=response_data)
|
|
1080
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1081
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1174
1082
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1175
|
-
response_data =
|
|
1176
|
-
|
|
1083
|
+
response_data = unmarshal_json_response(
|
|
1084
|
+
errors.UnprocessableEntityData, http_res
|
|
1177
1085
|
)
|
|
1178
|
-
raise errors.UnprocessableEntity(
|
|
1086
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1179
1087
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1180
|
-
response_data =
|
|
1181
|
-
|
|
1088
|
+
response_data = unmarshal_json_response(
|
|
1089
|
+
errors.RateLimitExceededData, http_res
|
|
1182
1090
|
)
|
|
1183
|
-
raise errors.RateLimitExceeded(
|
|
1091
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1184
1092
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1185
|
-
response_data =
|
|
1186
|
-
|
|
1093
|
+
response_data = unmarshal_json_response(
|
|
1094
|
+
errors.InternalServerErrorData, http_res
|
|
1187
1095
|
)
|
|
1188
|
-
raise errors.InternalServerError(
|
|
1096
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1189
1097
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1190
1098
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1191
|
-
raise errors.SDKError(
|
|
1192
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1193
|
-
)
|
|
1099
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1194
1100
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1195
1101
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1196
|
-
raise errors.SDKError(
|
|
1197
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1198
|
-
)
|
|
1102
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1199
1103
|
|
|
1200
|
-
|
|
1201
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1202
|
-
raise errors.SDKError(
|
|
1203
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1204
|
-
http_res.status_code,
|
|
1205
|
-
http_res_text,
|
|
1206
|
-
http_res,
|
|
1207
|
-
)
|
|
1104
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1208
1105
|
|
|
1209
1106
|
def delete(
|
|
1210
1107
|
self,
|
|
@@ -1290,63 +1187,50 @@ class Customers(BaseSDK):
|
|
|
1290
1187
|
|
|
1291
1188
|
response_data: Any = None
|
|
1292
1189
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1293
|
-
return
|
|
1294
|
-
|
|
1190
|
+
return unmarshal_json_response(
|
|
1191
|
+
Optional[operations.DeleteCustomerResponseBody], http_res
|
|
1295
1192
|
)
|
|
1296
1193
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1297
|
-
response_data =
|
|
1298
|
-
raise errors.BadRequest(
|
|
1194
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1195
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1299
1196
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1300
|
-
response_data =
|
|
1301
|
-
raise errors.Unauthorized(
|
|
1197
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1198
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1302
1199
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1303
|
-
response_data =
|
|
1304
|
-
raise errors.Forbidden(
|
|
1200
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1201
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1305
1202
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1306
|
-
response_data =
|
|
1307
|
-
raise errors.NotFound(
|
|
1203
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1204
|
+
raise errors.NotFound(response_data, http_res)
|
|
1308
1205
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1309
|
-
response_data =
|
|
1310
|
-
raise errors.Conflict(
|
|
1206
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1207
|
+
raise errors.Conflict(response_data, http_res)
|
|
1311
1208
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1312
|
-
response_data =
|
|
1313
|
-
|
|
1314
|
-
)
|
|
1315
|
-
raise errors.InviteExpired(data=response_data)
|
|
1209
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1210
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1316
1211
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1317
|
-
response_data =
|
|
1318
|
-
|
|
1212
|
+
response_data = unmarshal_json_response(
|
|
1213
|
+
errors.UnprocessableEntityData, http_res
|
|
1319
1214
|
)
|
|
1320
|
-
raise errors.UnprocessableEntity(
|
|
1215
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1321
1216
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1322
|
-
response_data =
|
|
1323
|
-
|
|
1217
|
+
response_data = unmarshal_json_response(
|
|
1218
|
+
errors.RateLimitExceededData, http_res
|
|
1324
1219
|
)
|
|
1325
|
-
raise errors.RateLimitExceeded(
|
|
1220
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1326
1221
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1327
|
-
response_data =
|
|
1328
|
-
|
|
1222
|
+
response_data = unmarshal_json_response(
|
|
1223
|
+
errors.InternalServerErrorData, http_res
|
|
1329
1224
|
)
|
|
1330
|
-
raise errors.InternalServerError(
|
|
1225
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1331
1226
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1332
1227
|
http_res_text = utils.stream_to_text(http_res)
|
|
1333
|
-
raise errors.SDKError(
|
|
1334
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1335
|
-
)
|
|
1228
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1336
1229
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1337
1230
|
http_res_text = utils.stream_to_text(http_res)
|
|
1338
|
-
raise errors.SDKError(
|
|
1339
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1340
|
-
)
|
|
1231
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1341
1232
|
|
|
1342
|
-
|
|
1343
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1344
|
-
raise errors.SDKError(
|
|
1345
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1346
|
-
http_res.status_code,
|
|
1347
|
-
http_res_text,
|
|
1348
|
-
http_res,
|
|
1349
|
-
)
|
|
1233
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1350
1234
|
|
|
1351
1235
|
async def delete_async(
|
|
1352
1236
|
self,
|
|
@@ -1432,60 +1316,47 @@ class Customers(BaseSDK):
|
|
|
1432
1316
|
|
|
1433
1317
|
response_data: Any = None
|
|
1434
1318
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1435
|
-
return
|
|
1436
|
-
|
|
1319
|
+
return unmarshal_json_response(
|
|
1320
|
+
Optional[operations.DeleteCustomerResponseBody], http_res
|
|
1437
1321
|
)
|
|
1438
1322
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1439
|
-
response_data =
|
|
1440
|
-
raise errors.BadRequest(
|
|
1323
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1324
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1441
1325
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1442
|
-
response_data =
|
|
1443
|
-
raise errors.Unauthorized(
|
|
1326
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1327
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1444
1328
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1445
|
-
response_data =
|
|
1446
|
-
raise errors.Forbidden(
|
|
1329
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1330
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1447
1331
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1448
|
-
response_data =
|
|
1449
|
-
raise errors.NotFound(
|
|
1332
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1333
|
+
raise errors.NotFound(response_data, http_res)
|
|
1450
1334
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1451
|
-
response_data =
|
|
1452
|
-
raise errors.Conflict(
|
|
1335
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1336
|
+
raise errors.Conflict(response_data, http_res)
|
|
1453
1337
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1454
|
-
response_data =
|
|
1455
|
-
|
|
1456
|
-
)
|
|
1457
|
-
raise errors.InviteExpired(data=response_data)
|
|
1338
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1339
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1458
1340
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1459
|
-
response_data =
|
|
1460
|
-
|
|
1341
|
+
response_data = unmarshal_json_response(
|
|
1342
|
+
errors.UnprocessableEntityData, http_res
|
|
1461
1343
|
)
|
|
1462
|
-
raise errors.UnprocessableEntity(
|
|
1344
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1463
1345
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1464
|
-
response_data =
|
|
1465
|
-
|
|
1346
|
+
response_data = unmarshal_json_response(
|
|
1347
|
+
errors.RateLimitExceededData, http_res
|
|
1466
1348
|
)
|
|
1467
|
-
raise errors.RateLimitExceeded(
|
|
1349
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1468
1350
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1469
|
-
response_data =
|
|
1470
|
-
|
|
1351
|
+
response_data = unmarshal_json_response(
|
|
1352
|
+
errors.InternalServerErrorData, http_res
|
|
1471
1353
|
)
|
|
1472
|
-
raise errors.InternalServerError(
|
|
1354
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1473
1355
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1474
1356
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1475
|
-
raise errors.SDKError(
|
|
1476
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1477
|
-
)
|
|
1357
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1478
1358
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1479
1359
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1480
|
-
raise errors.SDKError(
|
|
1481
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1482
|
-
)
|
|
1360
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1483
1361
|
|
|
1484
|
-
|
|
1485
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1486
|
-
raise errors.SDKError(
|
|
1487
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1488
|
-
http_res.status_code,
|
|
1489
|
-
http_res_text,
|
|
1490
|
-
http_res,
|
|
1491
|
-
)
|
|
1362
|
+
raise errors.SDKError("Unexpected response received", http_res)
|