latitudesh-python-sdk 2.0.0__py3-none-any.whl → 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of latitudesh-python-sdk might be problematic. Click here for more details.

Files changed (43) hide show
  1. latitudesh_python_sdk/_version.py +3 -3
  2. latitudesh_python_sdk/apikeys.py +51 -138
  3. latitudesh_python_sdk/basesdk.py +4 -4
  4. latitudesh_python_sdk/billing.py +11 -32
  5. latitudesh_python_sdk/events_sdk.py +9 -34
  6. latitudesh_python_sdk/firewalls_sdk.py +89 -264
  7. latitudesh_python_sdk/ipaddresses_sdk.py +25 -68
  8. latitudesh_python_sdk/models/__init__.py +27 -4
  9. latitudesh_python_sdk/models/apierror.py +30 -14
  10. latitudesh_python_sdk/models/deploy_config.py +11 -6
  11. latitudesh_python_sdk/models/error_object.py +11 -6
  12. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  13. latitudesh_python_sdk/models/no_response_error.py +13 -0
  14. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  15. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  16. latitudesh_python_sdk/models/server.py +11 -6
  17. latitudesh_python_sdk/models/server_data.py +6 -3
  18. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  19. latitudesh_python_sdk/models/update_serverop.py +1 -3
  20. latitudesh_python_sdk/models/virtual_network.py +11 -6
  21. latitudesh_python_sdk/operatingsystems_sdk.py +11 -32
  22. latitudesh_python_sdk/plans.py +57 -188
  23. latitudesh_python_sdk/privatenetworks.py +87 -262
  24. latitudesh_python_sdk/projects_sdk.py +43 -130
  25. latitudesh_python_sdk/regions_sdk.py +21 -66
  26. latitudesh_python_sdk/roles.py +21 -64
  27. latitudesh_python_sdk/servers_sdk.py +207 -604
  28. latitudesh_python_sdk/sshkeys_sdk.py +85 -304
  29. latitudesh_python_sdk/storage.py +33 -120
  30. latitudesh_python_sdk/tags.py +39 -126
  31. latitudesh_python_sdk/teams_sdk.py +35 -100
  32. latitudesh_python_sdk/teamsmembers.py +31 -96
  33. latitudesh_python_sdk/traffic_sdk.py +25 -68
  34. latitudesh_python_sdk/userdata_sdk.py +79 -298
  35. latitudesh_python_sdk/userprofile.py +31 -100
  36. latitudesh_python_sdk/utils/serializers.py +3 -2
  37. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  38. latitudesh_python_sdk/virtualmachines.py +35 -122
  39. latitudesh_python_sdk/vpnsessions.py +55 -146
  40. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +47 -24
  41. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +43 -38
  42. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
  43. {latitudesh_python_sdk-2.0.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +0 -0
@@ -3,11 +3,11 @@
3
3
  import importlib.metadata
4
4
 
5
5
  __title__: str = "latitudesh-python-sdk"
6
- __version__: str = "2.0.0"
6
+ __version__: str = "2.0.1"
7
7
  __openapi_doc_version__: str = "2023-06-01"
8
- __gen_version__: str = "2.640.2"
8
+ __gen_version__: str = "2.656.5"
9
9
  __user_agent__: str = (
10
- "speakeasy-sdk/python 2.0.0 2.640.2 2023-06-01 latitudesh-python-sdk"
10
+ "speakeasy-sdk/python 2.0.1 2.656.5 2023-06-01 latitudesh-python-sdk"
11
11
  )
12
12
 
13
13
  try:
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
5
5
  from latitudesh_python_sdk._hooks import HookContext
6
6
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
7
  from latitudesh_python_sdk.utils import get_security_from_env
8
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
9
  from typing import Any, Mapping, Optional, Union
9
10
 
10
11
 
@@ -76,26 +77,15 @@ class APIKeys(BaseSDK):
76
77
  )
77
78
 
78
79
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
79
- return utils.unmarshal_json(http_res.text, models.APIKey)
80
+ return unmarshal_json_response(models.APIKey, http_res)
80
81
  if utils.match_response(http_res, "4XX", "*"):
81
82
  http_res_text = utils.stream_to_text(http_res)
82
- raise models.APIError(
83
- "API error occurred", http_res.status_code, http_res_text, http_res
84
- )
83
+ raise models.APIError("API error occurred", http_res, http_res_text)
85
84
  if utils.match_response(http_res, "5XX", "*"):
86
85
  http_res_text = utils.stream_to_text(http_res)
