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/services.py CHANGED
@@ -109,22 +109,33 @@ class Services(BaseSDK):
109
109
 
110
110
  response_data: Any = None
111
111
  if utils.match_response(http_res, "200", "application/json"):
112
- return utils.unmarshal_json_response(
113
- models.ListResponseServiceResponse, http_res
112
+ return utils.unmarshal_json(
113
+ http_res.text, models.ListResponseServiceResponse
114
114
  )
115
115
  if utils.match_response(http_res, "422", "application/json"):
116
- response_data = utils.unmarshal_json_response(
117
- models.HTTPValidationErrorData, http_res
116
+ response_data = utils.unmarshal_json(
117
+ http_res.text, models.HTTPValidationErrorData
118
118
  )
119
- raise models.HTTPValidationError(response_data, http_res)
119
+ raise models.HTTPValidationError(data=response_data)
120
120
  if utils.match_response(http_res, "4XX", "*"):
121
121
  http_res_text = utils.stream_to_text(http_res)
122
- raise models.APIError("API error occurred", http_res, http_res_text)
122
+ raise models.APIError(
123
+ "API error occurred", http_res.status_code, http_res_text, http_res
124
+ )
123
125
  if utils.match_response(http_res, "5XX", "*"):
124
126
  http_res_text = utils.stream_to_text(http_res)
125
- raise models.APIError("API error occurred", http_res, http_res_text)
127
+ raise models.APIError(
128
+ "API error occurred", http_res.status_code, http_res_text, http_res
129
+ )
126
130
 
127
- raise models.APIError("Unexpected response received", http_res)
131
+ content_type = http_res.headers.get("Content-Type")
132
+ http_res_text = utils.stream_to_text(http_res)
133
+ raise models.APIError(
134
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
135
+ http_res.status_code,
136
+ http_res_text,
137
+ http_res,
138
+ )
128
139
 
129
140
  async def list_async(
130
141
  self,
@@ -224,22 +235,33 @@ class Services(BaseSDK):
224
235
 
225
236
  response_data: Any = None
226
237
  if utils.match_response(http_res, "200", "application/json"):
227
- return utils.unmarshal_json_response(
228
- models.ListResponseServiceResponse, http_res
238
+ return utils.unmarshal_json(
239
+ http_res.text, models.ListResponseServiceResponse
229
240
  )
230
241
  if utils.match_response(http_res, "422", "application/json"):
231
- response_data = utils.unmarshal_json_response(
232
- models.HTTPValidationErrorData, http_res
242
+ response_data = utils.unmarshal_json(
243
+ http_res.text, models.HTTPValidationErrorData
233
244
  )
234
- raise models.HTTPValidationError(response_data, http_res)
245
+ raise models.HTTPValidationError(data=response_data)
235
246
  if utils.match_response(http_res, "4XX", "*"):
236
247
  http_res_text = await utils.stream_to_text_async(http_res)
237
- raise models.APIError("API error occurred", http_res, http_res_text)
248
+ raise models.APIError(
249
+ "API error occurred", http_res.status_code, http_res_text, http_res
250
+ )
238
251
  if utils.match_response(http_res, "5XX", "*"):
239
252
  http_res_text = await utils.stream_to_text_async(http_res)
240
- raise models.APIError("API error occurred", http_res, http_res_text)
253
+ raise models.APIError(
254
+ "API error occurred", http_res.status_code, http_res_text, http_res
255
+ )
241
256
 
242
- raise models.APIError("Unexpected response received", http_res)
257
+ content_type = http_res.headers.get("Content-Type")
258
+ http_res_text = await utils.stream_to_text_async(http_res)
259
+ raise models.APIError(
260
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
261
+ http_res.status_code,
262
+ http_res_text,
263
+ http_res,
264
+ )
243
265
 
244
266
  def create(
245
267
  self,
@@ -320,20 +342,31 @@ class Services(BaseSDK):
320
342
 
321
343
  response_data: Any = None
322
344
  if utils.match_response(http_res, "200", "application/json"):
323
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
345
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
324
346
  if utils.match_response(http_res, "422", "application/json"):
325
- response_data = utils.unmarshal_json_response(
326
- models.HTTPValidationErrorData, http_res
347
+ response_data = utils.unmarshal_json(
348
+ http_res.text, models.HTTPValidationErrorData
327
349
  )
328
- raise models.HTTPValidationError(response_data, http_res)
350
+ raise models.HTTPValidationError(data=response_data)
329
351
  if utils.match_response(http_res, "4XX", "*"):
330
352
  http_res_text = utils.stream_to_text(http_res)
331
- raise models.APIError("API error occurred", http_res, http_res_text)
353
+ raise models.APIError(
354
+ "API error occurred", http_res.status_code, http_res_text, http_res
355
+ )
332
356
  if utils.match_response(http_res, "5XX", "*"):
333
357
  http_res_text = utils.stream_to_text(http_res)
334
- raise models.APIError("API error occurred", http_res, http_res_text)
358
+ raise models.APIError(
359
+ "API error occurred", http_res.status_code, http_res_text, http_res
360
+ )
335
361
 
336
- raise models.APIError("Unexpected response received", http_res)
362
+ content_type = http_res.headers.get("Content-Type")
363
+ http_res_text = utils.stream_to_text(http_res)
364
+ raise models.APIError(
365
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
366
+ http_res.status_code,
367
+ http_res_text,
368
+ http_res,
369
+ )
337
370
 
338
371
  async def create_async(
339
372
  self,
@@ -414,20 +447,31 @@ class Services(BaseSDK):
414
447
 
415
448
  response_data: Any = None
416
449
  if utils.match_response(http_res, "200", "application/json"):
417
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
450
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
418
451
  if utils.match_response(http_res, "422", "application/json"):
419
- response_data = utils.unmarshal_json_response(
420
- models.HTTPValidationErrorData, http_res
452
+ response_data = utils.unmarshal_json(
453
+ http_res.text, models.HTTPValidationErrorData
421
454
  )
422
- raise models.HTTPValidationError(response_data, http_res)
455
+ raise models.HTTPValidationError(data=response_data)
423
456
  if utils.match_response(http_res, "4XX", "*"):
424
457
  http_res_text = await utils.stream_to_text_async(http_res)
425
- raise models.APIError("API error occurred", http_res, http_res_text)
458
+ raise models.APIError(
459
+ "API error occurred", http_res.status_code, http_res_text, http_res
460
+ )
426
461
  if utils.match_response(http_res, "5XX", "*"):
427
462
  http_res_text = await utils.stream_to_text_async(http_res)
428
- raise models.APIError("API error occurred", http_res, http_res_text)
463
+ raise models.APIError(
464
+ "API error occurred", http_res.status_code, http_res_text, http_res
465
+ )
429
466
 
430
- raise models.APIError("Unexpected response received", http_res)
467
+ content_type = http_res.headers.get("Content-Type")
468
+ http_res_text = await utils.stream_to_text_async(http_res)
469
+ raise models.APIError(
470
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
471
+ http_res.status_code,
472
+ http_res_text,
473
+ http_res,
474
+ )
431
475
 
432
476
  def update(
433
477
  self,
@@ -508,20 +552,31 @@ class Services(BaseSDK):
508
552
 
509
553
  response_data: Any = None
510
554
  if utils.match_response(http_res, "200", "application/json"):
511
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
555
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
512
556
  if utils.match_response(http_res, "422", "application/json"):
513
- response_data = utils.unmarshal_json_response(
514
- models.HTTPValidationErrorData, http_res
557
+ response_data = utils.unmarshal_json(
558
+ http_res.text, models.HTTPValidationErrorData
515
559
  )
516
- raise models.HTTPValidationError(response_data, http_res)
560
+ raise models.HTTPValidationError(data=response_data)
517
561
  if utils.match_response(http_res, "4XX", "*"):
518
562
  http_res_text = utils.stream_to_text(http_res)
519
- raise models.APIError("API error occurred", http_res, http_res_text)
563
+ raise models.APIError(
564
+ "API error occurred", http_res.status_code, http_res_text, http_res
565
+ )
520
566
  if utils.match_response(http_res, "5XX", "*"):
521
567
  http_res_text = utils.stream_to_text(http_res)
522
- raise models.APIError("API error occurred", http_res, http_res_text)
568
+ raise models.APIError(
569
+ "API error occurred", http_res.status_code, http_res_text, http_res
570
+ )
523
571
 
524
- raise models.APIError("Unexpected response received", http_res)
572
+ content_type = http_res.headers.get("Content-Type")
573
+ http_res_text = utils.stream_to_text(http_res)
574
+ raise models.APIError(
575
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
576
+ http_res.status_code,
577
+ http_res_text,
578
+ http_res,
579
+ )
525
580
 
526
581
  async def update_async(
527
582
  self,
@@ -602,20 +657,31 @@ class Services(BaseSDK):
602
657
 
603
658
  response_data: Any = None
604
659
  if utils.match_response(http_res, "200", "application/json"):
605
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
660
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
606
661
  if utils.match_response(http_res, "422", "application/json"):
607
- response_data = utils.unmarshal_json_response(
608
- models.HTTPValidationErrorData, http_res
662
+ response_data = utils.unmarshal_json(
663
+ http_res.text, models.HTTPValidationErrorData
609
664
  )
610
- raise models.HTTPValidationError(response_data, http_res)
665
+ raise models.HTTPValidationError(data=response_data)
611
666
  if utils.match_response(http_res, "4XX", "*"):
612
667
  http_res_text = await utils.stream_to_text_async(http_res)
613
- raise models.APIError("API error occurred", http_res, http_res_text)
668
+ raise models.APIError(
669
+ "API error occurred", http_res.status_code, http_res_text, http_res
670
+ )
614
671
  if utils.match_response(http_res, "5XX", "*"):
615
672
  http_res_text = await utils.stream_to_text_async(http_res)
616
- raise models.APIError("API error occurred", http_res, http_res_text)
673
+ raise models.APIError(
674
+ "API error occurred", http_res.status_code, http_res_text, http_res
675
+ )
617
676
 
618
- raise models.APIError("Unexpected response received", http_res)
677
+ content_type = http_res.headers.get("Content-Type")
678
+ http_res_text = await utils.stream_to_text_async(http_res)
679
+ raise models.APIError(
680
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
681
+ http_res.status_code,
682
+ http_res_text,
683
+ http_res,
684
+ )
619
685
 
620
686
  def get_by_id(
621
687
  self,
@@ -691,20 +757,31 @@ class Services(BaseSDK):
691
757
 
692
758
  response_data: Any = None
693
759
  if utils.match_response(http_res, "200", "application/json"):
694
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
760
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
695
761
  if utils.match_response(http_res, "422", "application/json"):
696
- response_data = utils.unmarshal_json_response(
697
- models.HTTPValidationErrorData, http_res
762
+ response_data = utils.unmarshal_json(
763
+ http_res.text, models.HTTPValidationErrorData
698
764
  )
699
- raise models.HTTPValidationError(response_data, http_res)
765
+ raise models.HTTPValidationError(data=response_data)
700
766
  if utils.match_response(http_res, "4XX", "*"):
701
767
  http_res_text = utils.stream_to_text(http_res)
702
- raise models.APIError("API error occurred", http_res, http_res_text)
768
+ raise models.APIError(
769
+ "API error occurred", http_res.status_code, http_res_text, http_res
770
+ )
703
771
  if utils.match_response(http_res, "5XX", "*"):
704
772
  http_res_text = utils.stream_to_text(http_res)
705
- raise models.APIError("API error occurred", http_res, http_res_text)
773
+ raise models.APIError(
774
+ "API error occurred", http_res.status_code, http_res_text, http_res
775
+ )
706
776
 
707
- raise models.APIError("Unexpected response received", http_res)
777
+ content_type = http_res.headers.get("Content-Type")
778
+ http_res_text = utils.stream_to_text(http_res)
779
+ raise models.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
+ )
708
785
 
709
786
  async def get_by_id_async(
710
787
  self,
@@ -780,20 +857,31 @@ class Services(BaseSDK):
780
857
 
781
858
  response_data: Any = None
782
859
  if utils.match_response(http_res, "200", "application/json"):
783
- return utils.unmarshal_json_response(models.ServiceResponse, http_res)
860
+ return utils.unmarshal_json(http_res.text, models.ServiceResponse)
784
861
  if utils.match_response(http_res, "422", "application/json"):
785
- response_data = utils.unmarshal_json_response(
786
- models.HTTPValidationErrorData, http_res
862
+ response_data = utils.unmarshal_json(
863
+ http_res.text, models.HTTPValidationErrorData
787
864
  )
788
- raise models.HTTPValidationError(response_data, http_res)
865
+ raise models.HTTPValidationError(data=response_data)
789
866
  if utils.match_response(http_res, "4XX", "*"):
790
867
  http_res_text = await utils.stream_to_text_async(http_res)
791
- raise models.APIError("API error occurred", http_res, http_res_text)
868
+ raise models.APIError(
869
+ "API error occurred", http_res.status_code, http_res_text, http_res
870
+ )
792
871
  if utils.match_response(http_res, "5XX", "*"):
793
872
  http_res_text = await utils.stream_to_text_async(http_res)
794
- raise models.APIError("API error occurred", http_res, http_res_text)
873
+ raise models.APIError(
874
+ "API error occurred", http_res.status_code, http_res_text, http_res
875
+ )
795
876
 
796
- raise models.APIError("Unexpected response received", http_res)
877
+ content_type = http_res.headers.get("Content-Type")
878
+ http_res_text = await utils.stream_to_text_async(http_res)
879
+ raise models.APIError(
880
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
881
+ http_res.status_code,
882
+ http_res_text,
883
+ http_res,
884
+ )
797
885
 
798
886
  def delete(
799
887
  self,
@@ -872,20 +960,31 @@ class Services(BaseSDK):
872
960
 
873
961
  response_data: Any = None
874
962
  if utils.match_response(http_res, "200", "application/json"):
875
- return utils.unmarshal_json_response(Any, http_res)
963
+ return utils.unmarshal_json(http_res.text, Any)
876
964
  if utils.match_response(http_res, "422", "application/json"):
877
- response_data = utils.unmarshal_json_response(
878
- models.HTTPValidationErrorData, http_res
965
+ response_data = utils.unmarshal_json(
966
+ http_res.text, models.HTTPValidationErrorData
879
967
  )
880
- raise models.HTTPValidationError(response_data, http_res)
968
+ raise models.HTTPValidationError(data=response_data)
881
969
  if utils.match_response(http_res, "4XX", "*"):
882
970
  http_res_text = utils.stream_to_text(http_res)
883
- raise models.APIError("API error occurred", http_res, http_res_text)
971
+ raise models.APIError(
972
+ "API error occurred", http_res.status_code, http_res_text, http_res
973
+ )
884
974
  if utils.match_response(http_res, "5XX", "*"):
885
975
  http_res_text = utils.stream_to_text(http_res)
886
- raise models.APIError("API error occurred", http_res, http_res_text)
976
+ raise models.APIError(
977
+ "API error occurred", http_res.status_code, http_res_text, http_res
978
+ )
887
979
 
888
- raise models.APIError("Unexpected response received", http_res)
980
+ content_type = http_res.headers.get("Content-Type")
981
+ http_res_text = utils.stream_to_text(http_res)
982
+ raise models.APIError(
983
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
984
+ http_res.status_code,
985
+ http_res_text,
986
+ http_res,
987
+ )
889
988
 
890
989
  async def delete_async(
891
990
  self,
@@ -964,17 +1063,28 @@ class Services(BaseSDK):
964
1063
 
965
1064
  response_data: Any = None
966
1065
  if utils.match_response(http_res, "200", "application/json"):
967
- return utils.unmarshal_json_response(Any, http_res)
1066
+ return utils.unmarshal_json(http_res.text, Any)
968
1067
  if utils.match_response(http_res, "422", "application/json"):
969
- response_data = utils.unmarshal_json_response(
970
- models.HTTPValidationErrorData, http_res
1068
+ response_data = utils.unmarshal_json(
1069
+ http_res.text, models.HTTPValidationErrorData
971
1070
  )
972
- raise models.HTTPValidationError(response_data, http_res)
1071
+ raise models.HTTPValidationError(data=response_data)
973
1072
  if utils.match_response(http_res, "4XX", "*"):
974
1073
  http_res_text = await utils.stream_to_text_async(http_res)
975
- raise models.APIError("API error occurred", http_res, http_res_text)
1074
+ raise models.APIError(
1075
+ "API error occurred", http_res.status_code, http_res_text, http_res
1076
+ )
976
1077
  if utils.match_response(http_res, "5XX", "*"):
977
1078
  http_res_text = await utils.stream_to_text_async(http_res)
978
- raise models.APIError("API error occurred", http_res, http_res_text)
1079
+ raise models.APIError(
1080
+ "API error occurred", http_res.status_code, http_res_text, http_res
1081
+ )
979
1082
 
980
- raise models.APIError("Unexpected response received", http_res)
1083
+ content_type = http_res.headers.get("Content-Type")
1084
+ http_res_text = await utils.stream_to_text_async(http_res)
1085
+ raise models.APIError(
1086
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1087
+ http_res.status_code,
1088
+ http_res_text,
1089
+ http_res,
1090
+ )
@@ -84,20 +84,31 @@ class SessionDebug(BaseSDK):
84
84
 
85
85
  response_data: Any = None
86
86
  if utils.match_response(http_res, "200", "application/json"):
87
- return utils.unmarshal_json_response(models.SessionData, http_res)
87
+ return utils.unmarshal_json(http_res.text, models.SessionData)
88
88
  if utils.match_response(http_res, "422", "application/json"):
89
- response_data = utils.unmarshal_json_response(
90
- models.HTTPValidationErrorData, http_res
89
+ response_data = utils.unmarshal_json(
90
+ http_res.text, models.HTTPValidationErrorData
91
91
  )
92
- raise models.HTTPValidationError(response_data, http_res)
92
+ raise models.HTTPValidationError(data=response_data)
93
93
  if utils.match_response(http_res, "4XX", "*"):
94
94
  http_res_text = utils.stream_to_text(http_res)
95
- raise models.APIError("API error occurred", http_res, http_res_text)
95
+ raise models.APIError(
96
+ "API error occurred", http_res.status_code, http_res_text, http_res
97
+ )
96
98
  if utils.match_response(http_res, "5XX", "*"):
97
99
  http_res_text = utils.stream_to_text(http_res)
98
- raise models.APIError("API error occurred", http_res, http_res_text)
100
+ raise models.APIError(
101
+ "API error occurred", http_res.status_code, http_res_text, http_res
102
+ )
99
103
 
100
- raise models.APIError("Unexpected response received", http_res)
104
+ content_type = http_res.headers.get("Content-Type")
105
+ http_res_text = utils.stream_to_text(http_res)
106
+ raise models.APIError(
107
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
108
+ http_res.status_code,
109
+ http_res_text,
110
+ http_res,
111
+ )
101
112
 
102
113
  async def get_session_data_by_sid_async(
103
114
  self,
@@ -174,20 +185,31 @@ class SessionDebug(BaseSDK):
174
185
 
175
186
  response_data: Any = None
176
187
  if utils.match_response(http_res, "200", "application/json"):
177
- return utils.unmarshal_json_response(models.SessionData, http_res)
188
+ return utils.unmarshal_json(http_res.text, models.SessionData)
178
189
  if utils.match_response(http_res, "422", "application/json"):
179
- response_data = utils.unmarshal_json_response(
180
- models.HTTPValidationErrorData, http_res
190
+ response_data = utils.unmarshal_json(
191
+ http_res.text, models.HTTPValidationErrorData
181
192
  )
182
- raise models.HTTPValidationError(response_data, http_res)
193
+ raise models.HTTPValidationError(data=response_data)
183
194
  if utils.match_response(http_res, "4XX", "*"):
184
195
  http_res_text = await utils.stream_to_text_async(http_res)
185
- raise models.APIError("API error occurred", http_res, http_res_text)
196
+ raise models.APIError(
197
+ "API error occurred", http_res.status_code, http_res_text, http_res
198
+ )
186
199
  if utils.match_response(http_res, "5XX", "*"):
187
200
  http_res_text = await utils.stream_to_text_async(http_res)
188
- raise models.APIError("API error occurred", http_res, http_res_text)
201
+ raise models.APIError(
202
+ "API error occurred", http_res.status_code, http_res_text, http_res
203
+ )
189
204
 
190
- raise models.APIError("Unexpected response received", http_res)
205
+ content_type = http_res.headers.get("Content-Type")
206
+ http_res_text = await utils.stream_to_text_async(http_res)
207
+ raise models.APIError(
208
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
209
+ http_res.status_code,
210
+ http_res_text,
211
+ http_res,
212
+ )
191
213
 
192
214
  def get_session_data_by_session_id(
193
215
  self,
@@ -261,20 +283,31 @@ class SessionDebug(BaseSDK):
261
283
 
262
284
  response_data: Any = None
263
285
  if utils.match_response(http_res, "200", "application/json"):
264
- return utils.unmarshal_json_response(models.SessionData, http_res)
286
+ return utils.unmarshal_json(http_res.text, models.SessionData)
265
287
  if utils.match_response(http_res, "422", "application/json"):
266
- response_data = utils.unmarshal_json_response(
267
- models.HTTPValidationErrorData, http_res
288
+ response_data = utils.unmarshal_json(
289
+ http_res.text, models.HTTPValidationErrorData
268
290
  )
269
- raise models.HTTPValidationError(response_data, http_res)
291
+ raise models.HTTPValidationError(data=response_data)
270
292
  if utils.match_response(http_res, "4XX", "*"):
271
293
  http_res_text = utils.stream_to_text(http_res)
272
- raise models.APIError("API error occurred", http_res, http_res_text)
294
+ raise models.APIError(
295
+ "API error occurred", http_res.status_code, http_res_text, http_res
296
+ )
273
297
  if utils.match_response(http_res, "5XX", "*"):
274
298
  http_res_text = utils.stream_to_text(http_res)
275
- raise models.APIError("API error occurred", http_res, http_res_text)
299
+ raise models.APIError(
300
+ "API error occurred", http_res.status_code, http_res_text, http_res
301
+ )
276
302
 
277
- raise models.APIError("Unexpected response received", http_res)
303
+ content_type = http_res.headers.get("Content-Type")
304
+ http_res_text = utils.stream_to_text(http_res)
305
+ raise models.APIError(
306
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
307
+ http_res.status_code,
308
+ http_res_text,
309
+ http_res,
310
+ )
278
311
 
279
312
  async def get_session_data_by_session_id_async(
280
313
  self,
@@ -348,20 +381,31 @@ class SessionDebug(BaseSDK):
348
381
 
349
382
  response_data: Any = None
350
383
  if utils.match_response(http_res, "200", "application/json"):
351
- return utils.unmarshal_json_response(models.SessionData, http_res)
384
+ return utils.unmarshal_json(http_res.text, models.SessionData)
352
385
  if utils.match_response(http_res, "422", "application/json"):
353
- response_data = utils.unmarshal_json_response(
354
- models.HTTPValidationErrorData, http_res
386
+ response_data = utils.unmarshal_json(
387
+ http_res.text, models.HTTPValidationErrorData
355
388
  )
356
- raise models.HTTPValidationError(response_data, http_res)
389
+ raise models.HTTPValidationError(data=response_data)
357
390
  if utils.match_response(http_res, "4XX", "*"):
358
391
  http_res_text = await utils.stream_to_text_async(http_res)
359
- raise models.APIError("API error occurred", http_res, http_res_text)
392
+ raise models.APIError(
393
+ "API error occurred", http_res.status_code, http_res_text, http_res
394
+ )
360
395
  if utils.match_response(http_res, "5XX", "*"):
361
396
  http_res_text = await utils.stream_to_text_async(http_res)
362
- raise models.APIError("API error occurred", http_res, http_res_text)
397
+ raise models.APIError(
398
+ "API error occurred", http_res.status_code, http_res_text, http_res
399
+ )
363
400
 
364
- raise models.APIError("Unexpected response received", http_res)
401
+ content_type = http_res.headers.get("Content-Type")
402
+ http_res_text = await utils.stream_to_text_async(http_res)
403
+ raise models.APIError(
404
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
405
+ http_res.status_code,
406
+ http_res_text,
407
+ http_res,
408
+ )
365
409
 
366
410
  def get_session_tool_call_result_by_id(
367
411
  self,
@@ -438,20 +482,31 @@ class SessionDebug(BaseSDK):
438
482
 
439
483
  response_data: Any = None
440
484
  if utils.match_response(http_res, "200", "application/json"):
441
- return utils.unmarshal_json_response(models.ToolResultData, http_res)
485
+ return utils.unmarshal_json(http_res.text, models.ToolResultData)
442
486
  if utils.match_response(http_res, "422", "application/json"):
443
- response_data = utils.unmarshal_json_response(
444
- models.HTTPValidationErrorData, http_res
487
+ response_data = utils.unmarshal_json(
488
+ http_res.text, models.HTTPValidationErrorData
445
489
  )
446
- raise models.HTTPValidationError(response_data, http_res)
490
+ raise models.HTTPValidationError(data=response_data)
447
491
  if utils.match_response(http_res, "4XX", "*"):
448
492
  http_res_text = utils.stream_to_text(http_res)
449
- raise models.APIError("API error occurred", http_res, http_res_text)
493
+ raise models.APIError(
494
+ "API error occurred", http_res.status_code, http_res_text, http_res
495
+ )
450
496
  if utils.match_response(http_res, "5XX", "*"):
451
497
  http_res_text = utils.stream_to_text(http_res)
452
- raise models.APIError("API error occurred", http_res, http_res_text)
498
+ raise models.APIError(
499
+ "API error occurred", http_res.status_code, http_res_text, http_res
500
+ )
453
501
 
454
- raise models.APIError("Unexpected response received", http_res)
502
+ content_type = http_res.headers.get("Content-Type")
503
+ http_res_text = utils.stream_to_text(http_res)
504
+ raise models.APIError(
505
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
506
+ http_res.status_code,
507
+ http_res_text,
508
+ http_res,
509
+ )
455
510
 
456
511
  async def get_session_tool_call_result_by_id_async(
457
512
  self,
@@ -528,17 +583,28 @@ class SessionDebug(BaseSDK):
528
583
 
529
584
  response_data: Any = None
530
585
  if utils.match_response(http_res, "200", "application/json"):
531
- return utils.unmarshal_json_response(models.ToolResultData, http_res)
586
+ return utils.unmarshal_json(http_res.text, models.ToolResultData)
532
587
  if utils.match_response(http_res, "422", "application/json"):
533
- response_data = utils.unmarshal_json_response(
534
- models.HTTPValidationErrorData, http_res
588
+ response_data = utils.unmarshal_json(
589
+ http_res.text, models.HTTPValidationErrorData
535
590
  )
536
- raise models.HTTPValidationError(response_data, http_res)
591
+ raise models.HTTPValidationError(data=response_data)
537
592
  if utils.match_response(http_res, "4XX", "*"):
538
593
  http_res_text = await utils.stream_to_text_async(http_res)
539
- raise models.APIError("API error occurred", http_res, http_res_text)
594
+ raise models.APIError(
595
+ "API error occurred", http_res.status_code, http_res_text, http_res
596
+ )
540
597
  if utils.match_response(http_res, "5XX", "*"):
541
598
  http_res_text = await utils.stream_to_text_async(http_res)
542
- raise models.APIError("API error occurred", http_res, http_res_text)
599
+ raise models.APIError(
600
+ "API error occurred", http_res.status_code, http_res_text, http_res
601
+ )
543
602
 
544
- raise models.APIError("Unexpected response received", http_res)
603
+ content_type = http_res.headers.get("Content-Type")
604
+ http_res_text = await utils.stream_to_text_async(http_res)
605
+ raise models.APIError(
606
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
607
+ http_res.status_code,
608
+ http_res_text,
609
+ http_res,
610
+ )