syllable-sdk 0.35.27__py3-none-any.whl → 0.35.31__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 (51) 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 +6 -19
  20. syllable_sdk/models/apierror.py +14 -30
  21. syllable_sdk/models/dialogtoolcall.py +37 -1
  22. syllable_sdk/models/httpvalidationerror.py +6 -11
  23. syllable_sdk/models/testmessageresponse.py +38 -15
  24. syllable_sdk/models/tooldefinition.py +10 -2
  25. syllable_sdk/models/tooloptions.py +20 -0
  26. syllable_sdk/numbers.py +110 -52
  27. syllable_sdk/organizations.py +138 -50
  28. syllable_sdk/permissions.py +32 -10
  29. syllable_sdk/prompts.py +248 -94
  30. syllable_sdk/roles.py +180 -74
  31. syllable_sdk/services.py +182 -72
  32. syllable_sdk/session_debug.py +108 -42
  33. syllable_sdk/session_labels.py +108 -46
  34. syllable_sdk/sessions.py +140 -58
  35. syllable_sdk/takeouts.py +98 -34
  36. syllable_sdk/targets.py +184 -74
  37. syllable_sdk/test.py +36 -14
  38. syllable_sdk/tools.py +180 -74
  39. syllable_sdk/transcript.py +38 -16
  40. syllable_sdk/twilio.py +108 -42
  41. syllable_sdk/users.py +246 -96
  42. syllable_sdk/utils/__init__.py +0 -3
  43. syllable_sdk/utils/serializers.py +3 -21
  44. syllable_sdk/v1.py +246 -96
  45. syllable_sdk/workflows.py +290 -114
  46. {syllable_sdk-0.35.27.dist-info → syllable_sdk-0.35.31.dist-info}/METADATA +24 -44
  47. {syllable_sdk-0.35.27.dist-info → syllable_sdk-0.35.31.dist-info}/RECORD +48 -50
  48. syllable_sdk/models/no_response_error.py +0 -13
  49. syllable_sdk/models/responsevalidationerror.py +0 -25
  50. syllable_sdk/models/syllablesdkerror.py +0 -26
  51. {syllable_sdk-0.35.27.dist-info → syllable_sdk-0.35.31.dist-info}/WHEEL +0 -0
@@ -81,22 +81,31 @@ class FullSummary(BaseSDK):
81
81
 
82
82
  response_data: Any = None
83
83
  if utils.match_response(http_res, "200", "application/json"):
84
- return utils.unmarshal_json_response(
85
- models.SessionSummaryResponse, http_res
86
- )
84
+ return utils.unmarshal_json(http_res.text, models.SessionSummaryResponse)
87
85
  if utils.match_response(http_res, "422", "application/json"):