87
- raise models.APIError(
88
- "API error occurred", http_res.status_code, http_res_text, http_res
89
- )
90
-
91
- content_type = http_res.headers.get("Content-Type")
92
- http_res_text = utils.stream_to_text(http_res)
93
- raise models.APIError(
94
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
95
- http_res.status_code,
96
- http_res_text,
97
- http_res,
98
- )
86
+ raise models.APIError("API error occurred", http_res, http_res_text)
87
+
88
+ raise models.APIError("Unexpected response received", http_res)
99
89
 
100
90
  async def list_async(
101
91
  self,
@@ -164,26 +154,15 @@ class APIKeys(BaseSDK):
164
154
  )
165
155
 
166
156
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
167
- return utils.unmarshal_json(http_res.text, models.APIKey)
157
+ return unmarshal_json_response(models.APIKey, http_res)
168
158
  if utils.match_response(http_res, "4XX", "*"):
169
159
  http_res_text = await utils.stream_to_text_async(http_res)
170
- raise models.APIError(
171
- "API error occurred", http_res.status_code, http_res_text, http_res
172
- )
160
+ raise models.APIError("API error occurred", http_res, http_res_text)
173
161
  if utils.match_response(http_res, "5XX", "*"):
174
162
  http_res_text = await utils.stream_to_text_async(http_res)
175
- raise models.APIError(
176
- "API error occurred", http_res.status_code, http_res_text, http_res
177
- )
178
-
179
- content_type = http_res.headers.get("Content-Type")
180
- http_res_text = await utils.stream_to_text_async(http_res)
181
- raise models.APIError(
182
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
183
- http_res.status_code,
184
- http_res_text,
185
- http_res,
186
- )
163
+ raise models.APIError("API error occurred", http_res, http_res_text)
164
+
165
+ raise models.APIError("Unexpected response received", http_res)
187
166
 
