syllable-sdk 0.35.30__py3-none-any.whl → 0.35.32__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.
Files changed (47) hide show
  1. syllable_sdk/_version.py +3 -3
  2. syllable_sdk/agents.py +210 -82
  3. syllable_sdk/basesdk.py +4 -4
  4. syllable_sdk/batches.py +328 -130
  5. syllable_sdk/campaigns.py +182 -72
  6. syllable_sdk/channels.py +72 -28
  7. syllable_sdk/conversations.py +36 -18
  8. syllable_sdk/custom_messages.py +182 -72
  9. syllable_sdk/dashboards.py +194 -66
  10. syllable_sdk/data_sources.py +182 -84
  11. syllable_sdk/events.py +36 -14
  12. syllable_sdk/folders.py +292 -120
  13. syllable_sdk/full_summary.py +36 -18
  14. syllable_sdk/incidents.py +214 -82
  15. syllable_sdk/insights_sdk.py +38 -16
  16. syllable_sdk/insights_tools.py +250 -96
  17. syllable_sdk/language_groups.py +214 -84
  18. syllable_sdk/latency.py +36 -18
  19. syllable_sdk/models/__init__.py +0 -9
  20. syllable_sdk/models/apierror.py +14 -30
  21. syllable_sdk/models/httpvalidationerror.py +6 -11
  22. syllable_sdk/numbers.py +110 -52
  23. syllable_sdk/organizations.py +138 -50
  24. syllable_sdk/permissions.py +32 -10
  25. syllable_sdk/prompts.py +248 -94
  26. syllable_sdk/roles.py +180 -74
  27. syllable_sdk/services.py +182 -72
  28. syllable_sdk/session_debug.py +108 -42
  29. syllable_sdk/session_labels.py +108 -46
  30. syllable_sdk/sessions.py +140 -58
  31. syllable_sdk/takeouts.py +98 -34
  32. syllable_sdk/targets.py +184 -74
  33. syllable_sdk/test.py +36 -14
  34. syllable_sdk/tools.py +180 -74
  35. syllable_sdk/transcript.py +38 -16
  36. syllable_sdk/twilio.py +108 -42
  37. syllable_sdk/users.py +246 -96
  38. syllable_sdk/utils/__init__.py +0 -3
  39. syllable_sdk/utils/serializers.py +4 -20
  40. syllable_sdk/v1.py +246 -96
  41. syllable_sdk/workflows.py +290 -114
  42. {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/METADATA +24 -44
  43. {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/RECORD +44 -47
  44. syllable_sdk/models/no_response_error.py +0 -13
  45. syllable_sdk/models/responsevalidationerror.py +0 -25
  46. syllable_sdk/models/syllablesdkerror.py +0 -26
  47. {syllable_sdk-0.35.30.dist-info → syllable_sdk-0.35.32.dist-info}/WHEEL +0 -0
syllable_sdk/batches.py CHANGED
@@ -107,22 +107,33 @@ class Batches(BaseSDK):
107
107
 
108
108
  response_data: Any = None
109
109
  if utils.match_response(http_res, "200", "application/json"):
110
- return utils.unmarshal_json_response(
111
- models.ListResponseCommunicationBatch, http_res
110
+ return utils.unmarshal_json(
111
+ http_res.text, models.ListResponseCommunicationBatch
112
112
  )
113
113
  if utils.match_response(http_res, "422", "application/json"):
114
- response_data = utils.unmarshal_json_response(
115
- models.HTTPValidationErrorData, http_res
114
+ response_data = utils.unmarshal_json(
115
+ http_res.text, models.HTTPValidationErrorData
116
116
  )
117
- raise models.HTTPValidationError(response_data, http_res)
117
+ raise models.HTTPValidationError(data=response_data)
118
118
  if utils.match_response(http_res, "4XX", "*"):
119
119
  http_res_text = utils.stream_to_text(http_res)
120
- raise models.APIError("API error occurred", http_res, http_res_text)
120
+ raise models.APIError(
121
+ "API error occurred", http_res.status_code, http_res_text, http_res
122
+ )
121
123
  if utils.match_response(http_res, "5XX", "*"):
122
124
  http_res_text = utils.stream_to_text(http_res)
123
- raise models.APIError("API error occurred", http_res, http_res_text)
125
+ raise models.APIError(
126
+ "API error occurred", http_res.status_code, http_res_text, http_res
127
+ )
124
128
 
125
- raise models.APIError("Unexpected response received", http_res)
129
+ content_type = http_res.headers.get("Content-Type")
130
+ http_res_text = utils.stream_to_text(http_res)
131
+ raise models.APIError(
132
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
133
+ http_res.status_code,
134
+ http_res_text,
135
+ http_res,
136
+ )
126
137
 
127
138
  async def list_async(
128
139
  self,
@@ -220,22 +231,33 @@ class Batches(BaseSDK):
220
231
 
221
232
  response_data: Any = None
222
233
  if utils.match_response(http_res, "200", "application/json"):
223
- return utils.unmarshal_json_response(
224
- models.ListResponseCommunicationBatch, http_res
234
+ return utils.unmarshal_json(
235
+ http_res.text, models.ListResponseCommunicationBatch
225
236
  )
226
237
  if utils.match_response(http_res, "422", "application/json"):
227
- response_data = utils.unmarshal_json_response(
228
- models.HTTPValidationErrorData, http_res
238
+ response_data = utils.unmarshal_json(
239
+ http_res.text, models.HTTPValidationErrorData
229
240
  )
230
- raise models.HTTPValidationError(response_data, http_res)
241
+ raise models.HTTPValidationError(data=response_data)
231
242
  if utils.match_response(http_res, "4XX", "*"):
232
243
  http_res_text = await utils.stream_to_text_async(http_res)
233
- raise models.APIError("API error occurred", http_res, http_res_text)
244
+ raise models.APIError(
245
+ "API error occurred", http_res.status_code, http_res_text, http_res
246
+ )
234
247
  if utils.match_response(http_res, "5XX", "*"):
235
248
  http_res_text = await utils.stream_to_text_async(http_res)
236
- raise models.APIError("API error occurred", http_res, http_res_text)
249
+ raise models.APIError(
250
+ "API error occurred", http_res.status_code, http_res_text, http_res
251
+ )
237
252
 
238
- raise models.APIError("Unexpected response received", http_res)
253
+ content_type = http_res.headers.get("Content-Type")
254
+ http_res_text = await utils.stream_to_text_async(http_res)
255
+ raise models.APIError(
256
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
257
+ http_res.status_code,
258
+ http_res_text,
259
+ http_res,
260
+ )
239
261
 
240
262
  def create(
241
263
  self,
@@ -314,20 +336,31 @@ class Batches(BaseSDK):
314
336
 
315
337
  response_data: Any = None
316
338
  if utils.match_response(http_res, "200", "application/json"):
317
- return utils.unmarshal_json_response(models.CommunicationBatch, http_res)
339
+ return utils.unmarshal_json(http_res.text, models.CommunicationBatch)
318
340
  if utils.match_response(http_res, "422", "application/json"):
319
- response_data = utils.unmarshal_json_response(
320
- models.HTTPValidationErrorData, http_res
341
+ response_data = utils.unmarshal_json(
342
+ http_res.text, models.HTTPValidationErrorData
321
343
  )
322
- raise models.HTTPValidationError(response_data, http_res)
344
+ raise models.HTTPValidationError(data=response_data)
323
345
  if utils.match_response(http_res, "4XX", "*"):
324
346
  http_res_text = utils.stream_to_text(http_res)
325
- raise models.APIError("API error occurred", http_res, http_res_text)
347
+ raise models.APIError(
348
+ "API error occurred", http_res.status_code, http_res_text, http_res
349
+ )
326
350
  if utils.match_response(http_res, "5XX", "*"):
327
351
  http_res_text = utils.stream_to_text(http_res)
328
- raise models.APIError("API error occurred", http_res, http_res_text)
352
+ raise models.APIError(
353
+ "API error occurred", http_res.status_code, http_res_text, http_res
354
+ )
329
355
 
330
- raise models.APIError("Unexpected response received", http_res)
356
+ content_type = http_res.headers.get("Content-Type")
357
+ http_res_text = utils.stream_to_text(http_res)
358
+ raise models.APIError(
359
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
360
+ http_res.status_code,
361
+ http_res_text,
362
+ http_res,
363
+ )
331
364
 
332
365
  async def create_async(
333
366
  self,
@@ -406,20 +439,31 @@ class Batches(BaseSDK):
406
439
 
407
440
  response_data: Any = None
408
441
  if utils.match_response(http_res, "200", "application/json"):
409
- return utils.unmarshal_json_response(models.CommunicationBatch, http_res)
442
+ return utils.unmarshal_json(http_res.text, models.CommunicationBatch)
410
443
  if utils.match_response(http_res, "422", "application/json"):
411
- response_data = utils.unmarshal_json_response(
412
- models.HTTPValidationErrorData, http_res
444
+ response_data = utils.unmarshal_json(
445
+ http_res.text, models.HTTPValidationErrorData
413
446
  )
414
- raise models.HTTPValidationError(response_data, http_res)
447
+ raise models.HTTPValidationError(data=response_data)
415
448
  if utils.match_response(http_res, "4XX", "*"):
416
449
  http_res_text = await utils.stream_to_text_async(http_res)
417
- raise models.APIError("API error occurred", http_res, http_res_text)
450
+ raise models.APIError(
451
+ "API error occurred", http_res.status_code, http_res_text, http_res
452
+ )
418
453
  if utils.match_response(http_res, "5XX", "*"):
419
454
  http_res_text = await utils.stream_to_text_async(http_res)
420
- raise models.APIError("API error occurred", http_res, http_res_text)
455
+ raise models.APIError(
456
+ "API error occurred", http_res.status_code, http_res_text, http_res
457
+ )
421
458
 
422
- raise models.APIError("Unexpected response received", http_res)
459
+ content_type = http_res.headers.get("Content-Type")
460
+ http_res_text = await utils.stream_to_text_async(http_res)
461
+ raise models.APIError(
462
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
463
+ http_res.status_code,
464
+ http_res_text,
465
+ http_res,
466
+ )
423
467
 
424
468
  def get_by_id(
425
469
  self,
@@ -493,20 +537,31 @@ class Batches(BaseSDK):
493
537
 
494
538
  response_data: Any = None
495
539
  if utils.match_response(http_res, "200", "application/json"):
496
- return utils.unmarshal_json_response(models.BatchDetails, http_res)
540
+ return utils.unmarshal_json(http_res.text, models.BatchDetails)
497
541
  if utils.match_response(http_res, "422", "application/json"):
498
- response_data = utils.unmarshal_json_response(
499
- models.HTTPValidationErrorData, http_res
542
+ response_data = utils.unmarshal_json(
543
+ http_res.text, models.HTTPValidationErrorData
500
544
  )
501
- raise models.HTTPValidationError(response_data, http_res)
545
+ raise models.HTTPValidationError(data=response_data)
502
546
  if utils.match_response(http_res, "4XX", "*"):
503
547
  http_res_text = utils.stream_to_text(http_res)
504
- raise models.APIError("API error occurred", http_res, http_res_text)
548
+ raise models.APIError(
549
+ "API error occurred", http_res.status_code, http_res_text, http_res
550
+ )
505
551
  if utils.match_response(http_res, "5XX", "*"):
506
552
  http_res_text = utils.stream_to_text(http_res)
507
- raise models.APIError("API error occurred", http_res, http_res_text)
553
+ raise models.APIError(
554
+ "API error occurred", http_res.status_code, http_res_text, http_res
555
+ )
508
556
 
509
- raise models.APIError("Unexpected response received", http_res)
557
+ content_type = http_res.headers.get("Content-Type")
558
+ http_res_text = utils.stream_to_text(http_res)
559
+ raise models.APIError(
560
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
561
+ http_res.status_code,
562
+ http_res_text,
563
+ http_res,
564
+ )
510
565
 
511
566
  async def get_by_id_async(
512
567
  self,
@@ -580,20 +635,31 @@ class Batches(BaseSDK):
580
635
 
581
636
  response_data: Any = None
582
637
  if utils.match_response(http_res, "200", "application/json"):
583
- return utils.unmarshal_json_response(models.BatchDetails, http_res)
638
+ return utils.unmarshal_json(http_res.text, models.BatchDetails)
584
639
  if utils.match_response(http_res, "422", "application/json"):
585
- response_data = utils.unmarshal_json_response(
586
- models.HTTPValidationErrorData, http_res
640
+ response_data = utils.unmarshal_json(
641
+ http_res.text, models.HTTPValidationErrorData
587
642
  )
588
- raise models.HTTPValidationError(response_data, http_res)
643
+ raise models.HTTPValidationError(data=response_data)
589
644
  if utils.match_response(http_res, "4XX", "*"):
590
645
  http_res_text = await utils.stream_to_text_async(http_res)
591
- raise models.APIError("API error occurred", http_res, http_res_text)
646
+ raise models.APIError(
647
+ "API error occurred", http_res.status_code, http_res_text, http_res
648
+ )
592
649
  if utils.match_response(http_res, "5XX", "*"):
593
650
  http_res_text = await utils.stream_to_text_async(http_res)
594
- raise models.APIError("API error occurred", http_res, http_res_text)
651
+ raise models.APIError(
652
+ "API error occurred", http_res.status_code, http_res_text, http_res
653
+ )
595
654
 
596
- raise models.APIError("Unexpected response received", http_res)
655
+ content_type = http_res.headers.get("Content-Type")
656
+ http_res_text = await utils.stream_to_text_async(http_res)
657
+ raise models.APIError(
658
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
659
+ http_res.status_code,
660
+ http_res_text,
661
+ http_res,
662
+ )
597
663
 
598
664
  def update(
599
665
  self,
@@ -681,20 +747,31 @@ class Batches(BaseSDK):
681
747
 
682
748
  response_data: Any = None
683
749
  if utils.match_response(http_res, "200", "application/json"):
684
- return utils.unmarshal_json_response(models.CommunicationBatch, http_res)
750
+ return utils.unmarshal_json(http_res.text, models.CommunicationBatch)
685
751
  if utils.match_response(http_res, "422", "application/json"):
686
- response_data = utils.unmarshal_json_response(
687
- models.HTTPValidationErrorData, http_res
752
+ response_data = utils.unmarshal_json(
753
+ http_res.text, models.HTTPValidationErrorData
688
754
  )
689
- raise models.HTTPValidationError(response_data, http_res)
755
+ raise models.HTTPValidationError(data=response_data)
690
756
  if utils.match_response(http_res, "4XX", "*"):
691
757
  http_res_text = utils.stream_to_text(http_res)
692
- raise models.APIError("API error occurred", http_res, http_res_text)
758
+ raise models.APIError(
759
+ "API error occurred", http_res.status_code, http_res_text, http_res
760
+ )
693
761
  if utils.match_response(http_res, "5XX", "*"):
694
762
  http_res_text = utils.stream_to_text(http_res)
695
- raise models.APIError("API error occurred", http_res, http_res_text)
763
+ raise models.APIError(
764
+ "API error occurred", http_res.status_code, http_res_text, http_res
765
+ )
696
766
 
697
- raise models.APIError("Unexpected response received", http_res)
767
+ content_type = http_res.headers.get("Content-Type")
768
+ http_res_text = utils.stream_to_text(http_res)
769
+ raise models.APIError(
770
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
771
+ http_res.status_code,
772
+ http_res_text,
773
+ http_res,
774
+ )
698
775
 
699
776
  async def update_async(
700
777
  self,
@@ -782,20 +859,31 @@ class Batches(BaseSDK):
782
859
 
783
860
  response_data: Any = None
784
861
  if utils.match_response(http_res, "200", "application/json"):
785
- return utils.unmarshal_json_response(models.CommunicationBatch, http_res)
862
+ return utils.unmarshal_json(http_res.text, models.CommunicationBatch)
786
863
  if utils.match_response(http_res, "422", "application/json"):
787
- response_data = utils.unmarshal_json_response(
788
- models.HTTPValidationErrorData, http_res
864
+ response_data = utils.unmarshal_json(
865
+ http_res.text, models.HTTPValidationErrorData
789
866
  )
790
- raise models.HTTPValidationError(response_data, http_res)
867
+ raise models.HTTPValidationError(data=response_data)
791
868
  if utils.match_response(http_res, "4XX", "*"):
792
869
  http_res_text = await utils.stream_to_text_async(http_res)
793
- raise models.APIError("API error occurred", http_res, http_res_text)
870
+ raise models.APIError(
871
+ "API error occurred", http_res.status_code, http_res_text, http_res
872
+ )
794
873
  if utils.match_response(http_res, "5XX", "*"):
795
874
  http_res_text = await utils.stream_to_text_async(http_res)
796
- raise models.APIError("API error occurred", http_res, http_res_text)
875
+ raise models.APIError(
876
+ "API error occurred", http_res.status_code, http_res_text, http_res
877
+ )
797
878
 
798
- raise models.APIError("Unexpected response received", http_res)
879
+ content_type = http_res.headers.get("Content-Type")
880
+ http_res_text = await utils.stream_to_text_async(http_res)
881
+ raise models.APIError(
882
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
883
+ http_res.status_code,
884
+ http_res_text,
885
+ http_res,
886
+ )
799
887
 
800
888
  def delete(
801
889
  self,
@@ -883,20 +971,31 @@ class Batches(BaseSDK):
883
971
 
884
972
  response_data: Any = None
885
973
  if utils.match_response(http_res, "200", "application/json"):
886
- return utils.unmarshal_json_response(Any, http_res)
974
+ return utils.unmarshal_json(http_res.text, Any)
887
975
  if utils.match_response(http_res, "422", "application/json"):
888
- response_data = utils.unmarshal_json_response(
889
- models.HTTPValidationErrorData, http_res
976
+ response_data = utils.unmarshal_json(
977
+ http_res.text, models.HTTPValidationErrorData
890
978
  )
891
- raise models.HTTPValidationError(response_data, http_res)
979
+ raise models.HTTPValidationError(data=response_data)
892
980
  if utils.match_response(http_res, "4XX", "*"):
893
981
  http_res_text = utils.stream_to_text(http_res)
894
- raise models.APIError("API error occurred", http_res, http_res_text)
982
+ raise models.APIError(
983
+ "API error occurred", http_res.status_code, http_res_text, http_res
984
+ )
895
985
  if utils.match_response(http_res, "5XX", "*"):
896
986
  http_res_text = utils.stream_to_text(http_res)
897
- raise models.APIError("API error occurred", http_res, http_res_text)
987
+ raise models.APIError(
988
+ "API error occurred", http_res.status_code, http_res_text, http_res
989
+ )
898
990
 
899
- raise models.APIError("Unexpected response received", http_res)
991
+ content_type = http_res.headers.get("Content-Type")
992
+ http_res_text = utils.stream_to_text(http_res)
993
+ raise models.APIError(
994
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
995
+ http_res.status_code,
996
+ http_res_text,
997
+ http_res,
998
+ )
900
999
 
901
1000
  async def delete_async(
902
1001
  self,
@@ -984,20 +1083,31 @@ class Batches(BaseSDK):
984
1083
 
985
1084
  response_data: Any = None
986
1085
  if utils.match_response(http_res, "200", "application/json"):
987
- return utils.unmarshal_json_response(Any, http_res)
1086
+ return utils.unmarshal_json(http_res.text, Any)
988
1087
  if utils.match_response(http_res, "422", "application/json"):
989
- response_data = utils.unmarshal_json_response(
990
- models.HTTPValidationErrorData, http_res
1088
+ response_data = utils.unmarshal_json(
1089
+ http_res.text, models.HTTPValidationErrorData
991
1090
  )
992
- raise models.HTTPValidationError(response_data, http_res)
1091
+ raise models.HTTPValidationError(data=response_data)
993
1092
  if utils.match_response(http_res, "4XX", "*"):
994
1093
  http_res_text = await utils.stream_to_text_async(http_res)
995
- raise models.APIError("API error occurred", http_res, http_res_text)
1094
+ raise models.APIError(
1095
+ "API error occurred", http_res.status_code, http_res_text, http_res
1096
+ )
996
1097
  if utils.match_response(http_res, "5XX", "*"):
997
1098
  http_res_text = await utils.stream_to_text_async(http_res)
998
- raise models.APIError("API error occurred", http_res, http_res_text)
1099
+ raise models.APIError(
1100
+ "API error occurred", http_res.status_code, http_res_text, http_res
1101
+ )
999
1102
 
1000
- raise models.APIError("Unexpected response received", http_res)
1103
+ content_type = http_res.headers.get("Content-Type")
1104
+ http_res_text = await utils.stream_to_text_async(http_res)
1105
+ raise models.APIError(
1106
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1107
+ http_res.status_code,
1108
+ http_res_text,
1109
+ http_res,
1110
+ )
1001
1111
 
1002
1112
  def upload(
1003
1113
  self,
@@ -1087,20 +1197,31 @@ class Batches(BaseSDK):
1087
1197
 
1088
1198
  response_data: Any = None
1089
1199
  if utils.match_response(http_res, "200", "application/json"):
1090
- return utils.unmarshal_json_response(Any, http_res)
1200
+ return utils.unmarshal_json(http_res.text, Any)
1091
1201
  if utils.match_response(http_res, "422", "application/json"):
1092
- response_data = utils.unmarshal_json_response(
1093
- models.HTTPValidationErrorData, http_res
1202
+ response_data = utils.unmarshal_json(
1203
+ http_res.text, models.HTTPValidationErrorData
1094
1204
  )
1095
- raise models.HTTPValidationError(response_data, http_res)
1205
+ raise models.HTTPValidationError(data=response_data)
1096
1206
  if utils.match_response(http_res, "4XX", "*"):
1097
1207
  http_res_text = utils.stream_to_text(http_res)
1098
- raise models.APIError("API error occurred", http_res, http_res_text)
1208
+ raise models.APIError(
1209
+ "API error occurred", http_res.status_code, http_res_text, http_res
1210
+ )
1099
1211
  if utils.match_response(http_res, "5XX", "*"):
1100
1212
  http_res_text = utils.stream_to_text(http_res)
1101
- raise models.APIError("API error occurred", http_res, http_res_text)
1213
+ raise models.APIError(
1214
+ "API error occurred", http_res.status_code, http_res_text, http_res
1215
+ )
1102
1216
 
1103
- raise models.APIError("Unexpected response received", http_res)
1217
+ content_type = http_res.headers.get("Content-Type")
1218
+ http_res_text = utils.stream_to_text(http_res)
1219
+ raise models.APIError(
1220
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1221
+ http_res.status_code,
1222
+ http_res_text,
1223
+ http_res,
1224
+ )
1104
1225
 
1105
1226
  async def upload_async(
1106
1227
  self,
@@ -1190,20 +1311,31 @@ class Batches(BaseSDK):
1190
1311
 
1191
1312
  response_data: Any = None
1192
1313
  if utils.match_response(http_res, "200", "application/json"):
1193
- return utils.unmarshal_json_response(Any, http_res)
1314
+ return utils.unmarshal_json(http_res.text, Any)
1194
1315
  if utils.match_response(http_res, "422", "application/json"):
1195
- response_data = utils.unmarshal_json_response(
1196
- models.HTTPValidationErrorData, http_res
1316
+ response_data = utils.unmarshal_json(
1317
+ http_res.text, models.HTTPValidationErrorData
1197
1318
  )
1198
- raise models.HTTPValidationError(response_data, http_res)
1319
+ raise models.HTTPValidationError(data=response_data)
1199
1320
  if utils.match_response(http_res, "4XX", "*"):
1200
1321
  http_res_text = await utils.stream_to_text_async(http_res)
1201
- raise models.APIError("API error occurred", http_res, http_res_text)
1322
+ raise models.APIError(
1323
+ "API error occurred", http_res.status_code, http_res_text, http_res
1324
+ )
1202
1325
  if utils.match_response(http_res, "5XX", "*"):
1203
1326
  http_res_text = await utils.stream_to_text_async(http_res)
1204
- raise models.APIError("API error occurred", http_res, http_res_text)
1327
+ raise models.APIError(
1328
+ "API error occurred", http_res.status_code, http_res_text, http_res
1329
+ )
1205
1330
 
1206
- raise models.APIError("Unexpected response received", http_res)
1331
+ content_type = http_res.headers.get("Content-Type")
1332
+ http_res_text = await utils.stream_to_text_async(http_res)
1333
+ raise models.APIError(
1334
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1335
+ http_res.status_code,
1336
+ http_res_text,
1337
+ http_res,
1338
+ )
1207
1339
 
1208
1340
  def results(
1209
1341
  self,
@@ -1286,22 +1418,33 @@ class Batches(BaseSDK):
1286
1418
 
1287
1419
  response_data: Any = None
1288
1420
  if utils.match_response(http_res, "200", "application/json"):
1289
- return utils.unmarshal_json_response(
1290
- List[models.CommunicationRequestResult], http_res
1421
+ return utils.unmarshal_json(
1422
+ http_res.text, List[models.CommunicationRequestResult]
1291
1423
  )
1292
1424
  if utils.match_response(http_res, "422", "application/json"):
1293
- response_data = utils.unmarshal_json_response(
1294
- models.HTTPValidationErrorData, http_res
1425
+ response_data = utils.unmarshal_json(
1426
+ http_res.text, models.HTTPValidationErrorData
1295
1427
  )
1296
- raise models.HTTPValidationError(response_data, http_res)
1428
+ raise models.HTTPValidationError(data=response_data)
1297
1429
  if utils.match_response(http_res, "4XX", "*"):
1298
1430
  http_res_text = utils.stream_to_text(http_res)
1299
- raise models.APIError("API error occurred", http_res, http_res_text)
1431
+ raise models.APIError(
1432
+ "API error occurred", http_res.status_code, http_res_text, http_res
1433
+ )
1300
1434
  if utils.match_response(http_res, "5XX", "*"):
1301
1435
  http_res_text = utils.stream_to_text(http_res)
1302
- raise models.APIError("API error occurred", http_res, http_res_text)
1436
+ raise models.APIError(
1437
+ "API error occurred", http_res.status_code, http_res_text, http_res
1438
+ )
1303
1439
 
1304
- raise models.APIError("Unexpected response received", http_res)
1440
+ content_type = http_res.headers.get("Content-Type")
1441
+ http_res_text = utils.stream_to_text(http_res)
1442
+ raise models.APIError(
1443
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1444
+ http_res.status_code,
1445
+ http_res_text,
1446
+ http_res,
1447
+ )
1305
1448
 
1306
1449
  async def results_async(
1307
1450
  self,
@@ -1384,22 +1527,33 @@ class Batches(BaseSDK):
1384
1527
 
1385
1528
  response_data: Any = None
1386
1529
  if utils.match_response(http_res, "200", "application/json"):
1387
- return utils.unmarshal_json_response(
1388
- List[models.CommunicationRequestResult], http_res
1530
+ return utils.unmarshal_json(
1531
+ http_res.text, List[models.CommunicationRequestResult]
1389
1532
  )
1390
1533
  if utils.match_response(http_res, "422", "application/json"):
1391
- response_data = utils.unmarshal_json_response(
1392
- models.HTTPValidationErrorData, http_res
1534
+ response_data = utils.unmarshal_json(
1535
+ http_res.text, models.HTTPValidationErrorData
1393
1536
  )
1394
- raise models.HTTPValidationError(response_data, http_res)
1537
+ raise models.HTTPValidationError(data=response_data)
1395
1538
  if utils.match_response(http_res, "4XX", "*"):
1396
1539
  http_res_text = await utils.stream_to_text_async(http_res)
1397
- raise models.APIError("API error occurred", http_res, http_res_text)
1540
+ raise models.APIError(
1541
+ "API error occurred", http_res.status_code, http_res_text, http_res
1542
+ )
1398
1543
  if utils.match_response(http_res, "5XX", "*"):
1399
1544
  http_res_text = await utils.stream_to_text_async(http_res)
1400
- raise models.APIError("API error occurred", http_res, http_res_text)
1545
+ raise models.APIError(
1546
+ "API error occurred", http_res.status_code, http_res_text, http_res
1547
+ )
1401
1548
 
1402
- raise models.APIError("Unexpected response received", http_res)
1549
+ content_type = http_res.headers.get("Content-Type")
1550
+ http_res_text = await utils.stream_to_text_async(http_res)
1551
+ raise models.APIError(
1552
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1553
+ http_res.status_code,
1554
+ http_res_text,
1555
+ http_res,
1556
+ )
1403
1557
 
1404
1558
  def add(
1405
1559
  self,
@@ -1487,20 +1641,31 @@ class Batches(BaseSDK):
1487
1641
 
1488
1642
  response_data: Any = None
1489
1643
  if utils.match_response(http_res, "200", "application/json"):
1490
- return utils.unmarshal_json_response(Any, http_res)
1644
+ return utils.unmarshal_json(http_res.text, Any)
1491
1645
  if utils.match_response(http_res, "422", "application/json"):
1492
- response_data = utils.unmarshal_json_response(
1493
- models.HTTPValidationErrorData, http_res
1646
+ response_data = utils.unmarshal_json(
1647
+ http_res.text, models.HTTPValidationErrorData
1494
1648
  )
1495
- raise models.HTTPValidationError(response_data, http_res)
1649
+ raise models.HTTPValidationError(data=response_data)
1496
1650
  if utils.match_response(http_res, "4XX", "*"):
1497
1651
  http_res_text = utils.stream_to_text(http_res)
1498
- raise models.APIError("API error occurred", http_res, http_res_text)
1652
+ raise models.APIError(
1653
+ "API error occurred", http_res.status_code, http_res_text, http_res
1654
+ )
1499
1655
  if utils.match_response(http_res, "5XX", "*"):
1500
1656
  http_res_text = utils.stream_to_text(http_res)
1501
- raise models.APIError("API error occurred", http_res, http_res_text)
1657
+ raise models.APIError(
1658
+ "API error occurred", http_res.status_code, http_res_text, http_res
1659
+ )
1502
1660
 
1503
- raise models.APIError("Unexpected response received", http_res)
1661
+ content_type = http_res.headers.get("Content-Type")
1662
+ http_res_text = utils.stream_to_text(http_res)
1663
+ raise models.APIError(
1664
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1665
+ http_res.status_code,
1666
+ http_res_text,
1667
+ http_res,
1668
+ )
1504
1669
 
1505
1670
  async def add_async(
1506
1671
  self,
@@ -1588,20 +1753,31 @@ class Batches(BaseSDK):
1588
1753
 
1589
1754
  response_data: Any = None
1590
1755
  if utils.match_response(http_res, "200", "application/json"):
1591
- return utils.unmarshal_json_response(Any, http_res)
1756
+ return utils.unmarshal_json(http_res.text, Any)
1592
1757
  if utils.match_response(http_res, "422", "application/json"):
1593
- response_data = utils.unmarshal_json_response(
1594
- models.HTTPValidationErrorData, http_res
1758
+ response_data = utils.unmarshal_json(
1759
+ http_res.text, models.HTTPValidationErrorData
1595
1760
  )
1596
- raise models.HTTPValidationError(response_data, http_res)
1761
+ raise models.HTTPValidationError(data=response_data)
1597
1762
  if utils.match_response(http_res, "4XX", "*"):
1598
1763
  http_res_text = await utils.stream_to_text_async(http_res)
1599
- raise models.APIError("API error occurred", http_res, http_res_text)
1764
+ raise models.APIError(
1765
+ "API error occurred", http_res.status_code, http_res_text, http_res
1766
+ )
1600
1767
  if utils.match_response(http_res, "5XX", "*"):
1601
1768
  http_res_text = await utils.stream_to_text_async(http_res)
1602
- raise models.APIError("API error occurred", http_res, http_res_text)
1769
+ raise models.APIError(
1770
+ "API error occurred", http_res.status_code, http_res_text, http_res
1771
+ )
1603
1772
 
1604
- raise models.APIError("Unexpected response received", http_res)
1773
+ content_type = http_res.headers.get("Content-Type")
1774
+ http_res_text = await utils.stream_to_text_async(http_res)
1775
+ raise models.APIError(
1776
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1777
+ http_res.status_code,
1778
+ http_res_text,
1779
+ http_res,
1780
+ )
1605
1781
 
1606
1782
  def remove(
1607
1783
  self,
@@ -1681,20 +1857,31 @@ class Batches(BaseSDK):
1681
1857
 
1682
1858
  response_data: Any = None
1683
1859
  if utils.match_response(http_res, "200", "application/json"):
1684
- return utils.unmarshal_json_response(Any, http_res)
1860
+ return utils.unmarshal_json(http_res.text, Any)
1685
1861
  if utils.match_response(http_res, "422", "application/json"):
1686
- response_data = utils.unmarshal_json_response(
1687
- models.HTTPValidationErrorData, http_res
1862
+ response_data = utils.unmarshal_json(
1863
+ http_res.text, models.HTTPValidationErrorData
1688
1864
  )
1689
- raise models.HTTPValidationError(response_data, http_res)
1865
+ raise models.HTTPValidationError(data=response_data)
1690
1866
  if utils.match_response(http_res, "4XX", "*"):
1691
1867
  http_res_text = utils.stream_to_text(http_res)
1692
- raise models.APIError("API error occurred", http_res, http_res_text)
1868
+ raise models.APIError(
1869
+ "API error occurred", http_res.status_code, http_res_text, http_res
1870
+ )
1693
1871
  if utils.match_response(http_res, "5XX", "*"):
1694
1872
  http_res_text = utils.stream_to_text(http_res)
1695
- raise models.APIError("API error occurred", http_res, http_res_text)
1873
+ raise models.APIError(
1874
+ "API error occurred", http_res.status_code, http_res_text, http_res
1875
+ )
1696
1876
 
1697
- raise models.APIError("Unexpected response received", http_res)
1877
+ content_type = http_res.headers.get("Content-Type")
1878
+ http_res_text = utils.stream_to_text(http_res)
1879
+ raise models.APIError(
1880
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1881
+ http_res.status_code,
1882
+ http_res_text,
1883
+ http_res,
1884
+ )
1698
1885
 
1699
1886
  async def remove_async(
1700
1887
  self,
@@ -1774,17 +1961,28 @@ class Batches(BaseSDK):
1774
1961
 
1775
1962
  response_data: Any = None
1776
1963
  if utils.match_response(http_res, "200", "application/json"):
1777
- return utils.unmarshal_json_response(Any, http_res)
1964
+ return utils.unmarshal_json(http_res.text, Any)
1778
1965
  if utils.match_response(http_res, "422", "application/json"):
1779
- response_data = utils.unmarshal_json_response(
1780
- models.HTTPValidationErrorData, http_res
1966
+ response_data = utils.unmarshal_json(
1967
+ http_res.text, models.HTTPValidationErrorData
1781
1968
  )
1782
- raise models.HTTPValidationError(response_data, http_res)
1969
+ raise models.HTTPValidationError(data=response_data)
1783
1970
  if utils.match_response(http_res, "4XX", "*"):
1784
1971
  http_res_text = await utils.stream_to_text_async(http_res)
1785
- raise models.APIError("API error occurred", http_res, http_res_text)
1972
+ raise models.APIError(
1973
+ "API error occurred", http_res.status_code, http_res_text, http_res
1974
+ )
1786
1975
  if utils.match_response(http_res, "5XX", "*"):
1787
1976
  http_res_text = await utils.stream_to_text_async(http_res)
1788
- raise models.APIError("API error occurred", http_res, http_res_text)
1977
+ raise models.APIError(
1978
+ "API error occurred", http_res.status_code, http_res_text, http_res
1979
+ )
1789
1980
 
1790
- raise models.APIError("Unexpected response received", http_res)
1981
+ content_type = http_res.headers.get("Content-Type")
1982
+ http_res_text = await utils.stream_to_text_async(http_res)
1983
+ raise models.APIError(
1984
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1985
+ http_res.status_code,
1986
+ http_res_text,
1987
+ http_res,
1988
+ )