88
- response_data = utils.unmarshal_json_response(
89
- models.HTTPValidationErrorData, http_res
86
+ response_data = utils.unmarshal_json(
87
+ http_res.text, models.HTTPValidationErrorData
90
88
  )
91
- raise models.HTTPValidationError(response_data, http_res)
89
+ raise models.HTTPValidationError(data=response_data)
92
90
  if utils.match_response(http_res, "4XX", "*"):
93
91
  http_res_text = utils.stream_to_text(http_res)
94
- raise models.APIError("API error occurred", http_res, http_res_text)
92
+ raise models.APIError(
93
+ "API error occurred", http_res.status_code, http_res_text, http_res
94
+ )
95
95
  if utils.match_response(http_res, "5XX", "*"):
96
96
  http_res_text = utils.stream_to_text(http_res)
97
- raise models.APIError("API error occurred", http_res, http_res_text)
97
+ raise models.APIError(
98
+ "API error occurred", http_res.status_code, http_res_text, http_res
99
+ )
98
100
 
99
- raise models.APIError("Unexpected response received", http_res)
101
+ content_type = http_res.headers.get("Content-Type")
102
+ http_res_text = utils.stream_to_text(http_res)
103
+ raise models.APIError(
104
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
105
+ http_res.status_code,
106
+ http_res_text,
107
+ http_res,
108
+ )
100
109
 
101
110
  async def get_by_id_async(
102
111
  self,
@@ -170,19 +179,28 @@ class FullSummary(BaseSDK):
170
179
 
171
180
  response_data: Any = None
172
181
  if utils.match_response(http_res, "200", "application/json"):
173
- return utils.unmarshal_json_response(
174
- models.SessionSummaryResponse, http_res
175
- )
182
+ return utils.unmarshal_json(http_res.text, models.SessionSummaryResponse)
176
183
  if utils.match_response(http_res, "422", "application/json"):
177
- response_data = utils.unmarshal_json_response(
178
- models.HTTPValidationErrorData, http_res
184
+ response_data = utils.unmarshal_json(
185
+ http_res.text, models.HTTPValidationErrorData
179
186
  )
180
- raise models.HTTPValidationError(response_data, http_res)
187
+ raise models.HTTPValidationError(data=response_data)
181
188
  if utils.match_response(http_res, "4XX", "*"):
182
189
  http_res_text = await utils.stream_to_text_async(http_res)
183
- raise models.APIError("API error occurred", http_res, http_res_text)
190
+ raise models.APIError(
191
+ "API error occurred", http_res.status_code, http_res_text, http_res
192
+ )
184
193
  if utils.match_response(http_res, "5XX", "*"):
185
194
  http_res_text = await utils.stream_to_text_async(http_res)
186
- raise models.APIError("API error occurred", http_res, http_res_text)
195
+ raise models.APIError(
196
+ "API error occurred", http_res.status_code, http_res_text, http_res
197
+ )
187
198
 
188
- raise models.APIError("Unexpected response received", http_res)
199
+ content_type = http_res.headers.get("Content-Type")
200
+ http_res_text = await utils.stream_to_text_async(http_res)
201
+ raise models.APIError(
202
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
203
+ http_res.status_code,
204
+ http_res_text,
205
+ http_res,
206
+ )
syllable_sdk/incidents.py CHANGED
@@ -109,22 +109,33 @@ class Incidents(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.ListResponseIncidentResponse, http_res
112
+ return utils.unmarshal_json(
113
+ http_res.text, models.ListResponseIncidentResponse
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 Incidents(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.ListResponseIncidentResponse, http_res
238
+ return utils.unmarshal_json(
239
+ http_res.text, models.ListResponseIncidentResponse
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 Incidents(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.IncidentResponse, http_res)
345
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
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 Incidents(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.IncidentResponse, http_res)
450
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
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 Incidents(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.IncidentResponse, http_res)
555
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
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 Incidents(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.IncidentResponse, http_res)
660
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
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 incident_get_organizations(
621
687
  self,
@@ -683,17 +749,28 @@ class Incidents(BaseSDK):
683
749
  )
684
750
 
685
751
  if utils.match_response(http_res, "200", "application/json"):
686
- return utils.unmarshal_json_response(
687
- List[models.IncidentOrganizationResponse], http_res
752
+ return utils.unmarshal_json(
753
+ http_res.text, List[models.IncidentOrganizationResponse]
688
754
  )
689
755
  if utils.match_response(http_res, "4XX", "*"):
690
756
  http_res_text = utils.stream_to_text(http_res)
691
- raise models.APIError("API error occurred", http_res, http_res_text)
757
+ raise models.APIError(
758
+ "API error occurred", http_res.status_code, http_res_text, http_res
759
+ )
692
760
  if utils.match_response(http_res, "5XX", "*"):
693
761
  http_res_text = utils.stream_to_text(http_res)
694
- raise models.APIError("API error occurred", http_res, http_res_text)
762
+ raise models.APIError(
763
+ "API error occurred", http_res.status_code, http_res_text, http_res
764
+ )
695
765
 
696
- raise models.APIError("Unexpected response received", http_res)
766
+ content_type = http_res.headers.get("Content-Type")
767
+ http_res_text = utils.stream_to_text(http_res)
768
+ raise models.APIError(
769
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
770
+ http_res.status_code,
771
+ http_res_text,
772
+ http_res,
773
+ )
697
774
 
698
775
  async def incident_get_organizations_async(
699
776
  self,
@@ -761,17 +838,28 @@ class Incidents(BaseSDK):
761
838
  )
762
839
 
763
840
  if utils.match_response(http_res, "200", "application/json"):
764
- return utils.unmarshal_json_response(
765
- List[models.IncidentOrganizationResponse], http_res
841
+ return utils.unmarshal_json(
842
+ http_res.text, List[models.IncidentOrganizationResponse]
766
843
  )
767
844
  if utils.match_response(http_res, "4XX", "*"):
768
845
  http_res_text = await utils.stream_to_text_async(http_res)
769
- raise models.APIError("API error occurred", http_res, http_res_text)
846
+ raise models.APIError(
847
+ "API error occurred", http_res.status_code, http_res_text, http_res
848
+ )
770
849
  if utils.match_response(http_res, "5XX", "*"):
771
850
  http_res_text = await utils.stream_to_text_async(http_res)
772
- raise models.APIError("API error occurred", http_res, http_res_text)
851
+ raise models.APIError(
852
+ "API error occurred", http_res.status_code, http_res_text, http_res
853
+ )
773
854
 
774
- raise models.APIError("Unexpected response received", http_res)
855
+ content_type = http_res.headers.get("Content-Type")
856
+ http_res_text = await utils.stream_to_text_async(http_res)
857
+ raise models.APIError(
858
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
859
+ http_res.status_code,
860
+ http_res_text,
861
+ http_res,
862
+ )
775
863
 
776
864
  def get_by_id(
777
865
  self,
@@ -847,20 +935,31 @@ class Incidents(BaseSDK):
847
935
 
848
936
  response_data: Any = None
849
937
  if utils.match_response(http_res, "200", "application/json"):
850
- return utils.unmarshal_json_response(models.IncidentResponse, http_res)
938
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
851
939
  if utils.match_response(http_res, "422", "application/json"):
852
- response_data = utils.unmarshal_json_response(
853
- models.HTTPValidationErrorData, http_res
940
+ response_data = utils.unmarshal_json(
941
+ http_res.text, models.HTTPValidationErrorData
854
942
  )
855
- raise models.HTTPValidationError(response_data, http_res)
943
+ raise models.HTTPValidationError(data=response_data)
856
944
  if utils.match_response(http_res, "4XX", "*"):
857
945
  http_res_text = utils.stream_to_text(http_res)
858
- raise models.APIError("API error occurred", http_res, http_res_text)
946
+ raise models.APIError(
947
+ "API error occurred", http_res.status_code, http_res_text, http_res
948
+ )
859
949
  if utils.match_response(http_res, "5XX", "*"):
860
950
  http_res_text = utils.stream_to_text(http_res)
861
- raise models.APIError("API error occurred", http_res, http_res_text)
951
+ raise models.APIError(
952
+ "API error occurred", http_res.status_code, http_res_text, http_res
953
+ )
862
954
 
863
- raise models.APIError("Unexpected response received", http_res)
955
+ content_type = http_res.headers.get("Content-Type")
956
+ http_res_text = utils.stream_to_text(http_res)
957
+ raise models.APIError(
958
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
959
+ http_res.status_code,
960
+ http_res_text,
961
+ http_res,
962
+ )
864
963
 
865
964
  async def get_by_id_async(
866
965
  self,
@@ -936,20 +1035,31 @@ class Incidents(BaseSDK):
936
1035
 
937
1036
  response_data: Any = None
938
1037
  if utils.match_response(http_res, "200", "application/json"):
939
- return utils.unmarshal_json_response(models.IncidentResponse, http_res)
1038
+ return utils.unmarshal_json(http_res.text, models.IncidentResponse)
940
1039
  if utils.match_response(http_res, "422", "application/json"):
941
- response_data = utils.unmarshal_json_response(
942
- models.HTTPValidationErrorData, http_res
1040
+ response_data = utils.unmarshal_json(
1041
+ http_res.text, models.HTTPValidationErrorData
943
1042
  )
944
- raise models.HTTPValidationError(response_data, http_res)
1043
+ raise models.HTTPValidationError(data=response_data)
945
1044
  if utils.match_response(http_res, "4XX", "*"):
946
1045
  http_res_text = await utils.stream_to_text_async(http_res)
947
- raise models.APIError("API error occurred", http_res, http_res_text)
1046
+ raise models.APIError(
1047
+ "API error occurred", http_res.status_code, http_res_text, http_res
1048
+ )
948
1049
  if utils.match_response(http_res, "5XX", "*"):
949
1050
  http_res_text = await utils.stream_to_text_async(http_res)
950
- raise models.APIError("API error occurred", http_res, http_res_text)
1051
+ raise models.APIError(
1052
+ "API error occurred", http_res.status_code, http_res_text, http_res
1053
+ )
951
1054
 
952
- raise models.APIError("Unexpected response received", http_res)
1055
+ content_type = http_res.headers.get("Content-Type")
1056
+ http_res_text = await utils.stream_to_text_async(http_res)
1057
+ raise models.APIError(
1058
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1059
+ http_res.status_code,
1060
+ http_res_text,
1061
+ http_res,
1062
+ )
953
1063
 
954
1064
  def delete(
955
1065
  self,
@@ -1028,20 +1138,31 @@ class Incidents(BaseSDK):
1028
1138
 
1029
1139
  response_data: Any = None
1030
1140
  if utils.match_response(http_res, "200", "application/json"):
1031
- return utils.unmarshal_json_response(Any, http_res)
1141
+ return utils.unmarshal_json(http_res.text, Any)
1032
1142
  if utils.match_response(http_res, "422", "application/json"):
1033
- response_data = utils.unmarshal_json_response(
1034
- models.HTTPValidationErrorData, http_res
1143
+ response_data = utils.unmarshal_json(
1144
+ http_res.text, models.HTTPValidationErrorData
1035
1145
  )
1036
- raise models.HTTPValidationError(response_data, http_res)
1146
+ raise models.HTTPValidationError(data=response_data)
1037
1147
  if utils.match_response(http_res, "4XX", "*"):
1038
1148
  http_res_text = utils.stream_to_text(http_res)
1039
- raise models.APIError("API error occurred", http_res, http_res_text)
1149
+ raise models.APIError(
1150
+ "API error occurred", http_res.status_code, http_res_text, http_res
1151
+ )
1040
1152
  if utils.match_response(http_res, "5XX", "*"):
1041
1153
  http_res_text = utils.stream_to_text(http_res)
1042
- raise models.APIError("API error occurred", http_res, http_res_text)
1154
+ raise models.APIError(
1155
+ "API error occurred", http_res.status_code, http_res_text, http_res
1156
+ )
1043
1157
 
1044
- raise models.APIError("Unexpected response received", http_res)
1158
+ content_type = http_res.headers.get("Content-Type")
1159
+ http_res_text = utils.stream_to_text(http_res)
1160
+ raise models.APIError(
1161
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1162
+ http_res.status_code,
1163
+ http_res_text,
1164
+ http_res,
1165
+ )
1045
1166
 
1046
1167
  async def delete_async(
1047
1168
  self,
@@ -1120,17 +1241,28 @@ class Incidents(BaseSDK):
1120
1241
 
1121
1242
  response_data: Any = None
1122
1243
  if utils.match_response(http_res, "200", "application/json"):
1123
- return utils.unmarshal_json_response(Any, http_res)
1244
+ return utils.unmarshal_json(http_res.text, Any)
1124
1245
  if utils.match_response(http_res, "422", "application/json"):
1125
- response_data = utils.unmarshal_json_response(
1126
- models.HTTPValidationErrorData, http_res
1246
+ response_data = utils.unmarshal_json(
1247
+ http_res.text, models.HTTPValidationErrorData
1127
1248
  )
1128
- raise models.HTTPValidationError(response_data, http_res)
1249
+ raise models.HTTPValidationError(data=response_data)
1129
1250
  if utils.match_response(http_res, "4XX", "*"):
1130
1251
  http_res_text = await utils.stream_to_text_async(http_res)
1131
- raise models.APIError("API error occurred", http_res, http_res_text)
1252
+ raise models.APIError(
1253
+ "API error occurred", http_res.status_code, http_res_text, http_res
1254
+ )
1132
1255
  if utils.match_response(http_res, "5XX", "*"):
1133
1256
  http_res_text = await utils.stream_to_text_async(http_res)
1134
- raise models.APIError("API error occurred", http_res, http_res_text)
1257
+ raise models.APIError(
1258
+ "API error occurred", http_res.status_code, http_res_text, http_res
1259
+ )
1135
1260
 
1136
- raise models.APIError("Unexpected response received", http_res)
1261
+ content_type = http_res.headers.get("Content-Type")
1262
+ http_res_text = await utils.stream_to_text_async(http_res)
1263
+ raise models.APIError(
1264
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1265
+ http_res.status_code,
1266
+ http_res_text,
1267
+ http_res,
1268
+ )
@@ -130,22 +130,33 @@ class InsightsSDK(BaseSDK):
130
130
 
131
131
  response_data: Any = None
132
132
  if utils.match_response(http_res, "200", "application/json"):
133
- return utils.unmarshal_json_response(
134
- models.ListResponseInsightsOutput, http_res
133
+ return utils.unmarshal_json(
134
+ http_res.text, models.ListResponseInsightsOutput
135
135
  )
136
136
  if utils.match_response(http_res, "422", "application/json"):
137
- response_data = utils.unmarshal_json_response(
138
- models.HTTPValidationErrorData, http_res
137
+ response_data = utils.unmarshal_json(
138
+ http_res.text, models.HTTPValidationErrorData
139
139
  )
140
- raise models.HTTPValidationError(response_data, http_res)
140
+ raise models.HTTPValidationError(data=response_data)
141
141
  if utils.match_response(http_res, "4XX", "*"):
142
142
  http_res_text = utils.stream_to_text(http_res)
143
- raise models.APIError("API error occurred", http_res, http_res_text)
143
+ raise models.APIError(
144
+ "API error occurred", http_res.status_code, http_res_text, http_res
145
+ )
144
146
  if utils.match_response(http_res, "5XX", "*"):
145
147
  http_res_text = utils.stream_to_text(http_res)
146
- raise models.APIError("API error occurred", http_res, http_res_text)
148
+ raise models.APIError(
149
+ "API error occurred", http_res.status_code, http_res_text, http_res
150
+ )
147
151
 
148
- raise models.APIError("Unexpected response received", http_res)
152
+ content_type = http_res.headers.get("Content-Type")
153
+ http_res_text = utils.stream_to_text(http_res)
154
+ raise models.APIError(
155
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
156
+ http_res.status_code,
157
+ http_res_text,
158
+ http_res,
159
+ )
149
160
 
150
161
  async def list_async(
151
162
  self,
@@ -245,19 +256,30 @@ class InsightsSDK(BaseSDK):
245
256
 
246
257
  response_data: Any = None
247
258
  if utils.match_response(http_res, "200", "application/json"):
248
- return utils.unmarshal_json_response(
249
- models.ListResponseInsightsOutput, http_res
259
+ return utils.unmarshal_json(
260
+ http_res.text, models.ListResponseInsightsOutput
250
261
  )
251
262
  if utils.match_response(http_res, "422", "application/json"):
252
- response_data = utils.unmarshal_json_response(
253
- models.HTTPValidationErrorData, http_res
263
+ response_data = utils.unmarshal_json(
264
+ http_res.text, models.HTTPValidationErrorData
254
265
  )
255
- raise models.HTTPValidationError(response_data, http_res)
266
+ raise models.HTTPValidationError(data=response_data)
256
267
  if utils.match_response(http_res, "4XX", "*"):
257
268
  http_res_text = await utils.stream_to_text_async(http_res)
258
- raise models.APIError("API error occurred", http_res, http_res_text)
269
+ raise models.APIError(
270
+ "API error occurred", http_res.status_code, http_res_text, http_res
271
+ )
259
272
  if utils.match_response(http_res, "5XX", "*"):
260
273
  http_res_text = await utils.stream_to_text_async(http_res)
261
- raise models.APIError("API error occurred", http_res, http_res_text)
274
+ raise models.APIError(
275
+ "API error occurred", http_res.status_code, http_res_text, http_res
276
+ )
262
277
 
263
- raise models.APIError("Unexpected response received", http_res)
278
+ content_type = http_res.headers.get("Content-Type")
279
+ http_res_text = await utils.stream_to_text_async(http_res)
280
+ raise models.APIError(
281
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
282
+ http_res.status_code,
283
+ http_res_text,
284
+ http_res,
285
+ )