latitudesh-python-sdk 0.0.6__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 (206) hide show
  1. latitudesh_python_sdk/__init__.py +18 -0
  2. latitudesh_python_sdk/_hooks/__init__.py +5 -0
  3. latitudesh_python_sdk/_hooks/registration.py +13 -0
  4. latitudesh_python_sdk/_hooks/sdkhooks.py +76 -0
  5. latitudesh_python_sdk/_hooks/types.py +106 -0
  6. latitudesh_python_sdk/_version.py +15 -0
  7. latitudesh_python_sdk/apikeys.py +802 -0
  8. latitudesh_python_sdk/basesdk.py +366 -0
  9. latitudesh_python_sdk/billing.py +210 -0
  10. latitudesh_python_sdk/events_sdk.py +240 -0
  11. latitudesh_python_sdk/firewalls_sdk.py +1640 -0
  12. latitudesh_python_sdk/httpclient.py +136 -0
  13. latitudesh_python_sdk/ipaddresses_sdk.py +448 -0
  14. latitudesh_python_sdk/models/__init__.py +1927 -0
  15. latitudesh_python_sdk/models/api_key.py +81 -0
  16. latitudesh_python_sdk/models/apierror.py +22 -0
  17. latitudesh_python_sdk/models/assign_server_virtual_networkop.py +43 -0
  18. latitudesh_python_sdk/models/bandwidth_packages.py +67 -0
  19. latitudesh_python_sdk/models/bandwidth_plan.py +72 -0
  20. latitudesh_python_sdk/models/bandwidth_plans.py +15 -0
  21. latitudesh_python_sdk/models/billing_usage.py +158 -0
  22. latitudesh_python_sdk/models/create_api_key.py +40 -0
  23. latitudesh_python_sdk/models/create_firewall_assignmentop.py +61 -0
  24. latitudesh_python_sdk/models/create_firewallop.py +69 -0
  25. latitudesh_python_sdk/models/create_ipmi_sessionop.py +16 -0
  26. latitudesh_python_sdk/models/create_projectop.py +79 -0
  27. latitudesh_python_sdk/models/create_server_actionop.py +69 -0
  28. latitudesh_python_sdk/models/create_server_out_of_bandop.py +61 -0
  29. latitudesh_python_sdk/models/create_server_reinstallop.py +140 -0
  30. latitudesh_python_sdk/models/create_serverop.py +173 -0
  31. latitudesh_python_sdk/models/create_tagop.py +50 -0
  32. latitudesh_python_sdk/models/create_virtual_networkop.py +72 -0
  33. latitudesh_python_sdk/models/custom_tag.py +54 -0
  34. latitudesh_python_sdk/models/delete_api_keyop.py +16 -0
  35. latitudesh_python_sdk/models/delete_firewall_assignmentop.py +25 -0
  36. latitudesh_python_sdk/models/delete_firewallop.py +18 -0
  37. latitudesh_python_sdk/models/delete_project_ssh_keyop.py +23 -0
  38. latitudesh_python_sdk/models/delete_project_user_dataop.py +23 -0
  39. latitudesh_python_sdk/models/delete_projectop.py +18 -0
  40. latitudesh_python_sdk/models/delete_storage_filesystemsop.py +16 -0
  41. latitudesh_python_sdk/models/delete_virtual_networks_assignmentsop.py +16 -0
  42. latitudesh_python_sdk/models/delete_vpn_sessionop.py +16 -0
  43. latitudesh_python_sdk/models/deploy_config.py +74 -0
  44. latitudesh_python_sdk/models/destroy_serverop.py +31 -0
  45. latitudesh_python_sdk/models/destroy_tagop.py +16 -0
  46. latitudesh_python_sdk/models/destroy_team_memberop.py +18 -0
  47. latitudesh_python_sdk/models/destroy_virtual_machineop.py +16 -0
  48. latitudesh_python_sdk/models/destroy_virtual_networkop.py +18 -0
  49. latitudesh_python_sdk/models/error_object.py +49 -0
  50. latitudesh_python_sdk/models/events.py +90 -0
  51. latitudesh_python_sdk/models/filesystem_data.py +53 -0
  52. latitudesh_python_sdk/models/firewall.py +71 -0
  53. latitudesh_python_sdk/models/firewall_server.py +50 -0
  54. latitudesh_python_sdk/models/firewalls.py +26 -0
  55. latitudesh_python_sdk/models/get_bandwidth_plansop.py +33 -0
  56. latitudesh_python_sdk/models/get_billing_usageop.py +46 -0
  57. latitudesh_python_sdk/models/get_eventsop.py +98 -0
  58. latitudesh_python_sdk/models/get_firewall_assignmentsop.py +18 -0
  59. latitudesh_python_sdk/models/get_firewallop.py +18 -0
  60. latitudesh_python_sdk/models/get_ipop.py +33 -0
  61. latitudesh_python_sdk/models/get_ipsop.py +91 -0
  62. latitudesh_python_sdk/models/get_planop.py +16 -0
  63. latitudesh_python_sdk/models/get_plans_operating_systemop.py +19 -0
  64. latitudesh_python_sdk/models/get_plansop.py +125 -0
  65. latitudesh_python_sdk/models/get_project_ssh_keyop.py +37 -0
  66. latitudesh_python_sdk/models/get_project_ssh_keysop.py +33 -0
  67. latitudesh_python_sdk/models/get_project_user_dataop.py +38 -0
  68. latitudesh_python_sdk/models/get_project_users_dataop.py +46 -0
  69. latitudesh_python_sdk/models/get_projectsop.py +76 -0
  70. latitudesh_python_sdk/models/get_regionop.py +18 -0
  71. latitudesh_python_sdk/models/get_role_idop.py +16 -0
  72. latitudesh_python_sdk/models/get_rolesop.py +19 -0
  73. latitudesh_python_sdk/models/get_server_deploy_configop.py +18 -0
  74. latitudesh_python_sdk/models/get_server_out_of_bandop.py +18 -0
  75. latitudesh_python_sdk/models/get_serverop.py +33 -0
  76. latitudesh_python_sdk/models/get_serversop.py +156 -0
  77. latitudesh_python_sdk/models/get_storage_filesystemsop.py +22 -0
  78. latitudesh_python_sdk/models/get_traffic_consumptionop.py +45 -0
  79. latitudesh_python_sdk/models/get_traffic_quotaop.py +20 -0
  80. latitudesh_python_sdk/models/get_user_profileop.py +19 -0
  81. latitudesh_python_sdk/models/get_virtual_networkop.py +32 -0
  82. latitudesh_python_sdk/models/get_virtual_networks_assignmentsop.py +40 -0
  83. latitudesh_python_sdk/models/get_virtual_networksop.py +40 -0
  84. latitudesh_python_sdk/models/get_vpn_sessionsop.py +70 -0
  85. latitudesh_python_sdk/models/index_virtual_machineop.py +22 -0
  86. latitudesh_python_sdk/models/ip_address.py +122 -0
  87. latitudesh_python_sdk/models/ip_addresses.py +15 -0
  88. latitudesh_python_sdk/models/ipmi_session.py +53 -0
  89. latitudesh_python_sdk/models/list_firewallsop.py +20 -0
  90. latitudesh_python_sdk/models/membership.py +63 -0
  91. latitudesh_python_sdk/models/operating_systems.py +57 -0
  92. latitudesh_python_sdk/models/out_of_band_connection.py +88 -0
  93. latitudesh_python_sdk/models/patch_current_teamop.py +91 -0
  94. latitudesh_python_sdk/models/patch_storage_filesystemsop.py +79 -0
  95. latitudesh_python_sdk/models/patch_user_profileop.py +88 -0
  96. latitudesh_python_sdk/models/plan.py +15 -0
  97. latitudesh_python_sdk/models/plan_data.py +206 -0
  98. latitudesh_python_sdk/models/post_api_keyop.py +19 -0
  99. latitudesh_python_sdk/models/post_project_ssh_keyop.py +81 -0
  100. latitudesh_python_sdk/models/post_project_user_dataop.py +68 -0
  101. latitudesh_python_sdk/models/post_storage_filesystemsop.py +63 -0
  102. latitudesh_python_sdk/models/post_team_membersop.py +54 -0
  103. latitudesh_python_sdk/models/post_teamop.py +67 -0
  104. latitudesh_python_sdk/models/post_vpn_sessionop.py +63 -0
  105. latitudesh_python_sdk/models/project.py +130 -0
  106. latitudesh_python_sdk/models/project_include.py +72 -0
  107. latitudesh_python_sdk/models/projects.py +15 -0
  108. latitudesh_python_sdk/models/put_project_ssh_keyop.py +87 -0
  109. latitudesh_python_sdk/models/put_project_user_dataop.py +76 -0
  110. latitudesh_python_sdk/models/put_vpn_sessionop.py +16 -0
  111. latitudesh_python_sdk/models/region.py +50 -0
  112. latitudesh_python_sdk/models/region_resource_data.py +37 -0
  113. latitudesh_python_sdk/models/regions.py +50 -0
  114. latitudesh_python_sdk/models/role.py +15 -0
  115. latitudesh_python_sdk/models/role_data.py +35 -0
  116. latitudesh_python_sdk/models/security.py +25 -0
  117. latitudesh_python_sdk/models/server.py +54 -0
  118. latitudesh_python_sdk/models/server_action.py +52 -0
  119. latitudesh_python_sdk/models/server_data.py +219 -0
  120. latitudesh_python_sdk/models/server_exit_rescue_modeop.py +16 -0
  121. latitudesh_python_sdk/models/server_lockop.py +16 -0
  122. latitudesh_python_sdk/models/server_rescue.py +22 -0
  123. latitudesh_python_sdk/models/server_schedule_deletion.py +44 -0
  124. latitudesh_python_sdk/models/server_schedule_deletionop.py +16 -0
  125. latitudesh_python_sdk/models/server_start_rescue_modeop.py +16 -0
  126. latitudesh_python_sdk/models/server_unlockop.py +16 -0
  127. latitudesh_python_sdk/models/server_unschedule_deletionop.py +16 -0
  128. latitudesh_python_sdk/models/servers.py +26 -0
  129. latitudesh_python_sdk/models/show_virtual_machineop.py +16 -0
  130. latitudesh_python_sdk/models/ssh_key.py +15 -0
  131. latitudesh_python_sdk/models/ssh_key_data.py +55 -0
  132. latitudesh_python_sdk/models/storage_plan.py +36 -0
  133. latitudesh_python_sdk/models/storage_plans.py +15 -0
  134. latitudesh_python_sdk/models/team.py +74 -0
  135. latitudesh_python_sdk/models/team_include.py +43 -0
  136. latitudesh_python_sdk/models/team_members.py +51 -0
  137. latitudesh_python_sdk/models/teams.py +26 -0
  138. latitudesh_python_sdk/models/traffic.py +133 -0
  139. latitudesh_python_sdk/models/traffic_quota.py +106 -0
  140. latitudesh_python_sdk/models/update_api_key.py +48 -0
  141. latitudesh_python_sdk/models/update_api_keyop.py +41 -0
  142. latitudesh_python_sdk/models/update_firewallop.py +89 -0
  143. latitudesh_python_sdk/models/update_plans_bandwidthop.py +50 -0
  144. latitudesh_python_sdk/models/update_projectop.py +95 -0
  145. latitudesh_python_sdk/models/update_server_deploy_configop.py +122 -0
  146. latitudesh_python_sdk/models/update_serverop.py +69 -0
  147. latitudesh_python_sdk/models/update_tagop.py +74 -0
  148. latitudesh_python_sdk/models/update_virtual_networkop.py +67 -0
  149. latitudesh_python_sdk/models/user.py +59 -0
  150. latitudesh_python_sdk/models/user_data.py +15 -0
  151. latitudesh_python_sdk/models/user_data_properties.py +46 -0
  152. latitudesh_python_sdk/models/user_include.py +52 -0
  153. latitudesh_python_sdk/models/user_team.py +61 -0
  154. latitudesh_python_sdk/models/user_teams.py +26 -0
  155. latitudesh_python_sdk/models/user_update.py +37 -0
  156. latitudesh_python_sdk/models/virtual_machine.py +25 -0
  157. latitudesh_python_sdk/models/virtual_machine_payload.py +41 -0
  158. latitudesh_python_sdk/models/virtual_machine_plans.py +180 -0
  159. latitudesh_python_sdk/models/virtual_network.py +103 -0
  160. latitudesh_python_sdk/models/virtual_network1.py +84 -0
  161. latitudesh_python_sdk/models/virtual_network_assignment.py +37 -0
  162. latitudesh_python_sdk/models/virtual_network_assignments.py +29 -0
  163. latitudesh_python_sdk/models/virtual_networks.py +26 -0
  164. latitudesh_python_sdk/models/vpn_session_data_with_password.py +77 -0
  165. latitudesh_python_sdk/models/vpn_session_with_password.py +18 -0
  166. latitudesh_python_sdk/operatingsystems_sdk.py +188 -0
  167. latitudesh_python_sdk/plans.py +1178 -0
  168. latitudesh_python_sdk/privatenetworks.py +1672 -0
  169. latitudesh_python_sdk/projects_sdk.py +864 -0
  170. latitudesh_python_sdk/py.typed +1 -0
  171. latitudesh_python_sdk/regions_sdk.py +376 -0
  172. latitudesh_python_sdk/roles.py +374 -0
  173. latitudesh_python_sdk/sdk.py +214 -0
  174. latitudesh_python_sdk/sdkconfiguration.py +57 -0
  175. latitudesh_python_sdk/servers_sdk.py +3810 -0
  176. latitudesh_python_sdk/sshkeys.py +1050 -0
  177. latitudesh_python_sdk/storage.py +820 -0
  178. latitudesh_python_sdk/tags.py +786 -0
  179. latitudesh_python_sdk/teams_sdk.py +596 -0
  180. latitudesh_python_sdk/teamsmembers.py +578 -0
  181. latitudesh_python_sdk/traffic_sdk.py +400 -0
  182. latitudesh_python_sdk/types/__init__.py +21 -0
  183. latitudesh_python_sdk/types/basemodel.py +39 -0
  184. latitudesh_python_sdk/userdata_sdk.py +1052 -0
  185. latitudesh_python_sdk/userprofile.py +596 -0
  186. latitudesh_python_sdk/utils/__init__.py +101 -0
  187. latitudesh_python_sdk/utils/annotations.py +55 -0
  188. latitudesh_python_sdk/utils/enums.py +34 -0
  189. latitudesh_python_sdk/utils/eventstreaming.py +238 -0
  190. latitudesh_python_sdk/utils/forms.py +202 -0
  191. latitudesh_python_sdk/utils/headers.py +136 -0
  192. latitudesh_python_sdk/utils/logger.py +27 -0
  193. latitudesh_python_sdk/utils/metadata.py +118 -0
  194. latitudesh_python_sdk/utils/queryparams.py +205 -0
  195. latitudesh_python_sdk/utils/requestbodies.py +66 -0
  196. latitudesh_python_sdk/utils/retries.py +217 -0
  197. latitudesh_python_sdk/utils/security.py +192 -0
  198. latitudesh_python_sdk/utils/serializers.py +219 -0
  199. latitudesh_python_sdk/utils/url.py +155 -0
  200. latitudesh_python_sdk/utils/values.py +137 -0
  201. latitudesh_python_sdk/virtualmachines.py +772 -0
  202. latitudesh_python_sdk/vpnsessions.py +818 -0
  203. latitudesh_python_sdk-0.0.6.dist-info/LICENSE +21 -0
  204. latitudesh_python_sdk-0.0.6.dist-info/METADATA +730 -0
  205. latitudesh_python_sdk-0.0.6.dist-info/RECORD +206 -0
  206. latitudesh_python_sdk-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,596 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from latitudesh_python_sdk import models, utils