188
167
  def create(
189
168
  self,
@@ -263,29 +242,18 @@ class APIKeys(BaseSDK):
263
242
 
264
243
  response_data: Any = None
265
244
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
266
- return utils.unmarshal_json(http_res.text, models.PostAPIKeyResponseBody)
245
+ return unmarshal_json_response(models.PostAPIKeyResponseBody, http_res)
267
246
  if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
268
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
269
- raise models.ErrorObject(data=response_data)
247
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
248
+ raise models.ErrorObject(response_data, http_res)
270
249
  if utils.match_response(http_res, "4XX", "*"):
271
250
  http_res_text = utils.stream_to_text(http_res)
272
- raise models.APIError(
273
- "API error occurred", http_res.status_code, http_res_text, http_res
274
- )
251
+ raise models.APIError("API error occurred", http_res, http_res_text)
275
252
  if utils.match_response(http_res, "5XX", "*"):
276
253
  http_res_text = utils.stream_to_text(http_res)
277
- raise models.APIError(
278
- "API error occurred", http_res.status_code, http_res_text, http_res
279
- )
280
-
281
- content_type = http_res.headers.get("Content-Type")
282
- http_res_text = utils.stream_to_text(http_res)
283
- raise models.APIError(
284
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
285
- http_res.status_code,
286
- http_res_text,
287
- http_res,
288
- )
254
+ raise models.APIError("API error occurred", http_res, http_res_text)
255
+
256
+ raise models.APIError("Unexpected response received", http_res)
289
257
 
290
258
  async def create_async(
291
259
  self,
@@ -365,29 +333,18 @@ class APIKeys(BaseSDK):
365
333
 
366
334
  response_data: Any = None
367
335
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
368
- return utils.unmarshal_json(http_res.text, models.PostAPIKeyResponseBody)
336
+ return unmarshal_json_response(models.PostAPIKeyResponseBody, http_res)
369
337
  if utils.match_response(http_res, ["400", "422"], "application/vnd.api+json"):
370
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
371
- raise models.ErrorObject(data=response_data)
338
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
339
+ raise models.ErrorObject(response_data, http_res)
372
340
  if utils.match_response(http_res, "4XX", "*"):
373
341
  http_res_text = await utils.stream_to_text_async(http_res)
374
- raise models.APIError(
375
- "API error occurred", http_res.status_code, http_res_text, http_res
376
- )
342
+ raise models.APIError("API error occurred", http_res, http_res_text)
377
343
  if utils.match_response(http_res, "5XX", "*"):
378
344
  http_res_text = await utils.stream_to_text_async(http_res)
379
- raise models.APIError(
380
- "API error occurred", http_res.status_code, http_res_text, http_res
381
- )
382
-
383
- content_type = http_res.headers.get("Content-Type")
384
- http_res_text = await utils.stream_to_text_async(http_res)
385
- raise models.APIError(
386
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
387
- http_res.status_code,
388
- http_res_text,
389
- http_res,
390
- )
345
+ raise models.APIError("API error occurred", http_res, http_res_text)
346
+
347
+ raise models.APIError("Unexpected response received", http_res)
391
348
 
392
349
  def regenerate(
393
350
  self,
@@ -474,29 +431,18 @@ class APIKeys(BaseSDK):
474
431
 
475
432
  response_data: Any = None
476
433
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
477
- return utils.unmarshal_json(http_res.text, models.UpdateAPIKeyResponseBody)
434
+ return unmarshal_json_response(models.UpdateAPIKeyResponseBody, http_res)
478
435
  if utils.match_response(http_res, ["400", "404"], "application/vnd.api+json"):
479
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
480
- raise models.ErrorObject(data=response_data)
436
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
437
+ raise models.ErrorObject(response_data, http_res)
481
438
  if utils.match_response(http_res, "4XX", "*"):
482
439
  http_res_text = utils.stream_to_text(http_res)
483
- raise models.APIError(
484
- "API error occurred", http_res.status_code, http_res_text, http_res
485
- )
440
+ raise models.APIError("API error occurred", http_res, http_res_text)
486
441
  if utils.match_response(http_res, "5XX", "*"):
487
442
  http_res_text = utils.stream_to_text(http_res)
488
- raise models.APIError(
489
- "API error occurred", http_res.status_code, http_res_text, http_res
490
- )
491
-
492
- content_type = http_res.headers.get("Content-Type")
493
- http_res_text = utils.stream_to_text(http_res)
494
- raise models.APIError(
495
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
496
- http_res.status_code,
497
- http_res_text,
498
- http_res,
499
- )
443
+ raise models.APIError("API error occurred", http_res, http_res_text)
444
+
445
+ raise models.APIError("Unexpected response received", http_res)
500
446
 
501
447
  async def regenerate_async(
502
448
  self,
@@ -583,29 +529,18 @@ class APIKeys(BaseSDK):
583
529
 
584
530
  response_data: Any = None
585
531
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
586
- return utils.unmarshal_json(http_res.text, models.UpdateAPIKeyResponseBody)
532
+ return unmarshal_json_response(models.UpdateAPIKeyResponseBody, http_res)
587
533
  if utils.match_response(http_res, ["400", "404"], "application/vnd.api+json"):
588
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
589
- raise models.ErrorObject(data=response_data)
534
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
535
+ raise models.ErrorObject(response_data, http_res)
590
536
  if utils.match_response(http_res, "4XX", "*"):
591
537
  http_res_text = await utils.stream_to_text_async(http_res)
592
- raise models.APIError(
593
- "API error occurred", http_res.status_code, http_res_text, http_res
594
- )
538
+ raise models.APIError("API error occurred", http_res, http_res_text)
595
539
  if utils.match_response(http_res, "5XX", "*"):
596
540
  http_res_text = await utils.stream_to_text_async(http_res)
597
- raise models.APIError(
598
- "API error occurred", http_res.status_code, http_res_text, http_res
599
- )
600
-
601
- content_type = http_res.headers.get("Content-Type")
602
- http_res_text = await utils.stream_to_text_async(http_res)
603
- raise models.APIError(
604
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
605
- http_res.status_code,
606
- http_res_text,
607
- http_res,
608
- )
541
+ raise models.APIError("API error occurred", http_res, http_res_text)
542
+
543
+ raise models.APIError("Unexpected response received", http_res)
609
544
 
610
545
  def delete(
611
546
  self,
@@ -684,27 +619,16 @@ class APIKeys(BaseSDK):
684
619
  if utils.match_response(http_res, "200", "*"):
685
620
  return
686
621
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
687
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
688
- raise models.ErrorObject(data=response_data)
622
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
623
+ raise models.ErrorObject(response_data, http_res)
689
624
  if utils.match_response(http_res, "4XX", "*"):
690
625
  http_res_text = utils.stream_to_text(http_res)
691
- raise models.APIError(
692
- "API error occurred", http_res.status_code, http_res_text, http_res
693
- )
626
+ raise models.APIError("API error occurred", http_res, http_res_text)
694
627
  if utils.match_response(http_res, "5XX", "*"):
695
628
  http_res_text = utils.stream_to_text(http_res)
696
- raise models.APIError(
697
- "API error occurred", http_res.status_code, http_res_text, http_res
698
- )
699
-
700
- content_type = http_res.headers.get("Content-Type")
701
- http_res_text = utils.stream_to_text(http_res)
702
- raise models.APIError(
703
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
704
- http_res.status_code,
705
- http_res_text,
706
- http_res,
707
- )
629
+ raise models.APIError("API error occurred", http_res, http_res_text)
630
+
631
+ raise models.APIError("Unexpected response received", http_res)
708
632
 
709
633
  async def delete_async(
710
634
  self,
@@ -783,24 +707,13 @@ class APIKeys(BaseSDK):
783
707
  if utils.match_response(http_res, "200", "*"):
784
708
  return
785
709
  if utils.match_response(http_res, "404", "application/vnd.api+json"):
786
- response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
787
- raise models.ErrorObject(data=response_data)
710
+ response_data = unmarshal_json_response(models.ErrorObjectData, http_res)
711
+ raise models.ErrorObject(response_data, http_res)
788
712
  if utils.match_response(http_res, "4XX", "*"):
789
713
  http_res_text = await utils.stream_to_text_async(http_res)
790
- raise models.APIError(
791
- "API error occurred", http_res.status_code, http_res_text, http_res
792
- )
714
+ raise models.APIError("API error occurred", http_res, http_res_text)
793
715
  if utils.match_response(http_res, "5XX", "*"):
794
716
  http_res_text = await utils.stream_to_text_async(http_res)
795
- raise models.APIError(
796
- "API error occurred", http_res.status_code, http_res_text, http_res
797
- )
798
-
799
- content_type = http_res.headers.get("Content-Type")
800
- http_res_text = await utils.stream_to_text_async(http_res)
801
- raise models.APIError(
802
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
803
- http_res.status_code,
804
- http_res_text,
805
- http_res,
806
- )
717
+ raise models.APIError("API error occurred", http_res, http_res_text)
718
+
719
+ raise models.APIError("Unexpected response received", http_res)
@@ -248,7 +248,7 @@ class BaseSDK:
248
248
 
249
249
  if http_res is None:
250
250
  logger.debug("Raising no response SDK error")
251
- raise models.APIError("No response received")
251
+ raise models.NoResponseError("No response received")
252
252
 
253
253
  logger.debug(
254
254
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -269,7 +269,7 @@ class BaseSDK:
269
269
  http_res = result
270
270
  else:
271
271
  logger.debug("Raising unexpected SDK error")
272
- raise models.APIError("Unexpected error occurred")
272
+ raise models.APIError("Unexpected error occurred", http_res)
273
273
 
274
274
  return http_res
275
275
 
@@ -320,7 +320,7 @@ class BaseSDK:
320
320
 
321
321
  if http_res is None:
322
322
  logger.debug("Raising no response SDK error")
323
- raise models.APIError("No response received")
323
+ raise models.NoResponseError("No response received")
324
324
 
325
325
  logger.debug(
326
326
  "Response:\nStatus Code: %s\nURL: %s\nHeaders: %s\nBody: %s",
@@ -341,7 +341,7 @@ class BaseSDK:
341
341
  http_res = result
342
342
  else:
343
343
  logger.debug("Raising unexpected SDK error")
344
- raise models.APIError("Unexpected error occurred")
344
+ raise models.APIError("Unexpected error occurred", http_res)
345
345
 
346
346
  return http_res
347
347
 
@@ -5,6 +5,7 @@ from latitudesh_python_sdk import models, utils
5
5
  from latitudesh_python_sdk._hooks import HookContext
6
6
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
7
  from latitudesh_python_sdk.utils import get_security_from_env
8
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
8
9
  from typing import List, Mapping, Optional
9
10
 
10
11
 
@@ -89,26 +90,15 @@ class Billing(BaseSDK):
89
90
  )
90
91
 
91
92
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
92
- return utils.unmarshal_json(http_res.text, models.BillingUsage)
93
+ return unmarshal_json_response(models.BillingUsage, http_res)
93
94
  if utils.match_response(http_res, "4XX", "*"):
94
95
  http_res_text = utils.stream_to_text(http_res)
95
- raise models.APIError(
96
- "API error occurred", http_res.status_code, http_res_text, http_res
97
- )
96
+ raise models.APIError("API error occurred", http_res, http_res_text)
98
97
  if utils.match_response(http_res, "5XX", "*"):
99
98
  http_res_text = utils.stream_to_text(http_res)
100
- raise models.APIError(
101
- "API error occurred", http_res.status_code, http_res_text, http_res
102
- )
103
-
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
- )
99
+ raise models.APIError("API error occurred", http_res, http_res_text)
100
+
101
+ raise models.APIError("Unexpected response received", http_res)
112
102
 
113
103
  async def list_usage_async(
114
104
  self,
@@ -190,23 +180,12 @@ class Billing(BaseSDK):
190
180
  )
191
181
 
192
182
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
193
- return utils.unmarshal_json(http_res.text, models.BillingUsage)
183
+ return unmarshal_json_response(models.BillingUsage, http_res)
194
184
  if utils.match_response(http_res, "4XX", "*"):
195
185
  http_res_text = await utils.stream_to_text_async(http_res)
196
- raise models.APIError(
197
- "API error occurred", http_res.status_code, http_res_text, http_res
198
- )
186
+ raise models.APIError("API error occurred", http_res, http_res_text)
199
187
  if utils.match_response(http_res, "5XX", "*"):
200
188
  http_res_text = await utils.stream_to_text_async(http_res)
201
- raise models.APIError(
202
- "API error occurred", http_res.status_code, http_res_text, http_res
203
- )
204
-
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
- )
189
+ raise models.APIError("API error occurred", http_res, http_res_text)
190
+
191
+ raise models.APIError("Unexpected response received", http_res)
@@ -6,6 +6,7 @@ from latitudesh_python_sdk import models, utils
6
6
  from latitudesh_python_sdk._hooks import HookContext
7
7
  from latitudesh_python_sdk.types import OptionalNullable, UNSET
8
8
  from latitudesh_python_sdk.utils import get_security_from_env
9
+ from latitudesh_python_sdk.utils.unmarshal_json_response import unmarshal_json_response
9
10
  from typing import Any, Dict, List, Mapping, Optional, Union
10
11
 
11
12
 
@@ -140,30 +141,17 @@ class EventsSDK(BaseSDK):
140
141
 
141
142
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
142
143
  return models.GetEventsResponse(
143
- result=utils.unmarshal_json(
144
- http_res.text, models.GetEventsResponseBody
145
- ),
144
+ result=unmarshal_json_response(models.GetEventsResponseBody, http_res),
146
145
  next=next_func,
147
146
  )
148
147
  if utils.match_response(http_res, "4XX", "*"):
149
148
  http_res_text = utils.stream_to_text(http_res)
150
- raise models.APIError(
151
- "API error occurred", http_res.status_code, http_res_text, http_res
152
- )
149
+ raise models.APIError("API error occurred", http_res, http_res_text)
153
150
  if utils.match_response(http_res, "5XX", "*"):
154
151
  http_res_text = utils.stream_to_text(http_res)
155
- raise models.APIError(
156
- "API error occurred", http_res.status_code, http_res_text, http_res
157
- )
152
+ raise models.APIError("API error occurred", http_res, http_res_text)
158
153
 
159
- content_type = http_res.headers.get("Content-Type")
160
- http_res_text = utils.stream_to_text(http_res)
161
- raise models.APIError(
162
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
163
- http_res.status_code,
164
- http_res_text,
165
- http_res,
166
- )
154
+ raise models.APIError("Unexpected response received", http_res)
167
155
 
168
156
  async def list_async(
169
157
  self,
@@ -295,27 +283,14 @@ class EventsSDK(BaseSDK):
295
283
 
296
284
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
297
285
  return models.GetEventsResponse(
298
- result=utils.unmarshal_json(
299
- http_res.text, models.GetEventsResponseBody
300
- ),
286
+ result=unmarshal_json_response(models.GetEventsResponseBody, http_res),
301
287
  next=next_func,
302
288
  )
303
289
  if utils.match_response(http_res, "4XX", "*"):
304
290
  http_res_text = await utils.stream_to_text_async(http_res)
305
- raise models.APIError(
306
- "API error occurred", http_res.status_code, http_res_text, http_res
307
- )
291
+ raise models.APIError("API error occurred", http_res, http_res_text)
308
292
  if utils.match_response(http_res, "5XX", "*"):
309
293
  http_res_text = await utils.stream_to_text_async(http_res)
310
- raise models.APIError(
311
- "API error occurred", http_res.status_code, http_res_text, http_res
312
- )
294
+ raise models.APIError("API error occurred", http_res, http_res_text)
313
295
 
314
- content_type = http_res.headers.get("Content-Type")
315
- http_res_text = await utils.stream_to_text_async(http_res)
316
- raise models.APIError(
317
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
318
- http_res.status_code,
319
- http_res_text,
320
- http_res,
321
- )
296
+ raise models.APIError("Unexpected response received", http_res)