compass_api_sdk 0.9.36__py3-none-any.whl → 0.9.37__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.

Potentially problematic release.


This version of compass_api_sdk might be problematic. Click here for more details.

@@ -99,31 +99,20 @@ class AaveV3(BaseSDK):
99
99
 
100
100
  response_data: Any = None
101
101
  if utils.match_response(http_res, "200", "application/json"):
102
- return utils.unmarshal_json(http_res.text, models.AaveRateResponse)
102
+ return utils.unmarshal_json_response(models.AaveRateResponse, http_res)
103
103
  if utils.match_response(http_res, "422", "application/json"):
104
- response_data = utils.unmarshal_json(
105
- http_res.text, errors.HTTPValidationErrorData
104
+ response_data = utils.unmarshal_json_response(
105
+ errors.HTTPValidationErrorData, http_res
106
106
  )
107
- raise errors.HTTPValidationError(data=response_data)
107
+ raise errors.HTTPValidationError(response_data, http_res)
108
108
  if utils.match_response(http_res, "4XX", "*"):
109
109
  http_res_text = utils.stream_to_text(http_res)
110
- raise errors.APIError(
111
- "API error occurred", http_res.status_code, http_res_text, http_res
112
- )
110
+ raise errors.APIError("API error occurred", http_res, http_res_text)
113
111
  if utils.match_response(http_res, "5XX", "*"):
114
112
  http_res_text = utils.stream_to_text(http_res)
115
- raise errors.APIError(
116
- "API error occurred", http_res.status_code, http_res_text, http_res
117
- )
113
+ raise errors.APIError("API error occurred", http_res, http_res_text)
118
114
 
119
- content_type = http_res.headers.get("Content-Type")
120
- http_res_text = utils.stream_to_text(http_res)
121
- raise errors.APIError(
122
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
123
- http_res.status_code,
124
- http_res_text,
125
- http_res,
126
- )
115
+ raise errors.APIError("Unexpected response received", http_res)
127
116
 
128
117
  async def rate_async(
129
118
  self,
@@ -216,31 +205,20 @@ class AaveV3(BaseSDK):
216
205
 
217
206
  response_data: Any = None
218
207
  if utils.match_response(http_res, "200", "application/json"):
219
- return utils.unmarshal_json(http_res.text, models.AaveRateResponse)
208
+ return utils.unmarshal_json_response(models.AaveRateResponse, http_res)
220
209
  if utils.match_response(http_res, "422", "application/json"):
221
- response_data = utils.unmarshal_json(
222
- http_res.text, errors.HTTPValidationErrorData
210
+ response_data = utils.unmarshal_json_response(
211
+ errors.HTTPValidationErrorData, http_res
223
212
  )
224
- raise errors.HTTPValidationError(data=response_data)
213
+ raise errors.HTTPValidationError(response_data, http_res)
225
214
  if utils.match_response(http_res, "4XX", "*"):
226
215
  http_res_text = await utils.stream_to_text_async(http_res)
227
- raise errors.APIError(
228
- "API error occurred", http_res.status_code, http_res_text, http_res
229
- )
216
+ raise errors.APIError("API error occurred", http_res, http_res_text)
230
217
  if utils.match_response(http_res, "5XX", "*"):
231
218
  http_res_text = await utils.stream_to_text_async(http_res)
232
- raise errors.APIError(
233
- "API error occurred", http_res.status_code, http_res_text, http_res
234
- )
219
+ raise errors.APIError("API error occurred", http_res, http_res_text)
235
220
 
236
- content_type = http_res.headers.get("Content-Type")
237
- http_res_text = await utils.stream_to_text_async(http_res)
238
- raise errors.APIError(
239
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
240
- http_res.status_code,
241
- http_res_text,
242
- http_res,
243
- )
221
+ raise errors.APIError("Unexpected response received", http_res)
244
222
 
245
223
  def avg_rate(
246
224
  self,
@@ -323,31 +301,20 @@ class AaveV3(BaseSDK):
323
301
 
324
302
  response_data: Any = None
325
303
  if utils.match_response(http_res, "200", "application/json"):
326
- return utils.unmarshal_json(http_res.text, models.AaveAvgRateResponse)
304
+ return utils.unmarshal_json_response(models.AaveAvgRateResponse, http_res)
327
305
  if utils.match_response(http_res, "422", "application/json"):
328
- response_data = utils.unmarshal_json(
329
- http_res.text, errors.HTTPValidationErrorData
306
+ response_data = utils.unmarshal_json_response(
307
+ errors.HTTPValidationErrorData, http_res
330
308
  )
331
- raise errors.HTTPValidationError(data=response_data)
309
+ raise errors.HTTPValidationError(response_data, http_res)
332
310
  if utils.match_response(http_res, "4XX", "*"):
333
311
  http_res_text = utils.stream_to_text(http_res)
334
- raise errors.APIError(
335
- "API error occurred", http_res.status_code, http_res_text, http_res
336
- )
312
+ raise errors.APIError("API error occurred", http_res, http_res_text)
337
313
  if utils.match_response(http_res, "5XX", "*"):
338
314
  http_res_text = utils.stream_to_text(http_res)
339
- raise errors.APIError(
340
- "API error occurred", http_res.status_code, http_res_text, http_res
341
- )
315
+ raise errors.APIError("API error occurred", http_res, http_res_text)
342
316
 
343
- content_type = http_res.headers.get("Content-Type")
344
- http_res_text = utils.stream_to_text(http_res)
345
- raise errors.APIError(
346
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
347
- http_res.status_code,
348
- http_res_text,
349
- http_res,
350
- )
317
+ raise errors.APIError("Unexpected response received", http_res)
351
318
 
352
319
  async def avg_rate_async(
353
320
  self,
@@ -430,31 +397,20 @@ class AaveV3(BaseSDK):
430
397
 
431
398
  response_data: Any = None
432
399
  if utils.match_response(http_res, "200", "application/json"):
433
- return utils.unmarshal_json(http_res.text, models.AaveAvgRateResponse)
400
+ return utils.unmarshal_json_response(models.AaveAvgRateResponse, http_res)
434
401
  if utils.match_response(http_res, "422", "application/json"):
435
- response_data = utils.unmarshal_json(
436
- http_res.text, errors.HTTPValidationErrorData
402
+ response_data = utils.unmarshal_json_response(
403
+ errors.HTTPValidationErrorData, http_res
437
404
  )
438
- raise errors.HTTPValidationError(data=response_data)
405
+ raise errors.HTTPValidationError(response_data, http_res)
439
406
  if utils.match_response(http_res, "4XX", "*"):
440
407
  http_res_text = await utils.stream_to_text_async(http_res)
441
- raise errors.APIError(
442
- "API error occurred", http_res.status_code, http_res_text, http_res
443
- )
408
+ raise errors.APIError("API error occurred", http_res, http_res_text)
444
409
  if utils.match_response(http_res, "5XX", "*"):
445
410
  http_res_text = await utils.stream_to_text_async(http_res)
446
- raise errors.APIError(
447
- "API error occurred", http_res.status_code, http_res_text, http_res
448
- )
411
+ raise errors.APIError("API error occurred", http_res, http_res_text)
449
412
 
450
- content_type = http_res.headers.get("Content-Type")
451
- http_res_text = await utils.stream_to_text_async(http_res)
452
- raise errors.APIError(
453
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
454
- http_res.status_code,
455
- http_res_text,
456
- http_res,
457
- )
413
+ raise errors.APIError("Unexpected response received", http_res)
458
414
 
459
415
  def std_rate(
460
416
  self,
@@ -538,31 +494,20 @@ class AaveV3(BaseSDK):
538
494
 
539
495
  response_data: Any = None
540
496
  if utils.match_response(http_res, "200", "application/json"):
541
- return utils.unmarshal_json(http_res.text, models.AaveSTDRateResponse)
497
+ return utils.unmarshal_json_response(models.AaveSTDRateResponse, http_res)
542
498
  if utils.match_response(http_res, "422", "application/json"):
543
- response_data = utils.unmarshal_json(
544
- http_res.text, errors.HTTPValidationErrorData
499
+ response_data = utils.unmarshal_json_response(
500
+ errors.HTTPValidationErrorData, http_res
545
501
  )
546
- raise errors.HTTPValidationError(data=response_data)
502
+ raise errors.HTTPValidationError(response_data, http_res)
547
503
  if utils.match_response(http_res, "4XX", "*"):
548
504
  http_res_text = utils.stream_to_text(http_res)
549
- raise errors.APIError(
550
- "API error occurred", http_res.status_code, http_res_text, http_res
551
- )
505
+ raise errors.APIError("API error occurred", http_res, http_res_text)
552
506
  if utils.match_response(http_res, "5XX", "*"):
553
507
  http_res_text = utils.stream_to_text(http_res)
554
- raise errors.APIError(
555
- "API error occurred", http_res.status_code, http_res_text, http_res
556
- )
508
+ raise errors.APIError("API error occurred", http_res, http_res_text)
557
509
 
558
- content_type = http_res.headers.get("Content-Type")
559
- http_res_text = utils.stream_to_text(http_res)
560
- raise errors.APIError(
561
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
562
- http_res.status_code,
563
- http_res_text,
564
- http_res,
565
- )
510
+ raise errors.APIError("Unexpected response received", http_res)
566
511
 
567
512
  async def std_rate_async(
568
513
  self,
@@ -646,31 +591,20 @@ class AaveV3(BaseSDK):
646
591
 
647
592
  response_data: Any = None
648
593
  if utils.match_response(http_res, "200", "application/json"):
649
- return utils.unmarshal_json(http_res.text, models.AaveSTDRateResponse)
594
+ return utils.unmarshal_json_response(models.AaveSTDRateResponse, http_res)
650
595
  if utils.match_response(http_res, "422", "application/json"):
651
- response_data = utils.unmarshal_json(
652
- http_res.text, errors.HTTPValidationErrorData
596
+ response_data = utils.unmarshal_json_response(
597
+ errors.HTTPValidationErrorData, http_res
653
598
  )
654
- raise errors.HTTPValidationError(data=response_data)
599
+ raise errors.HTTPValidationError(response_data, http_res)
655
600
  if utils.match_response(http_res, "4XX", "*"):
656
601
  http_res_text = await utils.stream_to_text_async(http_res)
657
- raise errors.APIError(
658
- "API error occurred", http_res.status_code, http_res_text, http_res
659
- )
602
+ raise errors.APIError("API error occurred", http_res, http_res_text)
660
603
  if utils.match_response(http_res, "5XX", "*"):
661
604
  http_res_text = await utils.stream_to_text_async(http_res)
662
- raise errors.APIError(
663
- "API error occurred", http_res.status_code, http_res_text, http_res
664
- )
605
+ raise errors.APIError("API error occurred", http_res, http_res_text)
665
606
 
666
- content_type = http_res.headers.get("Content-Type")
667
- http_res_text = await utils.stream_to_text_async(http_res)
668
- raise errors.APIError(
669
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
670
- http_res.status_code,
671
- http_res_text,
672
- http_res,
673
- )
607
+ raise errors.APIError("Unexpected response received", http_res)
674
608
 
675
609
  def reserve_overview(
676
610
  self,
@@ -755,33 +689,22 @@ class AaveV3(BaseSDK):
755
689
 
756
690
  response_data: Any = None
757
691
  if utils.match_response(http_res, "200", "application/json"):
758
- return utils.unmarshal_json(
759
- http_res.text, models.AaveReserveOverviewResponse
692
+ return utils.unmarshal_json_response(
693
+ models.AaveReserveOverviewResponse, http_res
760
694
  )
761
695
  if utils.match_response(http_res, "422", "application/json"):
762
- response_data = utils.unmarshal_json(
763
- http_res.text, errors.HTTPValidationErrorData
696
+ response_data = utils.unmarshal_json_response(
697
+ errors.HTTPValidationErrorData, http_res
764
698
  )
765
- raise errors.HTTPValidationError(data=response_data)
699
+ raise errors.HTTPValidationError(response_data, http_res)
766
700
  if utils.match_response(http_res, "4XX", "*"):
767
701
  http_res_text = utils.stream_to_text(http_res)
768
- raise errors.APIError(
769
- "API error occurred", http_res.status_code, http_res_text, http_res
770
- )
702
+ raise errors.APIError("API error occurred", http_res, http_res_text)
771
703
  if utils.match_response(http_res, "5XX", "*"):
772
704
  http_res_text = utils.stream_to_text(http_res)
773
- raise errors.APIError(
774
- "API error occurred", http_res.status_code, http_res_text, http_res
775
- )
705
+ raise errors.APIError("API error occurred", http_res, http_res_text)
776
706
 
777
- content_type = http_res.headers.get("Content-Type")
778
- http_res_text = utils.stream_to_text(http_res)
779
- raise errors.APIError(
780
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
781
- http_res.status_code,
782
- http_res_text,
783
- http_res,
784
- )
707
+ raise errors.APIError("Unexpected response received", http_res)
785
708
 
786
709
  async def reserve_overview_async(
787
710
  self,
@@ -866,33 +789,22 @@ class AaveV3(BaseSDK):
866
789
 
867
790
  response_data: Any = None
868
791
  if utils.match_response(http_res, "200", "application/json"):
869
- return utils.unmarshal_json(
870
- http_res.text, models.AaveReserveOverviewResponse
792
+ return utils.unmarshal_json_response(
793
+ models.AaveReserveOverviewResponse, http_res
871
794
  )
872
795
  if utils.match_response(http_res, "422", "application/json"):
873
- response_data = utils.unmarshal_json(
874
- http_res.text, errors.HTTPValidationErrorData
796
+ response_data = utils.unmarshal_json_response(
797
+ errors.HTTPValidationErrorData, http_res
875
798
  )
876
- raise errors.HTTPValidationError(data=response_data)
799
+ raise errors.HTTPValidationError(response_data, http_res)
877
800
  if utils.match_response(http_res, "4XX", "*"):
878
801
  http_res_text = await utils.stream_to_text_async(http_res)
879
- raise errors.APIError(
880
- "API error occurred", http_res.status_code, http_res_text, http_res
881
- )
802
+ raise errors.APIError("API error occurred", http_res, http_res_text)
882
803
  if utils.match_response(http_res, "5XX", "*"):
883
804
  http_res_text = await utils.stream_to_text_async(http_res)
884
- raise errors.APIError(
885
- "API error occurred", http_res.status_code, http_res_text, http_res
886
- )
805
+ raise errors.APIError("API error occurred", http_res, http_res_text)
887
806
 
888
- content_type = http_res.headers.get("Content-Type")
889
- http_res_text = await utils.stream_to_text_async(http_res)
890
- raise errors.APIError(
891
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
892
- http_res.status_code,
893
- http_res_text,
894
- http_res,
895
- )
807
+ raise errors.APIError("Unexpected response received", http_res)
896
808
 
897
809
  def token_price(
898
810
  self,
@@ -979,31 +891,22 @@ class AaveV3(BaseSDK):
979
891
 
980
892
  response_data: Any = None
981
893
  if utils.match_response(http_res, "200", "application/json"):
982
- return utils.unmarshal_json(http_res.text, models.AaveTokenPriceResponse)
894
+ return utils.unmarshal_json_response(
895
+ models.AaveTokenPriceResponse, http_res
896
+ )
983
897
  if utils.match_response(http_res, "422", "application/json"):
984
- response_data = utils.unmarshal_json(
985
- http_res.text, errors.HTTPValidationErrorData
898
+ response_data = utils.unmarshal_json_response(
899
+ errors.HTTPValidationErrorData, http_res
986
900
  )
987
- raise errors.HTTPValidationError(data=response_data)
901
+ raise errors.HTTPValidationError(response_data, http_res)
988
902
  if utils.match_response(http_res, "4XX", "*"):
989
903
  http_res_text = utils.stream_to_text(http_res)
990
- raise errors.APIError(
991
- "API error occurred", http_res.status_code, http_res_text, http_res
992
- )
904
+ raise errors.APIError("API error occurred", http_res, http_res_text)
993
905
  if utils.match_response(http_res, "5XX", "*"):
994
906
  http_res_text = utils.stream_to_text(http_res)
995
- raise errors.APIError(
996
- "API error occurred", http_res.status_code, http_res_text, http_res
997
- )
907
+ raise errors.APIError("API error occurred", http_res, http_res_text)
998
908
 
999
- content_type = http_res.headers.get("Content-Type")
1000
- http_res_text = utils.stream_to_text(http_res)
1001
- raise errors.APIError(
1002
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1003
- http_res.status_code,
1004
- http_res_text,
1005
- http_res,
1006
- )
909
+ raise errors.APIError("Unexpected response received", http_res)
1007
910
 
1008
911
  async def token_price_async(
1009
912
  self,
@@ -1090,31 +993,22 @@ class AaveV3(BaseSDK):
1090
993
 
1091
994
  response_data: Any = None
1092
995
  if utils.match_response(http_res, "200", "application/json"):
1093
- return utils.unmarshal_json(http_res.text, models.AaveTokenPriceResponse)
996
+ return utils.unmarshal_json_response(
997
+ models.AaveTokenPriceResponse, http_res
998
+ )
1094
999
  if utils.match_response(http_res, "422", "application/json"):
1095
- response_data = utils.unmarshal_json(
1096
- http_res.text, errors.HTTPValidationErrorData
1000
+ response_data = utils.unmarshal_json_response(
1001
+ errors.HTTPValidationErrorData, http_res
1097
1002
  )
1098
- raise errors.HTTPValidationError(data=response_data)
1003
+ raise errors.HTTPValidationError(response_data, http_res)
1099
1004
  if utils.match_response(http_res, "4XX", "*"):
1100
1005
  http_res_text = await utils.stream_to_text_async(http_res)
1101
- raise errors.APIError(
1102
- "API error occurred", http_res.status_code, http_res_text, http_res
1103
- )
1006
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1104
1007
  if utils.match_response(http_res, "5XX", "*"):
1105
1008
  http_res_text = await utils.stream_to_text_async(http_res)
1106
- raise errors.APIError(
1107
- "API error occurred", http_res.status_code, http_res_text, http_res
1108
- )
1009
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1109
1010
 
1110
- content_type = http_res.headers.get("Content-Type")
1111
- http_res_text = await utils.stream_to_text_async(http_res)
1112
- raise errors.APIError(
1113
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1114
- http_res.status_code,
1115
- http_res_text,
1116
- http_res,
1117
- )
1011
+ raise errors.APIError("Unexpected response received", http_res)
1118
1012
 
1119
1013
  def liquidity_change(
1120
1014
  self,
@@ -1207,33 +1101,22 @@ class AaveV3(BaseSDK):
1207
1101
 
1208
1102
  response_data: Any = None
1209
1103
  if utils.match_response(http_res, "200", "application/json"):
1210
- return utils.unmarshal_json(
1211
- http_res.text, models.AaveLiquidityChangeResponse
1104
+ return utils.unmarshal_json_response(
1105
+ models.AaveLiquidityChangeResponse, http_res
1212
1106
  )
1213
1107
  if utils.match_response(http_res, "422", "application/json"):
1214
- response_data = utils.unmarshal_json(
1215
- http_res.text, errors.HTTPValidationErrorData
1108
+ response_data = utils.unmarshal_json_response(
1109
+ errors.HTTPValidationErrorData, http_res
1216
1110
  )
1217
- raise errors.HTTPValidationError(data=response_data)
1111
+ raise errors.HTTPValidationError(response_data, http_res)
1218
1112
  if utils.match_response(http_res, "4XX", "*"):
1219
1113
  http_res_text = utils.stream_to_text(http_res)
1220
- raise errors.APIError(
1221
- "API error occurred", http_res.status_code, http_res_text, http_res
1222
- )
1114
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1223
1115
  if utils.match_response(http_res, "5XX", "*"):
1224
1116
  http_res_text = utils.stream_to_text(http_res)
1225
- raise errors.APIError(
1226
- "API error occurred", http_res.status_code, http_res_text, http_res
1227
- )
1117
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1228
1118
 
1229
- content_type = http_res.headers.get("Content-Type")
1230
- http_res_text = utils.stream_to_text(http_res)
1231
- raise errors.APIError(
1232
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1233
- http_res.status_code,
1234
- http_res_text,
1235
- http_res,
1236
- )
1119
+ raise errors.APIError("Unexpected response received", http_res)
1237
1120
 
1238
1121
  async def liquidity_change_async(
1239
1122
  self,
@@ -1326,33 +1209,22 @@ class AaveV3(BaseSDK):
1326
1209
 
1327
1210
  response_data: Any = None
1328
1211
  if utils.match_response(http_res, "200", "application/json"):
1329
- return utils.unmarshal_json(
1330
- http_res.text, models.AaveLiquidityChangeResponse
1212
+ return utils.unmarshal_json_response(
1213
+ models.AaveLiquidityChangeResponse, http_res
1331
1214
  )
1332
1215
  if utils.match_response(http_res, "422", "application/json"):
1333
- response_data = utils.unmarshal_json(
1334
- http_res.text, errors.HTTPValidationErrorData
1216
+ response_data = utils.unmarshal_json_response(
1217
+ errors.HTTPValidationErrorData, http_res
1335
1218
  )
1336
- raise errors.HTTPValidationError(data=response_data)
1219
+ raise errors.HTTPValidationError(response_data, http_res)
1337
1220
  if utils.match_response(http_res, "4XX", "*"):
1338
1221
  http_res_text = await utils.stream_to_text_async(http_res)
1339
- raise errors.APIError(
1340
- "API error occurred", http_res.status_code, http_res_text, http_res
1341
- )
1222
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1342
1223
  if utils.match_response(http_res, "5XX", "*"):
1343
1224
  http_res_text = await utils.stream_to_text_async(http_res)
1344
- raise errors.APIError(
1345
- "API error occurred", http_res.status_code, http_res_text, http_res
1346
- )
1225
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1347
1226
 
1348
- content_type = http_res.headers.get("Content-Type")
1349
- http_res_text = await utils.stream_to_text_async(http_res)
1350
- raise errors.APIError(
1351
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1352
- http_res.status_code,
1353
- http_res_text,
1354
- http_res,
1355
- )
1227
+ raise errors.APIError("Unexpected response received", http_res)
1356
1228
 
1357
1229
  def user_position_summary(
1358
1230
  self,
@@ -1439,33 +1311,22 @@ class AaveV3(BaseSDK):
1439
1311
 
1440
1312
  response_data: Any = None
1441
1313
  if utils.match_response(http_res, "200", "application/json"):
1442
- return utils.unmarshal_json(
1443
- http_res.text, models.AaveUserPositionSummaryResponse
1314
+ return utils.unmarshal_json_response(
1315
+ models.AaveUserPositionSummaryResponse, http_res
1444
1316
  )
1445
1317
  if utils.match_response(http_res, "422", "application/json"):
1446
- response_data = utils.unmarshal_json(
1447
- http_res.text, errors.HTTPValidationErrorData
1318
+ response_data = utils.unmarshal_json_response(
1319
+ errors.HTTPValidationErrorData, http_res
1448
1320
  )
1449
- raise errors.HTTPValidationError(data=response_data)
1321
+ raise errors.HTTPValidationError(response_data, http_res)
1450
1322
  if utils.match_response(http_res, "4XX", "*"):
1451
1323
  http_res_text = utils.stream_to_text(http_res)
1452
- raise errors.APIError(
1453
- "API error occurred", http_res.status_code, http_res_text, http_res
1454
- )
1324
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1455
1325
  if utils.match_response(http_res, "5XX", "*"):
1456
1326
  http_res_text = utils.stream_to_text(http_res)
1457
- raise errors.APIError(
1458
- "API error occurred", http_res.status_code, http_res_text, http_res
1459
- )
1327
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1460
1328
 
1461
- content_type = http_res.headers.get("Content-Type")
1462
- http_res_text = utils.stream_to_text(http_res)
1463
- raise errors.APIError(
1464
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1465
- http_res.status_code,
1466
- http_res_text,
1467
- http_res,
1468
- )
1329
+ raise errors.APIError("Unexpected response received", http_res)
1469
1330
 
1470
1331
  async def user_position_summary_async(
1471
1332
  self,
@@ -1552,33 +1413,22 @@ class AaveV3(BaseSDK):
1552
1413
 
1553
1414
  response_data: Any = None
1554
1415
  if utils.match_response(http_res, "200", "application/json"):
1555
- return utils.unmarshal_json(
1556
- http_res.text, models.AaveUserPositionSummaryResponse
1416
+ return utils.unmarshal_json_response(
1417
+ models.AaveUserPositionSummaryResponse, http_res
1557
1418
  )
1558
1419
  if utils.match_response(http_res, "422", "application/json"):
1559
- response_data = utils.unmarshal_json(
1560
- http_res.text, errors.HTTPValidationErrorData
1420
+ response_data = utils.unmarshal_json_response(
1421
+ errors.HTTPValidationErrorData, http_res
1561
1422
  )
1562
- raise errors.HTTPValidationError(data=response_data)
1423
+ raise errors.HTTPValidationError(response_data, http_res)
1563
1424
  if utils.match_response(http_res, "4XX", "*"):
1564
1425
  http_res_text = await utils.stream_to_text_async(http_res)
1565
- raise errors.APIError(
1566
- "API error occurred", http_res.status_code, http_res_text, http_res
1567
- )
1426
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1568
1427
  if utils.match_response(http_res, "5XX", "*"):
1569
1428
  http_res_text = await utils.stream_to_text_async(http_res)
1570
- raise errors.APIError(
1571
- "API error occurred", http_res.status_code, http_res_text, http_res
1572
- )
1429
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1573
1430
 
1574
- content_type = http_res.headers.get("Content-Type")
1575
- http_res_text = await utils.stream_to_text_async(http_res)
1576
- raise errors.APIError(
1577
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1578
- http_res.status_code,
1579
- http_res_text,
1580
- http_res,
1581
- )
1431
+ raise errors.APIError("Unexpected response received", http_res)
1582
1432
 
1583
1433
  def user_position_per_token(
1584
1434
  self,
@@ -1669,33 +1519,22 @@ class AaveV3(BaseSDK):
1669
1519
 
1670
1520
  response_data: Any = None
1671
1521
  if utils.match_response(http_res, "200", "application/json"):
1672
- return utils.unmarshal_json(
1673
- http_res.text, models.AaveUserPositionPerTokenResponse
1522
+ return utils.unmarshal_json_response(
1523
+ models.AaveUserPositionPerTokenResponse, http_res
1674
1524
  )
1675
1525
  if utils.match_response(http_res, "422", "application/json"):
1676
- response_data = utils.unmarshal_json(
1677
- http_res.text, errors.HTTPValidationErrorData
1526
+ response_data = utils.unmarshal_json_response(
1527
+ errors.HTTPValidationErrorData, http_res
1678
1528
  )
1679
- raise errors.HTTPValidationError(data=response_data)
1529
+ raise errors.HTTPValidationError(response_data, http_res)
1680
1530
  if utils.match_response(http_res, "4XX", "*"):
1681
1531
  http_res_text = utils.stream_to_text(http_res)
1682
- raise errors.APIError(
1683
- "API error occurred", http_res.status_code, http_res_text, http_res
1684
- )
1532
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1685
1533
  if utils.match_response(http_res, "5XX", "*"):
1686
1534
  http_res_text = utils.stream_to_text(http_res)
1687
- raise errors.APIError(
1688
- "API error occurred", http_res.status_code, http_res_text, http_res
1689
- )
1535
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1690
1536
 
1691
- content_type = http_res.headers.get("Content-Type")
1692
- http_res_text = utils.stream_to_text(http_res)
1693
- raise errors.APIError(
1694
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1695
- http_res.status_code,
1696
- http_res_text,
1697
- http_res,
1698
- )
1537
+ raise errors.APIError("Unexpected response received", http_res)
1699
1538
 
1700
1539
  async def user_position_per_token_async(
1701
1540
  self,
@@ -1786,33 +1625,22 @@ class AaveV3(BaseSDK):
1786
1625
 
1787
1626
  response_data: Any = None
1788
1627
  if utils.match_response(http_res, "200", "application/json"):
1789
- return utils.unmarshal_json(
1790
- http_res.text, models.AaveUserPositionPerTokenResponse
1628
+ return utils.unmarshal_json_response(
1629
+ models.AaveUserPositionPerTokenResponse, http_res
1791
1630
  )
1792
1631
  if utils.match_response(http_res, "422", "application/json"):
1793
- response_data = utils.unmarshal_json(
1794
- http_res.text, errors.HTTPValidationErrorData
1632
+ response_data = utils.unmarshal_json_response(
1633
+ errors.HTTPValidationErrorData, http_res
1795
1634
  )
1796
- raise errors.HTTPValidationError(data=response_data)
1635
+ raise errors.HTTPValidationError(response_data, http_res)
1797
1636
  if utils.match_response(http_res, "4XX", "*"):
1798
1637
  http_res_text = await utils.stream_to_text_async(http_res)
1799
- raise errors.APIError(
1800
- "API error occurred", http_res.status_code, http_res_text, http_res
1801
- )
1638
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1802
1639
  if utils.match_response(http_res, "5XX", "*"):
1803
1640
  http_res_text = await utils.stream_to_text_async(http_res)
1804
- raise errors.APIError(
1805
- "API error occurred", http_res.status_code, http_res_text, http_res
1806
- )
1641
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1807
1642
 
1808
- content_type = http_res.headers.get("Content-Type")
1809
- http_res_text = await utils.stream_to_text_async(http_res)
1810
- raise errors.APIError(
1811
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1812
- http_res.status_code,
1813
- http_res_text,
1814
- http_res,
1815
- )
1643
+ raise errors.APIError("Unexpected response received", http_res)
1816
1644
 
1817
1645
  def historical_transactions(
1818
1646
  self,
@@ -1900,33 +1728,22 @@ class AaveV3(BaseSDK):
1900
1728
 
1901
1729
  response_data: Any = None
1902
1730
  if utils.match_response(http_res, "200", "application/json"):
1903
- return utils.unmarshal_json(
1904
- http_res.text, models.AaveHistoricalTransactionsResponse
1731
+ return utils.unmarshal_json_response(
1732
+ models.AaveHistoricalTransactionsResponse, http_res
1905
1733
  )
1906
1734
  if utils.match_response(http_res, "422", "application/json"):
1907
- response_data = utils.unmarshal_json(
1908
- http_res.text, errors.HTTPValidationErrorData
1735
+ response_data = utils.unmarshal_json_response(
1736
+ errors.HTTPValidationErrorData, http_res
1909
1737
  )
1910
- raise errors.HTTPValidationError(data=response_data)
1738
+ raise errors.HTTPValidationError(response_data, http_res)
1911
1739
  if utils.match_response(http_res, "4XX", "*"):
1912
1740
  http_res_text = utils.stream_to_text(http_res)
1913
- raise errors.APIError(
1914
- "API error occurred", http_res.status_code, http_res_text, http_res
1915
- )
1741
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1916
1742
  if utils.match_response(http_res, "5XX", "*"):
1917
1743
  http_res_text = utils.stream_to_text(http_res)
1918
- raise errors.APIError(
1919
- "API error occurred", http_res.status_code, http_res_text, http_res
1920
- )
1744
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1921
1745
 
1922
- content_type = http_res.headers.get("Content-Type")
1923
- http_res_text = utils.stream_to_text(http_res)
1924
- raise errors.APIError(
1925
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1926
- http_res.status_code,
1927
- http_res_text,
1928
- http_res,
1929
- )
1746
+ raise errors.APIError("Unexpected response received", http_res)
1930
1747
 
1931
1748
  async def historical_transactions_async(
1932
1749
  self,
@@ -2014,33 +1831,22 @@ class AaveV3(BaseSDK):
2014
1831
 
2015
1832
  response_data: Any = None
2016
1833
  if utils.match_response(http_res, "200", "application/json"):
2017
- return utils.unmarshal_json(
2018
- http_res.text, models.AaveHistoricalTransactionsResponse
1834
+ return utils.unmarshal_json_response(
1835
+ models.AaveHistoricalTransactionsResponse, http_res
2019
1836
  )
2020
1837
  if utils.match_response(http_res, "422", "application/json"):
2021
- response_data = utils.unmarshal_json(
2022
- http_res.text, errors.HTTPValidationErrorData
1838
+ response_data = utils.unmarshal_json_response(
1839
+ errors.HTTPValidationErrorData, http_res
2023
1840
  )
2024
- raise errors.HTTPValidationError(data=response_data)
1841
+ raise errors.HTTPValidationError(response_data, http_res)
2025
1842
  if utils.match_response(http_res, "4XX", "*"):
2026
1843
  http_res_text = await utils.stream_to_text_async(http_res)
2027
- raise errors.APIError(
2028
- "API error occurred", http_res.status_code, http_res_text, http_res
2029
- )
1844
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2030
1845
  if utils.match_response(http_res, "5XX", "*"):
2031
1846
  http_res_text = await utils.stream_to_text_async(http_res)
2032
- raise errors.APIError(
2033
- "API error occurred", http_res.status_code, http_res_text, http_res
2034
- )
1847
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2035
1848
 
2036
- content_type = http_res.headers.get("Content-Type")
2037
- http_res_text = await utils.stream_to_text_async(http_res)
2038
- raise errors.APIError(
2039
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2040
- http_res.status_code,
2041
- http_res_text,
2042
- http_res,
2043
- )
1849
+ raise errors.APIError("Unexpected response received", http_res)
2044
1850
 
2045
1851
  def supply(
2046
1852
  self,
@@ -2139,31 +1945,20 @@ class AaveV3(BaseSDK):
2139
1945
 
2140
1946
  response_data: Any = None
2141
1947
  if utils.match_response(http_res, "200", "application/json"):
2142
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1948
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2143
1949
  if utils.match_response(http_res, "422", "application/json"):
2144
- response_data = utils.unmarshal_json(
2145
- http_res.text, errors.HTTPValidationErrorData
1950
+ response_data = utils.unmarshal_json_response(
1951
+ errors.HTTPValidationErrorData, http_res
2146
1952
  )
2147
- raise errors.HTTPValidationError(data=response_data)
1953
+ raise errors.HTTPValidationError(response_data, http_res)
2148
1954
  if utils.match_response(http_res, "4XX", "*"):
2149
1955
  http_res_text = utils.stream_to_text(http_res)
2150
- raise errors.APIError(
2151
- "API error occurred", http_res.status_code, http_res_text, http_res
2152
- )
1956
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2153
1957
  if utils.match_response(http_res, "5XX", "*"):
2154
1958
  http_res_text = utils.stream_to_text(http_res)
2155
- raise errors.APIError(
2156
- "API error occurred", http_res.status_code, http_res_text, http_res
2157
- )
1959
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2158
1960
 
2159
- content_type = http_res.headers.get("Content-Type")
2160
- http_res_text = utils.stream_to_text(http_res)
2161
- raise errors.APIError(
2162
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2163
- http_res.status_code,
2164
- http_res_text,
2165
- http_res,
2166
- )
1961
+ raise errors.APIError("Unexpected response received", http_res)
2167
1962
 
2168
1963
  async def supply_async(
2169
1964
  self,
@@ -2262,31 +2057,20 @@ class AaveV3(BaseSDK):
2262
2057
 
2263
2058
  response_data: Any = None
2264
2059
  if utils.match_response(http_res, "200", "application/json"):
2265
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2060
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2266
2061
  if utils.match_response(http_res, "422", "application/json"):
2267
- response_data = utils.unmarshal_json(
2268
- http_res.text, errors.HTTPValidationErrorData
2062
+ response_data = utils.unmarshal_json_response(
2063
+ errors.HTTPValidationErrorData, http_res
2269
2064
  )
2270
- raise errors.HTTPValidationError(data=response_data)
2065
+ raise errors.HTTPValidationError(response_data, http_res)
2271
2066
  if utils.match_response(http_res, "4XX", "*"):
2272
2067
  http_res_text = await utils.stream_to_text_async(http_res)
2273
- raise errors.APIError(
2274
- "API error occurred", http_res.status_code, http_res_text, http_res
2275
- )
2068
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2276
2069
  if utils.match_response(http_res, "5XX", "*"):
2277
2070
  http_res_text = await utils.stream_to_text_async(http_res)
2278
- raise errors.APIError(
2279
- "API error occurred", http_res.status_code, http_res_text, http_res
2280
- )
2071
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2281
2072
 
2282
- content_type = http_res.headers.get("Content-Type")
2283
- http_res_text = await utils.stream_to_text_async(http_res)
2284
- raise errors.APIError(
2285
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2286
- http_res.status_code,
2287
- http_res_text,
2288
- http_res,
2289
- )
2073
+ raise errors.APIError("Unexpected response received", http_res)
2290
2074
 
2291
2075
  def borrow(
2292
2076
  self,
@@ -2383,31 +2167,20 @@ class AaveV3(BaseSDK):
2383
2167
 
2384
2168
  response_data: Any = None
2385
2169
  if utils.match_response(http_res, "200", "application/json"):
2386
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2170
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2387
2171
  if utils.match_response(http_res, "422", "application/json"):
2388
- response_data = utils.unmarshal_json(
2389
- http_res.text, errors.HTTPValidationErrorData
2172
+ response_data = utils.unmarshal_json_response(
2173
+ errors.HTTPValidationErrorData, http_res
2390
2174
  )
2391
- raise errors.HTTPValidationError(data=response_data)
2175
+ raise errors.HTTPValidationError(response_data, http_res)
2392
2176
  if utils.match_response(http_res, "4XX", "*"):
2393
2177
  http_res_text = utils.stream_to_text(http_res)
2394
- raise errors.APIError(
2395
- "API error occurred", http_res.status_code, http_res_text, http_res
2396
- )
2178
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2397
2179
  if utils.match_response(http_res, "5XX", "*"):
2398
2180
  http_res_text = utils.stream_to_text(http_res)
2399
- raise errors.APIError(
2400
- "API error occurred", http_res.status_code, http_res_text, http_res
2401
- )
2181
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2402
2182
 
2403
- content_type = http_res.headers.get("Content-Type")
2404
- http_res_text = utils.stream_to_text(http_res)
2405
- raise errors.APIError(
2406
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2407
- http_res.status_code,
2408
- http_res_text,
2409
- http_res,
2410
- )
2183
+ raise errors.APIError("Unexpected response received", http_res)
2411
2184
 
2412
2185
  async def borrow_async(
2413
2186
  self,
@@ -2504,31 +2277,20 @@ class AaveV3(BaseSDK):
2504
2277
 
2505
2278
  response_data: Any = None
2506
2279
  if utils.match_response(http_res, "200", "application/json"):
2507
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2280
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2508
2281
  if utils.match_response(http_res, "422", "application/json"):
2509
- response_data = utils.unmarshal_json(
2510
- http_res.text, errors.HTTPValidationErrorData
2282
+ response_data = utils.unmarshal_json_response(
2283
+ errors.HTTPValidationErrorData, http_res
2511
2284
  )
2512
- raise errors.HTTPValidationError(data=response_data)
2285
+ raise errors.HTTPValidationError(response_data, http_res)
2513
2286
  if utils.match_response(http_res, "4XX", "*"):
2514
2287
  http_res_text = await utils.stream_to_text_async(http_res)
2515
- raise errors.APIError(
2516
- "API error occurred", http_res.status_code, http_res_text, http_res
2517
- )
2288
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2518
2289
  if utils.match_response(http_res, "5XX", "*"):
2519
2290
  http_res_text = await utils.stream_to_text_async(http_res)
2520
- raise errors.APIError(
2521
- "API error occurred", http_res.status_code, http_res_text, http_res
2522
- )
2291
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2523
2292
 
2524
- content_type = http_res.headers.get("Content-Type")
2525
- http_res_text = await utils.stream_to_text_async(http_res)
2526
- raise errors.APIError(
2527
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2528
- http_res.status_code,
2529
- http_res_text,
2530
- http_res,
2531
- )
2293
+ raise errors.APIError("Unexpected response received", http_res)
2532
2294
 
2533
2295
  def repay(
2534
2296
  self,
@@ -2629,31 +2391,20 @@ class AaveV3(BaseSDK):
2629
2391
 
2630
2392
  response_data: Any = None
2631
2393
  if utils.match_response(http_res, "200", "application/json"):
2632
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2394
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2633
2395
  if utils.match_response(http_res, "422", "application/json"):
2634
- response_data = utils.unmarshal_json(
2635
- http_res.text, errors.HTTPValidationErrorData
2396
+ response_data = utils.unmarshal_json_response(
2397
+ errors.HTTPValidationErrorData, http_res
2636
2398
  )
2637
- raise errors.HTTPValidationError(data=response_data)
2399
+ raise errors.HTTPValidationError(response_data, http_res)
2638
2400
  if utils.match_response(http_res, "4XX", "*"):
2639
2401
  http_res_text = utils.stream_to_text(http_res)
2640
- raise errors.APIError(
2641
- "API error occurred", http_res.status_code, http_res_text, http_res
2642
- )
2402
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2643
2403
  if utils.match_response(http_res, "5XX", "*"):
2644
2404
  http_res_text = utils.stream_to_text(http_res)
2645
- raise errors.APIError(
2646
- "API error occurred", http_res.status_code, http_res_text, http_res
2647
- )
2405
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2648
2406
 
2649
- content_type = http_res.headers.get("Content-Type")
2650
- http_res_text = utils.stream_to_text(http_res)
2651
- raise errors.APIError(
2652
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2653
- http_res.status_code,
2654
- http_res_text,
2655
- http_res,
2656
- )
2407
+ raise errors.APIError("Unexpected response received", http_res)
2657
2408
 
2658
2409
  async def repay_async(
2659
2410
  self,
@@ -2754,31 +2505,20 @@ class AaveV3(BaseSDK):
2754
2505
 
2755
2506
  response_data: Any = None
2756
2507
  if utils.match_response(http_res, "200", "application/json"):
2757
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2508
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2758
2509
  if utils.match_response(http_res, "422", "application/json"):
2759
- response_data = utils.unmarshal_json(
2760
- http_res.text, errors.HTTPValidationErrorData
2510
+ response_data = utils.unmarshal_json_response(
2511
+ errors.HTTPValidationErrorData, http_res
2761
2512
  )
2762
- raise errors.HTTPValidationError(data=response_data)
2513
+ raise errors.HTTPValidationError(response_data, http_res)
2763
2514
  if utils.match_response(http_res, "4XX", "*"):
2764
2515
  http_res_text = await utils.stream_to_text_async(http_res)
2765
- raise errors.APIError(
2766
- "API error occurred", http_res.status_code, http_res_text, http_res
2767
- )
2516
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2768
2517
  if utils.match_response(http_res, "5XX", "*"):
2769
2518
  http_res_text = await utils.stream_to_text_async(http_res)
2770
- raise errors.APIError(
2771
- "API error occurred", http_res.status_code, http_res_text, http_res
2772
- )
2519
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2773
2520
 
2774
- content_type = http_res.headers.get("Content-Type")
2775
- http_res_text = await utils.stream_to_text_async(http_res)
2776
- raise errors.APIError(
2777
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2778
- http_res.status_code,
2779
- http_res_text,
2780
- http_res,
2781
- )
2521
+ raise errors.APIError("Unexpected response received", http_res)
2782
2522
 
2783
2523
  def withdraw(
2784
2524
  self,
@@ -2877,31 +2617,20 @@ class AaveV3(BaseSDK):
2877
2617
 
2878
2618
  response_data: Any = None
2879
2619
  if utils.match_response(http_res, "200", "application/json"):
2880
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2620
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2881
2621
  if utils.match_response(http_res, "422", "application/json"):
2882
- response_data = utils.unmarshal_json(
2883
- http_res.text, errors.HTTPValidationErrorData
2622
+ response_data = utils.unmarshal_json_response(
2623
+ errors.HTTPValidationErrorData, http_res
2884
2624
  )
2885
- raise errors.HTTPValidationError(data=response_data)
2625
+ raise errors.HTTPValidationError(response_data, http_res)
2886
2626
  if utils.match_response(http_res, "4XX", "*"):
2887
2627
  http_res_text = utils.stream_to_text(http_res)
2888
- raise errors.APIError(
2889
- "API error occurred", http_res.status_code, http_res_text, http_res
2890
- )
2628
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2891
2629
  if utils.match_response(http_res, "5XX", "*"):
2892
2630
  http_res_text = utils.stream_to_text(http_res)
2893
- raise errors.APIError(
2894
- "API error occurred", http_res.status_code, http_res_text, http_res
2895
- )
2631
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2896
2632
 
2897
- content_type = http_res.headers.get("Content-Type")
2898
- http_res_text = utils.stream_to_text(http_res)
2899
- raise errors.APIError(
2900
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2901
- http_res.status_code,
2902
- http_res_text,
2903
- http_res,
2904
- )
2633
+ raise errors.APIError("Unexpected response received", http_res)
2905
2634
 
2906
2635
  async def withdraw_async(
2907
2636
  self,
@@ -3000,28 +2729,17 @@ class AaveV3(BaseSDK):
3000
2729
 
3001
2730
  response_data: Any = None
3002
2731
  if utils.match_response(http_res, "200", "application/json"):
3003
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2732
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
3004
2733
  if utils.match_response(http_res, "422", "application/json"):
3005
- response_data = utils.unmarshal_json(
3006
- http_res.text, errors.HTTPValidationErrorData
2734
+ response_data = utils.unmarshal_json_response(
2735
+ errors.HTTPValidationErrorData, http_res
3007
2736
  )
3008
- raise errors.HTTPValidationError(data=response_data)
2737
+ raise errors.HTTPValidationError(response_data, http_res)
3009
2738
  if utils.match_response(http_res, "4XX", "*"):
3010
2739
  http_res_text = await utils.stream_to_text_async(http_res)
3011
- raise errors.APIError(
3012
- "API error occurred", http_res.status_code, http_res_text, http_res
3013
- )
2740
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3014
2741
  if utils.match_response(http_res, "5XX", "*"):
3015
2742
  http_res_text = await utils.stream_to_text_async(http_res)
3016
- raise errors.APIError(
3017
- "API error occurred", http_res.status_code, http_res_text, http_res
3018
- )
2743
+ raise errors.APIError("API error occurred", http_res, http_res_text)
3019
2744
 
3020
- content_type = http_res.headers.get("Content-Type")
3021
- http_res_text = await utils.stream_to_text_async(http_res)
3022
- raise errors.APIError(
3023
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
3024
- http_res.status_code,
3025
- http_res_text,
3026
- http_res,
3027
- )
2745
+ raise errors.APIError("Unexpected response received", http_res)