latitudesh-python-sdk 1.1.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 (93) hide show
  1. latitudesh_python_sdk/_hooks/types.py +7 -0
  2. latitudesh_python_sdk/_version.py +6 -4
  3. latitudesh_python_sdk/apikeys.py +73 -156
  4. latitudesh_python_sdk/basesdk.py +16 -24
  5. latitudesh_python_sdk/billing.py +13 -32
  6. latitudesh_python_sdk/events_sdk.py +11 -34
  7. latitudesh_python_sdk/firewalls_sdk.py +105 -264
  8. latitudesh_python_sdk/httpclient.py +6 -16
  9. latitudesh_python_sdk/ipaddresses_sdk.py +29 -68
  10. latitudesh_python_sdk/models/__init__.py +2586 -1126
  11. latitudesh_python_sdk/models/apierror.py +30 -14
  12. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +2 -2
  13. latitudesh_python_sdk/models/{bandwidth_plan.py → bandwidth_plan_data.py} +9 -9
  14. latitudesh_python_sdk/models/bandwidth_plans.py +14 -3
  15. latitudesh_python_sdk/models/custom_tag.py +15 -0
  16. latitudesh_python_sdk/models/custom_tag_data.py +54 -0
  17. latitudesh_python_sdk/models/custom_tags.py +26 -0
  18. latitudesh_python_sdk/models/delete_ssh_keyop.py +16 -0
  19. latitudesh_python_sdk/models/delete_user_dataop.py +16 -0
  20. latitudesh_python_sdk/models/deploy_config.py +11 -6
  21. latitudesh_python_sdk/models/error_object.py +11 -6
  22. latitudesh_python_sdk/models/event_data.py +98 -0
  23. latitudesh_python_sdk/models/events.py +16 -1
  24. latitudesh_python_sdk/models/filesystem_data.py +4 -0
  25. latitudesh_python_sdk/models/firewall.py +15 -0
  26. latitudesh_python_sdk/models/firewall_assignment_data.py +50 -0
  27. latitudesh_python_sdk/models/firewall_assignments.py +29 -0
  28. latitudesh_python_sdk/models/firewall_data.py +71 -0
  29. latitudesh_python_sdk/models/firewall_server.py +4 -1
  30. latitudesh_python_sdk/models/firewalls.py +7 -7
  31. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +3 -3
  32. latitudesh_python_sdk/models/get_ssh_keyop.py +30 -0
  33. latitudesh_python_sdk/models/get_ssh_keysop.py +22 -0
  34. latitudesh_python_sdk/models/get_traffic_consumptionop.py +8 -4
  35. latitudesh_python_sdk/models/get_user_dataop.py +31 -0
  36. latitudesh_python_sdk/models/get_users_dataop.py +35 -0
  37. latitudesh_python_sdk/models/latitudesherror.py +26 -0
  38. latitudesh_python_sdk/models/no_response_error.py +13 -0
  39. latitudesh_python_sdk/models/operating_system_data.py +65 -0
  40. latitudesh_python_sdk/models/operating_systems.py +15 -0
  41. latitudesh_python_sdk/models/out_of_band_connection.py +4 -4
  42. latitudesh_python_sdk/models/patch_user_dataop.py +69 -0
  43. latitudesh_python_sdk/models/post_ssh_keyop.py +58 -0
  44. latitudesh_python_sdk/models/post_user_dataop.py +45 -0
  45. latitudesh_python_sdk/models/project_include.py +3 -0
  46. latitudesh_python_sdk/models/put_ssh_keyop.py +80 -0
  47. latitudesh_python_sdk/models/region_resource_data.py +4 -4
  48. latitudesh_python_sdk/models/responsevalidationerror.py +25 -0
  49. latitudesh_python_sdk/models/role.py +11 -0
  50. latitudesh_python_sdk/models/server.py +11 -6
  51. latitudesh_python_sdk/models/server_data.py +14 -3
  52. latitudesh_python_sdk/models/server_region_resource_data.py +40 -0
  53. latitudesh_python_sdk/models/{ssh_key.py → ssh_keys.py} +13 -2
  54. latitudesh_python_sdk/models/storage_plan_data.py +47 -0
  55. latitudesh_python_sdk/models/storage_plans.py +14 -3
  56. latitudesh_python_sdk/models/update_serverop.py +58 -10
  57. latitudesh_python_sdk/models/user_data.py +11 -0
  58. latitudesh_python_sdk/models/virtual_network.py +30 -6
  59. latitudesh_python_sdk/models/virtual_network1.py +15 -0
  60. latitudesh_python_sdk/models/virtual_network_assignment.py +41 -0
  61. latitudesh_python_sdk/models/virtual_network_assignment_data.py +68 -0
  62. latitudesh_python_sdk/models/virtual_network_assignments.py +5 -5
  63. latitudesh_python_sdk/models/virtual_network_data.py +88 -0
  64. latitudesh_python_sdk/models/virtual_networks.py +3 -3
  65. latitudesh_python_sdk/operatingsystems_sdk.py +13 -32
  66. latitudesh_python_sdk/plans.py +99 -214
  67. latitudesh_python_sdk/privatenetworks.py +131 -290
  68. latitudesh_python_sdk/projects_sdk.py +79 -158
  69. latitudesh_python_sdk/regions_sdk.py +25 -66
  70. latitudesh_python_sdk/roles.py +25 -64
  71. latitudesh_python_sdk/sdk.py +110 -73
  72. latitudesh_python_sdk/sdkconfiguration.py +0 -7
  73. latitudesh_python_sdk/servers_sdk.py +305 -646
  74. latitudesh_python_sdk/sshkeys_sdk.py +1856 -0
  75. latitudesh_python_sdk/storage.py +41 -120
  76. latitudesh_python_sdk/tags.py +67 -146
  77. latitudesh_python_sdk/teams_sdk.py +41 -100
  78. latitudesh_python_sdk/teamsmembers.py +37 -96
  79. latitudesh_python_sdk/traffic_sdk.py +37 -76
  80. latitudesh_python_sdk/userdata_sdk.py +959 -149
  81. latitudesh_python_sdk/userprofile.py +37 -100
  82. latitudesh_python_sdk/utils/__init__.py +131 -46
  83. latitudesh_python_sdk/utils/forms.py +49 -28
  84. latitudesh_python_sdk/utils/serializers.py +3 -2
  85. latitudesh_python_sdk/utils/unmarshal_json_response.py +24 -0
  86. latitudesh_python_sdk/virtualmachines.py +71 -140
  87. latitudesh_python_sdk/vpnsessions.py +93 -172
  88. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/METADATA +76 -43
  89. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/RECORD +91 -67
  90. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/WHEEL +1 -1
  91. latitudesh_python_sdk/models/storage_plan.py +0 -36
  92. latitudesh_python_sdk/sshkeys.py +0 -1050
  93. {latitudesh_python_sdk-1.1.0.dist-info → latitudesh_python_sdk-2.0.1.dist-info}/LICENSE +0 -0
@@ -5,10 +5,15 @@ 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 Mapping, Optional, Union
10
+ from typing_extensions import deprecated
9
11
 
10
12
 
11
13
  class UserDataSDK(BaseSDK):