5
+ from latitudesh_python_sdk._hooks import HookContext
6
+ from latitudesh_python_sdk.types import OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.utils import get_security_from_env
8
+ from typing import Any, Mapping, Optional, Union
9
+
10
+
11
+ class UserProfile(BaseSDK):
12
+ def get(
13
+ self,
14
+ *,
15
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
16
+ server_url: Optional[str] = None,
17
+ timeout_ms: Optional[int] = None,
18
+ http_headers: Optional[Mapping[str, str]] = None,
19
+ ) -> models.GetUserProfileResponseBody:
20
+ r"""Get user profile
21
+
22
+ Retrieve the current user profile
23
+
24
+
25
+ :param retries: Override the default retry configuration for this method
26
+ :param server_url: Override the default server URL for this method
27
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
28
+ :param http_headers: Additional headers to set or replace on requests.
29
+ """
30
+ base_url = None
31
+ url_variables = None
32
+ if timeout_ms is None:
33
+ timeout_ms = self.sdk_configuration.timeout_ms
34
+
35
+ if server_url is not None:
36
+ base_url = server_url
37
+ else:
38
+ base_url = self._get_url(base_url, url_variables)
39
+ req = self._build_request(
40
+ method="GET",
41
+ path="/user/profile",
42
+ base_url=base_url,
43
+ url_variables=url_variables,
44
+ request=None,
45
+ request_body_required=False,
46
+ request_has_path_params=False,
47
+ request_has_query_params=True,
48
+ user_agent_header="user-agent",
49
+ accept_header_value="application/vnd.api+json",
50
+ http_headers=http_headers,
51
+ security=self.sdk_configuration.security,
52
+ timeout_ms=timeout_ms,
53
+ )
54
+
55
+ if retries == UNSET:
56
+ if self.sdk_configuration.retry_config is not UNSET:
57
+ retries = self.sdk_configuration.retry_config
58
+
59
+ retry_config = None
60
+ if isinstance(retries, utils.RetryConfig):
61
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
62
+
63
+ http_res = self.do_request(
64
+ hook_ctx=HookContext(
65
+ base_url=base_url or "",
66
+ operation_id="get-user-profile",
67
+ oauth2_scopes=[],
68
+ security_source=get_security_from_env(
69
+ self.sdk_configuration.security, models.Security
70
+ ),
71
+ ),
72
+ request=req,
73
+ error_status_codes=["4XX", "5XX"],
74
+ retry_config=retry_config,
75
+ )
76
+
77
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
78
+ return utils.unmarshal_json(
79
+ http_res.text, models.GetUserProfileResponseBody
80
+ )
81
+ if utils.match_response(http_res, "4XX", "*"):
82
+ http_res_text = utils.stream_to_text(http_res)
83
+ raise models.APIError(
84
+ "API error occurred", http_res.status_code, http_res_text, http_res
85
+ )
86
+ if utils.match_response(http_res, "5XX", "*"):
87
+ http_res_text = utils.stream_to_text(http_res)
88
+ raise models.APIError(
89
+ "API error occurred", http_res.status_code, http_res_text, http_res
90
+ )
91
+
92
+ content_type = http_res.headers.get("Content-Type")
93
+ http_res_text = utils.stream_to_text(http_res)
94
+ raise models.APIError(
95
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
96
+ http_res.status_code,
97
+ http_res_text,
98
+ http_res,
99
+ )
100
+
101
+ async def get_async(
102
+ self,
103
+ *,
104
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
105
+ server_url: Optional[str] = None,
106
+ timeout_ms: Optional[int] = None,
107
+ http_headers: Optional[Mapping[str, str]] = None,
108
+ ) -> models.GetUserProfileResponseBody:
109
+ r"""Get user profile
110
+
111
+ Retrieve the current user profile
112
+
113
+
114
+ :param retries: Override the default retry configuration for this method
115
+ :param server_url: Override the default server URL for this method
116
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
117
+ :param http_headers: Additional headers to set or replace on requests.
118
+ """
119
+ base_url = None
120
+ url_variables = None
121
+ if timeout_ms is None:
122
+ timeout_ms = self.sdk_configuration.timeout_ms
123
+
124
+ if server_url is not None:
125
+ base_url = server_url
126
+ else:
127
+ base_url = self._get_url(base_url, url_variables)
128
+ req = self._build_request_async(
129
+ method="GET",
130
+ path="/user/profile",
131
+ base_url=base_url,
132
+ url_variables=url_variables,
133
+ request=None,
134
+ request_body_required=False,
135
+ request_has_path_params=False,
136
+ request_has_query_params=True,
137
+ user_agent_header="user-agent",
138
+ accept_header_value="application/vnd.api+json",
139
+ http_headers=http_headers,
140
+ security=self.sdk_configuration.security,
141
+ timeout_ms=timeout_ms,
142
+ )
143
+
144
+ if retries == UNSET:
145
+ if self.sdk_configuration.retry_config is not UNSET:
146
+ retries = self.sdk_configuration.retry_config
147
+
148
+ retry_config = None
149
+ if isinstance(retries, utils.RetryConfig):
150
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
151
+
152
+ http_res = await self.do_request_async(
153
+ hook_ctx=HookContext(
154
+ base_url=base_url or "",
155
+ operation_id="get-user-profile",
156
+ oauth2_scopes=[],
157
+ security_source=get_security_from_env(
158
+ self.sdk_configuration.security, models.Security
159
+ ),
160
+ ),
161
+ request=req,
162
+ error_status_codes=["4XX", "5XX"],
163
+ retry_config=retry_config,
164
+ )
165
+
166
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
167
+ return utils.unmarshal_json(
168
+ http_res.text, models.GetUserProfileResponseBody
169
+ )
170
+ if utils.match_response(http_res, "4XX", "*"):
171
+ http_res_text = await utils.stream_to_text_async(http_res)
172
+ raise models.APIError(
173
+ "API error occurred", http_res.status_code, http_res_text, http_res
174
+ )
175
+ if utils.match_response(http_res, "5XX", "*"):
176
+ http_res_text = await utils.stream_to_text_async(http_res)
177
+ raise models.APIError(
178
+ "API error occurred", http_res.status_code, http_res_text, http_res
179
+ )
180
+
181
+ content_type = http_res.headers.get("Content-Type")
182
+ http_res_text = await utils.stream_to_text_async(http_res)
183
+ raise models.APIError(
184
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
185
+ http_res.status_code,
186
+ http_res_text,
187
+ http_res,
188
+ )
189
+
190
+ def update(
191
+ self,
192
+ *,
193
+ id: str,
194
+ data: Union[
195
+ models.PatchUserProfileUserProfileData,
196
+ models.PatchUserProfileUserProfileDataTypedDict,
197
+ ],
198
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
199
+ server_url: Optional[str] = None,
200
+ timeout_ms: Optional[int] = None,
201
+ http_headers: Optional[Mapping[str, str]] = None,
202
+ ) -> models.PatchUserProfileResponseBody:
203
+ r"""Update User Profile
204
+
205
+ Update the current user profile
206
+
207
+
208
+ :param id:
209
+ :param data:
210
+ :param retries: Override the default retry configuration for this method
211
+ :param server_url: Override the default server URL for this method
212
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
213
+ :param http_headers: Additional headers to set or replace on requests.
214
+ """
215
+ base_url = None
216
+ url_variables = None
217
+ if timeout_ms is None:
218
+ timeout_ms = self.sdk_configuration.timeout_ms
219
+
220
+ if server_url is not None:
221
+ base_url = server_url
222
+ else:
223
+ base_url = self._get_url(base_url, url_variables)
224
+
225
+ request = models.PatchUserProfileRequest(
226
+ id=id,
227
+ request_body=models.PatchUserProfileUserProfileRequestBody(
228
+ data=utils.get_pydantic_model(
229
+ data, models.PatchUserProfileUserProfileData
230
+ ),
231
+ ),
232
+ )
233
+
234
+ req = self._build_request(
235
+ method="PATCH",
236
+ path="/user/profile/{id}",
237
+ base_url=base_url,
238
+ url_variables=url_variables,
239
+ request=request,
240
+ request_body_required=True,
241
+ request_has_path_params=True,
242
+ request_has_query_params=True,
243
+ user_agent_header="user-agent",
244
+ accept_header_value="application/vnd.api+json",
245
+ http_headers=http_headers,
246
+ security=self.sdk_configuration.security,
247
+ get_serialized_body=lambda: utils.serialize_request_body(
248
+ request.request_body,
249
+ False,
250
+ False,
251
+ "json",
252
+ models.PatchUserProfileUserProfileRequestBody,
253
+ ),
254
+ timeout_ms=timeout_ms,
255
+ )
256
+
257
+ if retries == UNSET:
258
+ if self.sdk_configuration.retry_config is not UNSET:
259
+ retries = self.sdk_configuration.retry_config
260
+
261
+ retry_config = None
262
+ if isinstance(retries, utils.RetryConfig):
263
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
264
+
265
+ http_res = self.do_request(
266
+ hook_ctx=HookContext(
267
+ base_url=base_url or "",
268
+ operation_id="patch-user-profile",
269
+ oauth2_scopes=[],
270
+ security_source=get_security_from_env(
271
+ self.sdk_configuration.security, models.Security
272
+ ),
273
+ ),
274
+ request=req,
275
+ error_status_codes=["403", "422", "4XX", "5XX"],
276
+ retry_config=retry_config,
277
+ )
278
+
279
+ response_data: Any = None
280
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
281
+ return utils.unmarshal_json(
282
+ http_res.text, models.PatchUserProfileResponseBody
283
+ )
284
+ if utils.match_response(http_res, "403", "application/vnd.api+json"):
285
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
286
+ raise models.ErrorObject(data=response_data)
287
+ if utils.match_response(http_res, ["422", "4XX"], "*"):
288
+ http_res_text = utils.stream_to_text(http_res)
289
+ raise models.APIError(
290
+ "API error occurred", http_res.status_code, http_res_text, http_res
291
+ )
292
+ if utils.match_response(http_res, "5XX", "*"):
293
+ http_res_text = utils.stream_to_text(http_res)
294
+ raise models.APIError(
295
+ "API error occurred", http_res.status_code, http_res_text, http_res
296
+ )
297
+
298
+ content_type = http_res.headers.get("Content-Type")
299
+ http_res_text = utils.stream_to_text(http_res)
300
+ raise models.APIError(
301
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
302
+ http_res.status_code,
303
+ http_res_text,
304
+ http_res,
305
+ )
306
+
307
+ async def update_async(
308
+ self,
309
+ *,
310
+ id: str,
311
+ data: Union[
312
+ models.PatchUserProfileUserProfileData,
313
+ models.PatchUserProfileUserProfileDataTypedDict,
314
+ ],
315
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
316
+ server_url: Optional[str] = None,
317
+ timeout_ms: Optional[int] = None,
318
+ http_headers: Optional[Mapping[str, str]] = None,
319
+ ) -> models.PatchUserProfileResponseBody:
320
+ r"""Update User Profile
321
+
322
+ Update the current user profile
323
+
324
+
325
+ :param id:
326
+ :param data:
327
+ :param retries: Override the default retry configuration for this method
328
+ :param server_url: Override the default server URL for this method
329
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
330
+ :param http_headers: Additional headers to set or replace on requests.
331
+ """
332
+ base_url = None
333
+ url_variables = None
334
+ if timeout_ms is None:
335
+ timeout_ms = self.sdk_configuration.timeout_ms
336
+
337
+ if server_url is not None:
338
+ base_url = server_url
339
+ else:
340
+ base_url = self._get_url(base_url, url_variables)
341
+
342
+ request = models.PatchUserProfileRequest(
343
+ id=id,
344
+ request_body=models.PatchUserProfileUserProfileRequestBody(
345
+ data=utils.get_pydantic_model(
346
+ data, models.PatchUserProfileUserProfileData
347
+ ),
348
+ ),
349
+ )
350
+
351
+ req = self._build_request_async(
352
+ method="PATCH",
353
+ path="/user/profile/{id}",
354
+ base_url=base_url,
355
+ url_variables=url_variables,
356
+ request=request,
357
+ request_body_required=True,
358
+ request_has_path_params=True,
359
+ request_has_query_params=True,
360
+ user_agent_header="user-agent",
361
+ accept_header_value="application/vnd.api+json",
362
+ http_headers=http_headers,
363
+ security=self.sdk_configuration.security,
364
+ get_serialized_body=lambda: utils.serialize_request_body(
365
+ request.request_body,
366
+ False,
367
+ False,
368
+ "json",
369
+ models.PatchUserProfileUserProfileRequestBody,
370
+ ),
371
+ timeout_ms=timeout_ms,
372
+ )
373
+
374
+ if retries == UNSET:
375
+ if self.sdk_configuration.retry_config is not UNSET:
376
+ retries = self.sdk_configuration.retry_config
377
+
378
+ retry_config = None
379
+ if isinstance(retries, utils.RetryConfig):
380
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
381
+
382
+ http_res = await self.do_request_async(
383
+ hook_ctx=HookContext(
384
+ base_url=base_url or "",
385
+ operation_id="patch-user-profile",
386
+ oauth2_scopes=[],
387
+ security_source=get_security_from_env(
388
+ self.sdk_configuration.security, models.Security
389
+ ),
390
+ ),
391
+ request=req,
392
+ error_status_codes=["403", "422", "4XX", "5XX"],
393
+ retry_config=retry_config,
394
+ )
395
+
396
+ response_data: Any = None
397
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
398
+ return utils.unmarshal_json(
399
+ http_res.text, models.PatchUserProfileResponseBody
400
+ )
401
+ if utils.match_response(http_res, "403", "application/vnd.api+json"):
402
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
403
+ raise models.ErrorObject(data=response_data)
404
+ if utils.match_response(http_res, ["422", "4XX"], "*"):
405
+ http_res_text = await utils.stream_to_text_async(http_res)
406
+ raise models.APIError(
407
+ "API error occurred", http_res.status_code, http_res_text, http_res
408
+ )
409
+ if utils.match_response(http_res, "5XX", "*"):
410
+ http_res_text = await utils.stream_to_text_async(http_res)
411
+ raise models.APIError(
412
+ "API error occurred", http_res.status_code, http_res_text, http_res
413
+ )
414
+
415
+ content_type = http_res.headers.get("Content-Type")
416
+ http_res_text = await utils.stream_to_text_async(http_res)
417
+ raise models.APIError(
418
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
419
+ http_res.status_code,
420
+ http_res_text,
421
+ http_res,
422
+ )
423
+
424
+ def list_teams(
425
+ self,
426
+ *,
427
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
428
+ server_url: Optional[str] = None,
429
+ timeout_ms: Optional[int] = None,
430
+ http_headers: Optional[Mapping[str, str]] = None,
431
+ ) -> models.UserTeams:
432
+ r"""List User Teams
433
+
434
+ Returns a list of all teams the user belongs to
435
+
436
+
437
+ :param retries: Override the default retry configuration for this method
438
+ :param server_url: Override the default server URL for this method
439
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
440
+ :param http_headers: Additional headers to set or replace on requests.
441
+ """
442
+ base_url = None
443
+ url_variables = None
444
+ if timeout_ms is None:
445
+ timeout_ms = self.sdk_configuration.timeout_ms
446
+
447
+ if server_url is not None:
448
+ base_url = server_url
449
+ else:
450
+ base_url = self._get_url(base_url, url_variables)
451
+ req = self._build_request(
452
+ method="GET",
453
+ path="/user/teams",
454
+ base_url=base_url,
455
+ url_variables=url_variables,
456
+ request=None,
457
+ request_body_required=False,
458
+ request_has_path_params=False,
459
+ request_has_query_params=True,
460
+ user_agent_header="user-agent",
461
+ accept_header_value="application/vnd.api+json",
462
+ http_headers=http_headers,
463
+ security=self.sdk_configuration.security,
464
+ timeout_ms=timeout_ms,
465
+ )
466
+
467
+ if retries == UNSET:
468
+ if self.sdk_configuration.retry_config is not UNSET:
469
+ retries = self.sdk_configuration.retry_config
470
+
471
+ retry_config = None
472
+ if isinstance(retries, utils.RetryConfig):
473
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
474
+
475
+ http_res = self.do_request(
476
+ hook_ctx=HookContext(
477
+ base_url=base_url or "",
478
+ operation_id="get-user-teams",
479
+ oauth2_scopes=[],
480
+ security_source=get_security_from_env(
481
+ self.sdk_configuration.security, models.Security
482
+ ),
483
+ ),
484
+ request=req,
485
+ error_status_codes=["4XX", "5XX"],
486
+ retry_config=retry_config,
487
+ )
488
+
489
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
490
+ return utils.unmarshal_json(http_res.text, models.UserTeams)
491
+ if utils.match_response(http_res, "4XX", "*"):
492
+ http_res_text = utils.stream_to_text(http_res)
493
+ raise models.APIError(
494
+ "API error occurred", http_res.status_code, http_res_text, http_res
495
+ )
496
+ if utils.match_response(http_res, "5XX", "*"):
497
+ http_res_text = utils.stream_to_text(http_res)
498
+ raise models.APIError(
499
+ "API error occurred", http_res.status_code, http_res_text, http_res
500
+ )
501
+
502
+ content_type = http_res.headers.get("Content-Type")
503
+ http_res_text = utils.stream_to_text(http_res)
504
+ raise models.APIError(
505
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
506
+ http_res.status_code,
507
+ http_res_text,
508
+ http_res,
509
+ )
510
+
511
+ async def list_teams_async(
512
+ self,
513
+ *,
514
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
515
+ server_url: Optional[str] = None,
516
+ timeout_ms: Optional[int] = None,
517
+ http_headers: Optional[Mapping[str, str]] = None,
518
+ ) -> models.UserTeams:
519
+ r"""List User Teams
520
+
521
+ Returns a list of all teams the user belongs to
522
+
523
+
524
+ :param retries: Override the default retry configuration for this method
525
+ :param server_url: Override the default server URL for this method
526
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
527
+ :param http_headers: Additional headers to set or replace on requests.
528
+ """
529
+ base_url = None
530
+ url_variables = None
531
+ if timeout_ms is None:
532
+ timeout_ms = self.sdk_configuration.timeout_ms
533
+
534
+ if server_url is not None:
535
+ base_url = server_url
536
+ else:
537
+ base_url = self._get_url(base_url, url_variables)
538
+ req = self._build_request_async(
539
+ method="GET",
540
+ path="/user/teams",
541
+ base_url=base_url,
542
+ url_variables=url_variables,
543
+ request=None,
544
+ request_body_required=False,
545
+ request_has_path_params=False,
546
+ request_has_query_params=True,
547
+ user_agent_header="user-agent",
548
+ accept_header_value="application/vnd.api+json",
549
+ http_headers=http_headers,
550
+ security=self.sdk_configuration.security,
551
+ timeout_ms=timeout_ms,
552
+ )
553
+
554
+ if retries == UNSET:
555
+ if self.sdk_configuration.retry_config is not UNSET:
556
+ retries = self.sdk_configuration.retry_config
557
+
558
+ retry_config = None
559
+ if isinstance(retries, utils.RetryConfig):
560
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
561
+
562
+ http_res = await self.do_request_async(
563
+ hook_ctx=HookContext(
564
+ base_url=base_url or "",
565
+ operation_id="get-user-teams",
566
+ oauth2_scopes=[],
567
+ security_source=get_security_from_env(
568
+ self.sdk_configuration.security, models.Security
569
+ ),
570
+ ),
571
+ request=req,
572
+ error_status_codes=["4XX", "5XX"],
573
+ retry_config=retry_config,
574
+ )
575
+
576
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
577
+ return utils.unmarshal_json(http_res.text, models.UserTeams)
578
+ if utils.match_response(http_res, "4XX", "*"):
579
+ http_res_text = await utils.stream_to_text_async(http_res)
580
+ raise models.APIError(
581
+ "API error occurred", http_res.status_code, http_res_text, http_res
582
+ )
583
+ if utils.match_response(http_res, "5XX", "*"):
584
+ http_res_text = await utils.stream_to_text_async(http_res)
585
+ raise models.APIError(
586
+ "API error occurred", http_res.status_code, http_res_text, http_res
587
+ )
588
+
589
+ content_type = http_res.headers.get("Content-Type")
590
+ http_res_text = await utils.stream_to_text_async(http_res)
591
+ raise models.APIError(
592
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
593
+ http_res.status_code,
594
+ http_res_text,
595
+ http_res,
596
+ )
@@ -0,0 +1,101 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .annotations import get_discriminator
4
+ from .enums import OpenEnumMeta
5
+ from .headers import get_headers, get_response_headers
6
+ from .metadata import (
7
+ FieldMetadata,
8
+ find_metadata,
9
+ FormMetadata,
10
+ HeaderMetadata,
11
+ MultipartFormMetadata,
12
+ PathParamMetadata,
13
+ QueryParamMetadata,
14
+ RequestMetadata,
15
+ SecurityMetadata,
16
+ )
17
+ from .queryparams import get_query_params
18
+ from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
19
+ from .requestbodies import serialize_request_body, SerializedRequestBody
20
+ from .security import get_security, get_security_from_env
21
+
22
+ from .serializers import (
23
+ get_pydantic_model,
24
+ marshal_json,
25
+ unmarshal,
26
+ unmarshal_json,
27
+ serialize_decimal,
28
+ serialize_float,
29
+ serialize_int,
30
+ stream_to_text,
31
+ stream_to_text_async,
32
+ stream_to_bytes,
33
+ stream_to_bytes_async,
34
+ validate_const,
35
+ validate_decimal,
36
+ validate_float,
37
+ validate_int,
38
+ validate_open_enum,
39
+ )
40
+ from .url import generate_url, template_url, remove_suffix
41
+ from .values import (
42
+ get_global_from_env,
43
+ match_content_type,
44
+ match_status_codes,
45
+ match_response,
46
+ cast_partial,
47
+ )
48
+ from .logger import Logger, get_body_content, get_default_logger
49
+
50
+ __all__ = [
51
+ "BackoffStrategy",
52
+ "FieldMetadata",
53
+ "find_metadata",
54
+ "FormMetadata",
55
+ "generate_url",
56
+ "get_body_content",
57
+ "get_default_logger",
58
+ "get_discriminator",
59
+ "get_global_from_env",
60
+ "get_headers",
61
+ "get_pydantic_model",
62
+ "get_query_params",
63
+ "get_response_headers",
64
+ "get_security",
65
+ "get_security_from_env",
66
+ "HeaderMetadata",
67
+ "Logger",
68
+ "marshal_json",
69
+ "match_content_type",
70
+ "match_status_codes",
71
+ "match_response",
72
+ "MultipartFormMetadata",
73
+ "OpenEnumMeta",
74
+ "PathParamMetadata",
75
+ "QueryParamMetadata",
76
+ "remove_suffix",
77
+ "Retries",
78
+ "retry",
79
+ "retry_async",
80
+ "RetryConfig",
81
+ "RequestMetadata",
82
+ "SecurityMetadata",
83
+ "serialize_decimal",
84
+ "serialize_float",
85
+ "serialize_int",
86
+ "serialize_request_body",
87
+ "SerializedRequestBody",
88
+ "stream_to_text",
89
+ "stream_to_text_async",
90
+ "stream_to_bytes",
91
+ "stream_to_bytes_async",
92
+ "template_url",
93
+ "unmarshal",
94
+ "unmarshal_json",
95
+ "validate_decimal",
96
+ "validate_const",
97
+ "validate_float",
98
+ "validate_int",
99
+ "validate_open_enum",
100
+ "cast_partial",
101
+ ]