dub 0.26.12__py3-none-any.whl → 0.27.0__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/tags.py CHANGED
@@ -103,61 +103,58 @@ class Tags(BaseSDK):
103
103
 
104
104
  response_data: Any = None
105
105
  if utils.match_response(http_res, "201", "application/json"):
106
- return utils.unmarshal_json(http_res.text, Optional[components.TagSchema])
106
+ return utils.unmarshal_json_response(
107
+ Optional[components.TagSchema], http_res
108
+ )
107
109
  if utils.match_response(http_res, "400", "application/json"):
108
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
109
- raise errors.BadRequest(data=response_data)
110
+ response_data = utils.unmarshal_json_response(
111
+ errors.BadRequestData, http_res
112
+ )
113
+ raise errors.BadRequest(response_data, http_res)
110
114
  if utils.match_response(http_res, "401", "application/json"):
111
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
112
- raise errors.Unauthorized(data=response_data)
115
+ response_data = utils.unmarshal_json_response(
116
+ errors.UnauthorizedData, http_res
117
+ )
118
+ raise errors.Unauthorized(response_data, http_res)
113
119
  if utils.match_response(http_res, "403", "application/json"):
114
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
115
- raise errors.Forbidden(data=response_data)
120
+ response_data = utils.unmarshal_json_response(
121
+ errors.ForbiddenData, http_res
122
+ )
123
+ raise errors.Forbidden(response_data, http_res)
116
124
  if utils.match_response(http_res, "404", "application/json"):
117
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
118
- raise errors.NotFound(data=response_data)
125
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
126
+ raise errors.NotFound(response_data, http_res)
119
127
  if utils.match_response(http_res, "409", "application/json"):
120
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
121
- raise errors.Conflict(data=response_data)
128
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
129
+ raise errors.Conflict(response_data, http_res)
122
130
  if utils.match_response(http_res, "410", "application/json"):
