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/domains.py CHANGED
@@ -108,63 +108,58 @@ class Domains(BaseSDK):
108
108
 
109
109
  response_data: Any = None
110
110
  if utils.match_response(http_res, "201", "application/json"):
111
- return utils.unmarshal_json(
112
- http_res.text, Optional[components.DomainSchema]
111
+ return utils.unmarshal_json_response(
112
+ Optional[components.DomainSchema], http_res
113
113
  )
114
114
  if utils.match_response(http_res, "400", "application/json"):
115
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
116
- raise errors.BadRequest(data=response_data)
115
+ response_data = utils.unmarshal_json_response(
116
+ errors.BadRequestData, http_res
117
+ )
118
+ raise errors.BadRequest(response_data, http_res)
117
119
  if utils.match_response(http_res, "401", "application/json"):
118
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
119
- raise errors.Unauthorized(data=response_data)
120
+ response_data = utils.unmarshal_json_response(
121
+ errors.UnauthorizedData, http_res
122
+ )
123
+ raise errors.Unauthorized(response_data, http_res)
120
124
  if utils.match_response(http_res, "403", "application/json"):
121
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
122
- raise errors.Forbidden(data=response_data)
125
+ response_data = utils.unmarshal_json_response(
126
+ errors.ForbiddenData, http_res
127
+ )
128
+ raise errors.Forbidden(response_data, http_res)
123
129
  if utils.match_response(http_res, "404", "application/json"):
124
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
125
- raise errors.NotFound(data=response_data)
130
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
131
+ raise errors.NotFound(response_data, http_res)
126
132
  if utils.match_response(http_res, "409", "application/json"):
127
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
128
- raise errors.Conflict(data=response_data)
133
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
134
+ raise errors.Conflict(response_data, http_res)
129
135
  if utils.match_response(http_res, "410", "application/json"):
130
- response_data = utils.unmarshal_json(
131
- http_res.text, errors.InviteExpiredData
136
+ response_data = utils.unmarshal_json_response(
137
+ errors.InviteExpiredData, http_res
132
138
  )
133
- raise errors.InviteExpired(data=response_data)
139
+ raise errors.InviteExpired(response_data, http_res)
134
140
  if utils.match_response(http_res, "422", "application/json"):
135
- response_data = utils.unmarshal_json(
136
- http_res.text, errors.UnprocessableEntityData
141
+ response_data = utils.unmarshal_json_response(
142
+ errors.UnprocessableEntityData, http_res
137
143
  )
138
- raise errors.UnprocessableEntity(data=response_data)
144
+ raise errors.UnprocessableEntity(response_data, http_res)
139
145
  if utils.match_response(http_res, "429", "application/json"):
140
- response_data = utils.unmarshal_json(
141
- http_res.text, errors.RateLimitExceededData
146
+ response_data = utils.unmarshal_json_response(
147
+ errors.RateLimitExceededData, http_res
142
148
  )
143
- raise errors.RateLimitExceeded(data=response_data)
149
+ raise errors.RateLimitExceeded(response_data, http_res)
144
150
  if utils.match_response(http_res, "500", "application/json"):
145
- response_data = utils.unmarshal_json(
146
- http_res.text, errors.InternalServerErrorData
151
+ response_data = utils.unmarshal_json_response(
152
+ errors.InternalServerErrorData, http_res
147
153
  )
148
- raise errors.InternalServerError(data=response_data)
154
+ raise errors.InternalServerError(response_data, http_res)
149
155
  if utils.match_response(http_res, "4XX", "*"):
150
156
  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
- )
157
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
154
158
  if utils.match_response(http_res, "5XX", "*"):
155
159
  http_res_text = utils.stream_to_text(http_res)
156
- raise errors.SDKError(
157
- "API error occurred", http_res.status_code, http_res_text, http_res
158
- )
160
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
159
161
 
160
- content_type = http_res.headers.get("Content-Type")
161
- http_res_text = utils.stream_to_text(http_res)
162
- raise errors.SDKError(
163
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
164
- http_res.status_code,
165
- http_res_text,
166
- http_res,
167
- )
162
+ raise errors.SDKError("Unexpected response received", http_res)
168
163
 
169
164
  async def create_async(
170
165
  self,
@@ -264,63 +259,58 @@ class Domains(BaseSDK):
264
259
 
265
260
  response_data: Any = None
266
261
  if utils.match_response(http_res, "201", "application/json"):
267
- return utils.unmarshal_json(
268
- http_res.text, Optional[components.DomainSchema]
262
+ return utils.unmarshal_json_response(
263
+ Optional[components.DomainSchema], http_res
269
264
  )
270
265
  if utils.match_response(http_res, "400", "application/json"):
271
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
272
- raise errors.BadRequest(data=response_data)
266
+ response_data = utils.unmarshal_json_response(
267
+ errors.BadRequestData, http_res
268
+ )
269
+ raise errors.BadRequest(response_data, http_res)
273
270
  if utils.match_response(http_res, "401", "application/json"):
274
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
275
- raise errors.Unauthorized(data=response_data)
271
+ response_data = utils.unmarshal_json_response(
272
+ errors.UnauthorizedData, http_res
273
+ )
274
+ raise errors.Unauthorized(response_data, http_res)
276
275
  if utils.match_response(http_res, "403", "application/json"):
277
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
278
- raise errors.Forbidden(data=response_data)
276
+ response_data = utils.unmarshal_json_response(
277
+ errors.ForbiddenData, http_res
278
+ )
279
+ raise errors.Forbidden(response_data, http_res)
279
280
  if utils.match_response(http_res, "404", "application/json"):
280
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
281
- raise errors.NotFound(data=response_data)
281
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
282
+ raise errors.NotFound(response_data, http_res)
282
283
  if utils.match_response(http_res, "409", "application/json"):
283
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
284
- raise errors.Conflict(data=response_data)
284
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
285
+ raise errors.Conflict(response_data, http_res)
285
286
  if utils.match_response(http_res, "410", "application/json"):
286
- response_data = utils.unmarshal_json(
287
- http_res.text, errors.InviteExpiredData
287
+ response_data = utils.unmarshal_json_response(
288
+ errors.InviteExpiredData, http_res
288
289
  )
289
- raise errors.InviteExpired(data=response_data)
290
+ raise errors.InviteExpired(response_data, http_res)
290
291
  if utils.match_response(http_res, "422", "application/json"):
291
- response_data = utils.unmarshal_json(
292
- http_res.text, errors.UnprocessableEntityData
292
+ response_data = utils.unmarshal_json_response(
293
+ errors.UnprocessableEntityData, http_res
293
294
  )
294
- raise errors.UnprocessableEntity(data=response_data)
295
+ raise errors.UnprocessableEntity(response_data, http_res)
295
296
  if utils.match_response(http_res, "429", "application/json"):
296
- response_data = utils.unmarshal_json(
297
- http_res.text, errors.RateLimitExceededData
297
+ response_data = utils.unmarshal_json_response(
298
+ errors.RateLimitExceededData, http_res
298
299
  )
299
- raise errors.RateLimitExceeded(data=response_data)
300
+ raise errors.RateLimitExceeded(response_data, http_res)
300
301
  if utils.match_response(http_res, "500", "application/json"):
301
- response_data = utils.unmarshal_json(
302
- http_res.text, errors.InternalServerErrorData
302
+ response_data = utils.unmarshal_json_response(
303
+ errors.InternalServerErrorData, http_res
303
304
  )
304
- raise errors.InternalServerError(data=response_data)
305
+ raise errors.InternalServerError(response_data, http_res)
305
306
  if utils.match_response(http_res, "4XX", "*"):
306
307
  http_res_text = await utils.stream_to_text_async(http_res)
307
- raise errors.SDKError(
308
- "API error occurred", http_res.status_code, http_res_text, http_res
309
- )
308
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
310
309
  if utils.match_response(http_res, "5XX", "*"):
311
310
  http_res_text = await utils.stream_to_text_async(http_res)
312
- raise errors.SDKError(
313
- "API error occurred", http_res.status_code, http_res_text, http_res
314
- )
311
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
315
312
 
316
- content_type = http_res.headers.get("Content-Type")
317
- http_res_text = await utils.stream_to_text_async(http_res)
318
- raise errors.SDKError(
319
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
320
- http_res.status_code,
321
- http_res_text,
322
- http_res,
323
- )
313
+ raise errors.SDKError("Unexpected response received", http_res)
324
314
 
325
315
  def list(
326
316
  self,
@@ -433,65 +423,60 @@ class Domains(BaseSDK):
433
423
  response_data: Any = None
434
424
  if utils.match_response(http_res, "200", "application/json"):
435
425
  return operations.ListDomainsResponse(
436
- result=utils.unmarshal_json(
437
- http_res.text, Optional[List[components.DomainSchema]]
426
+ result=utils.unmarshal_json_response(
427
+ Optional[List[components.DomainSchema]], http_res
438
428
  ),
439
429
  next=next_func,
440
430
  )
441
431
  if utils.match_response(http_res, "400", "application/json"):
442
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
443
- raise errors.BadRequest(data=response_data)
432
+ response_data = utils.unmarshal_json_response(
433
+ errors.BadRequestData, http_res
434
+ )
435
+ raise errors.BadRequest(response_data, http_res)
444
436
  if utils.match_response(http_res, "401", "application/json"):
445
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
446
- raise errors.Unauthorized(data=response_data)
437
+ response_data = utils.unmarshal_json_response(
438
+ errors.UnauthorizedData, http_res
439
+ )
440
+ raise errors.Unauthorized(response_data, http_res)
447
441
  if utils.match_response(http_res, "403", "application/json"):
448
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
449
- raise errors.Forbidden(data=response_data)
442
+ response_data = utils.unmarshal_json_response(
443
+ errors.ForbiddenData, http_res
444
+ )
445
+ raise errors.Forbidden(response_data, http_res)
450
446
  if utils.match_response(http_res, "404", "application/json"):
451
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
452
- raise errors.NotFound(data=response_data)
447
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
448
+ raise errors.NotFound(response_data, http_res)
453
449
  if utils.match_response(http_res, "409", "application/json"):
454
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
455
- raise errors.Conflict(data=response_data)
450
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
451
+ raise errors.Conflict(response_data, http_res)
456
452
  if utils.match_response(http_res, "410", "application/json"):
457
- response_data = utils.unmarshal_json(
458
- http_res.text, errors.InviteExpiredData
453
+ response_data = utils.unmarshal_json_response(
454
+ errors.InviteExpiredData, http_res
459
455
  )
460
- raise errors.InviteExpired(data=response_data)
456
+ raise errors.InviteExpired(response_data, http_res)
461
457
  if utils.match_response(http_res, "422", "application/json"):
462
- response_data = utils.unmarshal_json(
463
- http_res.text, errors.UnprocessableEntityData
458
+ response_data = utils.unmarshal_json_response(
459
+ errors.UnprocessableEntityData, http_res
464
460
  )
465
- raise errors.UnprocessableEntity(data=response_data)
461
+ raise errors.UnprocessableEntity(response_data, http_res)
466
462
  if utils.match_response(http_res, "429", "application/json"):
467
- response_data = utils.unmarshal_json(
468
- http_res.text, errors.RateLimitExceededData
463
+ response_data = utils.unmarshal_json_response(
464
+ errors.RateLimitExceededData, http_res
469
465
  )
470
- raise errors.RateLimitExceeded(data=response_data)
466
+ raise errors.RateLimitExceeded(response_data, http_res)
471
467
  if utils.match_response(http_res, "500", "application/json"):
472
- response_data = utils.unmarshal_json(
473
- http_res.text, errors.InternalServerErrorData
468
+ response_data = utils.unmarshal_json_response(
469
+ errors.InternalServerErrorData, http_res
474
470
  )
475
- raise errors.InternalServerError(data=response_data)
471
+ raise errors.InternalServerError(response_data, http_res)
476
472
  if utils.match_response(http_res, "4XX", "*"):
477
473
  http_res_text = utils.stream_to_text(http_res)
478
- raise errors.SDKError(
479
- "API error occurred", http_res.status_code, http_res_text, http_res
480
- )
474
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
481
475
  if utils.match_response(http_res, "5XX", "*"):
482
476
  http_res_text = utils.stream_to_text(http_res)
483
- raise errors.SDKError(
484
- "API error occurred", http_res.status_code, http_res_text, http_res
485
- )
477
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
486
478
 
487
- content_type = http_res.headers.get("Content-Type")
488
- http_res_text = utils.stream_to_text(http_res)
489
- raise errors.SDKError(
490
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
491
- http_res.status_code,
492
- http_res_text,
493
- http_res,
494
- )
479
+ raise errors.SDKError("Unexpected response received", http_res)
495
480
 
496
481
  async def list_async(
497
482
  self,
@@ -604,65 +589,60 @@ class Domains(BaseSDK):
604
589
  response_data: Any = None
605
590
  if utils.match_response(http_res, "200", "application/json"):
606
591
  return operations.ListDomainsResponse(
607
- result=utils.unmarshal_json(
608
- http_res.text, Optional[List[components.DomainSchema]]
592
+ result=utils.unmarshal_json_response(
593
+ Optional[List[components.DomainSchema]], http_res
609
594
  ),
610
595
  next=next_func,
611
596
  )
612
597
  if utils.match_response(http_res, "400", "application/json"):
613
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
614
- raise errors.BadRequest(data=response_data)
598
+ response_data = utils.unmarshal_json_response(
599
+ errors.BadRequestData, http_res
600
+ )
601
+ raise errors.BadRequest(response_data, http_res)
615
602
  if utils.match_response(http_res, "401", "application/json"):
616
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
617
- raise errors.Unauthorized(data=response_data)
603
+ response_data = utils.unmarshal_json_response(
604
+ errors.UnauthorizedData, http_res
605
+ )
606
+ raise errors.Unauthorized(response_data, http_res)
618
607
  if utils.match_response(http_res, "403", "application/json"):
619
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
620
- raise errors.Forbidden(data=response_data)
608
+ response_data = utils.unmarshal_json_response(
609
+ errors.ForbiddenData, http_res
610
+ )
611
+ raise errors.Forbidden(response_data, http_res)
621
612
  if utils.match_response(http_res, "404", "application/json"):
622
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
623
- raise errors.NotFound(data=response_data)
613
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
614
+ raise errors.NotFound(response_data, http_res)
624
615
  if utils.match_response(http_res, "409", "application/json"):
625
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
626
- raise errors.Conflict(data=response_data)
616
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
617
+ raise errors.Conflict(response_data, http_res)
627
618
  if utils.match_response(http_res, "410", "application/json"):
628
- response_data = utils.unmarshal_json(
629
- http_res.text, errors.InviteExpiredData
619
+ response_data = utils.unmarshal_json_response(
620
+ errors.InviteExpiredData, http_res
630
621
  )
631
- raise errors.InviteExpired(data=response_data)
622
+ raise errors.InviteExpired(response_data, http_res)
632
623
  if utils.match_response(http_res, "422", "application/json"):
633
- response_data = utils.unmarshal_json(
634
- http_res.text, errors.UnprocessableEntityData
624
+ response_data = utils.unmarshal_json_response(
625
+ errors.UnprocessableEntityData, http_res
635
626
  )
636
- raise errors.UnprocessableEntity(data=response_data)
627
+ raise errors.UnprocessableEntity(response_data, http_res)
637
628
  if utils.match_response(http_res, "429", "application/json"):
638
- response_data = utils.unmarshal_json(
639
- http_res.text, errors.RateLimitExceededData
629
+ response_data = utils.unmarshal_json_response(
630
+ errors.RateLimitExceededData, http_res
640
631
  )
641
- raise errors.RateLimitExceeded(data=response_data)
632
+ raise errors.RateLimitExceeded(response_data, http_res)
642
633
  if utils.match_response(http_res, "500", "application/json"):
643
- response_data = utils.unmarshal_json(
644
- http_res.text, errors.InternalServerErrorData
634
+ response_data = utils.unmarshal_json_response(
635
+ errors.InternalServerErrorData, http_res
645
636
  )
646
- raise errors.InternalServerError(data=response_data)
637
+ raise errors.InternalServerError(response_data, http_res)
647
638
  if utils.match_response(http_res, "4XX", "*"):
648
639
  http_res_text = await utils.stream_to_text_async(http_res)
649
- raise errors.SDKError(
650
- "API error occurred", http_res.status_code, http_res_text, http_res
651
- )
640
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
652
641
  if utils.match_response(http_res, "5XX", "*"):
653
642
  http_res_text = await utils.stream_to_text_async(http_res)
654
- raise errors.SDKError(
655
- "API error occurred", http_res.status_code, http_res_text, http_res
656
- )
643
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
657
644
 
658
- content_type = http_res.headers.get("Content-Type")
659
- http_res_text = await utils.stream_to_text_async(http_res)
660
- raise errors.SDKError(
661
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
662
- http_res.status_code,
663
- http_res_text,
664
- http_res,
665
- )
645
+ raise errors.SDKError("Unexpected response received", http_res)
666
646
 
667
647
  def update(
668
648
  self,
@@ -765,63 +745,58 @@ class Domains(BaseSDK):
765
745
 
766
746
  response_data: Any = None
767
747
  if utils.match_response(http_res, "200", "application/json"):
768
- return utils.unmarshal_json(
769
- http_res.text, Optional[components.DomainSchema]
748
+ return utils.unmarshal_json_response(
749
+ Optional[components.DomainSchema], http_res
770
750
  )
771
751
  if utils.match_response(http_res, "400", "application/json"):
772
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
773
- raise errors.BadRequest(data=response_data)
752
+ response_data = utils.unmarshal_json_response(
753
+ errors.BadRequestData, http_res
754
+ )
755
+ raise errors.BadRequest(response_data, http_res)
774
756
  if utils.match_response(http_res, "401", "application/json"):
775
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
776
- raise errors.Unauthorized(data=response_data)
757
+ response_data = utils.unmarshal_json_response(
758
+ errors.UnauthorizedData, http_res
759
+ )
760
+ raise errors.Unauthorized(response_data, http_res)
777
761
  if utils.match_response(http_res, "403", "application/json"):
778
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
779
- raise errors.Forbidden(data=response_data)
762
+ response_data = utils.unmarshal_json_response(
763
+ errors.ForbiddenData, http_res
764
+ )
765
+ raise errors.Forbidden(response_data, http_res)
780
766
  if utils.match_response(http_res, "404", "application/json"):
781
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
782
- raise errors.NotFound(data=response_data)
767
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
768
+ raise errors.NotFound(response_data, http_res)
783
769
  if utils.match_response(http_res, "409", "application/json"):
784
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
785
- raise errors.Conflict(data=response_data)
770
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
771
+ raise errors.Conflict(response_data, http_res)
786
772
  if utils.match_response(http_res, "410", "application/json"):
787
- response_data = utils.unmarshal_json(
788
- http_res.text, errors.InviteExpiredData
773
+ response_data = utils.unmarshal_json_response(
774
+ errors.InviteExpiredData, http_res
789
775
  )
790
- raise errors.InviteExpired(data=response_data)
776
+ raise errors.InviteExpired(response_data, http_res)
791
777
  if utils.match_response(http_res, "422", "application/json"):
792
- response_data = utils.unmarshal_json(
793
- http_res.text, errors.UnprocessableEntityData
778
+ response_data = utils.unmarshal_json_response(
779
+ errors.UnprocessableEntityData, http_res
794
780
  )
795
- raise errors.UnprocessableEntity(data=response_data)
781
+ raise errors.UnprocessableEntity(response_data, http_res)
796
782
  if utils.match_response(http_res, "429", "application/json"):
797
- response_data = utils.unmarshal_json(
798
- http_res.text, errors.RateLimitExceededData
783
+ response_data = utils.unmarshal_json_response(
784
+ errors.RateLimitExceededData, http_res
799
785
  )
800
- raise errors.RateLimitExceeded(data=response_data)
786
+ raise errors.RateLimitExceeded(response_data, http_res)
801
787
  if utils.match_response(http_res, "500", "application/json"):
802
- response_data = utils.unmarshal_json(
803
- http_res.text, errors.InternalServerErrorData
788
+ response_data = utils.unmarshal_json_response(
789
+ errors.InternalServerErrorData, http_res
804
790
  )
805
- raise errors.InternalServerError(data=response_data)
791
+ raise errors.InternalServerError(response_data, http_res)
806
792
  if utils.match_response(http_res, "4XX", "*"):
807
793
  http_res_text = utils.stream_to_text(http_res)
808
- raise errors.SDKError(
809
- "API error occurred", http_res.status_code, http_res_text, http_res
810
- )
794
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
811
795
  if utils.match_response(http_res, "5XX", "*"):
812
796
  http_res_text = utils.stream_to_text(http_res)
813
- raise errors.SDKError(
814
- "API error occurred", http_res.status_code, http_res_text, http_res
815
- )
797
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
816
798
 
817
- content_type = http_res.headers.get("Content-Type")
818
- http_res_text = utils.stream_to_text(http_res)
819
- raise errors.SDKError(
820
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
821
- http_res.status_code,
822
- http_res_text,
823
- http_res,
824
- )
799
+ raise errors.SDKError("Unexpected response received", http_res)
825
800
 
826
801
  async def update_async(
827
802
  self,
@@ -924,63 +899,58 @@ class Domains(BaseSDK):
924
899
 
925
900
  response_data: Any = None
926
901
  if utils.match_response(http_res, "200", "application/json"):
927
- return utils.unmarshal_json(
928
- http_res.text, Optional[components.DomainSchema]
902
+ return utils.unmarshal_json_response(
903
+ Optional[components.DomainSchema], http_res
929
904
  )
930
905
  if utils.match_response(http_res, "400", "application/json"):
931
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
932
- raise errors.BadRequest(data=response_data)
906
+ response_data = utils.unmarshal_json_response(
907
+ errors.BadRequestData, http_res
908
+ )
909
+ raise errors.BadRequest(response_data, http_res)
933
910
  if utils.match_response(http_res, "401", "application/json"):
934
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
935
- raise errors.Unauthorized(data=response_data)
911
+ response_data = utils.unmarshal_json_response(
912
+ errors.UnauthorizedData, http_res
913
+ )
914
+ raise errors.Unauthorized(response_data, http_res)
936
915
  if utils.match_response(http_res, "403", "application/json"):
937
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
938
- raise errors.Forbidden(data=response_data)
916
+ response_data = utils.unmarshal_json_response(
917
+ errors.ForbiddenData, http_res
918
+ )
919
+ raise errors.Forbidden(response_data, http_res)
939
920
  if utils.match_response(http_res, "404", "application/json"):
940
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
941
- raise errors.NotFound(data=response_data)
921
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
922
+ raise errors.NotFound(response_data, http_res)
942
923
  if utils.match_response(http_res, "409", "application/json"):
943
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
944
- raise errors.Conflict(data=response_data)
924
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
925
+ raise errors.Conflict(response_data, http_res)
945
926
  if utils.match_response(http_res, "410", "application/json"):
946
- response_data = utils.unmarshal_json(
947
- http_res.text, errors.InviteExpiredData
927
+ response_data = utils.unmarshal_json_response(
928
+ errors.InviteExpiredData, http_res
948
929
  )
949
- raise errors.InviteExpired(data=response_data)
930
+ raise errors.InviteExpired(response_data, http_res)
950
931
  if utils.match_response(http_res, "422", "application/json"):
951
- response_data = utils.unmarshal_json(
952
- http_res.text, errors.UnprocessableEntityData
932
+ response_data = utils.unmarshal_json_response(
933
+ errors.UnprocessableEntityData, http_res
953
934
  )
954
- raise errors.UnprocessableEntity(data=response_data)
935
+ raise errors.UnprocessableEntity(response_data, http_res)
955
936
  if utils.match_response(http_res, "429", "application/json"):
956
- response_data = utils.unmarshal_json(
957
- http_res.text, errors.RateLimitExceededData
937
+ response_data = utils.unmarshal_json_response(
938
+ errors.RateLimitExceededData, http_res
958
939
  )
959
- raise errors.RateLimitExceeded(data=response_data)
940
+ raise errors.RateLimitExceeded(response_data, http_res)
960
941
  if utils.match_response(http_res, "500", "application/json"):
961
- response_data = utils.unmarshal_json(
962
- http_res.text, errors.InternalServerErrorData
942
+ response_data = utils.unmarshal_json_response(
943
+ errors.InternalServerErrorData, http_res
963
944
  )
964
- raise errors.InternalServerError(data=response_data)
945
+ raise errors.InternalServerError(response_data, http_res)
965
946
  if utils.match_response(http_res, "4XX", "*"):
966
947
  http_res_text = await utils.stream_to_text_async(http_res)
967
- raise errors.SDKError(
968
- "API error occurred", http_res.status_code, http_res_text, http_res
969
- )
948
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
970
949
  if utils.match_response(http_res, "5XX", "*"):
971
950
  http_res_text = await utils.stream_to_text_async(http_res)
972
- raise errors.SDKError(
973
- "API error occurred", http_res.status_code, http_res_text, http_res
974
- )
951
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
975
952
 
976
- content_type = http_res.headers.get("Content-Type")
977
- http_res_text = await utils.stream_to_text_async(http_res)
978
- raise errors.SDKError(
979
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
980
- http_res.status_code,
981
- http_res_text,
982
- http_res,
983
- )
953
+ raise errors.SDKError("Unexpected response received", http_res)
984
954
 
985
955
  def delete(
986
956
  self,
@@ -1066,63 +1036,58 @@ class Domains(BaseSDK):
1066
1036
 
1067
1037
  response_data: Any = None
1068
1038
  if utils.match_response(http_res, "200", "application/json"):
1069
- return utils.unmarshal_json(
1070
- http_res.text, Optional[operations.DeleteDomainResponseBody]
1039
+ return utils.unmarshal_json_response(
1040
+ Optional[operations.DeleteDomainResponseBody], http_res
1071
1041
  )
1072
1042
  if utils.match_response(http_res, "400", "application/json"):
1073
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1074
- raise errors.BadRequest(data=response_data)
1043
+ response_data = utils.unmarshal_json_response(
1044
+ errors.BadRequestData, http_res
1045
+ )
1046
+ raise errors.BadRequest(response_data, http_res)
1075
1047
  if utils.match_response(http_res, "401", "application/json"):
1076
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1077
- raise errors.Unauthorized(data=response_data)
1048
+ response_data = utils.unmarshal_json_response(
1049
+ errors.UnauthorizedData, http_res
1050
+ )
1051
+ raise errors.Unauthorized(response_data, http_res)
1078
1052
  if utils.match_response(http_res, "403", "application/json"):
1079
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1080
- raise errors.Forbidden(data=response_data)
1053
+ response_data = utils.unmarshal_json_response(
1054
+ errors.ForbiddenData, http_res
1055
+ )
1056
+ raise errors.Forbidden(response_data, http_res)
1081
1057
  if utils.match_response(http_res, "404", "application/json"):
1082
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1083
- raise errors.NotFound(data=response_data)
1058
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1059
+ raise errors.NotFound(response_data, http_res)
1084
1060
  if utils.match_response(http_res, "409", "application/json"):
1085
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1086
- raise errors.Conflict(data=response_data)
1061
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1062
+ raise errors.Conflict(response_data, http_res)
1087
1063
  if utils.match_response(http_res, "410", "application/json"):
1088
- response_data = utils.unmarshal_json(
1089
- http_res.text, errors.InviteExpiredData
1064
+ response_data = utils.unmarshal_json_response(
1065
+ errors.InviteExpiredData, http_res
1090
1066
  )
1091
- raise errors.InviteExpired(data=response_data)
1067
+ raise errors.InviteExpired(response_data, http_res)
1092
1068
  if utils.match_response(http_res, "422", "application/json"):
1093
- response_data = utils.unmarshal_json(
1094
- http_res.text, errors.UnprocessableEntityData
1069
+ response_data = utils.unmarshal_json_response(
1070
+ errors.UnprocessableEntityData, http_res
1095
1071
  )
1096
- raise errors.UnprocessableEntity(data=response_data)
1072
+ raise errors.UnprocessableEntity(response_data, http_res)
1097
1073
  if utils.match_response(http_res, "429", "application/json"):
1098
- response_data = utils.unmarshal_json(
1099
- http_res.text, errors.RateLimitExceededData
1074
+ response_data = utils.unmarshal_json_response(
1075
+ errors.RateLimitExceededData, http_res
1100
1076
  )
1101
- raise errors.RateLimitExceeded(data=response_data)
1077
+ raise errors.RateLimitExceeded(response_data, http_res)
1102
1078
  if utils.match_response(http_res, "500", "application/json"):
1103
- response_data = utils.unmarshal_json(
1104
- http_res.text, errors.InternalServerErrorData
1079
+ response_data = utils.unmarshal_json_response(
1080
+ errors.InternalServerErrorData, http_res
1105
1081
  )
1106
- raise errors.InternalServerError(data=response_data)
1082
+ raise errors.InternalServerError(response_data, http_res)
1107
1083
  if utils.match_response(http_res, "4XX", "*"):
1108
1084
  http_res_text = utils.stream_to_text(http_res)
1109
- raise errors.SDKError(
1110
- "API error occurred", http_res.status_code, http_res_text, http_res
1111
- )
1085
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1112
1086
  if utils.match_response(http_res, "5XX", "*"):
1113
1087
  http_res_text = utils.stream_to_text(http_res)
1114
- raise errors.SDKError(
1115
- "API error occurred", http_res.status_code, http_res_text, http_res
1116
- )
1088
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1117
1089
 
1118
- content_type = http_res.headers.get("Content-Type")
1119
- http_res_text = utils.stream_to_text(http_res)
1120
- raise errors.SDKError(
1121
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1122
- http_res.status_code,
1123
- http_res_text,
1124
- http_res,
1125
- )
1090
+ raise errors.SDKError("Unexpected response received", http_res)
1126
1091
 
1127
1092
  async def delete_async(
1128
1093
  self,
@@ -1208,63 +1173,58 @@ class Domains(BaseSDK):
1208
1173
 
1209
1174
  response_data: Any = None
1210
1175
  if utils.match_response(http_res, "200", "application/json"):
1211
- return utils.unmarshal_json(
1212
- http_res.text, Optional[operations.DeleteDomainResponseBody]
1176
+ return utils.unmarshal_json_response(
1177
+ Optional[operations.DeleteDomainResponseBody], http_res
1213
1178
  )
1214
1179
  if utils.match_response(http_res, "400", "application/json"):
1215
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1216
- raise errors.BadRequest(data=response_data)
1180
+ response_data = utils.unmarshal_json_response(
1181
+ errors.BadRequestData, http_res
1182
+ )
1183
+ raise errors.BadRequest(response_data, http_res)
1217
1184
  if utils.match_response(http_res, "401", "application/json"):
1218
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1219
- raise errors.Unauthorized(data=response_data)
1185
+ response_data = utils.unmarshal_json_response(
1186
+ errors.UnauthorizedData, http_res
1187
+ )
1188
+ raise errors.Unauthorized(response_data, http_res)
1220
1189
  if utils.match_response(http_res, "403", "application/json"):
1221
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1222
- raise errors.Forbidden(data=response_data)
1190
+ response_data = utils.unmarshal_json_response(
1191
+ errors.ForbiddenData, http_res
1192
+ )
1193
+ raise errors.Forbidden(response_data, http_res)
1223
1194
  if utils.match_response(http_res, "404", "application/json"):
1224
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1225
- raise errors.NotFound(data=response_data)
1195
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1196
+ raise errors.NotFound(response_data, http_res)
1226
1197
  if utils.match_response(http_res, "409", "application/json"):
1227
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1228
- raise errors.Conflict(data=response_data)
1198
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1199
+ raise errors.Conflict(response_data, http_res)
1229
1200
  if utils.match_response(http_res, "410", "application/json"):
1230
- response_data = utils.unmarshal_json(
1231
- http_res.text, errors.InviteExpiredData
1201
+ response_data = utils.unmarshal_json_response(
1202
+ errors.InviteExpiredData, http_res
1232
1203
  )
1233
- raise errors.InviteExpired(data=response_data)
1204
+ raise errors.InviteExpired(response_data, http_res)
1234
1205
  if utils.match_response(http_res, "422", "application/json"):
1235
- response_data = utils.unmarshal_json(
1236
- http_res.text, errors.UnprocessableEntityData
1206
+ response_data = utils.unmarshal_json_response(
1207
+ errors.UnprocessableEntityData, http_res
1237
1208
  )
1238
- raise errors.UnprocessableEntity(data=response_data)
1209
+ raise errors.UnprocessableEntity(response_data, http_res)
1239
1210
  if utils.match_response(http_res, "429", "application/json"):
1240
- response_data = utils.unmarshal_json(
1241
- http_res.text, errors.RateLimitExceededData
1211
+ response_data = utils.unmarshal_json_response(
1212
+ errors.RateLimitExceededData, http_res
1242
1213
  )
1243
- raise errors.RateLimitExceeded(data=response_data)
1214
+ raise errors.RateLimitExceeded(response_data, http_res)
1244
1215
  if utils.match_response(http_res, "500", "application/json"):
1245
- response_data = utils.unmarshal_json(
1246
- http_res.text, errors.InternalServerErrorData
1216
+ response_data = utils.unmarshal_json_response(
1217
+ errors.InternalServerErrorData, http_res
1247
1218
  )
1248
- raise errors.InternalServerError(data=response_data)
1219
+ raise errors.InternalServerError(response_data, http_res)
1249
1220
  if utils.match_response(http_res, "4XX", "*"):
1250
1221
  http_res_text = await utils.stream_to_text_async(http_res)
1251
- raise errors.SDKError(
1252
- "API error occurred", http_res.status_code, http_res_text, http_res
1253
- )
1222
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1254
1223
  if utils.match_response(http_res, "5XX", "*"):
1255
1224
  http_res_text = await utils.stream_to_text_async(http_res)
1256
- raise errors.SDKError(
1257
- "API error occurred", http_res.status_code, http_res_text, http_res
1258
- )
1225
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1259
1226
 
1260
- content_type = http_res.headers.get("Content-Type")
1261
- http_res_text = await utils.stream_to_text_async(http_res)
1262
- raise errors.SDKError(
1263
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1264
- http_res.status_code,
1265
- http_res_text,
1266
- http_res,
1267
- )
1227
+ raise errors.SDKError("Unexpected response received", http_res)
1268
1228
 
1269
1229
  def register(
1270
1230
  self,
@@ -1364,63 +1324,58 @@ class Domains(BaseSDK):
1364
1324
 
1365
1325
  response_data: Any = None
1366
1326
  if utils.match_response(http_res, "201", "application/json"):
1367
- return utils.unmarshal_json(
1368
- http_res.text, Optional[operations.RegisterDomainResponseBody]
1327
+ return utils.unmarshal_json_response(
1328
+ Optional[operations.RegisterDomainResponseBody], http_res
1369
1329
  )
1370
1330
  if utils.match_response(http_res, "400", "application/json"):
1371
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1372
- raise errors.BadRequest(data=response_data)
1331
+ response_data = utils.unmarshal_json_response(
1332
+ errors.BadRequestData, http_res
1333
+ )
1334
+ raise errors.BadRequest(response_data, http_res)
1373
1335
  if utils.match_response(http_res, "401", "application/json"):
1374
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1375
- raise errors.Unauthorized(data=response_data)
1336
+ response_data = utils.unmarshal_json_response(
1337
+ errors.UnauthorizedData, http_res
1338
+ )
1339
+ raise errors.Unauthorized(response_data, http_res)
1376
1340
  if utils.match_response(http_res, "403", "application/json"):
1377
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1378
- raise errors.Forbidden(data=response_data)
1341
+ response_data = utils.unmarshal_json_response(
1342
+ errors.ForbiddenData, http_res
1343
+ )
1344
+ raise errors.Forbidden(response_data, http_res)
1379
1345
  if utils.match_response(http_res, "404", "application/json"):
1380
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1381
- raise errors.NotFound(data=response_data)
1346
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1347
+ raise errors.NotFound(response_data, http_res)
1382
1348
  if utils.match_response(http_res, "409", "application/json"):
1383
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1384
- raise errors.Conflict(data=response_data)
1349
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1350
+ raise errors.Conflict(response_data, http_res)
1385
1351
  if utils.match_response(http_res, "410", "application/json"):
1386
- response_data = utils.unmarshal_json(
1387
- http_res.text, errors.InviteExpiredData
1352
+ response_data = utils.unmarshal_json_response(
1353
+ errors.InviteExpiredData, http_res
1388
1354
  )
1389
- raise errors.InviteExpired(data=response_data)
1355
+ raise errors.InviteExpired(response_data, http_res)
1390
1356
  if utils.match_response(http_res, "422", "application/json"):
1391
- response_data = utils.unmarshal_json(
1392
- http_res.text, errors.UnprocessableEntityData
1357
+ response_data = utils.unmarshal_json_response(
1358
+ errors.UnprocessableEntityData, http_res
1393
1359
  )
1394
- raise errors.UnprocessableEntity(data=response_data)
1360
+ raise errors.UnprocessableEntity(response_data, http_res)
1395
1361
  if utils.match_response(http_res, "429", "application/json"):
1396
- response_data = utils.unmarshal_json(
1397
- http_res.text, errors.RateLimitExceededData
1362
+ response_data = utils.unmarshal_json_response(
1363
+ errors.RateLimitExceededData, http_res
1398
1364
  )
1399
- raise errors.RateLimitExceeded(data=response_data)
1365
+ raise errors.RateLimitExceeded(response_data, http_res)
1400
1366
  if utils.match_response(http_res, "500", "application/json"):
1401
- response_data = utils.unmarshal_json(
1402
- http_res.text, errors.InternalServerErrorData
1367
+ response_data = utils.unmarshal_json_response(
1368
+ errors.InternalServerErrorData, http_res
1403
1369
  )
1404
- raise errors.InternalServerError(data=response_data)
1370
+ raise errors.InternalServerError(response_data, http_res)
1405
1371
  if utils.match_response(http_res, "4XX", "*"):
1406
1372
  http_res_text = utils.stream_to_text(http_res)
1407
- raise errors.SDKError(
1408
- "API error occurred", http_res.status_code, http_res_text, http_res
1409
- )
1373
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1410
1374
  if utils.match_response(http_res, "5XX", "*"):
1411
1375
  http_res_text = utils.stream_to_text(http_res)
1412
- raise errors.SDKError(
1413
- "API error occurred", http_res.status_code, http_res_text, http_res
1414
- )
1376
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1415
1377
 
1416
- content_type = http_res.headers.get("Content-Type")
1417
- http_res_text = utils.stream_to_text(http_res)
1418
- raise errors.SDKError(
1419
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1420
- http_res.status_code,
1421
- http_res_text,
1422
- http_res,
1423
- )
1378
+ raise errors.SDKError("Unexpected response received", http_res)
1424
1379
 
1425
1380
  async def register_async(
1426
1381
  self,
@@ -1520,63 +1475,58 @@ class Domains(BaseSDK):
1520
1475
 
1521
1476
  response_data: Any = None
1522
1477
  if utils.match_response(http_res, "201", "application/json"):
1523
- return utils.unmarshal_json(
1524
- http_res.text, Optional[operations.RegisterDomainResponseBody]
1478
+ return utils.unmarshal_json_response(
1479
+ Optional[operations.RegisterDomainResponseBody], http_res
1525
1480
  )
1526
1481
  if utils.match_response(http_res, "400", "application/json"):
1527
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1528
- raise errors.BadRequest(data=response_data)
1482
+ response_data = utils.unmarshal_json_response(
1483
+ errors.BadRequestData, http_res
1484
+ )
1485
+ raise errors.BadRequest(response_data, http_res)
1529
1486
  if utils.match_response(http_res, "401", "application/json"):
1530
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1531
- raise errors.Unauthorized(data=response_data)
1487
+ response_data = utils.unmarshal_json_response(
1488
+ errors.UnauthorizedData, http_res
1489
+ )
1490
+ raise errors.Unauthorized(response_data, http_res)
1532
1491
  if utils.match_response(http_res, "403", "application/json"):
1533
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1534
- raise errors.Forbidden(data=response_data)
1492
+ response_data = utils.unmarshal_json_response(
1493
+ errors.ForbiddenData, http_res
1494
+ )
1495
+ raise errors.Forbidden(response_data, http_res)
1535
1496
  if utils.match_response(http_res, "404", "application/json"):
1536
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1537
- raise errors.NotFound(data=response_data)
1497
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1498
+ raise errors.NotFound(response_data, http_res)
1538
1499
  if utils.match_response(http_res, "409", "application/json"):
1539
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1540
- raise errors.Conflict(data=response_data)
1500
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1501
+ raise errors.Conflict(response_data, http_res)
1541
1502
  if utils.match_response(http_res, "410", "application/json"):
1542
- response_data = utils.unmarshal_json(
1543
- http_res.text, errors.InviteExpiredData
1503
+ response_data = utils.unmarshal_json_response(
1504
+ errors.InviteExpiredData, http_res
1544
1505
  )
1545
- raise errors.InviteExpired(data=response_data)
1506
+ raise errors.InviteExpired(response_data, http_res)
1546
1507
  if utils.match_response(http_res, "422", "application/json"):
1547
- response_data = utils.unmarshal_json(
1548
- http_res.text, errors.UnprocessableEntityData
1508
+ response_data = utils.unmarshal_json_response(
1509
+ errors.UnprocessableEntityData, http_res
1549
1510
  )
1550
- raise errors.UnprocessableEntity(data=response_data)
1511
+ raise errors.UnprocessableEntity(response_data, http_res)
1551
1512
  if utils.match_response(http_res, "429", "application/json"):
1552
- response_data = utils.unmarshal_json(
1553
- http_res.text, errors.RateLimitExceededData
1513
+ response_data = utils.unmarshal_json_response(
1514
+ errors.RateLimitExceededData, http_res
1554
1515
  )
1555
- raise errors.RateLimitExceeded(data=response_data)
1516
+ raise errors.RateLimitExceeded(response_data, http_res)
1556
1517
  if utils.match_response(http_res, "500", "application/json"):
1557
- response_data = utils.unmarshal_json(
1558
- http_res.text, errors.InternalServerErrorData
1518
+ response_data = utils.unmarshal_json_response(
1519
+ errors.InternalServerErrorData, http_res
1559
1520
  )
1560
- raise errors.InternalServerError(data=response_data)
1521
+ raise errors.InternalServerError(response_data, http_res)
1561
1522
  if utils.match_response(http_res, "4XX", "*"):
1562
1523
  http_res_text = await utils.stream_to_text_async(http_res)
1563
- raise errors.SDKError(
1564
- "API error occurred", http_res.status_code, http_res_text, http_res
1565
- )
1524
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1566
1525
  if utils.match_response(http_res, "5XX", "*"):
1567
1526
  http_res_text = await utils.stream_to_text_async(http_res)
1568
- raise errors.SDKError(
1569
- "API error occurred", http_res.status_code, http_res_text, http_res
1570
- )
1527
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1571
1528
 
1572
- content_type = http_res.headers.get("Content-Type")
1573
- http_res_text = await utils.stream_to_text_async(http_res)
1574
- raise errors.SDKError(
1575
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1576
- http_res.status_code,
1577
- http_res_text,
1578
- http_res,
1579
- )
1529
+ raise errors.SDKError("Unexpected response received", http_res)
1580
1530
 
1581
1531
  def check_status(
1582
1532
  self,
@@ -1665,63 +1615,58 @@ class Domains(BaseSDK):
1665
1615
 
1666
1616
  response_data: Any = None
1667
1617
  if utils.match_response(http_res, "200", "application/json"):
1668
- return utils.unmarshal_json(
1669
- http_res.text, Optional[List[operations.CheckDomainStatusResponseBody]]
1618
+ return utils.unmarshal_json_response(
1619
+ Optional[List[operations.CheckDomainStatusResponseBody]], http_res
1670
1620
  )
1671
1621
  if utils.match_response(http_res, "400", "application/json"):
1672
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1673
- raise errors.BadRequest(data=response_data)
1622
+ response_data = utils.unmarshal_json_response(
1623
+ errors.BadRequestData, http_res
1624
+ )
1625
+ raise errors.BadRequest(response_data, http_res)
1674
1626
  if utils.match_response(http_res, "401", "application/json"):
1675
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1676
- raise errors.Unauthorized(data=response_data)
1627
+ response_data = utils.unmarshal_json_response(
1628
+ errors.UnauthorizedData, http_res
1629
+ )
1630
+ raise errors.Unauthorized(response_data, http_res)
1677
1631
  if utils.match_response(http_res, "403", "application/json"):
1678
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1679
- raise errors.Forbidden(data=response_data)
1632
+ response_data = utils.unmarshal_json_response(
1633
+ errors.ForbiddenData, http_res
1634
+ )
1635
+ raise errors.Forbidden(response_data, http_res)
1680
1636
  if utils.match_response(http_res, "404", "application/json"):
1681
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1682
- raise errors.NotFound(data=response_data)
1637
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1638
+ raise errors.NotFound(response_data, http_res)
1683
1639
  if utils.match_response(http_res, "409", "application/json"):
1684
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1685
- raise errors.Conflict(data=response_data)
1640
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1641
+ raise errors.Conflict(response_data, http_res)
1686
1642
  if utils.match_response(http_res, "410", "application/json"):
1687
- response_data = utils.unmarshal_json(
1688
- http_res.text, errors.InviteExpiredData
1643
+ response_data = utils.unmarshal_json_response(
1644
+ errors.InviteExpiredData, http_res
1689
1645
  )
1690
- raise errors.InviteExpired(data=response_data)
1646
+ raise errors.InviteExpired(response_data, http_res)
1691
1647
  if utils.match_response(http_res, "422", "application/json"):
1692
- response_data = utils.unmarshal_json(
1693
- http_res.text, errors.UnprocessableEntityData
1648
+ response_data = utils.unmarshal_json_response(
1649
+ errors.UnprocessableEntityData, http_res
1694
1650
  )
1695
- raise errors.UnprocessableEntity(data=response_data)
1651
+ raise errors.UnprocessableEntity(response_data, http_res)
1696
1652
  if utils.match_response(http_res, "429", "application/json"):
1697
- response_data = utils.unmarshal_json(
1698
- http_res.text, errors.RateLimitExceededData
1653
+ response_data = utils.unmarshal_json_response(
1654
+ errors.RateLimitExceededData, http_res
1699
1655
  )
1700
- raise errors.RateLimitExceeded(data=response_data)
1656
+ raise errors.RateLimitExceeded(response_data, http_res)
1701
1657
  if utils.match_response(http_res, "500", "application/json"):
1702
- response_data = utils.unmarshal_json(
1703
- http_res.text, errors.InternalServerErrorData
1658
+ response_data = utils.unmarshal_json_response(
1659
+ errors.InternalServerErrorData, http_res
1704
1660
  )
1705
- raise errors.InternalServerError(data=response_data)
1661
+ raise errors.InternalServerError(response_data, http_res)
1706
1662
  if utils.match_response(http_res, "4XX", "*"):
1707
1663
  http_res_text = utils.stream_to_text(http_res)
1708
- raise errors.SDKError(
1709
- "API error occurred", http_res.status_code, http_res_text, http_res
1710
- )
1664
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1711
1665
  if utils.match_response(http_res, "5XX", "*"):
1712
1666
  http_res_text = utils.stream_to_text(http_res)
1713
- raise errors.SDKError(
1714
- "API error occurred", http_res.status_code, http_res_text, http_res
1715
- )
1667
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1716
1668
 
1717
- content_type = http_res.headers.get("Content-Type")
1718
- http_res_text = utils.stream_to_text(http_res)
1719
- raise errors.SDKError(
1720
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1721
- http_res.status_code,
1722
- http_res_text,
1723
- http_res,
1724
- )
1669
+ raise errors.SDKError("Unexpected response received", http_res)
1725
1670
 
1726
1671
  async def check_status_async(
1727
1672
  self,
@@ -1810,60 +1755,55 @@ class Domains(BaseSDK):
1810
1755
 
1811
1756
  response_data: Any = None
1812
1757
  if utils.match_response(http_res, "200", "application/json"):
1813
- return utils.unmarshal_json(
1814
- http_res.text, Optional[List[operations.CheckDomainStatusResponseBody]]
1758
+ return utils.unmarshal_json_response(
1759
+ Optional[List[operations.CheckDomainStatusResponseBody]], http_res
1815
1760
  )
1816
1761
  if utils.match_response(http_res, "400", "application/json"):
1817
- response_data = utils.unmarshal_json(http_res.text, errors.BadRequestData)
1818
- raise errors.BadRequest(data=response_data)
1762
+ response_data = utils.unmarshal_json_response(
1763
+ errors.BadRequestData, http_res
1764
+ )
1765
+ raise errors.BadRequest(response_data, http_res)
1819
1766
  if utils.match_response(http_res, "401", "application/json"):
1820
- response_data = utils.unmarshal_json(http_res.text, errors.UnauthorizedData)
1821
- raise errors.Unauthorized(data=response_data)
1767
+ response_data = utils.unmarshal_json_response(
1768
+ errors.UnauthorizedData, http_res
1769
+ )
1770
+ raise errors.Unauthorized(response_data, http_res)
1822
1771
  if utils.match_response(http_res, "403", "application/json"):
1823
- response_data = utils.unmarshal_json(http_res.text, errors.ForbiddenData)
1824
- raise errors.Forbidden(data=response_data)
1772
+ response_data = utils.unmarshal_json_response(
1773
+ errors.ForbiddenData, http_res
1774
+ )
1775
+ raise errors.Forbidden(response_data, http_res)
1825
1776
  if utils.match_response(http_res, "404", "application/json"):
1826
- response_data = utils.unmarshal_json(http_res.text, errors.NotFoundData)
1827
- raise errors.NotFound(data=response_data)
1777
+ response_data = utils.unmarshal_json_response(errors.NotFoundData, http_res)
1778
+ raise errors.NotFound(response_data, http_res)
1828
1779
  if utils.match_response(http_res, "409", "application/json"):
1829
- response_data = utils.unmarshal_json(http_res.text, errors.ConflictData)
1830
- raise errors.Conflict(data=response_data)
1780
+ response_data = utils.unmarshal_json_response(errors.ConflictData, http_res)
1781
+ raise errors.Conflict(response_data, http_res)
1831
1782
  if utils.match_response(http_res, "410", "application/json"):
1832
- response_data = utils.unmarshal_json(
1833
- http_res.text, errors.InviteExpiredData
1783
+ response_data = utils.unmarshal_json_response(
1784
+ errors.InviteExpiredData, http_res
1834
1785
  )
1835
- raise errors.InviteExpired(data=response_data)
1786
+ raise errors.InviteExpired(response_data, http_res)
1836
1787
  if utils.match_response(http_res, "422", "application/json"):
1837
- response_data = utils.unmarshal_json(
1838
- http_res.text, errors.UnprocessableEntityData
1788
+ response_data = utils.unmarshal_json_response(
1789
+ errors.UnprocessableEntityData, http_res
1839
1790
  )
1840
- raise errors.UnprocessableEntity(data=response_data)
1791
+ raise errors.UnprocessableEntity(response_data, http_res)
1841
1792
  if utils.match_response(http_res, "429", "application/json"):
1842
- response_data = utils.unmarshal_json(
1843
- http_res.text, errors.RateLimitExceededData
1793
+ response_data = utils.unmarshal_json_response(
1794
+ errors.RateLimitExceededData, http_res
1844
1795
  )
1845
- raise errors.RateLimitExceeded(data=response_data)
1796
+ raise errors.RateLimitExceeded(response_data, http_res)
1846
1797
  if utils.match_response(http_res, "500", "application/json"):
1847
- response_data = utils.unmarshal_json(
1848
- http_res.text, errors.InternalServerErrorData
1798
+ response_data = utils.unmarshal_json_response(
1799
+ errors.InternalServerErrorData, http_res
1849
1800
  )
1850
- raise errors.InternalServerError(data=response_data)
1801
+ raise errors.InternalServerError(response_data, http_res)
1851
1802
  if utils.match_response(http_res, "4XX", "*"):
1852
1803
  http_res_text = await utils.stream_to_text_async(http_res)
1853
- raise errors.SDKError(
1854
- "API error occurred", http_res.status_code, http_res_text, http_res
1855
- )
1804
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1856
1805
  if utils.match_response(http_res, "5XX", "*"):
1857
1806
  http_res_text = await utils.stream_to_text_async(http_res)
1858
- raise errors.SDKError(
1859
- "API error occurred", http_res.status_code, http_res_text, http_res
1860
- )
1807
+ raise errors.SDKError("API error occurred", http_res, http_res_text)
1861
1808
 
1862
- content_type = http_res.headers.get("Content-Type")
1863
- http_res_text = await utils.stream_to_text_async(http_res)
1864
- raise errors.SDKError(
1865
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1866
- http_res.status_code,
1867
- http_res_text,
1868
- http_res,
1869
- )
1809
+ raise errors.SDKError("Unexpected response received", http_res)