14
+ @deprecated(
15
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
16
+ )
12
17
  def list_project_user_data(
13
18
  self,
14
19
  *,
@@ -72,6 +77,7 @@ class UserDataSDK(BaseSDK):
72
77
 
73
78
  http_res = self.do_request(
74
79
  hook_ctx=HookContext(
80
+ config=self.sdk_configuration,
75
81
  base_url=base_url or "",
76
82
  operation_id="get-project-users-data",
77
83
  oauth2_scopes=[],
@@ -85,29 +91,21 @@ class UserDataSDK(BaseSDK):
85
91
  )
86
92
 
87
93
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
88
- return utils.unmarshal_json(
89
- http_res.text, models.GetProjectUsersDataResponseBody
94
+ return unmarshal_json_response(
95
+ models.GetProjectUsersDataResponseBody, http_res
90
96
  )
91
97
  if utils.match_response(http_res, ["404", "4XX"], "*"):
92
98
  http_res_text = utils.stream_to_text(http_res)
93
- raise models.APIError(
94
- "API error occurred", http_res.status_code, http_res_text, http_res
95
- )
99
+ raise models.APIError("API error occurred", http_res, http_res_text)
96
100
  if utils.match_response(http_res, "5XX", "*"):
97
101
  http_res_text = utils.stream_to_text(http_res)
98
- raise models.APIError(
99
- "API error occurred", http_res.status_code, http_res_text, http_res
100
- )
102
+ raise models.APIError("API error occurred", http_res, http_res_text)
101
103
 
102
- content_type = http_res.headers.get("Content-Type")
103
- http_res_text = utils.stream_to_text(http_res)
104
- raise models.APIError(
105
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
106
- http_res.status_code,
107
- http_res_text,
108
- http_res,
109
- )
104
+ raise models.APIError("Unexpected response received", http_res)
110
105
 
106
+ @deprecated(
107
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
108
+ )
111
109
  async def list_project_user_data_async(
112
110
  self,
113
111
  *,
@@ -171,6 +169,7 @@ class UserDataSDK(BaseSDK):
171
169
 
172
170
  http_res = await self.do_request_async(
173
171
  hook_ctx=HookContext(
172
+ config=self.sdk_configuration,
174
173
  base_url=base_url or "",
175
174
  operation_id="get-project-users-data",
176
175
  oauth2_scopes=[],
@@ -184,29 +183,21 @@ class UserDataSDK(BaseSDK):
184
183
  )
185
184
 
186
185
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
187
- return utils.unmarshal_json(
188
- http_res.text, models.GetProjectUsersDataResponseBody
186
+ return unmarshal_json_response(
187
+ models.GetProjectUsersDataResponseBody, http_res
189
188
  )
190
189
  if utils.match_response(http_res, ["404", "4XX"], "*"):
191
190
  http_res_text = await utils.stream_to_text_async(http_res)
192
- raise models.APIError(
193
- "API error occurred", http_res.status_code, http_res_text, http_res
194
- )
191
+ raise models.APIError("API error occurred", http_res, http_res_text)
195
192
  if utils.match_response(http_res, "5XX", "*"):
196
193
  http_res_text = await utils.stream_to_text_async(http_res)
197
- raise models.APIError(
198
- "API error occurred", http_res.status_code, http_res_text, http_res
199
- )
194
+ raise models.APIError("API error occurred", http_res, http_res_text)
200
195
 
201
- content_type = http_res.headers.get("Content-Type")
202
- http_res_text = await utils.stream_to_text_async(http_res)
203
- raise models.APIError(
204
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
205
- http_res.status_code,
206
- http_res_text,
207
- http_res,
208
- )
196
+ raise models.APIError("Unexpected response received", http_res)
209
197
 
198
+ @deprecated(
199
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
200
+ )
210
201
  def create(
211
202
  self,
212
203
  *,
@@ -284,6 +275,7 @@ class UserDataSDK(BaseSDK):
284
275
 
285
276
  http_res = self.do_request(
286
277
  hook_ctx=HookContext(
278
+ config=self.sdk_configuration,
287
279
  base_url=base_url or "",
288
280
  operation_id="post-project-user-data",
289
281
  oauth2_scopes=[],
@@ -297,27 +289,19 @@ class UserDataSDK(BaseSDK):
297
289
  )
298
290
 
299
291
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
300
- return utils.unmarshal_json(http_res.text, models.UserData)
292
+ return unmarshal_json_response(models.UserData, http_res)
301
293
  if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"):
302
294
  http_res_text = utils.stream_to_text(http_res)
303
- raise models.APIError(
304
- "API error occurred", http_res.status_code, http_res_text, http_res
305
- )
295
+ raise models.APIError("API error occurred", http_res, http_res_text)
306
296
  if utils.match_response(http_res, "5XX", "*"):
307
297
  http_res_text = utils.stream_to_text(http_res)
308
- raise models.APIError(
309
- "API error occurred", http_res.status_code, http_res_text, http_res
310
- )
298
+ raise models.APIError("API error occurred", http_res, http_res_text)
311
299
 
312
- content_type = http_res.headers.get("Content-Type")
313
- http_res_text = utils.stream_to_text(http_res)
314
- raise models.APIError(
315
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
316
- http_res.status_code,
317
- http_res_text,
318
- http_res,
319
- )
300
+ raise models.APIError("Unexpected response received", http_res)
320
301
 
302
+ @deprecated(
303
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
304
+ )
321
305
  async def create_async(
322
306
  self,
323
307
  *,
@@ -395,6 +379,7 @@ class UserDataSDK(BaseSDK):
395
379
 
396
380
  http_res = await self.do_request_async(
397
381
  hook_ctx=HookContext(
382
+ config=self.sdk_configuration,
398
383
  base_url=base_url or "",
399
384
  operation_id="post-project-user-data",
400
385
  oauth2_scopes=[],
@@ -408,27 +393,19 @@ class UserDataSDK(BaseSDK):
408
393
  )
409
394
 
410
395
  if utils.match_response(http_res, "201", "application/vnd.api+json"):
411
- return utils.unmarshal_json(http_res.text, models.UserData)
396
+ return unmarshal_json_response(models.UserData, http_res)
412
397
  if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"):
413
398
  http_res_text = await utils.stream_to_text_async(http_res)
414
- raise models.APIError(
415
- "API error occurred", http_res.status_code, http_res_text, http_res
416
- )
399
+ raise models.APIError("API error occurred", http_res, http_res_text)
417
400
  if utils.match_response(http_res, "5XX", "*"):
418
401
  http_res_text = await utils.stream_to_text_async(http_res)
419
- raise models.APIError(
420
- "API error occurred", http_res.status_code, http_res_text, http_res
421
- )
402
+ raise models.APIError("API error occurred", http_res, http_res_text)
422
403
 
423
- content_type = http_res.headers.get("Content-Type")
424
- http_res_text = await utils.stream_to_text_async(http_res)
425
- raise models.APIError(
426
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
427
- http_res.status_code,
428
- http_res_text,
429
- http_res,
430
- )
404
+ raise models.APIError("Unexpected response received", http_res)
431
405
 
406
+ @deprecated(
407
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
408
+ )
432
409
  def get_project_user_data(
433
410
  self,
434
411
  *,
@@ -495,6 +472,7 @@ class UserDataSDK(BaseSDK):
495
472
 
496
473
  http_res = self.do_request(
497
474
  hook_ctx=HookContext(
475
+ config=self.sdk_configuration,
498
476
  base_url=base_url or "",
499
477
  operation_id="get-project-user-data",
500
478
  oauth2_scopes=[],
@@ -508,27 +486,19 @@ class UserDataSDK(BaseSDK):
508
486
  )
509
487
 
510
488
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
511
- return utils.unmarshal_json(http_res.text, models.UserData)
489
+ return unmarshal_json_response(models.UserData, http_res)
512
490
  if utils.match_response(http_res, ["404", "4XX"], "*"):
513
491
  http_res_text = utils.stream_to_text(http_res)
514
- raise models.APIError(
515
- "API error occurred", http_res.status_code, http_res_text, http_res
516
- )
492
+ raise models.APIError("API error occurred", http_res, http_res_text)
517
493
  if utils.match_response(http_res, "5XX", "*"):
518
494
  http_res_text = utils.stream_to_text(http_res)
519
- raise models.APIError(
520
- "API error occurred", http_res.status_code, http_res_text, http_res
521
- )
495
+ raise models.APIError("API error occurred", http_res, http_res_text)
522
496
 
523
- content_type = http_res.headers.get("Content-Type")
524
- http_res_text = utils.stream_to_text(http_res)
525
- raise models.APIError(
526
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
527
- http_res.status_code,
528
- http_res_text,
529
- http_res,
530
- )
497
+ raise models.APIError("Unexpected response received", http_res)
531
498
 
499
+ @deprecated(
500
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
501
+ )
532
502
  async def get_project_user_data_async(
533
503
  self,
534
504
  *,
@@ -595,6 +565,7 @@ class UserDataSDK(BaseSDK):
595
565
 
596
566
  http_res = await self.do_request_async(
597
567
  hook_ctx=HookContext(
568
+ config=self.sdk_configuration,
598
569
  base_url=base_url or "",
599
570
  operation_id="get-project-user-data",
600
571
  oauth2_scopes=[],
@@ -608,27 +579,19 @@ class UserDataSDK(BaseSDK):
608
579
  )
609
580
 
610
581
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
611
- return utils.unmarshal_json(http_res.text, models.UserData)
582
+ return unmarshal_json_response(models.UserData, http_res)
612
583
  if utils.match_response(http_res, ["404", "4XX"], "*"):
613
584
  http_res_text = await utils.stream_to_text_async(http_res)
614
- raise models.APIError(
615
- "API error occurred", http_res.status_code, http_res_text, http_res
616
- )
585
+ raise models.APIError("API error occurred", http_res, http_res_text)
617
586
  if utils.match_response(http_res, "5XX", "*"):
618
587
  http_res_text = await utils.stream_to_text_async(http_res)
619
- raise models.APIError(
620
- "API error occurred", http_res.status_code, http_res_text, http_res
621
- )
588
+ raise models.APIError("API error occurred", http_res, http_res_text)
622
589
 
623
- content_type = http_res.headers.get("Content-Type")
624
- http_res_text = await utils.stream_to_text_async(http_res)
625
- raise models.APIError(
626
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
627
- http_res.status_code,
628
- http_res_text,
629
- http_res,
630
- )
590
+ raise models.APIError("Unexpected response received", http_res)
631
591
 
592
+ @deprecated(
593
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
594
+ )
632
595
  def update(
633
596
  self,
634
597
  *,
@@ -709,6 +672,7 @@ class UserDataSDK(BaseSDK):
709
672
 
710
673
  http_res = self.do_request(
711
674
  hook_ctx=HookContext(
675
+ config=self.sdk_configuration,
712
676
  base_url=base_url or "",
713
677
  operation_id="put-project-user-data",
714
678
  oauth2_scopes=[],
@@ -722,27 +686,19 @@ class UserDataSDK(BaseSDK):
722
686
  )
723
687
 
724
688
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
725
- return utils.unmarshal_json(http_res.text, models.UserData)
689
+ return unmarshal_json_response(models.UserData, http_res)
726
690
  if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"):
727
691
  http_res_text = utils.stream_to_text(http_res)
728
- raise models.APIError(
729
- "API error occurred", http_res.status_code, http_res_text, http_res
730
- )
692
+ raise models.APIError("API error occurred", http_res, http_res_text)
731
693
  if utils.match_response(http_res, "5XX", "*"):
732
694
  http_res_text = utils.stream_to_text(http_res)
733
- raise models.APIError(
734
- "API error occurred", http_res.status_code, http_res_text, http_res
735
- )
695
+ raise models.APIError("API error occurred", http_res, http_res_text)
736
696
 
737
- content_type = http_res.headers.get("Content-Type")
738
- http_res_text = utils.stream_to_text(http_res)
739
- raise models.APIError(
740
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
741
- http_res.status_code,
742
- http_res_text,
743
- http_res,
744
- )
697
+ raise models.APIError("Unexpected response received", http_res)
745
698
 
699
+ @deprecated(
700
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
701
+ )
746
702
  async def update_async(
747
703
  self,
748
704
  *,
@@ -823,6 +779,7 @@ class UserDataSDK(BaseSDK):
823
779
 
824
780
  http_res = await self.do_request_async(
825
781
  hook_ctx=HookContext(
782
+ config=self.sdk_configuration,
826
783
  base_url=base_url or "",
827
784
  operation_id="put-project-user-data",
828
785
  oauth2_scopes=[],
@@ -836,27 +793,19 @@ class UserDataSDK(BaseSDK):
836
793
  )
837
794
 
838
795
  if utils.match_response(http_res, "200", "application/vnd.api+json"):
839
- return utils.unmarshal_json(http_res.text, models.UserData)
796
+ return unmarshal_json_response(models.UserData, http_res)
840
797
  if utils.match_response(http_res, ["400", "404", "422", "4XX"], "*"):
841
798
  http_res_text = await utils.stream_to_text_async(http_res)
842
- raise models.APIError(
843
- "API error occurred", http_res.status_code, http_res_text, http_res
844
- )
799
+ raise models.APIError("API error occurred", http_res, http_res_text)
845
800
  if utils.match_response(http_res, "5XX", "*"):
846
801
  http_res_text = await utils.stream_to_text_async(http_res)
847
- raise models.APIError(
848
- "API error occurred", http_res.status_code, http_res_text, http_res
849
- )
802
+ raise models.APIError("API error occurred", http_res, http_res_text)
850
803
 
851
- content_type = http_res.headers.get("Content-Type")
852
- http_res_text = await utils.stream_to_text_async(http_res)
853
- raise models.APIError(
854
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
855
- http_res.status_code,
856
- http_res_text,
857
- http_res,
858
- )
804
+ raise models.APIError("Unexpected response received", http_res)
859
805
 
806
+ @deprecated(
807
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
808
+ )
860
809
  def delete(
861
810
  self,
862
811
  *,
@@ -920,6 +869,7 @@ class UserDataSDK(BaseSDK):
920
869
 
921
870
  http_res = self.do_request(
922
871
  hook_ctx=HookContext(
872
+ config=self.sdk_configuration,
923
873
  base_url=base_url or "",
924
874
  operation_id="delete-project-user-data",
925
875
  oauth2_scopes=[],
@@ -936,24 +886,16 @@ class UserDataSDK(BaseSDK):
936
886
  return
937
887
  if utils.match_response(http_res, ["404", "4XX"], "*"):
938
888
  http_res_text = utils.stream_to_text(http_res)
939
- raise models.APIError(
940
- "API error occurred", http_res.status_code, http_res_text, http_res
941
- )
889
+ raise models.APIError("API error occurred", http_res, http_res_text)
942
890
  if utils.match_response(http_res, "5XX", "*"):
943
891
  http_res_text = utils.stream_to_text(http_res)
944
- raise models.APIError(
945
- "API error occurred", http_res.status_code, http_res_text, http_res
946
- )
892
+ raise models.APIError("API error occurred", http_res, http_res_text)
947
893
 
948
- content_type = http_res.headers.get("Content-Type")
949
- http_res_text = utils.stream_to_text(http_res)
950
- raise models.APIError(
951
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
952
- http_res.status_code,
953
- http_res_text,
954
- http_res,
955
- )
894
+ raise models.APIError("Unexpected response received", http_res)
956
895
 
896
+ @deprecated(
897
+ "warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible."
898
+ )
957
899
  async def delete_async(
958
900
  self,
959
901
  *,
@@ -1017,6 +959,7 @@ class UserDataSDK(BaseSDK):
1017
959
 
1018
960
  http_res = await self.do_request_async(
1019
961
  hook_ctx=HookContext(
962
+ config=self.sdk_configuration,
1020
963
  base_url=base_url or "",
1021
964
  operation_id="delete-project-user-data",
1022
965
  oauth2_scopes=[],
@@ -1033,20 +976,887 @@ class UserDataSDK(BaseSDK):
1033
976
  return
1034
977
  if utils.match_response(http_res, ["404", "4XX"], "*"):
1035
978
  http_res_text = await utils.stream_to_text_async(http_res)
1036
- raise models.APIError(
1037
- "API error occurred", http_res.status_code, http_res_text, http_res
1038
- )
979
+ raise models.APIError("API error occurred", http_res, http_res_text)
1039
980
  if utils.match_response(http_res, "5XX", "*"):
1040
981
  http_res_text = await utils.stream_to_text_async(http_res)
1041
- raise models.APIError(
1042
- "API error occurred", http_res.status_code, http_res_text, http_res
1043
- )
982
+ raise models.APIError("API error occurred", http_res, http_res_text)
983
+
984
+ raise models.APIError("Unexpected response received", http_res)
985
+
986
+ def get_users_data(
987
+ self,
988
+ *,
989
+ extra_fields_user_data: Optional[str] = "decoded_content",
990
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
991
+ server_url: Optional[str] = None,
992
+ timeout_ms: Optional[int] = None,
993
+ http_headers: Optional[Mapping[str, str]] = None,
994
+ ) -> models.GetUsersDataResponseBody:
995
+ r"""List all User Data
996
+
997
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
998
+
999
+
1000
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1001
+ :param retries: Override the default retry configuration for this method
1002
+ :param server_url: Override the default server URL for this method
1003
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1004
+ :param http_headers: Additional headers to set or replace on requests.
1005
+ """
1006
+ base_url = None
1007
+ url_variables = None
1008
+ if timeout_ms is None:
1009
+ timeout_ms = self.sdk_configuration.timeout_ms
1010
+
1011
+ if server_url is not None:
1012
+ base_url = server_url
1013
+ else:
1014
+ base_url = self._get_url(base_url, url_variables)
1015
+
1016
+ request = models.GetUsersDataRequest(
1017
+ extra_fields_user_data=extra_fields_user_data,
1018
+ )
1019
+
1020
+ req = self._build_request(
1021
+ method="GET",
1022
+ path="/user_data",
1023
+ base_url=base_url,
1024
+ url_variables=url_variables,
1025
+ request=request,
1026
+ request_body_required=False,
1027
+ request_has_path_params=False,
1028
+ request_has_query_params=True,
1029
+ user_agent_header="user-agent",
1030
+ accept_header_value="application/vnd.api+json",
1031
+ http_headers=http_headers,
1032
+ security=self.sdk_configuration.security,
1033
+ timeout_ms=timeout_ms,
1034
+ )
1035
+
1036
+ if retries == UNSET:
1037
+ if self.sdk_configuration.retry_config is not UNSET:
1038
+ retries = self.sdk_configuration.retry_config
1039
+
1040
+ retry_config = None
1041
+ if isinstance(retries, utils.RetryConfig):
1042
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1043
+
1044
+ http_res = self.do_request(
1045
+ hook_ctx=HookContext(
1046
+ config=self.sdk_configuration,
1047
+ base_url=base_url or "",
1048
+ operation_id="get-users-data",
1049
+ oauth2_scopes=[],
1050
+ security_source=get_security_from_env(
1051
+ self.sdk_configuration.security, models.Security
1052
+ ),
1053
+ ),
1054
+ request=req,
1055
+ error_status_codes=["4XX", "5XX"],
1056
+ retry_config=retry_config,
1057
+ )
1058
+
1059
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1060
+ return unmarshal_json_response(models.GetUsersDataResponseBody, http_res)
1061
+ if utils.match_response(http_res, "4XX", "*"):
1062
+ http_res_text = utils.stream_to_text(http_res)
1063
+ raise models.APIError("API error occurred", http_res, http_res_text)
1064
+ if utils.match_response(http_res, "5XX", "*"):
1065
+ http_res_text = utils.stream_to_text(http_res)
1066
+ raise models.APIError("API error occurred", http_res, http_res_text)
1067
+
1068
+ raise models.APIError("Unexpected response received", http_res)
1069
+
1070
+ async def get_users_data_async(
1071
+ self,
1072
+ *,
1073
+ extra_fields_user_data: Optional[str] = "decoded_content",
1074
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1075
+ server_url: Optional[str] = None,
1076
+ timeout_ms: Optional[int] = None,
1077
+ http_headers: Optional[Mapping[str, str]] = None,
1078
+ ) -> models.GetUsersDataResponseBody:
1079
+ r"""List all User Data
1080
+
1081
+ List all Users Data in the project. These scripts can be used to configure servers with user data.
1082
+
1083
+
1084
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1085
+ :param retries: Override the default retry configuration for this method
1086
+ :param server_url: Override the default server URL for this method
1087
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1088
+ :param http_headers: Additional headers to set or replace on requests.
1089
+ """
1090
+ base_url = None
1091
+ url_variables = None
1092
+ if timeout_ms is None:
1093
+ timeout_ms = self.sdk_configuration.timeout_ms
1094
+
1095
+ if server_url is not None:
1096
+ base_url = server_url
1097
+ else:
1098
+ base_url = self._get_url(base_url, url_variables)
1099
+
1100
+ request = models.GetUsersDataRequest(
1101
+ extra_fields_user_data=extra_fields_user_data,
1102
+ )
1103
+
1104
+ req = self._build_request_async(
1105
+ method="GET",
1106
+ path="/user_data",
1107
+ base_url=base_url,
1108
+ url_variables=url_variables,
1109
+ request=request,
1110
+ request_body_required=False,
1111
+ request_has_path_params=False,
1112
+ request_has_query_params=True,
1113
+ user_agent_header="user-agent",
1114
+ accept_header_value="application/vnd.api+json",
1115
+ http_headers=http_headers,
1116
+ security=self.sdk_configuration.security,
1117
+ timeout_ms=timeout_ms,
1118
+ )
1119
+
1120
+ if retries == UNSET:
1121
+ if self.sdk_configuration.retry_config is not UNSET:
1122
+ retries = self.sdk_configuration.retry_config
1123
+
1124
+ retry_config = None
1125
+ if isinstance(retries, utils.RetryConfig):
1126
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1127
+
1128
+ http_res = await self.do_request_async(
1129
+ hook_ctx=HookContext(
1130
+ config=self.sdk_configuration,
1131
+ base_url=base_url or "",
1132
+ operation_id="get-users-data",
1133
+ oauth2_scopes=[],
1134
+ security_source=get_security_from_env(
1135
+ self.sdk_configuration.security, models.Security
1136
+ ),
1137
+ ),
1138
+ request=req,
1139
+ error_status_codes=["4XX", "5XX"],
1140
+ retry_config=retry_config,
1141
+ )
1142
+
1143
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1144
+ return unmarshal_json_response(models.GetUsersDataResponseBody, http_res)
1145
+ if utils.match_response(http_res, "4XX", "*"):
1146
+ http_res_text = await utils.stream_to_text_async(http_res)
1147
+ raise models.APIError("API error occurred", http_res, http_res_text)
1148
+ if utils.match_response(http_res, "5XX", "*"):
1149
+ http_res_text = await utils.stream_to_text_async(http_res)
1150
+ raise models.APIError("API error occurred", http_res, http_res_text)
1151
+
1152
+ raise models.APIError("Unexpected response received", http_res)
1153
+
1154
+ def post_user_data(
1155
+ self,
1156
+ *,
1157
+ data: Union[
1158
+ models.PostUserDataUserDataData, models.PostUserDataUserDataDataTypedDict
1159
+ ],
1160
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1161
+ server_url: Optional[str] = None,
1162
+ timeout_ms: Optional[int] = None,
1163
+ http_headers: Optional[Mapping[str, str]] = None,
1164
+ ) -> models.UserData:
1165
+ r"""Create an User Data
1166
+
1167
+ Allows you to create User Data in a team, which can be used to perform custom setup on your servers after deploy and reinstall.
1168
+
1169
+
1170
+ :param data:
1171
+ :param retries: Override the default retry configuration for this method
1172
+ :param server_url: Override the default server URL for this method
1173
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1174
+ :param http_headers: Additional headers to set or replace on requests.
1175
+ """
1176
+ base_url = None
1177
+ url_variables = None
1178
+ if timeout_ms is None:
1179
+ timeout_ms = self.sdk_configuration.timeout_ms
1180
+
1181
+ if server_url is not None:
1182
+ base_url = server_url
1183
+ else:
1184
+ base_url = self._get_url(base_url, url_variables)
1185
+
1186
+ request = models.PostUserDataUserDataRequestBody(
1187
+ data=utils.get_pydantic_model(data, models.PostUserDataUserDataData),
1188
+ )
1189
+
1190
+ req = self._build_request(
1191
+ method="POST",
1192
+ path="/user_data",
1193
+ base_url=base_url,
1194
+ url_variables=url_variables,
1195
+ request=request,
1196
+ request_body_required=True,
1197
+ request_has_path_params=False,
1198
+ request_has_query_params=True,
1199
+ user_agent_header="user-agent",
1200
+ accept_header_value="application/vnd.api+json",
1201
+ http_headers=http_headers,
1202
+ security=self.sdk_configuration.security,
1203
+ get_serialized_body=lambda: utils.serialize_request_body(
1204
+ request, False, False, "json", models.PostUserDataUserDataRequestBody
1205
+ ),
1206
+ timeout_ms=timeout_ms,
1207
+ )
1208
+
1209
+ if retries == UNSET:
1210
+ if self.sdk_configuration.retry_config is not UNSET:
1211
+ retries = self.sdk_configuration.retry_config
1212
+
1213
+ retry_config = None
1214
+ if isinstance(retries, utils.RetryConfig):
1215
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1044
1216
 
1045
- content_type = http_res.headers.get("Content-Type")
1046
- http_res_text = await utils.stream_to_text_async(http_res)
1047
- raise models.APIError(
1048
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1049
- http_res.status_code,
1050
- http_res_text,
1051
- http_res,
1217
+ http_res = self.do_request(
1218
+ hook_ctx=HookContext(
1219
+ config=self.sdk_configuration,
1220
+ base_url=base_url or "",
1221
+ operation_id="post-user-data",
1222
+ oauth2_scopes=[],
1223
+ security_source=get_security_from_env(
1224
+ self.sdk_configuration.security, models.Security
1225
+ ),
1226
+ ),
1227
+ request=req,
1228
+ error_status_codes=["4XX", "5XX"],
1229
+ retry_config=retry_config,
1052
1230
  )
1231
+
1232
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1233
+ return unmarshal_json_response(models.UserData, http_res)
1234
+ if utils.match_response(http_res, "4XX", "*"):
1235
+ http_res_text = utils.stream_to_text(http_res)
1236
+ raise models.APIError("API error occurred", http_res, http_res_text)
1237
+ if utils.match_response(http_res, "5XX", "*"):
1238
+ http_res_text = utils.stream_to_text(http_res)
1239
+ raise models.APIError("API error occurred", http_res, http_res_text)
1240
+
1241
+ raise models.APIError("Unexpected response received", http_res)
1242
+
1243
+ async def post_user_data_async(
1244
+ self,
1245
+ *,
1246
+ data: Union[
1247
+ models.PostUserDataUserDataData, models.PostUserDataUserDataDataTypedDict
1248
+ ],
1249
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1250
+ server_url: Optional[str] = None,
1251
+ timeout_ms: Optional[int] = None,
1252
+ http_headers: Optional[Mapping[str, str]] = None,
1253
+ ) -> models.UserData:
1254
+ r"""Create an User Data
1255
+
1256
+ Allows you to create User Data in a team, which can be used to perform custom setup on your servers after deploy and reinstall.
1257
+
1258
+
1259
+ :param data:
1260
+ :param retries: Override the default retry configuration for this method
1261
+ :param server_url: Override the default server URL for this method
1262
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1263
+ :param http_headers: Additional headers to set or replace on requests.
1264
+ """
1265
+ base_url = None
1266
+ url_variables = None
1267
+ if timeout_ms is None:
1268
+ timeout_ms = self.sdk_configuration.timeout_ms
1269
+
1270
+ if server_url is not None:
1271
+ base_url = server_url
1272
+ else:
1273
+ base_url = self._get_url(base_url, url_variables)
1274
+
1275
+ request = models.PostUserDataUserDataRequestBody(
1276
+ data=utils.get_pydantic_model(data, models.PostUserDataUserDataData),
1277
+ )
1278
+
1279
+ req = self._build_request_async(
1280
+ method="POST",
1281
+ path="/user_data",
1282
+ base_url=base_url,
1283
+ url_variables=url_variables,
1284
+ request=request,
1285
+ request_body_required=True,
1286
+ request_has_path_params=False,
1287
+ request_has_query_params=True,
1288
+ user_agent_header="user-agent",
1289
+ accept_header_value="application/vnd.api+json",
1290
+ http_headers=http_headers,
1291
+ security=self.sdk_configuration.security,
1292
+ get_serialized_body=lambda: utils.serialize_request_body(
1293
+ request, False, False, "json", models.PostUserDataUserDataRequestBody
1294
+ ),
1295
+ timeout_ms=timeout_ms,
1296
+ )
1297
+
1298
+ if retries == UNSET:
1299
+ if self.sdk_configuration.retry_config is not UNSET:
1300
+ retries = self.sdk_configuration.retry_config
1301
+
1302
+ retry_config = None
1303
+ if isinstance(retries, utils.RetryConfig):
1304
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1305
+
1306
+ http_res = await self.do_request_async(
1307
+ hook_ctx=HookContext(
1308
+ config=self.sdk_configuration,
1309
+ base_url=base_url or "",
1310
+ operation_id="post-user-data",
1311
+ oauth2_scopes=[],
1312
+ security_source=get_security_from_env(
1313
+ self.sdk_configuration.security, models.Security
1314
+ ),
1315
+ ),
1316
+ request=req,
1317
+ error_status_codes=["4XX", "5XX"],
1318
+ retry_config=retry_config,
1319
+ )
1320
+
1321
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
1322
+ return unmarshal_json_response(models.UserData, http_res)
1323
+ if utils.match_response(http_res, "4XX", "*"):
1324
+ http_res_text = await utils.stream_to_text_async(http_res)
1325
+ raise models.APIError("API error occurred", http_res, http_res_text)
1326
+ if utils.match_response(http_res, "5XX", "*"):
1327
+ http_res_text = await utils.stream_to_text_async(http_res)
1328
+ raise models.APIError("API error occurred", http_res, http_res_text)
1329
+
1330
+ raise models.APIError("Unexpected response received", http_res)
1331
+
1332
+ def get_user_data(
1333
+ self,
1334
+ *,
1335
+ user_data_id: str,
1336
+ extra_fields_user_data: Optional[str] = "decoded_content",
1337
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1338
+ server_url: Optional[str] = None,
1339
+ timeout_ms: Optional[int] = None,
1340
+ http_headers: Optional[Mapping[str, str]] = None,
1341
+ ) -> models.UserData:
1342
+ r"""Retrieve an User Data
1343
+
1344
+ Get User Data in the project. These scripts can be used to configure servers with user data.
1345
+
1346
+
1347
+ :param user_data_id:
1348
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1349
+ :param retries: Override the default retry configuration for this method
1350
+ :param server_url: Override the default server URL for this method
1351
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1352
+ :param http_headers: Additional headers to set or replace on requests.
1353
+ """
1354
+ base_url = None
1355
+ url_variables = None
1356
+ if timeout_ms is None:
1357
+ timeout_ms = self.sdk_configuration.timeout_ms
1358
+
1359
+ if server_url is not None:
1360
+ base_url = server_url
1361
+ else:
1362
+ base_url = self._get_url(base_url, url_variables)
1363
+
1364
+ request = models.GetUserDataRequest(
1365
+ user_data_id=user_data_id,
1366
+ extra_fields_user_data=extra_fields_user_data,
1367
+ )
1368
+
1369
+ req = self._build_request(
1370
+ method="GET",
1371
+ path="/user_data/{user_data_id}",
1372
+ base_url=base_url,
1373
+ url_variables=url_variables,
1374
+ request=request,
1375
+ request_body_required=False,
1376
+ request_has_path_params=True,
1377
+ request_has_query_params=True,
1378
+ user_agent_header="user-agent",
1379
+ accept_header_value="application/vnd.api+json",
1380
+ http_headers=http_headers,
1381
+ security=self.sdk_configuration.security,
1382
+ timeout_ms=timeout_ms,
1383
+ )
1384
+
1385
+ if retries == UNSET:
1386
+ if self.sdk_configuration.retry_config is not UNSET:
1387
+ retries = self.sdk_configuration.retry_config
1388
+
1389
+ retry_config = None
1390
+ if isinstance(retries, utils.RetryConfig):
1391
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1392
+
1393
+ http_res = self.do_request(
1394
+ hook_ctx=HookContext(
1395
+ config=self.sdk_configuration,
1396
+ base_url=base_url or "",
1397
+ operation_id="get-user-data",
1398
+ oauth2_scopes=[],
1399
+ security_source=get_security_from_env(
1400
+ self.sdk_configuration.security, models.Security
1401
+ ),
1402
+ ),
1403
+ request=req,
1404
+ error_status_codes=["404", "4XX", "5XX"],
1405
+ retry_config=retry_config,
1406
+ )
1407
+
1408
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1409
+ return unmarshal_json_response(models.UserData, http_res)
1410
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1411
+ http_res_text = utils.stream_to_text(http_res)
1412
+ raise models.APIError("API error occurred", http_res, http_res_text)
1413
+ if utils.match_response(http_res, "5XX", "*"):
1414
+ http_res_text = utils.stream_to_text(http_res)
1415
+ raise models.APIError("API error occurred", http_res, http_res_text)
1416
+
1417
+ raise models.APIError("Unexpected response received", http_res)
1418
+
1419
+ async def get_user_data_async(
1420
+ self,
1421
+ *,
1422
+ user_data_id: str,
1423
+ extra_fields_user_data: Optional[str] = "decoded_content",
1424
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1425
+ server_url: Optional[str] = None,
1426
+ timeout_ms: Optional[int] = None,
1427
+ http_headers: Optional[Mapping[str, str]] = None,
1428
+ ) -> models.UserData:
1429
+ r"""Retrieve an User Data
1430
+
1431
+ Get User Data in the project. These scripts can be used to configure servers with user data.
1432
+
1433
+
1434
+ :param user_data_id:
1435
+ :param extra_fields_user_data: The `decoded_content` is provided as an extra attribute that shows content in decoded form.
1436
+ :param retries: Override the default retry configuration for this method
1437
+ :param server_url: Override the default server URL for this method
1438
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1439
+ :param http_headers: Additional headers to set or replace on requests.
1440
+ """
1441
+ base_url = None
1442
+ url_variables = None
1443
+ if timeout_ms is None:
1444
+ timeout_ms = self.sdk_configuration.timeout_ms
1445
+
1446
+ if server_url is not None:
1447
+ base_url = server_url
1448
+ else:
1449
+ base_url = self._get_url(base_url, url_variables)
1450
+
1451
+ request = models.GetUserDataRequest(
1452
+ user_data_id=user_data_id,
1453
+ extra_fields_user_data=extra_fields_user_data,
1454
+ )
1455
+
1456
+ req = self._build_request_async(
1457
+ method="GET",
1458
+ path="/user_data/{user_data_id}",
1459
+ base_url=base_url,
1460
+ url_variables=url_variables,
1461
+ request=request,
1462
+ request_body_required=False,
1463
+ request_has_path_params=True,
1464
+ request_has_query_params=True,
1465
+ user_agent_header="user-agent",
1466
+ accept_header_value="application/vnd.api+json",
1467
+ http_headers=http_headers,
1468
+ security=self.sdk_configuration.security,
1469
+ timeout_ms=timeout_ms,
1470
+ )
1471
+
1472
+ if retries == UNSET:
1473
+ if self.sdk_configuration.retry_config is not UNSET:
1474
+ retries = self.sdk_configuration.retry_config
1475
+
1476
+ retry_config = None
1477
+ if isinstance(retries, utils.RetryConfig):
1478
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1479
+
1480
+ http_res = await self.do_request_async(
1481
+ hook_ctx=HookContext(
1482
+ config=self.sdk_configuration,
1483
+ base_url=base_url or "",
1484
+ operation_id="get-user-data",
1485
+ oauth2_scopes=[],
1486
+ security_source=get_security_from_env(
1487
+ self.sdk_configuration.security, models.Security
1488
+ ),
1489
+ ),
1490
+ request=req,
1491
+ error_status_codes=["404", "4XX", "5XX"],
1492
+ retry_config=retry_config,
1493
+ )
1494
+
1495
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1496
+ return unmarshal_json_response(models.UserData, http_res)
1497
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1498
+ http_res_text = await utils.stream_to_text_async(http_res)
1499
+ raise models.APIError("API error occurred", http_res, http_res_text)
1500
+ if utils.match_response(http_res, "5XX", "*"):
1501
+ http_res_text = await utils.stream_to_text_async(http_res)
1502
+ raise models.APIError("API error occurred", http_res, http_res_text)
1503
+
1504
+ raise models.APIError("Unexpected response received", http_res)
1505
+
1506
+ def patch_user_data(
1507
+ self,
1508
+ *,
1509
+ user_data_id: str,
1510
+ data: Union[
1511
+ models.PatchUserDataUserDataData, models.PatchUserDataUserDataDataTypedDict
1512
+ ],
1513
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1514
+ server_url: Optional[str] = None,
1515
+ timeout_ms: Optional[int] = None,
1516
+ http_headers: Optional[Mapping[str, str]] = None,
1517
+ ) -> models.UserData:
1518
+ r"""Update an User Data
1519
+
1520
+ Allow you update User Data in a team.
1521
+
1522
+
1523
+ :param user_data_id:
1524
+ :param data:
1525
+ :param retries: Override the default retry configuration for this method
1526
+ :param server_url: Override the default server URL for this method
1527
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1528
+ :param http_headers: Additional headers to set or replace on requests.
1529
+ """
1530
+ base_url = None
1531
+ url_variables = None
1532
+ if timeout_ms is None:
1533
+ timeout_ms = self.sdk_configuration.timeout_ms
1534
+
1535
+ if server_url is not None:
1536
+ base_url = server_url
1537
+ else:
1538
+ base_url = self._get_url(base_url, url_variables)
1539
+
1540
+ request = models.PatchUserDataRequest(
1541
+ user_data_id=user_data_id,
1542
+ request_body=models.PatchUserDataUserDataRequestBody(
1543
+ data=utils.get_pydantic_model(data, models.PatchUserDataUserDataData),
1544
+ ),
1545
+ )
1546
+
1547
+ req = self._build_request(
1548
+ method="PATCH",
1549
+ path="/user_data/{user_data_id}",
1550
+ base_url=base_url,
1551
+ url_variables=url_variables,
1552
+ request=request,
1553
+ request_body_required=False,
1554
+ request_has_path_params=True,
1555
+ request_has_query_params=True,
1556
+ user_agent_header="user-agent",
1557
+ accept_header_value="application/vnd.api+json",
1558
+ http_headers=http_headers,
1559
+ security=self.sdk_configuration.security,
1560
+ get_serialized_body=lambda: utils.serialize_request_body(
1561
+ request.request_body,
1562
+ False,
1563
+ True,
1564
+ "json",
1565
+ Optional[models.PatchUserDataUserDataRequestBody],
1566
+ ),
1567
+ timeout_ms=timeout_ms,
1568
+ )
1569
+
1570
+ if retries == UNSET:
1571
+ if self.sdk_configuration.retry_config is not UNSET:
1572
+ retries = self.sdk_configuration.retry_config
1573
+
1574
+ retry_config = None
1575
+ if isinstance(retries, utils.RetryConfig):
1576
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1577
+
1578
+ http_res = self.do_request(
1579
+ hook_ctx=HookContext(
1580
+ config=self.sdk_configuration,
1581
+ base_url=base_url or "",
1582
+ operation_id="patch-user-data",
1583
+ oauth2_scopes=[],
1584
+ security_source=get_security_from_env(
1585
+ self.sdk_configuration.security, models.Security
1586
+ ),
1587
+ ),
1588
+ request=req,
1589
+ error_status_codes=["4XX", "5XX"],
1590
+ retry_config=retry_config,
1591
+ )
1592
+
1593
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1594
+ return unmarshal_json_response(models.UserData, http_res)
1595
+ if utils.match_response(http_res, "4XX", "*"):
1596
+ http_res_text = utils.stream_to_text(http_res)
1597
+ raise models.APIError("API error occurred", http_res, http_res_text)
1598
+ if utils.match_response(http_res, "5XX", "*"):
1599
+ http_res_text = utils.stream_to_text(http_res)
1600
+ raise models.APIError("API error occurred", http_res, http_res_text)
1601
+
1602
+ raise models.APIError("Unexpected response received", http_res)
1603
+
1604
+ async def patch_user_data_async(
1605
+ self,
1606
+ *,
1607
+ user_data_id: str,
1608
+ data: Union[
1609
+ models.PatchUserDataUserDataData, models.PatchUserDataUserDataDataTypedDict
1610
+ ],
1611
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1612
+ server_url: Optional[str] = None,
1613
+ timeout_ms: Optional[int] = None,
1614
+ http_headers: Optional[Mapping[str, str]] = None,
1615
+ ) -> models.UserData:
1616
+ r"""Update an User Data
1617
+
1618
+ Allow you update User Data in a team.
1619
+
1620
+
1621
+ :param user_data_id:
1622
+ :param data:
1623
+ :param retries: Override the default retry configuration for this method
1624
+ :param server_url: Override the default server URL for this method
1625
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1626
+ :param http_headers: Additional headers to set or replace on requests.
1627
+ """
1628
+ base_url = None
1629
+ url_variables = None
1630
+ if timeout_ms is None:
1631
+ timeout_ms = self.sdk_configuration.timeout_ms
1632
+
1633
+ if server_url is not None:
1634
+ base_url = server_url
1635
+ else:
1636
+ base_url = self._get_url(base_url, url_variables)
1637
+
1638
+ request = models.PatchUserDataRequest(
1639
+ user_data_id=user_data_id,
1640
+ request_body=models.PatchUserDataUserDataRequestBody(
1641
+ data=utils.get_pydantic_model(data, models.PatchUserDataUserDataData),
1642
+ ),
1643
+ )
1644
+
1645
+ req = self._build_request_async(
1646
+ method="PATCH",
1647
+ path="/user_data/{user_data_id}",
1648
+ base_url=base_url,
1649
+ url_variables=url_variables,
1650
+ request=request,
1651
+ request_body_required=False,
1652
+ request_has_path_params=True,
1653
+ request_has_query_params=True,
1654
+ user_agent_header="user-agent",
1655
+ accept_header_value="application/vnd.api+json",
1656
+ http_headers=http_headers,
1657
+ security=self.sdk_configuration.security,
1658
+ get_serialized_body=lambda: utils.serialize_request_body(
1659
+ request.request_body,
1660
+ False,
1661
+ True,
1662
+ "json",
1663
+ Optional[models.PatchUserDataUserDataRequestBody],
1664
+ ),
1665
+ timeout_ms=timeout_ms,
1666
+ )
1667
+
1668
+ if retries == UNSET:
1669
+ if self.sdk_configuration.retry_config is not UNSET:
1670
+ retries = self.sdk_configuration.retry_config
1671
+
1672
+ retry_config = None
1673
+ if isinstance(retries, utils.RetryConfig):
1674
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1675
+
1676
+ http_res = await self.do_request_async(
1677
+ hook_ctx=HookContext(
1678
+ config=self.sdk_configuration,
1679
+ base_url=base_url or "",
1680
+ operation_id="patch-user-data",
1681
+ oauth2_scopes=[],
1682
+ security_source=get_security_from_env(
1683
+ self.sdk_configuration.security, models.Security
1684
+ ),
1685
+ ),
1686
+ request=req,
1687
+ error_status_codes=["4XX", "5XX"],
1688
+ retry_config=retry_config,
1689
+ )
1690
+
1691
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
1692
+ return unmarshal_json_response(models.UserData, http_res)
1693
+ if utils.match_response(http_res, "4XX", "*"):
1694
+ http_res_text = await utils.stream_to_text_async(http_res)
1695
+ raise models.APIError("API error occurred", http_res, http_res_text)
1696
+ if utils.match_response(http_res, "5XX", "*"):
1697
+ http_res_text = await utils.stream_to_text_async(http_res)
1698
+ raise models.APIError("API error occurred", http_res, http_res_text)
1699
+
1700
+ raise models.APIError("Unexpected response received", http_res)
1701
+
1702
+ def delete_user_data(
1703
+ self,
1704
+ *,
1705
+ user_data_id: str,
1706
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1707
+ server_url: Optional[str] = None,
1708
+ timeout_ms: Optional[int] = None,
1709
+ http_headers: Optional[Mapping[str, str]] = None,
1710
+ ):
1711
+ r"""Delete an User Data
1712
+
1713
+ :param user_data_id:
1714
+ :param retries: Override the default retry configuration for this method
1715
+ :param server_url: Override the default server URL for this method
1716
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1717
+ :param http_headers: Additional headers to set or replace on requests.
1718
+ """
1719
+ base_url = None
1720
+ url_variables = None
1721
+ if timeout_ms is None:
1722
+ timeout_ms = self.sdk_configuration.timeout_ms
1723
+
1724
+ if server_url is not None:
1725
+ base_url = server_url
1726
+ else:
1727
+ base_url = self._get_url(base_url, url_variables)
1728
+
1729
+ request = models.DeleteUserDataRequest(
1730
+ user_data_id=user_data_id,
1731
+ )
1732
+
1733
+ req = self._build_request(
1734
+ method="DELETE",
1735
+ path="/user_data/{user_data_id}",
1736
+ base_url=base_url,
1737
+ url_variables=url_variables,
1738
+ request=request,
1739
+ request_body_required=False,
1740
+ request_has_path_params=True,
1741
+ request_has_query_params=True,
1742
+ user_agent_header="user-agent",
1743
+ accept_header_value="*/*",
1744
+ http_headers=http_headers,
1745
+ security=self.sdk_configuration.security,
1746
+ timeout_ms=timeout_ms,
1747
+ )
1748
+
1749
+ if retries == UNSET:
1750
+ if self.sdk_configuration.retry_config is not UNSET:
1751
+ retries = self.sdk_configuration.retry_config
1752
+
1753
+ retry_config = None
1754
+ if isinstance(retries, utils.RetryConfig):
1755
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1756
+
1757
+ http_res = self.do_request(
1758
+ hook_ctx=HookContext(
1759
+ config=self.sdk_configuration,
1760
+ base_url=base_url or "",
1761
+ operation_id="delete-user-data",
1762
+ oauth2_scopes=[],
1763
+ security_source=get_security_from_env(
1764
+ self.sdk_configuration.security, models.Security
1765
+ ),
1766
+ ),
1767
+ request=req,
1768
+ error_status_codes=["404", "4XX", "5XX"],
1769
+ retry_config=retry_config,
1770
+ )
1771
+
1772
+ if utils.match_response(http_res, "204", "*"):
1773
+ return
1774
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1775
+ http_res_text = utils.stream_to_text(http_res)
1776
+ raise models.APIError("API error occurred", http_res, http_res_text)
1777
+ if utils.match_response(http_res, "5XX", "*"):
1778
+ http_res_text = utils.stream_to_text(http_res)
1779
+ raise models.APIError("API error occurred", http_res, http_res_text)
1780
+
1781
+ raise models.APIError("Unexpected response received", http_res)
1782
+
1783
+ async def delete_user_data_async(
1784
+ self,
1785
+ *,
1786
+ user_data_id: str,
1787
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1788
+ server_url: Optional[str] = None,
1789
+ timeout_ms: Optional[int] = None,
1790
+ http_headers: Optional[Mapping[str, str]] = None,
1791
+ ):
1792
+ r"""Delete an User Data
1793
+
1794
+ :param user_data_id:
1795
+ :param retries: Override the default retry configuration for this method
1796
+ :param server_url: Override the default server URL for this method
1797
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1798
+ :param http_headers: Additional headers to set or replace on requests.
1799
+ """
1800
+ base_url = None
1801
+ url_variables = None
1802
+ if timeout_ms is None:
1803
+ timeout_ms = self.sdk_configuration.timeout_ms
1804
+
1805
+ if server_url is not None:
1806
+ base_url = server_url
1807
+ else:
1808
+ base_url = self._get_url(base_url, url_variables)
1809
+
1810
+ request = models.DeleteUserDataRequest(
1811
+ user_data_id=user_data_id,
1812
+ )
1813
+
1814
+ req = self._build_request_async(
1815
+ method="DELETE",
1816
+ path="/user_data/{user_data_id}",
1817
+ base_url=base_url,
1818
+ url_variables=url_variables,
1819
+ request=request,
1820
+ request_body_required=False,
1821
+ request_has_path_params=True,
1822
+ request_has_query_params=True,
1823
+ user_agent_header="user-agent",
1824
+ accept_header_value="*/*",
1825
+ http_headers=http_headers,
1826
+ security=self.sdk_configuration.security,
1827
+ timeout_ms=timeout_ms,
1828
+ )
1829
+
1830
+ if retries == UNSET:
1831
+ if self.sdk_configuration.retry_config is not UNSET:
1832
+ retries = self.sdk_configuration.retry_config
1833
+
1834
+ retry_config = None
1835
+ if isinstance(retries, utils.RetryConfig):
1836
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1837
+
1838
+ http_res = await self.do_request_async(
1839
+ hook_ctx=HookContext(
1840
+ config=self.sdk_configuration,
1841
+ base_url=base_url or "",
1842
+ operation_id="delete-user-data",
1843
+ oauth2_scopes=[],
1844
+ security_source=get_security_from_env(
1845
+ self.sdk_configuration.security, models.Security
1846
+ ),
1847
+ ),
1848
+ request=req,
1849
+ error_status_codes=["404", "4XX", "5XX"],
1850
+ retry_config=retry_config,
1851
+ )
1852
+
1853
+ if utils.match_response(http_res, "204", "*"):
1854
+ return
1855
+ if utils.match_response(http_res, ["404", "4XX"], "*"):
1856
+ http_res_text = await utils.stream_to_text_async(http_res)
1857
+ raise models.APIError("API error occurred", http_res, http_res_text)
1858
+ if utils.match_response(http_res, "5XX", "*"):
1859
+ http_res_text = await utils.stream_to_text_async(http_res)
1860
+ raise models.APIError("API error occurred", http_res, http_res_text)
1861
+
1862
+ raise models.APIError("Unexpected response received", http_res)