123
- response_data = utils.unmarshal_json(
124
- http_res.text, errors.InviteExpiredData
131
+ response_data = utils.unmarshal_json_response(
132
+ errors.InviteExpiredData, http_res
125
133
  )
126
- raise errors.InviteExpired(data=response_data)
134
+ raise errors.InviteExpired(response_data, http_res)
127
135
  if utils.match_response(http_res, "422", "application/json"):
128
- response_data = utils.unmarshal_json(
129
- http_res.text, errors.UnprocessableEntityData
136
+ response_data = utils.unmarshal_json_response(
137
+ errors.UnprocessableEntityData, http_res
130
138
  )
131
- raise errors.UnprocessableEntity(data=response_data)
139
+ raise errors.UnprocessableEntity(response_data, http_res)
132
140
  if utils.match_response(http_res, "429", "application/json"):
133
- response_data = utils.unmarshal_json(
134
- http_res.text, errors.RateLimitExceededData
141
+ response_data = utils.unmarshal_json_response(
142
+ errors.RateLimitExceededData, http_res
135
143
  )
136
- raise errors.RateLimitExceeded(data=response_data)
144
+ raise errors.RateLimitExceeded(response_data, http_res)
137
145
  if utils.match_response(http_res, "500", "application/json"):
138
- response_data = utils.unmarshal_json(
139
- http_res.text, errors.InternalServerErrorData
146
+ response_data = utils.unmarshal_json_response(
147
+ errors.InternalServerErrorData, http_res
140
148
  )
141
- raise errors.InternalServerError(data=response_data)
149
+ raise errors.InternalServerError(response_data, http_res)
142
150
  if utils.match_response(http_res, "4XX", "*"):
143
151
  http_res_text = utils.stream_to_text(http_res)
144
- raise errors.SDKError(
145
- "API error occurred", http_res.status_code, http_res_text, http_res
146
- )
152
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
147
153
  if utils.match_response(http_res, "5XX", "*"):
148
154
  http_res_text = utils.stream_to_text(http_res)
149
- raise errors.SDKError(
150
- "API error occurred", http_res.status_code, http_res_text, http_res
151
- )
155
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
152
156
 
153
- content_type = http_res.headers.get("Content-Type")
154
- http_res_text = utils.stream_to_text(http_res)
155
- raise errors.SDKError(
156
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
157
- http_res.status_code,
158
- http_res_text,
159
- http_res,
160
- )
157
+ raise errors.SDKError("Unexpected response received", http_res)
161
158
 
162
159
  async def create_async(
163
160
  self,
@@ -253,61 +250,58 @@ class Tags(BaseSDK):
253
250
 
254
251
  response_data: Any = None
255
252
  if utils.match_response(http_res, "201", "application/json"):
256
- return utils.unmarshal_json(http_res.text, Optional[components.TagSchema])
253
+ return utils.unmarshal_json_response(
254
+ Optional[components.TagSchema], http_res
255
+ )
257
256
  if utils.match_response(http_res, "400", "application/json"):
258
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
259
- raise errors.BadRequest(data=response_data)
257
+ response_data = utils.unmarshal_json_response(
258
+ errors.BadRequestData, http_res
259
+ )
260
+ raise errors.BadRequest(response_data, http_res)
260
261
  if utils.match_response(http_res, "401", "application/json"):
261
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
262
- raise errors.Unauthorized(data=response_data)
262
+ response_data = utils.unmarshal_json_response(
263
+ errors.UnauthorizedData, http_res
264
+ )
265
+ raise errors.Unauthorized(response_data, http_res)
263
266
  if utils.match_response(http_res, "403", "application/json"):
264
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
265
- raise errors.Forbidden(data=response_data)
267
+ response_data = utils.unmarshal_json_response(
268
+ errors.ForbiddenData, http_res
269
+ )
270
+ raise errors.Forbidden(response_data, http_res)
266
271
  if utils.match_response(http_res, "404", "application/json"):
267
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
268
- raise errors.NotFound(data=response_data)
272
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
273
+ raise errors.NotFound(response_data, http_res)
269
274
  if utils.match_response(http_res, "409", "application/json"):
270
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
271
- raise errors.Conflict(data=response_data)
275
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
276
+ raise errors.Conflict(response_data, http_res)
272
277
  if utils.match_response(http_res, "410", "application/json"):
273
- response_data = utils.unmarshal_json(
274
- http_res.text, errors.InviteExpiredData
278
+ response_data = utils.unmarshal_json_response(
279
+ errors.InviteExpiredData, http_res
275
280
  )
276
- raise errors.InviteExpired(data=response_data)
281
+ raise errors.InviteExpired(response_data, http_res)
277
282
  if utils.match_response(http_res, "422", "application/json"):
278
- response_data = utils.unmarshal_json(
279
- http_res.text, errors.UnprocessableEntityData
283
+ response_data = utils.unmarshal_json_response(
284
+ errors.UnprocessableEntityData, http_res
280
285
  )
281
- raise errors.UnprocessableEntity(data=response_data)
286
+ raise errors.UnprocessableEntity(response_data, http_res)
282
287
  if utils.match_response(http_res, "429", "application/json"):
283
- response_data = utils.unmarshal_json(
284
- http_res.text, errors.RateLimitExceededData
288
+ response_data = utils.unmarshal_json_response(
289
+ errors.RateLimitExceededData, http_res
285
290
  )
286
- raise errors.RateLimitExceeded(data=response_data)
291
+ raise errors.RateLimitExceeded(response_data, http_res)
287
292
  if utils.match_response(http_res, "500", "application/json"):
288
- response_data = utils.unmarshal_json(
289
- http_res.text, errors.InternalServerErrorData
293
+ response_data = utils.unmarshal_json_response(
294
+ errors.InternalServerErrorData, http_res
290
295
  )
291
- raise errors.InternalServerError(data=response_data)
296
+ raise errors.InternalServerError(response_data, http_res)
292
297
  if utils.match_response(http_res, "4XX", "*"):
293
298
  http_res_text = await utils.stream_to_text_async(http_res)
294
- raise errors.SDKError(
295
- "API error occurred", http_res.status_code, http_res_text, http_res
296
- )
299
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
297
300
  if utils.match_response(http_res, "5XX", "*"):
298
301
  http_res_text = await utils.stream_to_text_async(http_res)
299
- raise errors.SDKError(
300
- "API error occurred", http_res.status_code, http_res_text, http_res
301
- )
302
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
302
303
 
303
- content_type = http_res.headers.get("Content-Type")
304
- http_res_text = await utils.stream_to_text_async(http_res)
305
- raise errors.SDKError(
306
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
307
- http_res.status_code,
308
- http_res_text,
309
- http_res,
310
- )
304
+ raise errors.SDKError("Unexpected response received", http_res)
311
305
 
312
306
  def list(
313
307
  self,
@@ -393,63 +387,58 @@ class Tags(BaseSDK):
393
387
 
394
388
  response_data: Any = None
395
389
  if utils.match_response(http_res, "200", "application/json"):
396
- return utils.unmarshal_json(
397
- http_res.text, Optional[List[components.TagSchema]]
390
+ return utils.unmarshal_json_response(
391
+ Optional[List[components.TagSchema]], http_res
398
392
  )
399
393
  if utils.match_response(http_res, "400", "application/json"):
400
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
401
- raise errors.BadRequest(data=response_data)
394
+ response_data = utils.unmarshal_json_response(
395
+ errors.BadRequestData, http_res
396
+ )
397
+ raise errors.BadRequest(response_data, http_res)
402
398
  if utils.match_response(http_res, "401", "application/json"):
403
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
404
- raise errors.Unauthorized(data=response_data)
399
+ response_data = utils.unmarshal_json_response(
400
+ errors.UnauthorizedData, http_res
401
+ )
402
+ raise errors.Unauthorized(response_data, http_res)
405
403
  if utils.match_response(http_res, "403", "application/json"):
406
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
407
- raise errors.Forbidden(data=response_data)
404
+ response_data = utils.unmarshal_json_response(
405
+ errors.ForbiddenData, http_res
406
+ )
407
+ raise errors.Forbidden(response_data, http_res)
408
408
  if utils.match_response(http_res, "404", "application/json"):
409
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
410
- raise errors.NotFound(data=response_data)
409
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
410
+ raise errors.NotFound(response_data, http_res)
411
411
  if utils.match_response(http_res, "409", "application/json"):
412
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
413
- raise errors.Conflict(data=response_data)
412
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
413
+ raise errors.Conflict(response_data, http_res)
414
414
  if utils.match_response(http_res, "410", "application/json"):
415
- response_data = utils.unmarshal_json(
416
- http_res.text, errors.InviteExpiredData
415
+ response_data = utils.unmarshal_json_response(
416
+ errors.InviteExpiredData, http_res
417
417
  )
418
- raise errors.InviteExpired(data=response_data)
418
+ raise errors.InviteExpired(response_data, http_res)
419
419
  if utils.match_response(http_res, "422", "application/json"):
420
- response_data = utils.unmarshal_json(
421
- http_res.text, errors.UnprocessableEntityData
420
+ response_data = utils.unmarshal_json_response(
421
+ errors.UnprocessableEntityData, http_res
422
422
  )
423
- raise errors.UnprocessableEntity(data=response_data)
423
+ raise errors.UnprocessableEntity(response_data, http_res)
424
424
  if utils.match_response(http_res, "429", "application/json"):
425
- response_data = utils.unmarshal_json(
426
- http_res.text, errors.RateLimitExceededData
425
+ response_data = utils.unmarshal_json_response(
426
+ errors.RateLimitExceededData, http_res
427
427
  )
428
- raise errors.RateLimitExceeded(data=response_data)
428
+ raise errors.RateLimitExceeded(response_data, http_res)
429
429
  if utils.match_response(http_res, "500", "application/json"):
430
- response_data = utils.unmarshal_json(
431
- http_res.text, errors.InternalServerErrorData
430
+ response_data = utils.unmarshal_json_response(
431
+ errors.InternalServerErrorData, http_res
432
432
  )
433
- raise errors.InternalServerError(data=response_data)
433
+ raise errors.InternalServerError(response_data, http_res)
434
434
  if utils.match_response(http_res, "4XX", "*"):
435
435
  http_res_text = utils.stream_to_text(http_res)
436
- raise errors.SDKError(
437
- "API error occurred", http_res.status_code, http_res_text, http_res
438
- )
436
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
439
437
  if utils.match_response(http_res, "5XX", "*"):
440
438
  http_res_text = utils.stream_to_text(http_res)
441
- raise errors.SDKError(
442
- "API error occurred", http_res.status_code, http_res_text, http_res
443
- )
439
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
444
440
 
445
- content_type = http_res.headers.get("Content-Type")
446
- http_res_text = utils.stream_to_text(http_res)
447
- raise errors.SDKError(
448
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
449
- http_res.status_code,
450
- http_res_text,
451
- http_res,
452
- )
441
+ raise errors.SDKError("Unexpected response received", http_res)
453
442
 
454
443
  async def list_async(
455
444
  self,
@@ -535,63 +524,58 @@ class Tags(BaseSDK):
535
524
 
536
525
  response_data: Any = None
537
526
  if utils.match_response(http_res, "200", "application/json"):
538
- return utils.unmarshal_json(
539
- http_res.text, Optional[List[components.TagSchema]]
527
+ return utils.unmarshal_json_response(
528
+ Optional[List[components.TagSchema]], http_res
540
529
  )
541
530
  if utils.match_response(http_res, "400", "application/json"):
542
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
543
- raise errors.BadRequest(data=response_data)
531
+ response_data = utils.unmarshal_json_response(
532
+ errors.BadRequestData, http_res
533
+ )
534
+ raise errors.BadRequest(response_data, http_res)
544
535
  if utils.match_response(http_res, "401", "application/json"):
545
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
546
- raise errors.Unauthorized(data=response_data)
536
+ response_data = utils.unmarshal_json_response(
537
+ errors.UnauthorizedData, http_res
538
+ )
539
+ raise errors.Unauthorized(response_data, http_res)
547
540
  if utils.match_response(http_res, "403", "application/json"):
548
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
549
- raise errors.Forbidden(data=response_data)
541
+ response_data = utils.unmarshal_json_response(
542
+ errors.ForbiddenData, http_res
543
+ )
544
+ raise errors.Forbidden(response_data, http_res)
550
545
  if utils.match_response(http_res, "404", "application/json"):
551
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
552
- raise errors.NotFound(data=response_data)
546
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
547
+ raise errors.NotFound(response_data, http_res)
553
548
  if utils.match_response(http_res, "409", "application/json"):
554
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
555
- raise errors.Conflict(data=response_data)
549
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
550
+ raise errors.Conflict(response_data, http_res)
556
551
  if utils.match_response(http_res, "410", "application/json"):
557
- response_data = utils.unmarshal_json(
558
- http_res.text, errors.InviteExpiredData
552
+ response_data = utils.unmarshal_json_response(
553
+ errors.InviteExpiredData, http_res
559
554
  )
560
- raise errors.InviteExpired(data=response_data)
555
+ raise errors.InviteExpired(response_data, http_res)
561
556
  if utils.match_response(http_res, "422", "application/json"):
562
- response_data = utils.unmarshal_json(
563
- http_res.text, errors.UnprocessableEntityData
557
+ response_data = utils.unmarshal_json_response(
558
+ errors.UnprocessableEntityData, http_res
564
559
  )
565
- raise errors.UnprocessableEntity(data=response_data)
560
+ raise errors.UnprocessableEntity(response_data, http_res)
566
561
  if utils.match_response(http_res, "429", "application/json"):
567
- response_data = utils.unmarshal_json(
568
- http_res.text, errors.RateLimitExceededData
562
+ response_data = utils.unmarshal_json_response(
563
+ errors.RateLimitExceededData, http_res
569
564
  )
570
- raise errors.RateLimitExceeded(data=response_data)
565
+ raise errors.RateLimitExceeded(response_data, http_res)
571
566
  if utils.match_response(http_res, "500", "application/json"):
572
- response_data = utils.unmarshal_json(
573
- http_res.text, errors.InternalServerErrorData
567
+ response_data = utils.unmarshal_json_response(
568
+ errors.InternalServerErrorData, http_res
574
569
  )
575
- raise errors.InternalServerError(data=response_data)
570
+ raise errors.InternalServerError(response_data, http_res)
576
571
  if utils.match_response(http_res, "4XX", "*"):
577
572
  http_res_text = await utils.stream_to_text_async(http_res)
578
- raise errors.SDKError(
579
- "API error occurred", http_res.status_code, http_res_text, http_res
580
- )
573
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
581
574
  if utils.match_response(http_res, "5XX", "*"):
582
575
  http_res_text = await utils.stream_to_text_async(http_res)
583
- raise errors.SDKError(
584
- "API error occurred", http_res.status_code, http_res_text, http_res
585
- )
576
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
586
577
 
587
- content_type = http_res.headers.get("Content-Type")
588
- http_res_text = await utils.stream_to_text_async(http_res)
589
- raise errors.SDKError(
590
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
591
- http_res.status_code,
592
- http_res_text,
593
- http_res,
594
- )
578
+ raise errors.SDKError("Unexpected response received", http_res)
595
579
 
596
580
  def update(
597
581
  self,
@@ -694,61 +678,58 @@ class Tags(BaseSDK):
694
678
 
695
679
  response_data: Any = None
696
680
  if utils.match_response(http_res, "200", "application/json"):
697
- return utils.unmarshal_json(http_res.text, Optional[components.TagSchema])
681
+ return utils.unmarshal_json_response(
682
+ Optional[components.TagSchema], http_res
683
+ )
698
684
  if utils.match_response(http_res, "400", "application/json"):
699
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
700
- raise errors.BadRequest(data=response_data)
685
+ response_data = utils.unmarshal_json_response(
686
+ errors.BadRequestData, http_res
687
+ )
688
+ raise errors.BadRequest(response_data, http_res)
701
689
  if utils.match_response(http_res, "401", "application/json"):
702
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
703
- raise errors.Unauthorized(data=response_data)
690
+ response_data = utils.unmarshal_json_response(
691
+ errors.UnauthorizedData, http_res
692
+ )
693
+ raise errors.Unauthorized(response_data, http_res)
704
694
  if utils.match_response(http_res, "403", "application/json"):
705
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
706
- raise errors.Forbidden(data=response_data)
695
+ response_data = utils.unmarshal_json_response(
696
+ errors.ForbiddenData, http_res
697
+ )
698
+ raise errors.Forbidden(response_data, http_res)
707
699
  if utils.match_response(http_res, "404", "application/json"):
708
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
709
- raise errors.NotFound(data=response_data)
700
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
701
+ raise errors.NotFound(response_data, http_res)
710
702
  if utils.match_response(http_res, "409", "application/json"):
711
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
712
- raise errors.Conflict(data=response_data)
703
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
704
+ raise errors.Conflict(response_data, http_res)
713
705
  if utils.match_response(http_res, "410", "application/json"):
714
- response_data = utils.unmarshal_json(
715
- http_res.text, errors.InviteExpiredData
706
+ response_data = utils.unmarshal_json_response(
707
+ errors.InviteExpiredData, http_res
716
708
  )
717
- raise errors.InviteExpired(data=response_data)
709
+ raise errors.InviteExpired(response_data, http_res)
718
710
  if utils.match_response(http_res, "422", "application/json"):
719
- response_data = utils.unmarshal_json(
720
- http_res.text, errors.UnprocessableEntityData
711
+ response_data = utils.unmarshal_json_response(
712
+ errors.UnprocessableEntityData, http_res
721
713
  )
722
- raise errors.UnprocessableEntity(data=response_data)
714
+ raise errors.UnprocessableEntity(response_data, http_res)
723
715
  if utils.match_response(http_res, "429", "application/json"):
724
- response_data = utils.unmarshal_json(
725
- http_res.text, errors.RateLimitExceededData
716
+ response_data = utils.unmarshal_json_response(
717
+ errors.RateLimitExceededData, http_res
726
718
  )
727
- raise errors.RateLimitExceeded(data=response_data)
719
+ raise errors.RateLimitExceeded(response_data, http_res)
728
720
  if utils.match_response(http_res, "500", "application/json"):
729
- response_data = utils.unmarshal_json(
730
- http_res.text, errors.InternalServerErrorData
721
+ response_data = utils.unmarshal_json_response(
722
+ errors.InternalServerErrorData, http_res
731
723
  )
732
- raise errors.InternalServerError(data=response_data)
724
+ raise errors.InternalServerError(response_data, http_res)
733
725
  if utils.match_response(http_res, "4XX", "*"):
734
726
  http_res_text = utils.stream_to_text(http_res)
735
- raise errors.SDKError(
736
- "API error occurred", http_res.status_code, http_res_text, http_res
737
- )
727
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
738
728
  if utils.match_response(http_res, "5XX", "*"):
739
729
  http_res_text = utils.stream_to_text(http_res)
740
- raise errors.SDKError(
741
- "API error occurred", http_res.status_code, http_res_text, http_res
742
- )
730
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
743
731
 
744
- content_type = http_res.headers.get("Content-Type")
745
- http_res_text = utils.stream_to_text(http_res)
746
- raise errors.SDKError(
747
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
748
- http_res.status_code,
749
- http_res_text,
750
- http_res,
751
- )
732
+ raise errors.SDKError("Unexpected response received", http_res)
752
733
 
753
734
  async def update_async(
754
735
  self,
@@ -851,61 +832,58 @@ class Tags(BaseSDK):
851
832
 
852
833
  response_data: Any = None
853
834
  if utils.match_response(http_res, "200", "application/json"):
854
- return utils.unmarshal_json(http_res.text, Optional[components.TagSchema])
835
+ return utils.unmarshal_json_response(
836
+ Optional[components.TagSchema], http_res
837
+ )
855
838
  if utils.match_response(http_res, "400", "application/json"):
856
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
857
- raise errors.BadRequest(data=response_data)
839
+ response_data = utils.unmarshal_json_response(
840
+ errors.BadRequestData, http_res
841
+ )
842
+ raise errors.BadRequest(response_data, http_res)
858
843
  if utils.match_response(http_res, "401", "application/json"):
859
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
860
- raise errors.Unauthorized(data=response_data)
844
+ response_data = utils.unmarshal_json_response(
845
+ errors.UnauthorizedData, http_res
846
+ )
847
+ raise errors.Unauthorized(response_data, http_res)
861
848
  if utils.match_response(http_res, "403", "application/json"):
862
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
863
- raise errors.Forbidden(data=response_data)
849
+ response_data = utils.unmarshal_json_response(
850
+ errors.ForbiddenData, http_res
851
+ )
852
+ raise errors.Forbidden(response_data, http_res)
864
853
  if utils.match_response(http_res, "404", "application/json"):
865
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
866
- raise errors.NotFound(data=response_data)
854
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
855
+ raise errors.NotFound(response_data, http_res)
867
856
  if utils.match_response(http_res, "409", "application/json"):
868
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
869
- raise errors.Conflict(data=response_data)
857
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
858
+ raise errors.Conflict(response_data, http_res)
870
859
  if utils.match_response(http_res, "410", "application/json"):
871
- response_data = utils.unmarshal_json(
872
- http_res.text, errors.InviteExpiredData
860
+ response_data = utils.unmarshal_json_response(
861
+ errors.InviteExpiredData, http_res
873
862
  )
874
- raise errors.InviteExpired(data=response_data)
863
+ raise errors.InviteExpired(response_data, http_res)
875
864
  if utils.match_response(http_res, "422", "application/json"):
876
- response_data = utils.unmarshal_json(
877
- http_res.text, errors.UnprocessableEntityData
865
+ response_data = utils.unmarshal_json_response(
866
+ errors.UnprocessableEntityData, http_res
878
867
  )
879
- raise errors.UnprocessableEntity(data=response_data)
868
+ raise errors.UnprocessableEntity(response_data, http_res)
880
869
  if utils.match_response(http_res, "429", "application/json"):
881
- response_data = utils.unmarshal_json(
882
- http_res.text, errors.RateLimitExceededData
870
+ response_data = utils.unmarshal_json_response(
871
+ errors.RateLimitExceededData, http_res
883
872
  )
884
- raise errors.RateLimitExceeded(data=response_data)
873
+ raise errors.RateLimitExceeded(response_data, http_res)
885
874
  if utils.match_response(http_res, "500", "application/json"):
886
- response_data = utils.unmarshal_json(
887
- http_res.text, errors.InternalServerErrorData
875
+ response_data = utils.unmarshal_json_response(
876
+ errors.InternalServerErrorData, http_res
888
877
  )
889
- raise errors.InternalServerError(data=response_data)
878
+ raise errors.InternalServerError(response_data, http_res)
890
879
  if utils.match_response(http_res, "4XX", "*"):
891
880
  http_res_text = await utils.stream_to_text_async(http_res)
892
- raise errors.SDKError(
893
- "API error occurred", http_res.status_code, http_res_text, http_res
894
- )
881
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
895
882
  if utils.match_response(http_res, "5XX", "*"):
896
883
  http_res_text = await utils.stream_to_text_async(http_res)
897
- raise errors.SDKError(
898
- "API error occurred", http_res.status_code, http_res_text, http_res
899
- )
884
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
900
885
 
901
- content_type = http_res.headers.get("Content-Type")
902
- http_res_text = await utils.stream_to_text_async(http_res)
903
- raise errors.SDKError(
904
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
905
- http_res.status_code,
906
- http_res_text,
907
- http_res,
908
- )
886
+ raise errors.SDKError("Unexpected response received", http_res)
909
887
 
910
888
  def delete(
911
889
  self,
@@ -991,63 +969,58 @@ class Tags(BaseSDK):
991
969
 
992
970
  response_data: Any = None
993
971
  if utils.match_response(http_res, "200", "application/json"):
994
- return utils.unmarshal_json(
995
- http_res.text, Optional[operations.DeleteTagResponseBody]
972
+ return utils.unmarshal_json_response(
973
+ Optional[operations.DeleteTagResponseBody], http_res
996
974
  )
997
975
  if utils.match_response(http_res, "400", "application/json"):
998
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
999
- raise errors.BadRequest(data=response_data)
976
+ response_data = utils.unmarshal_json_response(
977
+ errors.BadRequestData, http_res
978
+ )
979
+ raise errors.BadRequest(response_data, http_res)
1000
980
  if utils.match_response(http_res, "401", "application/json"):
1001
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1002
- raise errors.Unauthorized(data=response_data)
981
+ response_data = utils.unmarshal_json_response(
982
+ errors.UnauthorizedData, http_res
983
+ )
984
+ raise errors.Unauthorized(response_data, http_res)
1003
985
  if utils.match_response(http_res, "403", "application/json"):
1004
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1005
- raise errors.Forbidden(data=response_data)
986
+ response_data = utils.unmarshal_json_response(
987
+ errors.ForbiddenData, http_res
988
+ )
989
+ raise errors.Forbidden(response_data, http_res)
1006
990
  if utils.match_response(http_res, "404", "application/json"):
1007
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1008
- raise errors.NotFound(data=response_data)
991
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
992
+ raise errors.NotFound(response_data, http_res)
1009
993
  if utils.match_response(http_res, "409", "application/json"):
1010
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1011
- raise errors.Conflict(data=response_data)
994
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
995
+ raise errors.Conflict(response_data, http_res)
1012
996
  if utils.match_response(http_res, "410", "application/json"):
1013
- response_data = utils.unmarshal_json(
1014
- http_res.text, errors.InviteExpiredData
997
+ response_data = utils.unmarshal_json_response(
998
+ errors.InviteExpiredData, http_res
1015
999
  )
1016
- raise errors.InviteExpired(data=response_data)
1000
+ raise errors.InviteExpired(response_data, http_res)
1017
1001
  if utils.match_response(http_res, "422", "application/json"):
1018
- response_data = utils.unmarshal_json(
1019
- http_res.text, errors.UnprocessableEntityData
1002
+ response_data = utils.unmarshal_json_response(
1003
+ errors.UnprocessableEntityData, http_res
1020
1004
  )
1021
- raise errors.UnprocessableEntity(data=response_data)
1005
+ raise errors.UnprocessableEntity(response_data, http_res)
1022
1006
  if utils.match_response(http_res, "429", "application/json"):
1023
- response_data = utils.unmarshal_json(
1024
- http_res.text, errors.RateLimitExceededData
1007
+ response_data = utils.unmarshal_json_response(
1008
+ errors.RateLimitExceededData, http_res
1025
1009
  )
1026
- raise errors.RateLimitExceeded(data=response_data)
1010
+ raise errors.RateLimitExceeded(response_data, http_res)
1027
1011
  if utils.match_response(http_res, "500", "application/json"):
1028
- response_data = utils.unmarshal_json(
1029
- http_res.text, errors.InternalServerErrorData
1012
+ response_data = utils.unmarshal_json_response(
1013
+ errors.InternalServerErrorData, http_res
1030
1014
  )
1031
- raise errors.InternalServerError(data=response_data)
1015
+ raise errors.InternalServerError(response_data, http_res)
1032
1016
  if utils.match_response(http_res, "4XX", "*"):
1033
1017
  http_res_text = utils.stream_to_text(http_res)
1034
- raise errors.SDKError(
1035
- "API error occurred", http_res.status_code, http_res_text, http_res
1036
- )
1018
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1037
1019
  if utils.match_response(http_res, "5XX", "*"):
1038
1020
  http_res_text = utils.stream_to_text(http_res)
1039
- raise errors.SDKError(
1040
- "API error occurred", http_res.status_code, http_res_text, http_res
1041
- )
1021
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1042
1022
 
1043
- content_type = http_res.headers.get("Content-Type")
1044
- http_res_text = utils.stream_to_text(http_res)
1045
- raise errors.SDKError(
1046
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1047
- http_res.status_code,
1048
- http_res_text,
1049
- http_res,
1050
- )
1023
+ raise errors.SDKError("Unexpected response received", http_res)
1051
1024
 
1052
1025
  async def delete_async(
1053
1026
  self,
@@ -1133,60 +1106,55 @@ class Tags(BaseSDK):
1133
1106
 
1134
1107
  response_data: Any = None
1135
1108
  if utils.match_response(http_res, "200", "application/json"):
1136
- return utils.unmarshal_json(
1137
- http_res.text, Optional[operations.DeleteTagResponseBody]
1109
+ return utils.unmarshal_json_response(
1110
+ Optional[operations.DeleteTagResponseBody], http_res
1138
1111
  )
1139
1112
  if utils.match_response(http_res, "400", "application/json"):
1140
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1141
- raise errors.BadRequest(data=response_data)
1113
+ response_data = utils.unmarshal_json_response(
1114
+ errors.BadRequestData, http_res
1115
+ )
1116
+ raise errors.BadRequest(response_data, http_res)
1142
1117
  if utils.match_response(http_res, "401", "application/json"):
1143
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1144
- raise errors.Unauthorized(data=response_data)
1118
+ response_data = utils.unmarshal_json_response(
1119
+ errors.UnauthorizedData, http_res
1120
+ )
1121
+ raise errors.Unauthorized(response_data, http_res)
1145
1122
  if utils.match_response(http_res, "403", "application/json"):
1146
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1147
- raise errors.Forbidden(data=response_data)
1123
+ response_data = utils.unmarshal_json_response(
1124
+ errors.ForbiddenData, http_res
1125
+ )
1126
+ raise errors.Forbidden(response_data, http_res)
1148
1127
  if utils.match_response(http_res, "404", "application/json"):
1149
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1150
- raise errors.NotFound(data=response_data)
1128
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1129
+ raise errors.NotFound(response_data, http_res)
1151
1130
  if utils.match_response(http_res, "409", "application/json"):
1152
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1153
- raise errors.Conflict(data=response_data)
1131
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1132
+ raise errors.Conflict(response_data, http_res)
1154
1133
  if utils.match_response(http_res, "410", "application/json"):
1155
- response_data = utils.unmarshal_json(
1156
- http_res.text, errors.InviteExpiredData
1134
+ response_data = utils.unmarshal_json_response(
1135
+ errors.InviteExpiredData, http_res
1157
1136
  )
1158
- raise errors.InviteExpired(data=response_data)
1137
+ raise errors.InviteExpired(response_data, http_res)
1159
1138
  if utils.match_response(http_res, "422", "application/json"):
1160
- response_data = utils.unmarshal_json(
1161
- http_res.text, errors.UnprocessableEntityData
1139
+ response_data = utils.unmarshal_json_response(
1140
+ errors.UnprocessableEntityData, http_res
1162
1141
  )
1163
- raise errors.UnprocessableEntity(data=response_data)
1142
+ raise errors.UnprocessableEntity(response_data, http_res)
1164
1143
  if utils.match_response(http_res, "429", "application/json"):
1165
- response_data = utils.unmarshal_json(
1166
- http_res.text, errors.RateLimitExceededData
1144
+ response_data = utils.unmarshal_json_response(
1145
+ errors.RateLimitExceededData, http_res
1167
1146
  )
1168
- raise errors.RateLimitExceeded(data=response_data)
1147
+ raise errors.RateLimitExceeded(response_data, http_res)
1169
1148
  if utils.match_response(http_res, "500", "application/json"):
1170
- response_data = utils.unmarshal_json(
1171
- http_res.text, errors.InternalServerErrorData
1149
+ response_data = utils.unmarshal_json_response(
1150
+ errors.InternalServerErrorData, http_res
1172
1151
  )
1173
- raise errors.InternalServerError(data=response_data)
1152
+ raise errors.InternalServerError(response_data, http_res)
1174
1153
  if utils.match_response(http_res, "4XX", "*"):
1175
1154
  http_res_text = await utils.stream_to_text_async(http_res)
1176
- raise errors.SDKError(
1177
- "API error occurred", http_res.status_code, http_res_text, http_res
1178
- )
1155
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1179
1156
  if utils.match_response(http_res, "5XX", "*"):
1180
1157
  http_res_text = await utils.stream_to_text_async(http_res)
1181
- raise errors.SDKError(
1182
- "API error occurred", http_res.status_code, http_res_text, http_res
1183
- )
1158
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1184
1159
 
1185
- content_type = http_res.headers.get("Content-Type")
1186
- http_res_text = await utils.stream_to_text_async(http_res)
1187
- raise errors.SDKError(
1188
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1189
- http_res.status_code,
1190
- http_res_text,
1191
- http_res,
1192
- )
1160
+ raise errors.SDKError("Unexpected response received", http_res)