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/partners.py
CHANGED
|
@@ -5,6 +5,7 @@ from dub import utils
|
|
|
5
5
|
from dub._hooks import HookContext
|
|
6
6
|
from dub.models import components, 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
|
|
|
10
11
|
|
|
@@ -107,63 +108,50 @@ class Partners(BaseSDK):
|
|
|
107
108
|
|
|
108
109
|
response_data: Any = None
|
|
109
110
|
if utils.match_response(http_res, "201", "application/json"):
|
|
110
|
-
return
|
|
111
|
-
|
|
111
|
+
return unmarshal_json_response(
|
|
112
|
+
Optional[operations.CreatePartnerResponseBody], http_res
|
|
112
113
|
)
|
|
113
114
|
if utils.match_response(http_res, "400", "application/json"):
|
|
114
|
-
response_data =
|
|
115
|
-
raise errors.BadRequest(
|
|
115
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
116
|
+
raise errors.BadRequest(response_data, http_res)
|
|
116
117
|
if utils.match_response(http_res, "401", "application/json"):
|
|
117
|
-
response_data =
|
|
118
|
-
raise errors.Unauthorized(
|
|
118
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
119
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
119
120
|
if utils.match_response(http_res, "403", "application/json"):
|
|
120
|
-
response_data =
|
|
121
|
-
raise errors.Forbidden(
|
|
121
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
122
|
+
raise errors.Forbidden(response_data, http_res)
|
|
122
123
|
if utils.match_response(http_res, "404", "application/json"):
|
|
123
|
-
response_data =
|
|
124
|
-
raise errors.NotFound(
|
|
124
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
125
|
+
raise errors.NotFound(response_data, http_res)
|
|
125
126
|
if utils.match_response(http_res, "409", "application/json"):
|
|
126
|
-
response_data =
|
|
127
|
-
raise errors.Conflict(
|
|
127
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
128
|
+
raise errors.Conflict(response_data, http_res)
|
|
128
129
|
if utils.match_response(http_res, "410", "application/json"):
|
|
129
|
-
response_data =
|
|
130
|
-
|
|
131
|
-
)
|
|
132
|
-
raise errors.InviteExpired(data=response_data)
|
|
130
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
131
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
133
132
|
if utils.match_response(http_res, "422", "application/json"):
|
|
134
|
-
response_data =
|
|
135
|
-
|
|
133
|
+
response_data = unmarshal_json_response(
|
|
134
|
+
errors.UnprocessableEntityData, http_res
|
|
136
135
|
)
|
|
137
|
-
raise errors.UnprocessableEntity(
|
|
136
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
138
137
|
if utils.match_response(http_res, "429", "application/json"):
|
|
139
|
-
response_data =
|
|
140
|
-
|
|
138
|
+
response_data = unmarshal_json_response(
|
|
139
|
+
errors.RateLimitExceededData, http_res
|
|
141
140
|
)
|
|
142
|
-
raise errors.RateLimitExceeded(
|
|
141
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
143
142
|
if utils.match_response(http_res, "500", "application/json"):
|
|
144
|
-
response_data =
|
|
145
|
-
|
|
143
|
+
response_data = unmarshal_json_response(
|
|
144
|
+
errors.InternalServerErrorData, http_res
|
|
146
145
|
)
|
|
147
|
-
raise errors.InternalServerError(
|
|
146
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
148
147
|
if utils.match_response(http_res, "4XX", "*"):
|
|
149
148
|
http_res_text = utils.stream_to_text(http_res)
|
|
150
|
-
raise errors.SDKError(
|
|
151
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
152
|
-
)
|
|
149
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
153
150
|
if utils.match_response(http_res, "5XX", "*"):
|
|
154
151
|
http_res_text = utils.stream_to_text(http_res)
|
|
155
|
-
raise errors.SDKError(
|
|
156
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
157
|
-
)
|
|
152
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
158
153
|
|
|
159
|
-
|
|
160
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
161
|
-
raise errors.SDKError(
|
|
162
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
163
|
-
http_res.status_code,
|
|
164
|
-
http_res_text,
|
|
165
|
-
http_res,
|
|
166
|
-
)
|
|
154
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
167
155
|
|
|
168
156
|
async def create_async(
|
|
169
157
|
self,
|
|
@@ -263,63 +251,50 @@ class Partners(BaseSDK):
|
|
|
263
251
|
|
|
264
252
|
response_data: Any = None
|
|
265
253
|
if utils.match_response(http_res, "201", "application/json"):
|
|
266
|
-
return
|
|
267
|
-
|
|
254
|
+
return unmarshal_json_response(
|
|
255
|
+
Optional[operations.CreatePartnerResponseBody], http_res
|
|
268
256
|
)
|
|
269
257
|
if utils.match_response(http_res, "400", "application/json"):
|
|
270
|
-
response_data =
|
|
271
|
-
raise errors.BadRequest(
|
|
258
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
259
|
+
raise errors.BadRequest(response_data, http_res)
|
|
272
260
|
if utils.match_response(http_res, "401", "application/json"):
|
|
273
|
-
response_data =
|
|
274
|
-
raise errors.Unauthorized(
|
|
261
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
262
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
275
263
|
if utils.match_response(http_res, "403", "application/json"):
|
|
276
|
-
response_data =
|
|
277
|
-
raise errors.Forbidden(
|
|
264
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
265
|
+
raise errors.Forbidden(response_data, http_res)
|
|
278
266
|
if utils.match_response(http_res, "404", "application/json"):
|
|
279
|
-
response_data =
|
|
280
|
-
raise errors.NotFound(
|
|
267
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
268
|
+
raise errors.NotFound(response_data, http_res)
|
|
281
269
|
if utils.match_response(http_res, "409", "application/json"):
|
|
282
|
-
response_data =
|
|
283
|
-
raise errors.Conflict(
|
|
270
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
271
|
+
raise errors.Conflict(response_data, http_res)
|
|
284
272
|
if utils.match_response(http_res, "410", "application/json"):
|
|
285
|
-
response_data =
|
|
286
|
-
|
|
287
|
-
)
|
|
288
|
-
raise errors.InviteExpired(data=response_data)
|
|
273
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
274
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
289
275
|
if utils.match_response(http_res, "422", "application/json"):
|
|
290
|
-
response_data =
|
|
291
|
-
|
|
276
|
+
response_data = unmarshal_json_response(
|
|
277
|
+
errors.UnprocessableEntityData, http_res
|
|
292
278
|
)
|
|
293
|
-
raise errors.UnprocessableEntity(
|
|
279
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
294
280
|
if utils.match_response(http_res, "429", "application/json"):
|
|
295
|
-
response_data =
|
|
296
|
-
|
|
281
|
+
response_data = unmarshal_json_response(
|
|
282
|
+
errors.RateLimitExceededData, http_res
|
|
297
283
|
)
|
|
298
|
-
raise errors.RateLimitExceeded(
|
|
284
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
299
285
|
if utils.match_response(http_res, "500", "application/json"):
|
|
300
|
-
response_data =
|
|
301
|
-
|
|
286
|
+
response_data = unmarshal_json_response(
|
|
287
|
+
errors.InternalServerErrorData, http_res
|
|
302
288
|
)
|
|
303
|
-
raise errors.InternalServerError(
|
|
289
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
304
290
|
if utils.match_response(http_res, "4XX", "*"):
|
|
305
291
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
306
|
-
raise errors.SDKError(
|
|
307
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
308
|
-
)
|
|
292
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
309
293
|
if utils.match_response(http_res, "5XX", "*"):
|
|
310
294
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
311
|
-
raise errors.SDKError(
|
|
312
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
313
|
-
)
|
|
295
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
314
296
|
|
|
315
|
-
|
|
316
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
317
|
-
raise errors.SDKError(
|
|
318
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
319
|
-
http_res.status_code,
|
|
320
|
-
http_res_text,
|
|
321
|
-
http_res,
|
|
322
|
-
)
|
|
297
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
323
298
|
|
|
324
299
|
def create_link(
|
|
325
300
|
self,
|
|
@@ -419,61 +394,48 @@ class Partners(BaseSDK):
|
|
|
419
394
|
|
|
420
395
|
response_data: Any = None
|
|
421
396
|
if utils.match_response(http_res, "201", "application/json"):
|
|
422
|
-
return
|
|
397
|
+
return unmarshal_json_response(Optional[components.LinkSchema], http_res)
|
|
423
398
|
if utils.match_response(http_res, "400", "application/json"):
|
|
424
|
-
response_data =
|
|
425
|
-
raise errors.BadRequest(
|
|
399
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
400
|
+
raise errors.BadRequest(response_data, http_res)
|
|
426
401
|
if utils.match_response(http_res, "401", "application/json"):
|
|
427
|
-
response_data =
|
|
428
|
-
raise errors.Unauthorized(
|
|
402
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
403
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
429
404
|
if utils.match_response(http_res, "403", "application/json"):
|
|
430
|
-
response_data =
|
|
431
|
-
raise errors.Forbidden(
|
|
405
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
406
|
+
raise errors.Forbidden(response_data, http_res)
|
|
432
407
|
if utils.match_response(http_res, "404", "application/json"):
|
|
433
|
-
response_data =
|
|
434
|
-
raise errors.NotFound(
|
|
408
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
409
|
+
raise errors.NotFound(response_data, http_res)
|
|
435
410
|
if utils.match_response(http_res, "409", "application/json"):
|
|
436
|
-
response_data =
|
|
437
|
-
raise errors.Conflict(
|
|
411
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
412
|
+
raise errors.Conflict(response_data, http_res)
|
|
438
413
|
if utils.match_response(http_res, "410", "application/json"):
|
|
439
|
-
response_data =
|
|
440
|
-
|
|
441
|
-
)
|
|
442
|
-
raise errors.InviteExpired(data=response_data)
|
|
414
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
415
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
443
416
|
if utils.match_response(http_res, "422", "application/json"):
|
|
444
|
-
response_data =
|
|
445
|
-
|
|
417
|
+
response_data = unmarshal_json_response(
|
|
418
|
+
errors.UnprocessableEntityData, http_res
|
|
446
419
|
)
|
|
447
|
-
raise errors.UnprocessableEntity(
|
|
420
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
448
421
|
if utils.match_response(http_res, "429", "application/json"):
|
|
449
|
-
response_data =
|
|
450
|
-
|
|
422
|
+
response_data = unmarshal_json_response(
|
|
423
|
+
errors.RateLimitExceededData, http_res
|
|
451
424
|
)
|
|
452
|
-
raise errors.RateLimitExceeded(
|
|
425
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
453
426
|
if utils.match_response(http_res, "500", "application/json"):
|
|
454
|
-
response_data =
|
|
455
|
-
|
|
427
|
+
response_data = unmarshal_json_response(
|
|
428
|
+
errors.InternalServerErrorData, http_res
|
|
456
429
|
)
|
|
457
|
-
raise errors.InternalServerError(
|
|
430
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
458
431
|
if utils.match_response(http_res, "4XX", "*"):
|
|
459
432
|
http_res_text = utils.stream_to_text(http_res)
|
|
460
|
-
raise errors.SDKError(
|
|
461
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
462
|
-
)
|
|
433
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
463
434
|
if utils.match_response(http_res, "5XX", "*"):
|
|
464
435
|
http_res_text = utils.stream_to_text(http_res)
|
|
465
|
-
raise errors.SDKError(
|
|
466
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
467
|
-
)
|
|
436
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
468
437
|
|
|
469
|
-
|
|
470
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
471
|
-
raise errors.SDKError(
|
|
472
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
473
|
-
http_res.status_code,
|
|
474
|
-
http_res_text,
|
|
475
|
-
http_res,
|
|
476
|
-
)
|
|
438
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
477
439
|
|
|
478
440
|
async def create_link_async(
|
|
479
441
|
self,
|
|
@@ -573,61 +535,48 @@ class Partners(BaseSDK):
|
|
|
573
535
|
|
|
574
536
|
response_data: Any = None
|
|
575
537
|
if utils.match_response(http_res, "201", "application/json"):
|
|
576
|
-
return
|
|
538
|
+
return unmarshal_json_response(Optional[components.LinkSchema], http_res)
|
|
577
539
|
if utils.match_response(http_res, "400", "application/json"):
|
|
578
|
-
response_data =
|
|
579
|
-
raise errors.BadRequest(
|
|
540
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
541
|
+
raise errors.BadRequest(response_data, http_res)
|
|
580
542
|
if utils.match_response(http_res, "401", "application/json"):
|
|
581
|
-
response_data =
|
|
582
|
-
raise errors.Unauthorized(
|
|
543
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
544
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
583
545
|
if utils.match_response(http_res, "403", "application/json"):
|
|
584
|
-
response_data =
|
|
585
|
-
raise errors.Forbidden(
|
|
546
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
547
|
+
raise errors.Forbidden(response_data, http_res)
|
|
586
548
|
if utils.match_response(http_res, "404", "application/json"):
|
|
587
|
-
response_data =
|
|
588
|
-
raise errors.NotFound(
|
|
549
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
550
|
+
raise errors.NotFound(response_data, http_res)
|
|
589
551
|
if utils.match_response(http_res, "409", "application/json"):
|
|
590
|
-
response_data =
|
|
591
|
-
raise errors.Conflict(
|
|
552
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
553
|
+
raise errors.Conflict(response_data, http_res)
|
|
592
554
|
if utils.match_response(http_res, "410", "application/json"):
|
|
593
|
-
response_data =
|
|
594
|
-
|
|
595
|
-
)
|
|
596
|
-
raise errors.InviteExpired(data=response_data)
|
|
555
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
556
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
597
557
|
if utils.match_response(http_res, "422", "application/json"):
|
|
598
|
-
response_data =
|
|
599
|
-
|
|
558
|
+
response_data = unmarshal_json_response(
|
|
559
|
+
errors.UnprocessableEntityData, http_res
|
|
600
560
|
)
|
|
601
|
-
raise errors.UnprocessableEntity(
|
|
561
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
602
562
|
if utils.match_response(http_res, "429", "application/json"):
|
|
603
|
-
response_data =
|
|
604
|
-
|
|
563
|
+
response_data = unmarshal_json_response(
|
|
564
|
+
errors.RateLimitExceededData, http_res
|
|
605
565
|
)
|
|
606
|
-
raise errors.RateLimitExceeded(
|
|
566
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
607
567
|
if utils.match_response(http_res, "500", "application/json"):
|
|
608
|
-
response_data =
|
|
609
|
-
|
|
568
|
+
response_data = unmarshal_json_response(
|
|
569
|
+
errors.InternalServerErrorData, http_res
|
|
610
570
|
)
|
|
611
|
-
raise errors.InternalServerError(
|
|
571
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
612
572
|
if utils.match_response(http_res, "4XX", "*"):
|
|
613
573
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
614
|
-
raise errors.SDKError(
|
|
615
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
616
|
-
)
|
|
574
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
617
575
|
if utils.match_response(http_res, "5XX", "*"):
|
|
618
576
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
619
|
-
raise errors.SDKError(
|
|
620
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
621
|
-
)
|
|
577
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
622
578
|
|
|
623
|
-
|
|
624
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
625
|
-
raise errors.SDKError(
|
|
626
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
627
|
-
http_res.status_code,
|
|
628
|
-
http_res_text,
|
|
629
|
-
http_res,
|
|
630
|
-
)
|
|
579
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
631
580
|
|
|
632
581
|
def retrieve_links(
|
|
633
582
|
self,
|
|
@@ -715,61 +664,48 @@ class Partners(BaseSDK):
|
|
|
715
664
|
|
|
716
665
|
response_data: Any = None
|
|
717
666
|
if utils.match_response(http_res, "200", "application/json"):
|
|
718
|
-
return
|
|
667
|
+
return unmarshal_json_response(Optional[List[operations.Link]], http_res)
|
|
719
668
|
if utils.match_response(http_res, "400", "application/json"):
|
|
720
|
-
response_data =
|
|
721
|
-
raise errors.BadRequest(
|
|
669
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
670
|
+
raise errors.BadRequest(response_data, http_res)
|
|
722
671
|
if utils.match_response(http_res, "401", "application/json"):
|
|
723
|
-
response_data =
|
|
724
|
-
raise errors.Unauthorized(
|
|
672
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
673
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
725
674
|
if utils.match_response(http_res, "403", "application/json"):
|
|
726
|
-
response_data =
|
|
727
|
-
raise errors.Forbidden(
|
|
675
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
676
|
+
raise errors.Forbidden(response_data, http_res)
|
|
728
677
|
if utils.match_response(http_res, "404", "application/json"):
|
|
729
|
-
response_data =
|
|
730
|
-
raise errors.NotFound(
|
|
678
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
679
|
+
raise errors.NotFound(response_data, http_res)
|
|
731
680
|
if utils.match_response(http_res, "409", "application/json"):
|
|
732
|
-
response_data =
|
|
733
|
-
raise errors.Conflict(
|
|
681
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
682
|
+
raise errors.Conflict(response_data, http_res)
|
|
734
683
|
if utils.match_response(http_res, "410", "application/json"):
|
|
735
|
-
response_data =
|
|
736
|
-
|
|
737
|
-
)
|
|
738
|
-
raise errors.InviteExpired(data=response_data)
|
|
684
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
685
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
739
686
|
if utils.match_response(http_res, "422", "application/json"):
|
|
740
|
-
response_data =
|
|
741
|
-
|
|
687
|
+
response_data = unmarshal_json_response(
|
|
688
|
+
errors.UnprocessableEntityData, http_res
|
|
742
689
|
)
|
|
743
|
-
raise errors.UnprocessableEntity(
|
|
690
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
744
691
|
if utils.match_response(http_res, "429", "application/json"):
|
|
745
|
-
response_data =
|
|
746
|
-
|
|
692
|
+
response_data = unmarshal_json_response(
|
|
693
|
+
errors.RateLimitExceededData, http_res
|
|
747
694
|
)
|
|
748
|
-
raise errors.RateLimitExceeded(
|
|
695
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
749
696
|
if utils.match_response(http_res, "500", "application/json"):
|
|
750
|
-
response_data =
|
|
751
|
-
|
|
697
|
+
response_data = unmarshal_json_response(
|
|
698
|
+
errors.InternalServerErrorData, http_res
|
|
752
699
|
)
|
|
753
|
-
raise errors.InternalServerError(
|
|
700
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
754
701
|
if utils.match_response(http_res, "4XX", "*"):
|
|
755
702
|
http_res_text = utils.stream_to_text(http_res)
|
|
756
|
-
raise errors.SDKError(
|
|
757
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
758
|
-
)
|
|
703
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
759
704
|
if utils.match_response(http_res, "5XX", "*"):
|
|
760
705
|
http_res_text = utils.stream_to_text(http_res)
|
|
761
|
-
raise errors.SDKError(
|
|
762
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
763
|
-
)
|
|
706
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
764
707
|
|
|
765
|
-
|
|
766
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
767
|
-
raise errors.SDKError(
|
|
768
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
769
|
-
http_res.status_code,
|
|
770
|
-
http_res_text,
|
|
771
|
-
http_res,
|
|
772
|
-
)
|
|
708
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
773
709
|
|
|
774
710
|
async def retrieve_links_async(
|
|
775
711
|
self,
|
|
@@ -857,61 +793,48 @@ class Partners(BaseSDK):
|
|
|
857
793
|
|
|
858
794
|
response_data: Any = None
|
|
859
795
|
if utils.match_response(http_res, "200", "application/json"):
|
|
860
|
-
return
|
|
796
|
+
return unmarshal_json_response(Optional[List[operations.Link]], http_res)
|
|
861
797
|
if utils.match_response(http_res, "400", "application/json"):
|
|
862
|
-
response_data =
|
|
863
|
-
raise errors.BadRequest(
|
|
798
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
799
|
+
raise errors.BadRequest(response_data, http_res)
|
|
864
800
|
if utils.match_response(http_res, "401", "application/json"):
|
|
865
|
-
response_data =
|
|
866
|
-
raise errors.Unauthorized(
|
|
801
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
802
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
867
803
|
if utils.match_response(http_res, "403", "application/json"):
|
|
868
|
-
response_data =
|
|
869
|
-
raise errors.Forbidden(
|
|
804
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
805
|
+
raise errors.Forbidden(response_data, http_res)
|
|
870
806
|
if utils.match_response(http_res, "404", "application/json"):
|
|
871
|
-
response_data =
|
|
872
|
-
raise errors.NotFound(
|
|
807
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
808
|
+
raise errors.NotFound(response_data, http_res)
|
|
873
809
|
if utils.match_response(http_res, "409", "application/json"):
|
|
874
|
-
response_data =
|
|
875
|
-
raise errors.Conflict(
|
|
810
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
811
|
+
raise errors.Conflict(response_data, http_res)
|
|
876
812
|
if utils.match_response(http_res, "410", "application/json"):
|
|
877
|
-
response_data =
|
|
878
|
-
|
|
879
|
-
)
|
|
880
|
-
raise errors.InviteExpired(data=response_data)
|
|
813
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
814
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
881
815
|
if utils.match_response(http_res, "422", "application/json"):
|
|
882
|
-
response_data =
|
|
883
|
-
|
|
816
|
+
response_data = unmarshal_json_response(
|
|
817
|
+
errors.UnprocessableEntityData, http_res
|
|
884
818
|
)
|
|
885
|
-
raise errors.UnprocessableEntity(
|
|
819
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
886
820
|
if utils.match_response(http_res, "429", "application/json"):
|
|
887
|
-
response_data =
|
|
888
|
-
|
|
821
|
+
response_data = unmarshal_json_response(
|
|
822
|
+
errors.RateLimitExceededData, http_res
|
|
889
823
|
)
|
|
890
|
-
raise errors.RateLimitExceeded(
|
|
824
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
891
825
|
if utils.match_response(http_res, "500", "application/json"):
|
|
892
|
-
response_data =
|
|
893
|
-
|
|
826
|
+
response_data = unmarshal_json_response(
|
|
827
|
+
errors.InternalServerErrorData, http_res
|
|
894
828
|
)
|
|
895
|
-
raise errors.InternalServerError(
|
|
829
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
896
830
|
if utils.match_response(http_res, "4XX", "*"):
|
|
897
831
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
898
|
-
raise errors.SDKError(
|
|
899
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
900
|
-
)
|
|
832
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
901
833
|
if utils.match_response(http_res, "5XX", "*"):
|
|
902
834
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
903
|
-
raise errors.SDKError(
|
|
904
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
905
|
-
)
|
|
835
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
906
836
|
|
|
907
|
-
|
|
908
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
909
|
-
raise errors.SDKError(
|
|
910
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
911
|
-
http_res.status_code,
|
|
912
|
-
http_res_text,
|
|
913
|
-
http_res,
|
|
914
|
-
)
|
|
837
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
915
838
|
|
|
916
839
|
def upsert_link(
|
|
917
840
|
self,
|
|
@@ -1011,61 +934,48 @@ class Partners(BaseSDK):
|
|
|
1011
934
|
|
|
1012
935
|
response_data: Any = None
|
|
1013
936
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1014
|
-
return
|
|
937
|
+
return unmarshal_json_response(Optional[components.LinkSchema], http_res)
|
|
1015
938
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1016
|
-
response_data =
|
|
1017
|
-
raise errors.BadRequest(
|
|
939
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
940
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1018
941
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1019
|
-
response_data =
|
|
1020
|
-
raise errors.Unauthorized(
|
|
942
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
943
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1021
944
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1022
|
-
response_data =
|
|
1023
|
-
raise errors.Forbidden(
|
|
945
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
946
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1024
947
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1025
|
-
response_data =
|
|
1026
|
-
raise errors.NotFound(
|
|
948
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
949
|
+
raise errors.NotFound(response_data, http_res)
|
|
1027
950
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1028
|
-
response_data =
|
|
1029
|
-
raise errors.Conflict(
|
|
951
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
952
|
+
raise errors.Conflict(response_data, http_res)
|
|
1030
953
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1031
|
-
response_data =
|
|
1032
|
-
|
|
1033
|
-
)
|
|
1034
|
-
raise errors.InviteExpired(data=response_data)
|
|
954
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
955
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1035
956
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1036
|
-
response_data =
|
|
1037
|
-
|
|
957
|
+
response_data = unmarshal_json_response(
|
|
958
|
+
errors.UnprocessableEntityData, http_res
|
|
1038
959
|
)
|
|
1039
|
-
raise errors.UnprocessableEntity(
|
|
960
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1040
961
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1041
|
-
response_data =
|
|
1042
|
-
|
|
962
|
+
response_data = unmarshal_json_response(
|
|
963
|
+
errors.RateLimitExceededData, http_res
|
|
1043
964
|
)
|
|
1044
|
-
raise errors.RateLimitExceeded(
|
|
965
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1045
966
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1046
|
-
response_data =
|
|
1047
|
-
|
|
967
|
+
response_data = unmarshal_json_response(
|
|
968
|
+
errors.InternalServerErrorData, http_res
|
|
1048
969
|
)
|
|
1049
|
-
raise errors.InternalServerError(
|
|
970
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1050
971
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1051
972
|
http_res_text = utils.stream_to_text(http_res)
|
|
1052
|
-
raise errors.SDKError(
|
|
1053
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1054
|
-
)
|
|
973
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1055
974
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1056
975
|
http_res_text = utils.stream_to_text(http_res)
|
|
1057
|
-
raise errors.SDKError(
|
|
1058
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1059
|
-
)
|
|
976
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1060
977
|
|
|
1061
|
-
|
|
1062
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1063
|
-
raise errors.SDKError(
|
|
1064
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1065
|
-
http_res.status_code,
|
|
1066
|
-
http_res_text,
|
|
1067
|
-
http_res,
|
|
1068
|
-
)
|
|
978
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1069
979
|
|
|
1070
980
|
async def upsert_link_async(
|
|
1071
981
|
self,
|
|
@@ -1165,61 +1075,48 @@ class Partners(BaseSDK):
|
|
|
1165
1075
|
|
|
1166
1076
|
response_data: Any = None
|
|
1167
1077
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1168
|
-
return
|
|
1078
|
+
return unmarshal_json_response(Optional[components.LinkSchema], http_res)
|
|
1169
1079
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1170
|
-
response_data =
|
|
1171
|
-
raise errors.BadRequest(
|
|
1080
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1081
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1172
1082
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1173
|
-
response_data =
|
|
1174
|
-
raise errors.Unauthorized(
|
|
1083
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1084
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1175
1085
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1176
|
-
response_data =
|
|
1177
|
-
raise errors.Forbidden(
|
|
1086
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1087
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1178
1088
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1179
|
-
response_data =
|
|
1180
|
-
raise errors.NotFound(
|
|
1089
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1090
|
+
raise errors.NotFound(response_data, http_res)
|
|
1181
1091
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1182
|
-
response_data =
|
|
1183
|
-
raise errors.Conflict(
|
|
1092
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1093
|
+
raise errors.Conflict(response_data, http_res)
|
|
1184
1094
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1185
|
-
response_data =
|
|
1186
|
-
|
|
1187
|
-
)
|
|
1188
|
-
raise errors.InviteExpired(data=response_data)
|
|
1095
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1096
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1189
1097
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1190
|
-
response_data =
|
|
1191
|
-
|
|
1098
|
+
response_data = unmarshal_json_response(
|
|
1099
|
+
errors.UnprocessableEntityData, http_res
|
|
1192
1100
|
)
|
|
1193
|
-
raise errors.UnprocessableEntity(
|
|
1101
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1194
1102
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1195
|
-
response_data =
|
|
1196
|
-
|
|
1103
|
+
response_data = unmarshal_json_response(
|
|
1104
|
+
errors.RateLimitExceededData, http_res
|
|
1197
1105
|
)
|
|
1198
|
-
raise errors.RateLimitExceeded(
|
|
1106
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1199
1107
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1200
|
-
response_data =
|
|
1201
|
-
|
|
1108
|
+
response_data = unmarshal_json_response(
|
|
1109
|
+
errors.InternalServerErrorData, http_res
|
|
1202
1110
|
)
|
|
1203
|
-
raise errors.InternalServerError(
|
|
1111
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1204
1112
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1205
1113
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1206
|
-
raise errors.SDKError(
|
|
1207
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1208
|
-
)
|
|
1114
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1209
1115
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1210
1116
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1211
|
-
raise errors.SDKError(
|
|
1212
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1213
|
-
)
|
|
1117
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1214
1118
|
|
|
1215
|
-
|
|
1216
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1217
|
-
raise errors.SDKError(
|
|
1218
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1219
|
-
http_res.status_code,
|
|
1220
|
-
http_res_text,
|
|
1221
|
-
http_res,
|
|
1222
|
-
)
|
|
1119
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1223
1120
|
|
|
1224
1121
|
def analytics(
|
|
1225
1122
|
self,
|
|
@@ -1310,63 +1207,50 @@ class Partners(BaseSDK):
|
|
|
1310
1207
|
|
|
1311
1208
|
response_data: Any = None
|
|
1312
1209
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1313
|
-
return
|
|
1314
|
-
|
|
1210
|
+
return unmarshal_json_response(
|
|
1211
|
+
Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
|
|
1315
1212
|
)
|
|
1316
1213
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1317
|
-
response_data =
|
|
1318
|
-
raise errors.BadRequest(
|
|
1214
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1215
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1319
1216
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1320
|
-
response_data =
|
|
1321
|
-
raise errors.Unauthorized(
|
|
1217
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1218
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1322
1219
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1323
|
-
response_data =
|
|
1324
|
-
raise errors.Forbidden(
|
|
1220
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1221
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1325
1222
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1326
|
-
response_data =
|
|
1327
|
-
raise errors.NotFound(
|
|
1223
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1224
|
+
raise errors.NotFound(response_data, http_res)
|
|
1328
1225
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1329
|
-
response_data =
|
|
1330
|
-
raise errors.Conflict(
|
|
1226
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1227
|
+
raise errors.Conflict(response_data, http_res)
|
|
1331
1228
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1332
|
-
response_data =
|
|
1333
|
-
|
|
1334
|
-
)
|
|
1335
|
-
raise errors.InviteExpired(data=response_data)
|
|
1229
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1230
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1336
1231
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1337
|
-
response_data =
|
|
1338
|
-
|
|
1232
|
+
response_data = unmarshal_json_response(
|
|
1233
|
+
errors.UnprocessableEntityData, http_res
|
|
1339
1234
|
)
|
|
1340
|
-
raise errors.UnprocessableEntity(
|
|
1235
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1341
1236
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1342
|
-
response_data =
|
|
1343
|
-
|
|
1237
|
+
response_data = unmarshal_json_response(
|
|
1238
|
+
errors.RateLimitExceededData, http_res
|
|
1344
1239
|
)
|
|
1345
|
-
raise errors.RateLimitExceeded(
|
|
1240
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1346
1241
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1347
|
-
response_data =
|
|
1348
|
-
|
|
1242
|
+
response_data = unmarshal_json_response(
|
|
1243
|
+
errors.InternalServerErrorData, http_res
|
|
1349
1244
|
)
|
|
1350
|
-
raise errors.InternalServerError(
|
|
1245
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1351
1246
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1352
1247
|
http_res_text = utils.stream_to_text(http_res)
|
|
1353
|
-
raise errors.SDKError(
|
|
1354
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1355
|
-
)
|
|
1248
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1356
1249
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1357
1250
|
http_res_text = utils.stream_to_text(http_res)
|
|
1358
|
-
raise errors.SDKError(
|
|
1359
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1360
|
-
)
|
|
1251
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1361
1252
|
|
|
1362
|
-
|
|
1363
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1364
|
-
raise errors.SDKError(
|
|
1365
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1366
|
-
http_res.status_code,
|
|
1367
|
-
http_res_text,
|
|
1368
|
-
http_res,
|
|
1369
|
-
)
|
|
1253
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1370
1254
|
|
|
1371
1255
|
async def analytics_async(
|
|
1372
1256
|
self,
|
|
@@ -1457,60 +1341,47 @@ class Partners(BaseSDK):
|
|
|
1457
1341
|
|
|
1458
1342
|
response_data: Any = None
|
|
1459
1343
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1460
|
-
return
|
|
1461
|
-
|
|
1344
|
+
return unmarshal_json_response(
|
|
1345
|
+
Optional[operations.RetrievePartnerAnalyticsResponseBody], http_res
|
|
1462
1346
|
)
|
|
1463
1347
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1464
|
-
response_data =
|
|
1465
|
-
raise errors.BadRequest(
|
|
1348
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1349
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1466
1350
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1467
|
-
response_data =
|
|
1468
|
-
raise errors.Unauthorized(
|
|
1351
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1352
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1469
1353
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1470
|
-
response_data =
|
|
1471
|
-
raise errors.Forbidden(
|
|
1354
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1355
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1472
1356
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1473
|
-
response_data =
|
|
1474
|
-
raise errors.NotFound(
|
|
1357
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1358
|
+
raise errors.NotFound(response_data, http_res)
|
|
1475
1359
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1476
|
-
response_data =
|
|
1477
|
-
raise errors.Conflict(
|
|
1360
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1361
|
+
raise errors.Conflict(response_data, http_res)
|
|
1478
1362
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1479
|
-
response_data =
|
|
1480
|
-
|
|
1481
|
-
)
|
|
1482
|
-
raise errors.InviteExpired(data=response_data)
|
|
1363
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1364
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1483
1365
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1484
|
-
response_data =
|
|
1485
|
-
|
|
1366
|
+
response_data = unmarshal_json_response(
|
|
1367
|
+
errors.UnprocessableEntityData, http_res
|
|
1486
1368
|
)
|
|
1487
|
-
raise errors.UnprocessableEntity(
|
|
1369
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1488
1370
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1489
|
-
response_data =
|
|
1490
|
-
|
|
1371
|
+
response_data = unmarshal_json_response(
|
|
1372
|
+
errors.RateLimitExceededData, http_res
|
|
1491
1373
|
)
|
|
1492
|
-
raise errors.RateLimitExceeded(
|
|
1374
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1493
1375
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1494
|
-
response_data =
|
|
1495
|
-
|
|
1376
|
+
response_data = unmarshal_json_response(
|
|
1377
|
+
errors.InternalServerErrorData, http_res
|
|
1496
1378
|
)
|
|
1497
|
-
raise errors.InternalServerError(
|
|
1379
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1498
1380
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1499
1381
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1500
|
-
raise errors.SDKError(
|
|
1501
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1502
|
-
)
|
|
1382
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1503
1383
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1504
1384
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1505
|
-
raise errors.SDKError(
|
|
1506
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1507
|
-
)
|
|
1385
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1508
1386
|
|
|
1509
|
-
|
|
1510
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1511
|
-
raise errors.SDKError(
|
|
1512
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1513
|
-
http_res.status_code,
|
|
1514
|
-
http_res_text,
|
|
1515
|
-
http_res,
|
|
1516
|
-
)
|
|
1387
|
+
raise errors.SDKError("Unexpected response received", http_res)
|