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/track.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, Mapping, Optional, Union, cast
|
|
9
10
|
|
|
10
11
|
|
|
@@ -103,63 +104,50 @@ class Track(BaseSDK):
|
|
|
103
104
|
|
|
104
105
|
response_data: Any = None
|
|
105
106
|
if utils.match_response(http_res, "200", "application/json"):
|
|
106
|
-
return
|
|
107
|
-
|
|
107
|
+
return unmarshal_json_response(
|
|
108
|
+
Optional[operations.TrackLeadResponseBody], http_res
|
|
108
109
|
)
|
|
109
110
|
if utils.match_response(http_res, "400", "application/json"):
|
|
110
|
-
response_data =
|
|
111
|
-
raise errors.BadRequest(
|
|
111
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
112
|
+
raise errors.BadRequest(response_data, http_res)
|
|
112
113
|
if utils.match_response(http_res, "401", "application/json"):
|
|
113
|
-
response_data =
|
|
114
|
-
raise errors.Unauthorized(
|
|
114
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
115
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
115
116
|
if utils.match_response(http_res, "403", "application/json"):
|
|
116
|
-
response_data =
|
|
117
|
-
raise errors.Forbidden(
|
|
117
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
118
|
+
raise errors.Forbidden(response_data, http_res)
|
|
118
119
|
if utils.match_response(http_res, "404", "application/json"):
|
|
119
|
-
response_data =
|
|
120
|
-
raise errors.NotFound(
|
|
120
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
121
|
+
raise errors.NotFound(response_data, http_res)
|
|
121
122
|
if utils.match_response(http_res, "409", "application/json"):
|
|
122
|
-
response_data =
|
|
123
|
-
raise errors.Conflict(
|
|
123
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
124
|
+
raise errors.Conflict(response_data, http_res)
|
|
124
125
|
if utils.match_response(http_res, "410", "application/json"):
|
|
125
|
-
response_data =
|
|
126
|
-
|
|
127
|
-
)
|
|
128
|
-
raise errors.InviteExpired(data=response_data)
|
|
126
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
127
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
129
128
|
if utils.match_response(http_res, "422", "application/json"):
|
|
130
|
-
response_data =
|
|
131
|
-
|
|
129
|
+
response_data = unmarshal_json_response(
|
|
130
|
+
errors.UnprocessableEntityData, http_res
|
|
132
131
|
)
|
|
133
|
-
raise errors.UnprocessableEntity(
|
|
132
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
134
133
|
if utils.match_response(http_res, "429", "application/json"):
|
|
135
|
-
response_data =
|
|
136
|
-
|
|
134
|
+
response_data = unmarshal_json_response(
|
|
135
|
+
errors.RateLimitExceededData, http_res
|
|
137
136
|
)
|
|
138
|
-
raise errors.RateLimitExceeded(
|
|
137
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
139
138
|
if utils.match_response(http_res, "500", "application/json"):
|
|
140
|
-
response_data =
|
|
141
|
-
|
|
139
|
+
response_data = unmarshal_json_response(
|
|
140
|
+
errors.InternalServerErrorData, http_res
|
|
142
141
|
)
|
|
143
|
-
raise errors.InternalServerError(
|
|
142
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
144
143
|
if utils.match_response(http_res, "4XX", "*"):
|
|
145
144
|
http_res_text = utils.stream_to_text(http_res)
|
|
146
|
-
raise errors.SDKError(
|
|
147
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
148
|
-
)
|
|
145
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
149
146
|
if utils.match_response(http_res, "5XX", "*"):
|
|
150
147
|
http_res_text = utils.stream_to_text(http_res)
|
|
151
|
-
raise errors.SDKError(
|
|
152
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
153
|
-
)
|
|
148
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
154
149
|
|
|
155
|
-
|
|
156
|
-
http_res_text = utils.stream_to_text(http_res)
|
|
157
|
-
raise errors.SDKError(
|
|
158
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
159
|
-
http_res.status_code,
|
|
160
|
-
http_res_text,
|
|
161
|
-
http_res,
|
|
162
|
-
)
|
|
150
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
163
151
|
|
|
164
152
|
async def lead_async(
|
|
165
153
|
self,
|
|
@@ -255,63 +243,50 @@ class Track(BaseSDK):
|
|
|
255
243
|
|
|
256
244
|
response_data: Any = None
|
|
257
245
|
if utils.match_response(http_res, "200", "application/json"):
|
|
258
|
-
return
|
|
259
|
-
|
|
246
|
+
return unmarshal_json_response(
|
|
247
|
+
Optional[operations.TrackLeadResponseBody], http_res
|
|
260
248
|
)
|
|
261
249
|
if utils.match_response(http_res, "400", "application/json"):
|
|
262
|
-
response_data =
|
|
263
|
-
raise errors.BadRequest(
|
|
250
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
251
|
+
raise errors.BadRequest(response_data, http_res)
|
|
264
252
|
if utils.match_response(http_res, "401", "application/json"):
|
|
265
|
-
response_data =
|
|
266
|
-
raise errors.Unauthorized(
|
|
253
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
254
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
267
255
|
if utils.match_response(http_res, "403", "application/json"):
|
|
268
|
-
response_data =
|
|
269
|
-
raise errors.Forbidden(
|
|
256
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
257
|
+
raise errors.Forbidden(response_data, http_res)
|
|
270
258
|
if utils.match_response(http_res, "404", "application/json"):
|
|
271
|
-
response_data =
|
|
272
|
-
raise errors.NotFound(
|
|
259
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
260
|
+
raise errors.NotFound(response_data, http_res)
|
|
273
261
|
if utils.match_response(http_res, "409", "application/json"):
|
|
274
|
-
response_data =
|
|
275
|
-
raise errors.Conflict(
|
|
262
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
263
|
+
raise errors.Conflict(response_data, http_res)
|
|
276
264
|
if utils.match_response(http_res, "410", "application/json"):
|
|
277
|
-
response_data =
|
|
278
|
-
|
|
279
|
-
)
|
|
280
|
-
raise errors.InviteExpired(data=response_data)
|
|
265
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
266
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
281
267
|
if utils.match_response(http_res, "422", "application/json"):
|
|
282
|
-
response_data =
|
|
283
|
-
|
|
268
|
+
response_data = unmarshal_json_response(
|
|
269
|
+
errors.UnprocessableEntityData, http_res
|
|
284
270
|
)
|
|
285
|
-
raise errors.UnprocessableEntity(
|
|
271
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
286
272
|
if utils.match_response(http_res, "429", "application/json"):
|
|
287
|
-
response_data =
|
|
288
|
-
|
|
273
|
+
response_data = unmarshal_json_response(
|
|
274
|
+
errors.RateLimitExceededData, http_res
|
|
289
275
|
)
|
|
290
|
-
raise errors.RateLimitExceeded(
|
|
276
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
291
277
|
if utils.match_response(http_res, "500", "application/json"):
|
|
292
|
-
response_data =
|
|
293
|
-
|
|
278
|
+
response_data = unmarshal_json_response(
|
|
279
|
+
errors.InternalServerErrorData, http_res
|
|
294
280
|
)
|
|
295
|
-
raise errors.InternalServerError(
|
|
281
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
296
282
|
if utils.match_response(http_res, "4XX", "*"):
|
|
297
283
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
298
|
-
raise errors.SDKError(
|
|
299
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
300
|
-
)
|
|
284
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
301
285
|
if utils.match_response(http_res, "5XX", "*"):
|
|
302
286
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
303
|
-
raise errors.SDKError(
|
|
304
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
305
|
-
)
|
|
287
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
306
288
|
|
|
307
|
-
|
|
308
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
309
|
-
raise errors.SDKError(
|
|
310
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
311
|
-
http_res.status_code,
|
|
312
|
-
http_res_text,
|
|
313
|
-
http_res,
|
|
314
|
-
)
|
|
289
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
315
290
|
|
|
316
291
|
def sale(
|
|
317
292
|
self,
|
|
@@ -407,63 +382,50 @@ class Track(BaseSDK):
|
|
|
407
382
|
|
|
408
383
|
response_data: Any = None
|
|
409
384
|
if utils.match_response(http_res, "200", "application/json"):
|
|
410
|
-
return
|
|
411
|
-
|
|
385
|
+
return unmarshal_json_response(
|
|
386
|
+
Optional[operations.TrackSaleResponseBody], http_res
|
|
412
387
|
)
|
|
413
388
|
if utils.match_response(http_res, "400", "application/json"):
|
|
414
|
-
response_data =
|
|
415
|
-
raise errors.BadRequest(
|
|
389
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
390
|
+
raise errors.BadRequest(response_data, http_res)
|
|
416
391
|
if utils.match_response(http_res, "401", "application/json"):
|
|
417
|
-
response_data =
|
|
418
|
-
raise errors.Unauthorized(
|
|
392
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
393
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
419
394
|
if utils.match_response(http_res, "403", "application/json"):
|
|
420
|
-
response_data =
|
|
421
|
-
raise errors.Forbidden(
|
|
395
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
396
|
+
raise errors.Forbidden(response_data, http_res)
|
|
422
397
|
if utils.match_response(http_res, "404", "application/json"):
|
|
423
|
-
response_data =
|
|
424
|
-
raise errors.NotFound(
|
|
398
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
399
|
+
raise errors.NotFound(response_data, http_res)
|
|
425
400
|
if utils.match_response(http_res, "409", "application/json"):
|
|
426
|
-
response_data =
|
|
427
|
-
raise errors.Conflict(
|
|
401
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
402
|
+
raise errors.Conflict(response_data, http_res)
|
|
428
403
|
if utils.match_response(http_res, "410", "application/json"):
|
|
429
|
-
response_data =
|
|
430
|
-
|
|
431
|
-
)
|
|
432
|
-
raise errors.InviteExpired(data=response_data)
|
|
404
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
405
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
433
406
|
if utils.match_response(http_res, "422", "application/json"):
|
|
434
|
-
response_data =
|
|
435
|
-
|
|
407
|
+
response_data = unmarshal_json_response(
|
|
408
|
+
errors.UnprocessableEntityData, http_res
|
|
436
409
|
)
|
|
437
|
-
raise errors.UnprocessableEntity(
|
|
410
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
438
411
|
if utils.match_response(http_res, "429", "application/json"):
|
|
439
|
-
response_data =
|
|
440
|
-
|
|
412
|
+
response_data = unmarshal_json_response(
|
|
413
|
+
errors.RateLimitExceededData, http_res
|
|
441
414
|
)
|
|
442
|
-
raise errors.RateLimitExceeded(
|
|
415
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
443
416
|
if utils.match_response(http_res, "500", "application/json"):
|
|
444
|
-
response_data =
|
|
445
|
-
|
|
417
|
+
response_data = unmarshal_json_response(
|
|
418
|
+
errors.InternalServerErrorData, http_res
|
|
446
419
|
)
|
|
447
|
-
raise errors.InternalServerError(
|
|
420
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
448
421
|
if utils.match_response(http_res, "4XX", "*"):
|
|
449
422
|
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
|
-
)
|
|
423
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
453
424
|
if utils.match_response(http_res, "5XX", "*"):
|
|
454
425
|
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
|
-
)
|
|
426
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
458
427
|
|
|
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
|
-
)
|
|
428
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
|
467
429
|
|
|
468
430
|
async def sale_async(
|
|
469
431
|
self,
|
|
@@ -559,60 +521,47 @@ class Track(BaseSDK):
|
|
|
559
521
|
|
|
560
522
|
response_data: Any = None
|
|
561
523
|
if utils.match_response(http_res, "200", "application/json"):
|
|
562
|
-
return
|
|
563
|
-
|
|
524
|
+
return unmarshal_json_response(
|
|
525
|
+
Optional[operations.TrackSaleResponseBody], http_res
|
|
564
526
|
)
|
|
565
527
|
if utils.match_response(http_res, "400", "application/json"):
|
|
566
|
-
response_data =
|
|
567
|
-
raise errors.BadRequest(
|
|
528
|
+
response_data = unmarshal_json_response(errors.BadRequestData, http_res)
|
|
529
|
+
raise errors.BadRequest(response_data, http_res)
|
|
568
530
|
if utils.match_response(http_res, "401", "application/json"):
|
|
569
|
-
response_data =
|
|
570
|
-
raise errors.Unauthorized(
|
|
531
|
+
response_data = unmarshal_json_response(errors.UnauthorizedData, http_res)
|
|
532
|
+
raise errors.Unauthorized(response_data, http_res)
|
|
571
533
|
if utils.match_response(http_res, "403", "application/json"):
|
|
572
|
-
response_data =
|
|
573
|
-
raise errors.Forbidden(
|
|
534
|
+
response_data = unmarshal_json_response(errors.ForbiddenData, http_res)
|
|
535
|
+
raise errors.Forbidden(response_data, http_res)
|
|
574
536
|
if utils.match_response(http_res, "404", "application/json"):
|
|
575
|
-
response_data =
|
|
576
|
-
raise errors.NotFound(
|
|
537
|
+
response_data = unmarshal_json_response(errors.NotFoundData, http_res)
|
|
538
|
+
raise errors.NotFound(response_data, http_res)
|
|
577
539
|
if utils.match_response(http_res, "409", "application/json"):
|
|
578
|
-
response_data =
|
|
579
|
-
raise errors.Conflict(
|
|
540
|
+
response_data = unmarshal_json_response(errors.ConflictData, http_res)
|
|
541
|
+
raise errors.Conflict(response_data, http_res)
|
|
580
542
|
if utils.match_response(http_res, "410", "application/json"):
|
|
581
|
-
response_data =
|
|
582
|
-
|
|
583
|
-
)
|
|
584
|
-
raise errors.InviteExpired(data=response_data)
|
|
543
|
+
response_data = unmarshal_json_response(errors.InviteExpiredData, http_res)
|
|
544
|
+
raise errors.InviteExpired(response_data, http_res)
|
|
585
545
|
if utils.match_response(http_res, "422", "application/json"):
|
|
586
|
-
response_data =
|
|
587
|
-
|
|
546
|
+
response_data = unmarshal_json_response(
|
|
547
|
+
errors.UnprocessableEntityData, http_res
|
|
588
548
|
)
|
|
589
|
-
raise errors.UnprocessableEntity(
|
|
549
|
+
raise errors.UnprocessableEntity(response_data, http_res)
|
|
590
550
|
if utils.match_response(http_res, "429", "application/json"):
|
|
591
|
-
response_data =
|
|
592
|
-
|
|
551
|
+
response_data = unmarshal_json_response(
|
|
552
|
+
errors.RateLimitExceededData, http_res
|
|
593
553
|
)
|
|
594
|
-
raise errors.RateLimitExceeded(
|
|
554
|
+
raise errors.RateLimitExceeded(response_data, http_res)
|
|
595
555
|
if utils.match_response(http_res, "500", "application/json"):
|
|
596
|
-
response_data =
|
|
597
|
-
|
|
556
|
+
response_data = unmarshal_json_response(
|
|
557
|
+
errors.InternalServerErrorData, http_res
|
|
598
558
|
)
|
|
599
|
-
raise errors.InternalServerError(
|
|
559
|
+
raise errors.InternalServerError(response_data, http_res)
|
|
600
560
|
if utils.match_response(http_res, "4XX", "*"):
|
|
601
561
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
602
|
-
raise errors.SDKError(
|
|
603
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
604
|
-
)
|
|
562
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
605
563
|
if utils.match_response(http_res, "5XX", "*"):
|
|
606
564
|
http_res_text = await utils.stream_to_text_async(http_res)
|
|
607
|
-
raise errors.SDKError(
|
|
608
|
-
"API error occurred", http_res.status_code, http_res_text, http_res
|
|
609
|
-
)
|
|
565
|
+
raise errors.SDKError("API error occurred", http_res, http_res_text)
|
|
610
566
|
|
|
611
|
-
|
|
612
|
-
http_res_text = await utils.stream_to_text_async(http_res)
|
|
613
|
-
raise errors.SDKError(
|
|
614
|
-
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
|
615
|
-
http_res.status_code,
|
|
616
|
-
http_res_text,
|
|
617
|
-
http_res,
|
|
618
|
-
)
|
|
567
|
+
raise errors.SDKError("Unexpected response received", http_res)
|
dub/utils/serializers.py
CHANGED
|
@@ -192,7 +192,9 @@ def is_union(obj: object) -> bool:
|
|
|
192
192
|
"""
|
|
193
193
|
Returns True if the given object is a typing.Union or typing_extensions.Union.
|
|
194
194
|
"""
|
|
195
|
-
return any(
|
|
195
|
+
return any(
|
|
196
|
+
obj is typing_obj for typing_obj in _get_typing_objects_by_name_of("Union")
|
|
197
|
+
)
|
|
196
198
|
|
|
197
199
|
|
|
198
200
|
def stream_to_text(stream: httpx.Response) -> str:
|
|
@@ -245,4 +247,3 @@ def _get_typing_objects_by_name_of(name: str) -> Tuple[Any, ...]:
|
|
|
245
247
|
f"Neither typing nor typing_extensions has an object called {name!r}"
|
|
246
248
|
)
|
|
247
249
|
return result
|
|
248
|
-
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Optional
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from .serializers import unmarshal_json
|
|
8
|
+
from dub.models import errors
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def unmarshal_json_response(
|
|
12
|
+
typ: Any, http_res: httpx.Response, body: Optional[str] = None
|
|
13
|
+
) -> Any:
|
|
14
|
+
if body is None:
|
|
15
|
+
body = http_res.text
|
|
16
|
+
try:
|
|
17
|
+
return unmarshal_json(body, typ)
|
|
18
|
+
except Exception as e:
|
|
19
|
+
raise errors.ResponseValidationError(
|
|
20
|
+
"Response validation failed",
|
|
21
|
+
http_res,
|
|
22
|
+
e,
|
|
23
|
+
body,
|
|
24
|
+
) from e
|