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/folders.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,48 @@ class Folders(BaseSDK):
|
|
|
107
108
|
|
|
108
109
|
response_data: Any = None
|
|
109
110
|
if utils.match_response(http_res, "201", "application/json"):
|
|
110
|
-
return
|
|
111
|
-
http_res.text, Optional[components.FolderSchema]
|
|
112
|
-
)
|
|
111
|
+
return unmarshal_json_response(Optional[components.FolderSchema], http_res)
|
|
113
112
|
if utils.match_response(http_res, "400", "application/json"):
|
|
114
|
-
response_data =
|
|
115
|
-
raise errors.BadRequest(
|
|
113
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
114
|
+
raise errors.BadRequest(response_data, http_res)
|
|
116
115
|
if utils.match_response(http_res, "401", "application/json"):
|
|
117
|
-
response_data =
|
|
118
|
-
raise errors.Unauthorized(
|
|
116
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
117
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
119
118
|
if utils.match_response(http_res, "403", "application/json"):
|
|
120
|
-
response_data =
|
|
121
|
-
raise errors.Forbidden(
|
|
119
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
120
|
+
raise errors.Forbidden(response_data, http_res)
|
|
122
121
|
if utils.match_response(http_res, "404", "application/json"):
|
|
123
|
-
response_data =
|
|
124
|
-
raise errors.NotFound(
|
|
122
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
123
|
+
raise errors.NotFound(response_data, http_res)
|
|
125
124
|
if utils.match_response(http_res, "409", "application/json"):
|
|
126
|
-
response_data =
|
|
127
|
-
raise errors.Conflict(
|
|
125
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
126
|
+
raise errors.Conflict(response_data, http_res)
|
|
128
127
|
if utils.match_response(http_res, "410", "application/json"):
|
|
129
|
-
response_data =
|
|
130
|
-
|
|
131
|
-
)
|
|
132
|
-
raise errors.InviteExpired(data=response_data)
|
|
128
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
129
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
133
130
|
if utils.match_response(http_res, "422", "application/json"):
|
|
134
|
-
response_data =
|
|
135
|
-
|
|
131
|
+
response_data = unmarshal_json_response(
|
|
132
|
+
errors.UnprocessableEntityData, http_res
|
|
136
133
|
)
|
|
137
|
-
raise errors.UnprocessableEntity(
|
|
134
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
138
135
|
if utils.match_response(http_res, "429", "application/json"):
|
|
139
|
-
response_data =
|
|
140
|
-
|
|
136
|
+
response_data = unmarshal_json_response(
|
|
137
|
+
errors.RateLimitExceededData, http_res
|
|
141
138
|
)
|
|
142
|
-
raise errors.RateLimitExceeded(
|
|
139
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
143
140
|
if utils.match_response(http_res, "500", "application/json"):
|
|
144
|
-
response_data =
|
|
145
|
-
|
|
141
|
+
response_data = unmarshal_json_response(
|
|
142
|
+
errors.InternalServerErrorData, http_res
|
|
146
143
|
)
|
|
147
|
-
raise errors.InternalServerError(
|
|
144
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
148
145
|
if utils.match_response(http_res, "4XX", "*"):
|
|
149
146
|
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
|
-
)
|
|
147
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
153
148
|
if utils.match_response(http_res, "5XX", "*"):
|
|
154
149
|
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
|
-
)
|
|
150
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
158
151
|
|
|
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
|
-
)
|
|
152
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
167
153
|
|
|
168
154
|
async def create_async(
|
|
169
155
|
self,
|
|
@@ -263,63 +249,48 @@ class Folders(BaseSDK):
|
|
|
263
249
|
|
|
264
250
|
response_data: Any = None
|
|
265
251
|
if utils.match_response(http_res, "201", "application/json"):
|
|
266
|
-
return
|
|
267
|
-
http_res.text, Optional[components.FolderSchema]
|
|
268
|
-
)
|
|
252
|
+
return unmarshal_json_response(Optional[components.FolderSchema], http_res)
|
|
269
253
|
if utils.match_response(http_res, "400", "application/json"):
|
|
270
|
-
response_data =
|
|
271
|
-
raise errors.BadRequest(
|
|
254
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
255
|
+
raise errors.BadRequest(response_data, http_res)
|
|
272
256
|
if utils.match_response(http_res, "401", "application/json"):
|
|
273
|
-
response_data =
|
|
274
|
-
raise errors.Unauthorized(
|
|
257
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
258
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
275
259
|
if utils.match_response(http_res, "403", "application/json"):
|
|
276
|
-
response_data =
|
|
277
|
-
raise errors.Forbidden(
|
|
260
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
261
|
+
raise errors.Forbidden(response_data, http_res)
|
|
278
262
|
if utils.match_response(http_res, "404", "application/json"):
|
|
279
|
-
response_data =
|
|
280
|
-
raise errors.NotFound(
|
|
263
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
264
|
+
raise errors.NotFound(response_data, http_res)
|
|
281
265
|
if utils.match_response(http_res, "409", "application/json"):
|
|
282
|
-
response_data =
|
|
283
|
-
raise errors.Conflict(
|
|
266
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
267
|
+
raise errors.Conflict(response_data, http_res)
|
|
284
268
|
if utils.match_response(http_res, "410", "application/json"):
|
|
285
|
-
response_data =
|
|
286
|
-
|
|
287
|
-
)
|
|
288
|
-
raise errors.InviteExpired(data=response_data)
|
|
269
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
270
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
289
271
|
if utils.match_response(http_res, "422", "application/json"):
|
|
290
|
-
response_data =
|
|
291
|
-
|
|
272
|
+
response_data = unmarshal_json_response(
|
|
273
|
+
errors.UnprocessableEntityData, http_res
|
|
292
274
|
)
|
|
293
|
-
raise errors.UnprocessableEntity(
|
|
275
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
294
276
|
if utils.match_response(http_res, "429", "application/json"):
|
|
295
|
-
response_data =
|
|
296
|
-
|
|
277
|
+
response_data = unmarshal_json_response(
|
|
278
|
+
errors.RateLimitExceededData, http_res
|
|
297
279
|
)
|
|
298
|
-
raise errors.RateLimitExceeded(
|
|
280
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
299
281
|
if utils.match_response(http_res, "500", "application/json"):
|
|
300
|
-
response_data =
|
|
301
|
-
|
|
282
|
+
response_data = unmarshal_json_response(
|
|
283
|
+
errors.InternalServerErrorData, http_res
|
|
302
284
|
)
|
|
303
|
-
raise errors.InternalServerError(
|
|
285
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
304
286
|
if utils.match_response(http_res, "4XX", "*"):
|
|
305
287
|
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
|
-
)
|
|
288
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
309
289
|
if utils.match_response(http_res, "5XX", "*"):
|
|
310
290
|
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
|
-
)
|
|
291
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
314
292
|
|
|
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
|
-
)
|
|
293
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
323
294
|
|
|
324
295
|
def list(
|
|
325
296
|
self,
|
|
@@ -407,63 +378,50 @@ class Folders(BaseSDK):
|
|
|
407
378
|
|
|
408
379
|
response_data: Any = None
|
|
409
380
|
if utils.match_response(http_res, "200", "application/json"):
|
|
410
|
-
return
|
|
411
|
-
|
|
381
|
+
return unmarshal_json_response(
|
|
382
|
+
Optional[List[components.FolderSchema]], http_res
|
|
412
383
|
)
|
|
413
384
|
if utils.match_response(http_res, "400", "application/json"):
|
|
414
|
-
response_data =
|
|
415
|
-
raise errors.BadRequest(
|
|
385
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
386
|
+
raise errors.BadRequest(response_data, http_res)
|
|
416
387
|
if utils.match_response(http_res, "401", "application/json"):
|
|
417
|
-
response_data =
|
|
418
|
-
raise errors.Unauthorized(
|
|
388
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
389
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
419
390
|
if utils.match_response(http_res, "403", "application/json"):
|
|
420
|
-
response_data =
|
|
421
|
-
raise errors.Forbidden(
|
|
391
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
392
|
+
raise errors.Forbidden(response_data, http_res)
|
|
422
393
|
if utils.match_response(http_res, "404", "application/json"):
|
|
423
|
-
response_data =
|
|
424
|
-
raise errors.NotFound(
|
|
394
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
395
|
+
raise errors.NotFound(response_data, http_res)
|
|
425
396
|
if utils.match_response(http_res, "409", "application/json"):
|
|
426
|
-
response_data =
|
|
427
|
-
raise errors.Conflict(
|
|
397
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
398
|
+
raise errors.Conflict(response_data, http_res)
|
|
428
399
|
if utils.match_response(http_res, "410", "application/json"):
|
|
429
|
-
response_data =
|
|
430
|
-
|
|
431
|
-
)
|
|
432
|
-
raise errors.InviteExpired(data=response_data)
|
|
400
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
401
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
433
402
|
if utils.match_response(http_res, "422", "application/json"):
|
|
434
|
-
response_data =
|
|
435
|
-
|
|
403
|
+
response_data = unmarshal_json_response(
|
|
404
|
+
errors.UnprocessableEntityData, http_res
|
|
436
405
|
)
|
|
437
|
-
raise errors.UnprocessableEntity(
|
|
406
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
438
407
|
if utils.match_response(http_res, "429", "application/json"):
|
|
439
|
-
response_data =
|
|
440
|
-
|
|
408
|
+
response_data = unmarshal_json_response(
|
|
409
|
+
errors.RateLimitExceededData, http_res
|
|
441
410
|
)
|
|
442
|
-
raise errors.RateLimitExceeded(
|
|
411
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
443
412
|
if utils.match_response(http_res, "500", "application/json"):
|
|
444
|
-
response_data =
|
|
445
|
-
|
|
413
|
+
response_data = unmarshal_json_response(
|
|
414
|
+
errors.InternalServerErrorData, http_res
|
|
446
415
|
)
|
|
447
|
-
raise errors.InternalServerError(
|
|
416
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
448
417
|
if utils.match_response(http_res, "4XX", "*"):
|
|
449
418
|
http_res_text = utils.stream_to_text(http_res)
|
|
450
|
-
raise errors.SDKError(
|
|
451
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
452
|
-
)
|
|
419
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
453
420
|
if utils.match_response(http_res, "5XX", "*"):
|
|
454
421
|
http_res_text = utils.stream_to_text(http_res)
|
|
455
|
-
raise errors.SDKError(
|
|
456
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
457
|
-
)
|
|
422
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
458
423
|
|
|
459
|
-
|
|
460
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
461
|
-
raise errors.SDKError(
|
|
462
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
463
|
-
http_res.status_code,
|
|
464
|
-
http_res_text,
|
|
465
|
-
http_res,
|
|
466
|
-
)
|
|
424
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
467
425
|
|
|
468
426
|
async def list_async(
|
|
469
427
|
self,
|
|
@@ -551,63 +509,50 @@ class Folders(BaseSDK):
|
|
|
551
509
|
|
|
552
510
|
response_data: Any = None
|
|
553
511
|
if utils.match_response(http_res, "200", "application/json"):
|
|
554
|
-
return
|
|
555
|
-
|
|
512
|
+
return unmarshal_json_response(
|
|
513
|
+
Optional[List[components.FolderSchema]], http_res
|
|
556
514
|
)
|
|
557
515
|
if utils.match_response(http_res, "400", "application/json"):
|
|
558
|
-
response_data =
|
|
559
|
-
raise errors.BadRequest(
|
|
516
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
517
|
+
raise errors.BadRequest(response_data, http_res)
|
|
560
518
|
if utils.match_response(http_res, "401", "application/json"):
|
|
561
|
-
response_data =
|
|
562
|
-
raise errors.Unauthorized(
|
|
519
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
520
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
563
521
|
if utils.match_response(http_res, "403", "application/json"):
|
|
564
|
-
response_data =
|
|
565
|
-
raise errors.Forbidden(
|
|
522
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
523
|
+
raise errors.Forbidden(response_data, http_res)
|
|
566
524
|
if utils.match_response(http_res, "404", "application/json"):
|
|
567
|
-
response_data =
|
|
568
|
-
raise errors.NotFound(
|
|
525
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
526
|
+
raise errors.NotFound(response_data, http_res)
|
|
569
527
|
if utils.match_response(http_res, "409", "application/json"):
|
|
570
|
-
response_data =
|
|
571
|
-
raise errors.Conflict(
|
|
528
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
529
|
+
raise errors.Conflict(response_data, http_res)
|
|
572
530
|
if utils.match_response(http_res, "410", "application/json"):
|
|
573
|
-
response_data =
|
|
574
|
-
|
|
575
|
-
)
|
|
576
|
-
raise errors.InviteExpired(data=response_data)
|
|
531
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
532
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
577
533
|
if utils.match_response(http_res, "422", "application/json"):
|
|
578
|
-
response_data =
|
|
579
|
-
|
|
534
|
+
response_data = unmarshal_json_response(
|
|
535
|
+
errors.UnprocessableEntityData, http_res
|
|
580
536
|
)
|
|
581
|
-
raise errors.UnprocessableEntity(
|
|
537
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
582
538
|
if utils.match_response(http_res, "429", "application/json"):
|
|
583
|
-
response_data =
|
|
584
|
-
|
|
539
|
+
response_data = unmarshal_json_response(
|
|
540
|
+
errors.RateLimitExceededData, http_res
|
|
585
541
|
)
|
|
586
|
-
raise errors.RateLimitExceeded(
|
|
542
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
587
543
|
if utils.match_response(http_res, "500", "application/json"):
|
|
588
|
-
response_data =
|
|
589
|
-
|
|
544
|
+
response_data = unmarshal_json_response(
|
|
545
|
+
errors.InternalServerErrorData, http_res
|
|
590
546
|
)
|
|
591
|
-
raise errors.InternalServerError(
|
|
547
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
592
548
|
if utils.match_response(http_res, "4XX", "*"):
|
|
593
549
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
594
|
-
raise errors.SDKError(
|
|
595
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
596
|
-
)
|
|
550
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
597
551
|
if utils.match_response(http_res, "5XX", "*"):
|
|
598
552
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
599
|
-
raise errors.SDKError(
|
|
600
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
601
|
-
)
|
|
553
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
602
554
|
|
|
603
|
-
|
|
604
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
605
|
-
raise errors.SDKError(
|
|
606
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
607
|
-
http_res.status_code,
|
|
608
|
-
http_res_text,
|
|
609
|
-
http_res,
|
|
610
|
-
)
|
|
555
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
611
556
|
|
|
612
557
|
def update(
|
|
613
558
|
self,
|
|
@@ -710,63 +655,48 @@ class Folders(BaseSDK):
|
|
|
710
655
|
|
|
711
656
|
response_data: Any = None
|
|
712
657
|
if utils.match_response(http_res, "200", "application/json"):
|
|
713
|
-
return
|
|
714
|
-
http_res.text, Optional[components.FolderSchema]
|
|
715
|
-
)
|
|
658
|
+
return unmarshal_json_response(Optional[components.FolderSchema], http_res)
|
|
716
659
|
if utils.match_response(http_res, "400", "application/json"):
|
|
717
|
-
response_data =
|
|
718
|
-
raise errors.BadRequest(
|
|
660
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
661
|
+
raise errors.BadRequest(response_data, http_res)
|
|
719
662
|
if utils.match_response(http_res, "401", "application/json"):
|
|
720
|
-
response_data =
|
|
721
|
-
raise errors.Unauthorized(
|
|
663
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
664
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
722
665
|
if utils.match_response(http_res, "403", "application/json"):
|
|
723
|
-
response_data =
|
|
724
|
-
raise errors.Forbidden(
|
|
666
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
667
|
+
raise errors.Forbidden(response_data, http_res)
|
|
725
668
|
if utils.match_response(http_res, "404", "application/json"):
|
|
726
|
-
response_data =
|
|
727
|
-
raise errors.NotFound(
|
|
669
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
670
|
+
raise errors.NotFound(response_data, http_res)
|
|
728
671
|
if utils.match_response(http_res, "409", "application/json"):
|
|
729
|
-
response_data =
|
|
730
|
-
raise errors.Conflict(
|
|
672
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
673
|
+
raise errors.Conflict(response_data, http_res)
|
|
731
674
|
if utils.match_response(http_res, "410", "application/json"):
|
|
732
|
-
response_data =
|
|
733
|
-
|
|
734
|
-
)
|
|
735
|
-
raise errors.InviteExpired(data=response_data)
|
|
675
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
676
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
736
677
|
if utils.match_response(http_res, "422", "application/json"):
|
|
737
|
-
response_data =
|
|
738
|
-
|
|
678
|
+
response_data = unmarshal_json_response(
|
|
679
|
+
errors.UnprocessableEntityData, http_res
|
|
739
680
|
)
|
|
740
|
-
raise errors.UnprocessableEntity(
|
|
681
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
741
682
|
if utils.match_response(http_res, "429", "application/json"):
|
|
742
|
-
response_data =
|
|
743
|
-
|
|
683
|
+
response_data = unmarshal_json_response(
|
|
684
|
+
errors.RateLimitExceededData, http_res
|
|
744
685
|
)
|
|
745
|
-
raise errors.RateLimitExceeded(
|
|
686
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
746
687
|
if utils.match_response(http_res, "500", "application/json"):
|
|
747
|
-
response_data =
|
|
748
|
-
|
|
688
|
+
response_data = unmarshal_json_response(
|
|
689
|
+
errors.InternalServerErrorData, http_res
|
|
749
690
|
)
|
|
750
|
-
raise errors.InternalServerError(
|
|
691
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
751
692
|
if utils.match_response(http_res, "4XX", "*"):
|
|
752
693
|
http_res_text = utils.stream_to_text(http_res)
|
|
753
|
-
raise errors.SDKError(
|
|
754
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
755
|
-
)
|
|
694
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
756
695
|
if utils.match_response(http_res, "5XX", "*"):
|
|
757
696
|
http_res_text = utils.stream_to_text(http_res)
|
|
758
|
-
raise errors.SDKError(
|
|
759
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
760
|
-
)
|
|
697
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
761
698
|
|
|
762
|
-
|
|
763
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
764
|
-
raise errors.SDKError(
|
|
765
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
766
|
-
http_res.status_code,
|
|
767
|
-
http_res_text,
|
|
768
|
-
http_res,
|
|
769
|
-
)
|
|
699
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
770
700
|
|
|
771
701
|
async def update_async(
|
|
772
702
|
self,
|
|
@@ -869,63 +799,48 @@ class Folders(BaseSDK):
|
|
|
869
799
|
|
|
870
800
|
response_data: Any = None
|
|
871
801
|
if utils.match_response(http_res, "200", "application/json"):
|
|
872
|
-
return
|
|
873
|
-
http_res.text, Optional[components.FolderSchema]
|
|
874
|
-
)
|
|
802
|
+
return unmarshal_json_response(Optional[components.FolderSchema], http_res)
|
|
875
803
|
if utils.match_response(http_res, "400", "application/json"):
|
|
876
|
-
response_data =
|
|
877
|
-
raise errors.BadRequest(
|
|
804
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
805
|
+
raise errors.BadRequest(response_data, http_res)
|
|
878
806
|
if utils.match_response(http_res, "401", "application/json"):
|
|
879
|
-
response_data =
|
|
880
|
-
raise errors.Unauthorized(
|
|
807
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
808
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
881
809
|
if utils.match_response(http_res, "403", "application/json"):
|
|
882
|
-
response_data =
|
|
883
|
-
raise errors.Forbidden(
|
|
810
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
811
|
+
raise errors.Forbidden(response_data, http_res)
|
|
884
812
|
if utils.match_response(http_res, "404", "application/json"):
|
|
885
|
-
response_data =
|
|
886
|
-
raise errors.NotFound(
|
|
813
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
814
|
+
raise errors.NotFound(response_data, http_res)
|
|
887
815
|
if utils.match_response(http_res, "409", "application/json"):
|
|
888
|
-
response_data =
|
|
889
|
-
raise errors.Conflict(
|
|
816
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
817
|
+
raise errors.Conflict(response_data, http_res)
|
|
890
818
|
if utils.match_response(http_res, "410", "application/json"):
|
|
891
|
-
response_data =
|
|
892
|
-
|
|
893
|
-
)
|
|
894
|
-
raise errors.InviteExpired(data=response_data)
|
|
819
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
820
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
895
821
|
if utils.match_response(http_res, "422", "application/json"):
|
|
896
|
-
response_data =
|
|
897
|
-
|
|
822
|
+
response_data = unmarshal_json_response(
|
|
823
|
+
errors.UnprocessableEntityData, http_res
|
|
898
824
|
)
|
|
899
|
-
raise errors.UnprocessableEntity(
|
|
825
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
900
826
|
if utils.match_response(http_res, "429", "application/json"):
|
|
901
|
-
response_data =
|
|
902
|
-
|
|
827
|
+
response_data = unmarshal_json_response(
|
|
828
|
+
errors.RateLimitExceededData, http_res
|
|
903
829
|
)
|
|
904
|
-
raise errors.RateLimitExceeded(
|
|
830
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
905
831
|
if utils.match_response(http_res, "500", "application/json"):
|
|
906
|
-
response_data =
|
|
907
|
-
|
|
832
|
+
response_data = unmarshal_json_response(
|
|
833
|
+
errors.InternalServerErrorData, http_res
|
|
908
834
|
)
|
|
909
|
-
raise errors.InternalServerError(
|
|
835
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
910
836
|
if utils.match_response(http_res, "4XX", "*"):
|
|
911
837
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
912
|
-
raise errors.SDKError(
|
|
913
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
914
|
-
)
|
|
838
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
915
839
|
if utils.match_response(http_res, "5XX", "*"):
|
|
916
840
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
917
|
-
raise errors.SDKError(
|
|
918
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
919
|
-
)
|
|
841
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
920
842
|
|
|
921
|
-
|
|
922
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
923
|
-
raise errors.SDKError(
|
|
924
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
925
|
-
http_res.status_code,
|
|
926
|
-
http_res_text,
|
|
927
|
-
http_res,
|
|
928
|
-
)
|
|
843
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
929
844
|
|
|
930
845
|
def delete(
|
|
931
846
|
self,
|
|
@@ -1011,63 +926,50 @@ class Folders(BaseSDK):
|
|
|
1011
926
|
|
|
1012
927
|
response_data: Any = None
|
|
1013
928
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1014
|
-
return
|
|
1015
|
-
|
|
929
|
+
return unmarshal_json_response(
|
|
930
|
+
Optional[operations.DeleteFolderResponseBody], http_res
|
|
1016
931
|
)
|
|
1017
932
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1018
|
-
response_data =
|
|
1019
|
-
raise errors.BadRequest(
|
|
933
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
934
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1020
935
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1021
|
-
response_data =
|
|
1022
|
-
raise errors.Unauthorized(
|
|
936
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
937
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1023
938
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1024
|
-
response_data =
|
|
1025
|
-
raise errors.Forbidden(
|
|
939
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
940
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1026
941
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1027
|
-
response_data =
|
|
1028
|
-
raise errors.NotFound(
|
|
942
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
943
|
+
raise errors.NotFound(response_data, http_res)
|
|
1029
944
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1030
|
-
response_data =
|
|
1031
|
-
raise errors.Conflict(
|
|
945
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
946
|
+
raise errors.Conflict(response_data, http_res)
|
|
1032
947
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1033
|
-
response_data =
|
|
1034
|
-
|
|
1035
|
-
)
|
|
1036
|
-
raise errors.InviteExpired(data=response_data)
|
|
948
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
949
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1037
950
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1038
|
-
response_data =
|
|
1039
|
-
|
|
951
|
+
response_data = unmarshal_json_response(
|
|
952
|
+
errors.UnprocessableEntityData, http_res
|
|
1040
953
|
)
|
|
1041
|
-
raise errors.UnprocessableEntity(
|
|
954
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1042
955
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1043
|
-
response_data =
|
|
1044
|
-
|
|
956
|
+
response_data = unmarshal_json_response(
|
|
957
|
+
errors.RateLimitExceededData, http_res
|
|
1045
958
|
)
|
|
1046
|
-
raise errors.RateLimitExceeded(
|
|
959
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1047
960
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1048
|
-
response_data =
|
|
1049
|
-
|
|
961
|
+
response_data = unmarshal_json_response(
|
|
962
|
+
errors.InternalServerErrorData, http_res
|
|
1050
963
|
)
|
|
1051
|
-
raise errors.InternalServerError(
|
|
964
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1052
965
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1053
966
|
http_res_text = utils.stream_to_text(http_res)
|
|
1054
|
-
raise errors.SDKError(
|
|
1055
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1056
|
-
)
|
|
967
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1057
968
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1058
969
|
http_res_text = utils.stream_to_text(http_res)
|
|
1059
|
-
raise errors.SDKError(
|
|
1060
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1061
|
-
)
|
|
970
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1062
971
|
|
|
1063
|
-
|
|
1064
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
1065
|
-
raise errors.SDKError(
|
|
1066
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1067
|
-
http_res.status_code,
|
|
1068
|
-
http_res_text,
|
|
1069
|
-
http_res,
|
|
1070
|
-
)
|
|
972
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
1071
973
|
|
|
1072
974
|
async def delete_async(
|
|
1073
975
|
self,
|
|
@@ -1153,60 +1055,47 @@ class Folders(BaseSDK):
|
|
|
1153
1055
|
|
|
1154
1056
|
response_data: Any = None
|
|
1155
1057
|
if utils.match_response(http_res, "200", "application/json"):
|
|
1156
|
-
return
|
|
1157
|
-
|
|
1058
|
+
return unmarshal_json_response(
|
|
1059
|
+
Optional[operations.DeleteFolderResponseBody], http_res
|
|
1158
1060
|
)
|
|
1159
1061
|
if utils.match_response(http_res, "400", "application/json"):
|
|
1160
|
-
response_data =
|
|
1161
|
-
raise errors.BadRequest(
|
|
1062
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
1063
|
+
raise errors.BadRequest(response_data, http_res)
|
|
1162
1064
|
if utils.match_response(http_res, "401", "application/json"):
|
|
1163
|
-
response_data =
|
|
1164
|
-
raise errors.Unauthorized(
|
|
1065
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
1066
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
1165
1067
|
if utils.match_response(http_res, "403", "application/json"):
|
|
1166
|
-
response_data =
|
|
1167
|
-
raise errors.Forbidden(
|
|
1068
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
1069
|
+
raise errors.Forbidden(response_data, http_res)
|
|
1168
1070
|
if utils.match_response(http_res, "404", "application/json"):
|
|
1169
|
-
response_data =
|
|
1170
|
-
raise errors.NotFound(
|
|
1071
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
1072
|
+
raise errors.NotFound(response_data, http_res)
|
|
1171
1073
|
if utils.match_response(http_res, "409", "application/json"):
|
|
1172
|
-
response_data =
|
|
1173
|
-
raise errors.Conflict(
|
|
1074
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
1075
|
+
raise errors.Conflict(response_data, http_res)
|
|
1174
1076
|
if utils.match_response(http_res, "410", "application/json"):
|
|
1175
|
-
response_data =
|
|
1176
|
-
|
|
1177
|
-
)
|
|
1178
|
-
raise errors.InviteExpired(data=response_data)
|
|
1077
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
1078
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
1179
1079
|
if utils.match_response(http_res, "422", "application/json"):
|
|
1180
|
-
response_data =
|
|
1181
|
-
|
|
1080
|
+
response_data = unmarshal_json_response(
|
|
1081
|
+
errors.UnprocessableEntityData, http_res
|
|
1182
1082
|
)
|
|
1183
|
-
raise errors.UnprocessableEntity(
|
|
1083
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
1184
1084
|
if utils.match_response(http_res, "429", "application/json"):
|
|
1185
|
-
response_data =
|
|
1186
|
-
|
|
1085
|
+
response_data = unmarshal_json_response(
|
|
1086
|
+
errors.RateLimitExceededData, http_res
|
|
1187
1087
|
)
|
|
1188
|
-
raise errors.RateLimitExceeded(
|
|
1088
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
1189
1089
|
if utils.match_response(http_res, "500", "application/json"):
|
|
1190
|
-
response_data =
|
|
1191
|
-
|
|
1090
|
+
response_data = unmarshal_json_response(
|
|
1091
|
+
errors.InternalServerErrorData, http_res
|
|
1192
1092
|
)
|
|
1193
|
-
raise errors.InternalServerError(
|
|
1093
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
1194
1094
|
if utils.match_response(http_res, "4XX", "*"):
|
|
1195
1095
|
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
|
-
)
|
|
1096
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1199
1097
|
if utils.match_response(http_res, "5XX", "*"):
|
|
1200
1098
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1201
|
-
raise errors.SDKError(
|
|
1202
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
1203
|
-
)
|
|
1099
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
1204
1100
|
|
|
1205
|
-
|
|
1206
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
1207
|
-
raise errors.SDKError(
|
|
1208
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
1209
|
-
http_res.status_code,
|
|
1210
|
-
http_res_text,
|
|
1211
|
-
http_res,
|
|
1212
|
-
)
|
|
1101
|
+
raise errors.SDKError("Unexpected response received", http_res)
|