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,864 @@
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 BaseModel, OptionalNullable, UNSET
7
+ from latitudesh_python_sdk.utils import get_security_from_env
8
+ from typing import Any, Mapping, Optional, Union, cast
9
+
10
+
11
+ class ProjectsSDK(BaseSDK):
12
+ def list(
13
+ self,
14
+ *,
15
+ filter_name: Optional[str] = None,
16
+ filter_slug: Optional[str] = None,
17
+ filter_description: Optional[str] = None,
18
+ filter_billing_type: Optional[str] = None,
19
+ filter_environment: Optional[str] = None,
20
+ filter_tags: Optional[str] = None,
21
+ extra_fields_projects: Optional[str] = None,
22
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
23
+ server_url: Optional[str] = None,
24
+ timeout_ms: Optional[int] = None,
25
+ http_headers: Optional[Mapping[str, str]] = None,
26
+ ) -> models.Projects:
27
+ r"""List all Projects
28
+
29
+ Returns a list of all projects for the current team
30
+
31
+
32
+ :param filter_name: The project name to filter by
33
+ :param filter_slug: The project slug to filter by
34
+ :param filter_description: The project description to filter by
35
+ :param filter_billing_type: The billing type to filter by
36
+ :param filter_environment: The environment to filter by
37
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return projects with `tag_1` AND `tag_2`
38
+ :param extra_fields_projects: The `last_renewal_date` and `next_renewal_date` are provided as extra attributes that show previous and future billing cycle dates. To request it, just set `extra_fields[projects]=last_renewal_date,next_renewal_date` in the query string.
39
+ :param retries: Override the default retry configuration for this method
40
+ :param server_url: Override the default server URL for this method
41
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
42
+ :param http_headers: Additional headers to set or replace on requests.
43
+ """
44
+ base_url = None
45
+ url_variables = None
46
+ if timeout_ms is None:
47
+ timeout_ms = self.sdk_configuration.timeout_ms
48
+
49
+ if server_url is not None:
50
+ base_url = server_url
51
+ else:
52
+ base_url = self._get_url(base_url, url_variables)
53
+
54
+ request = models.GetProjectsRequest(
55
+ filter_name=filter_name,
56
+ filter_slug=filter_slug,
57
+ filter_description=filter_description,
58
+ filter_billing_type=filter_billing_type,
59
+ filter_environment=filter_environment,
60
+ filter_tags=filter_tags,
61
+ extra_fields_projects=extra_fields_projects,
62
+ )
63
+
64
+ req = self._build_request(
65
+ method="GET",
66
+ path="/projects",
67
+ base_url=base_url,
68
+ url_variables=url_variables,
69
+ request=request,
70
+ request_body_required=False,
71
+ request_has_path_params=False,
72
+ request_has_query_params=True,
73
+ user_agent_header="user-agent",
74
+ accept_header_value="application/vnd.api+json",
75
+ http_headers=http_headers,
76
+ security=self.sdk_configuration.security,
77
+ timeout_ms=timeout_ms,
78
+ )
79
+
80
+ if retries == UNSET:
81
+ if self.sdk_configuration.retry_config is not UNSET:
82
+ retries = self.sdk_configuration.retry_config
83
+
84
+ retry_config = None
85
+ if isinstance(retries, utils.RetryConfig):
86
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
87
+
88
+ http_res = self.do_request(
89
+ hook_ctx=HookContext(
90
+ base_url=base_url or "",
91
+ operation_id="get-projects",
92
+ oauth2_scopes=[],
93
+ security_source=get_security_from_env(
94
+ self.sdk_configuration.security, models.Security
95
+ ),
96
+ ),
97
+ request=req,
98
+ error_status_codes=["4XX", "5XX"],
99
+ retry_config=retry_config,
100
+ )
101
+
102
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
103
+ return utils.unmarshal_json(http_res.text, models.Projects)
104
+ if utils.match_response(http_res, "4XX", "*"):
105
+ http_res_text = utils.stream_to_text(http_res)
106
+ raise models.APIError(
107
+ "API error occurred", http_res.status_code, http_res_text, http_res
108
+ )
109
+ if utils.match_response(http_res, "5XX", "*"):
110
+ http_res_text = utils.stream_to_text(http_res)
111
+ raise models.APIError(
112
+ "API error occurred", http_res.status_code, http_res_text, http_res
113
+ )
114
+
115
+ content_type = http_res.headers.get("Content-Type")
116
+ http_res_text = utils.stream_to_text(http_res)
117
+ raise models.APIError(
118
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
119
+ http_res.status_code,
120
+ http_res_text,
121
+ http_res,
122
+ )
123
+
124
+ async def list_async(
125
+ self,
126
+ *,
127
+ filter_name: Optional[str] = None,
128
+ filter_slug: Optional[str] = None,
129
+ filter_description: Optional[str] = None,
130
+ filter_billing_type: Optional[str] = None,
131
+ filter_environment: Optional[str] = None,
132
+ filter_tags: Optional[str] = None,
133
+ extra_fields_projects: Optional[str] = None,
134
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
135
+ server_url: Optional[str] = None,
136
+ timeout_ms: Optional[int] = None,
137
+ http_headers: Optional[Mapping[str, str]] = None,
138
+ ) -> models.Projects:
139
+ r"""List all Projects
140
+
141
+ Returns a list of all projects for the current team
142
+
143
+
144
+ :param filter_name: The project name to filter by
145
+ :param filter_slug: The project slug to filter by
146
+ :param filter_description: The project description to filter by
147
+ :param filter_billing_type: The billing type to filter by
148
+ :param filter_environment: The environment to filter by
149
+ :param filter_tags: The tags ids to filter by, separated by comma, e.g. `filter[tags]=tag_1,tag_2`will return projects with `tag_1` AND `tag_2`
150
+ :param extra_fields_projects: The `last_renewal_date` and `next_renewal_date` are provided as extra attributes that show previous and future billing cycle dates. To request it, just set `extra_fields[projects]=last_renewal_date,next_renewal_date` in the query string.
151
+ :param retries: Override the default retry configuration for this method
152
+ :param server_url: Override the default server URL for this method
153
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
154
+ :param http_headers: Additional headers to set or replace on requests.
155
+ """
156
+ base_url = None
157
+ url_variables = None
158
+ if timeout_ms is None:
159
+ timeout_ms = self.sdk_configuration.timeout_ms
160
+
161
+ if server_url is not None:
162
+ base_url = server_url
163
+ else:
164
+ base_url = self._get_url(base_url, url_variables)
165
+
166
+ request = models.GetProjectsRequest(
167
+ filter_name=filter_name,
168
+ filter_slug=filter_slug,
169
+ filter_description=filter_description,
170
+ filter_billing_type=filter_billing_type,
171
+ filter_environment=filter_environment,
172
+ filter_tags=filter_tags,
173
+ extra_fields_projects=extra_fields_projects,
174
+ )
175
+
176
+ req = self._build_request_async(
177
+ method="GET",
178
+ path="/projects",
179
+ base_url=base_url,
180
+ url_variables=url_variables,
181
+ request=request,
182
+ request_body_required=False,
183
+ request_has_path_params=False,
184
+ request_has_query_params=True,
185
+ user_agent_header="user-agent",
186
+ accept_header_value="application/vnd.api+json",
187
+ http_headers=http_headers,
188
+ security=self.sdk_configuration.security,
189
+ timeout_ms=timeout_ms,
190
+ )
191
+
192
+ if retries == UNSET:
193
+ if self.sdk_configuration.retry_config is not UNSET:
194
+ retries = self.sdk_configuration.retry_config
195
+
196
+ retry_config = None
197
+ if isinstance(retries, utils.RetryConfig):
198
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
199
+
200
+ http_res = await self.do_request_async(
201
+ hook_ctx=HookContext(
202
+ base_url=base_url or "",
203
+ operation_id="get-projects",
204
+ oauth2_scopes=[],
205
+ security_source=get_security_from_env(
206
+ self.sdk_configuration.security, models.Security
207
+ ),
208
+ ),
209
+ request=req,
210
+ error_status_codes=["4XX", "5XX"],
211
+ retry_config=retry_config,
212
+ )
213
+
214
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
215
+ return utils.unmarshal_json(http_res.text, models.Projects)
216
+ if utils.match_response(http_res, "4XX", "*"):
217
+ http_res_text = await utils.stream_to_text_async(http_res)
218
+ raise models.APIError(
219
+ "API error occurred", http_res.status_code, http_res_text, http_res
220
+ )
221
+ if utils.match_response(http_res, "5XX", "*"):
222
+ http_res_text = await utils.stream_to_text_async(http_res)
223
+ raise models.APIError(
224
+ "API error occurred", http_res.status_code, http_res_text, http_res
225
+ )
226
+
227
+ content_type = http_res.headers.get("Content-Type")
228
+ http_res_text = await utils.stream_to_text_async(http_res)
229
+ raise models.APIError(
230
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
231
+ http_res.status_code,
232
+ http_res_text,
233
+ http_res,
234
+ )
235
+
236
+ def create(
237
+ self,
238
+ *,
239
+ request: Union[
240
+ models.CreateProjectProjectsRequestBody,
241
+ models.CreateProjectProjectsRequestBodyTypedDict,
242
+ ] = models.CreateProjectProjectsRequestBody(),
243
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
244
+ server_url: Optional[str] = None,
245
+ timeout_ms: Optional[int] = None,
246
+ http_headers: Optional[Mapping[str, str]] = None,
247
+ ) -> models.CreateProjectResponseBody:
248
+ r"""Create a Project
249
+
250
+ :param request: The request object to send.
251
+ :param retries: Override the default retry configuration for this method
252
+ :param server_url: Override the default server URL for this method
253
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
254
+ :param http_headers: Additional headers to set or replace on requests.
255
+ """
256
+ base_url = None
257
+ url_variables = None
258
+ if timeout_ms is None:
259
+ timeout_ms = self.sdk_configuration.timeout_ms
260
+
261
+ if server_url is not None:
262
+ base_url = server_url
263
+ else:
264
+ base_url = self._get_url(base_url, url_variables)
265
+
266
+ if not isinstance(request, BaseModel):
267
+ request = utils.unmarshal(request, models.CreateProjectProjectsRequestBody)
268
+ request = cast(models.CreateProjectProjectsRequestBody, request)
269
+
270
+ req = self._build_request(
271
+ method="POST",
272
+ path="/projects",
273
+ base_url=base_url,
274
+ url_variables=url_variables,
275
+ request=request,
276
+ request_body_required=True,
277
+ request_has_path_params=False,
278
+ request_has_query_params=True,
279
+ user_agent_header="user-agent",
280
+ accept_header_value="application/vnd.api+json",
281
+ http_headers=http_headers,
282
+ security=self.sdk_configuration.security,
283
+ get_serialized_body=lambda: utils.serialize_request_body(
284
+ request,
285
+ False,
286
+ True,
287
+ "json",
288
+ Optional[models.CreateProjectProjectsRequestBody],
289
+ ),
290
+ timeout_ms=timeout_ms,
291
+ )
292
+
293
+ if retries == UNSET:
294
+ if self.sdk_configuration.retry_config is not UNSET:
295
+ retries = self.sdk_configuration.retry_config
296
+
297
+ retry_config = None
298
+ if isinstance(retries, utils.RetryConfig):
299
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
300
+
301
+ http_res = self.do_request(
302
+ hook_ctx=HookContext(
303
+ base_url=base_url or "",
304
+ operation_id="create-project",
305
+ oauth2_scopes=[],
306
+ security_source=get_security_from_env(
307
+ self.sdk_configuration.security, models.Security
308
+ ),
309
+ ),
310
+ request=req,
311
+ error_status_codes=["400", "403", "422", "4XX", "5XX"],
312
+ retry_config=retry_config,
313
+ )
314
+
315
+ response_data: Any = None
316
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
317
+ return utils.unmarshal_json(http_res.text, models.CreateProjectResponseBody)
318
+ if utils.match_response(
319
+ http_res, ["400", "403", "422"], "application/vnd.api+json"
320
+ ):
321
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
322
+ raise models.ErrorObject(data=response_data)
323
+ if utils.match_response(http_res, "4XX", "*"):
324
+ http_res_text = utils.stream_to_text(http_res)
325
+ raise models.APIError(
326
+ "API error occurred", http_res.status_code, http_res_text, http_res
327
+ )
328
+ if utils.match_response(http_res, "5XX", "*"):
329
+ http_res_text = utils.stream_to_text(http_res)
330
+ raise models.APIError(
331
+ "API error occurred", http_res.status_code, http_res_text, http_res
332
+ )
333
+
334
+ content_type = http_res.headers.get("Content-Type")
335
+ http_res_text = utils.stream_to_text(http_res)
336
+ raise models.APIError(
337
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
338
+ http_res.status_code,
339
+ http_res_text,
340
+ http_res,
341
+ )
342
+
343
+ async def create_async(
344
+ self,
345
+ *,
346
+ request: Union[
347
+ models.CreateProjectProjectsRequestBody,
348
+ models.CreateProjectProjectsRequestBodyTypedDict,
349
+ ] = models.CreateProjectProjectsRequestBody(),
350
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
351
+ server_url: Optional[str] = None,
352
+ timeout_ms: Optional[int] = None,
353
+ http_headers: Optional[Mapping[str, str]] = None,
354
+ ) -> models.CreateProjectResponseBody:
355
+ r"""Create a Project
356
+
357
+ :param request: The request object to send.
358
+ :param retries: Override the default retry configuration for this method
359
+ :param server_url: Override the default server URL for this method
360
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
361
+ :param http_headers: Additional headers to set or replace on requests.
362
+ """
363
+ base_url = None
364
+ url_variables = None
365
+ if timeout_ms is None:
366
+ timeout_ms = self.sdk_configuration.timeout_ms
367
+
368
+ if server_url is not None:
369
+ base_url = server_url
370
+ else:
371
+ base_url = self._get_url(base_url, url_variables)
372
+
373
+ if not isinstance(request, BaseModel):
374
+ request = utils.unmarshal(request, models.CreateProjectProjectsRequestBody)
375
+ request = cast(models.CreateProjectProjectsRequestBody, request)
376
+
377
+ req = self._build_request_async(
378
+ method="POST",
379
+ path="/projects",
380
+ base_url=base_url,
381
+ url_variables=url_variables,
382
+ request=request,
383
+ request_body_required=True,
384
+ request_has_path_params=False,
385
+ request_has_query_params=True,
386
+ user_agent_header="user-agent",
387
+ accept_header_value="application/vnd.api+json",
388
+ http_headers=http_headers,
389
+ security=self.sdk_configuration.security,
390
+ get_serialized_body=lambda: utils.serialize_request_body(
391
+ request,
392
+ False,
393
+ True,
394
+ "json",
395
+ Optional[models.CreateProjectProjectsRequestBody],
396
+ ),
397
+ timeout_ms=timeout_ms,
398
+ )
399
+
400
+ if retries == UNSET:
401
+ if self.sdk_configuration.retry_config is not UNSET:
402
+ retries = self.sdk_configuration.retry_config
403
+
404
+ retry_config = None
405
+ if isinstance(retries, utils.RetryConfig):
406
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
407
+
408
+ http_res = await self.do_request_async(
409
+ hook_ctx=HookContext(
410
+ base_url=base_url or "",
411
+ operation_id="create-project",
412
+ oauth2_scopes=[],
413
+ security_source=get_security_from_env(
414
+ self.sdk_configuration.security, models.Security
415
+ ),
416
+ ),
417
+ request=req,
418
+ error_status_codes=["400", "403", "422", "4XX", "5XX"],
419
+ retry_config=retry_config,
420
+ )
421
+
422
+ response_data: Any = None
423
+ if utils.match_response(http_res, "201", "application/vnd.api+json"):
424
+ return utils.unmarshal_json(http_res.text, models.CreateProjectResponseBody)
425
+ if utils.match_response(
426
+ http_res, ["400", "403", "422"], "application/vnd.api+json"
427
+ ):
428
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
429
+ raise models.ErrorObject(data=response_data)
430
+ if utils.match_response(http_res, "4XX", "*"):
431
+ http_res_text = await utils.stream_to_text_async(http_res)
432
+ raise models.APIError(
433
+ "API error occurred", http_res.status_code, http_res_text, http_res
434
+ )
435
+ if utils.match_response(http_res, "5XX", "*"):
436
+ http_res_text = await utils.stream_to_text_async(http_res)
437
+ raise models.APIError(
438
+ "API error occurred", http_res.status_code, http_res_text, http_res
439
+ )
440
+
441
+ content_type = http_res.headers.get("Content-Type")
442
+ http_res_text = await utils.stream_to_text_async(http_res)
443
+ raise models.APIError(
444
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
445
+ http_res.status_code,
446
+ http_res_text,
447
+ http_res,
448
+ )
449
+
450
+ def update(
451
+ self,
452
+ *,
453
+ project_id: str,
454
+ data: Union[
455
+ models.UpdateProjectProjectsData, models.UpdateProjectProjectsDataTypedDict
456
+ ],
457
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
458
+ server_url: Optional[str] = None,
459
+ timeout_ms: Optional[int] = None,
460
+ http_headers: Optional[Mapping[str, str]] = None,
461
+ ) -> models.UpdateProjectResponseBody:
462
+ r"""Update a Project
463
+
464
+ :param project_id: The project ID or Slug
465
+ :param data:
466
+ :param retries: Override the default retry configuration for this method
467
+ :param server_url: Override the default server URL for this method
468
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
469
+ :param http_headers: Additional headers to set or replace on requests.
470
+ """
471
+ base_url = None
472
+ url_variables = None
473
+ if timeout_ms is None:
474
+ timeout_ms = self.sdk_configuration.timeout_ms
475
+
476
+ if server_url is not None:
477
+ base_url = server_url
478
+ else:
479
+ base_url = self._get_url(base_url, url_variables)
480
+
481
+ request = models.UpdateProjectRequest(
482
+ project_id=project_id,
483
+ request_body=models.UpdateProjectProjectsRequestBody(
484
+ data=utils.get_pydantic_model(data, models.UpdateProjectProjectsData),
485
+ ),
486
+ )
487
+
488
+ req = self._build_request(
489
+ method="PATCH",
490
+ path="/projects/{project_id}",
491
+ base_url=base_url,
492
+ url_variables=url_variables,
493
+ request=request,
494
+ request_body_required=False,
495
+ request_has_path_params=True,
496
+ request_has_query_params=True,
497
+ user_agent_header="user-agent",
498
+ accept_header_value="application/vnd.api+json",
499
+ http_headers=http_headers,
500
+ security=self.sdk_configuration.security,
501
+ get_serialized_body=lambda: utils.serialize_request_body(
502
+ request.request_body,
503
+ False,
504
+ True,
505
+ "json",
506
+ Optional[models.UpdateProjectProjectsRequestBody],
507
+ ),
508
+ timeout_ms=timeout_ms,
509
+ )
510
+
511
+ if retries == UNSET:
512
+ if self.sdk_configuration.retry_config is not UNSET:
513
+ retries = self.sdk_configuration.retry_config
514
+
515
+ retry_config = None
516
+ if isinstance(retries, utils.RetryConfig):
517
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
518
+
519
+ http_res = self.do_request(
520
+ hook_ctx=HookContext(
521
+ base_url=base_url or "",
522
+ operation_id="update-project",
523
+ oauth2_scopes=[],
524
+ security_source=get_security_from_env(
525
+ self.sdk_configuration.security, models.Security
526
+ ),
527
+ ),
528
+ request=req,
529
+ error_status_codes=["403", "404", "422", "4XX", "5XX"],
530
+ retry_config=retry_config,
531
+ )
532
+
533
+ response_data: Any = None
534
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
535
+ return utils.unmarshal_json(http_res.text, models.UpdateProjectResponseBody)
536
+ if utils.match_response(
537
+ http_res, ["403", "404", "422"], "application/vnd.api+json"
538
+ ):
539
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
540
+ raise models.ErrorObject(data=response_data)
541
+ if utils.match_response(http_res, "4XX", "*"):
542
+ http_res_text = utils.stream_to_text(http_res)
543
+ raise models.APIError(
544
+ "API error occurred", http_res.status_code, http_res_text, http_res
545
+ )
546
+ if utils.match_response(http_res, "5XX", "*"):
547
+ http_res_text = utils.stream_to_text(http_res)
548
+ raise models.APIError(
549
+ "API error occurred", http_res.status_code, http_res_text, http_res
550
+ )
551
+
552
+ content_type = http_res.headers.get("Content-Type")
553
+ http_res_text = utils.stream_to_text(http_res)
554
+ raise models.APIError(
555
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
556
+ http_res.status_code,
557
+ http_res_text,
558
+ http_res,
559
+ )
560
+
561
+ async def update_async(
562
+ self,
563
+ *,
564
+ project_id: str,
565
+ data: Union[
566
+ models.UpdateProjectProjectsData, models.UpdateProjectProjectsDataTypedDict
567
+ ],
568
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
569
+ server_url: Optional[str] = None,
570
+ timeout_ms: Optional[int] = None,
571
+ http_headers: Optional[Mapping[str, str]] = None,
572
+ ) -> models.UpdateProjectResponseBody:
573
+ r"""Update a Project
574
+
575
+ :param project_id: The project ID or Slug
576
+ :param data:
577
+ :param retries: Override the default retry configuration for this method
578
+ :param server_url: Override the default server URL for this method
579
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
580
+ :param http_headers: Additional headers to set or replace on requests.
581
+ """
582
+ base_url = None
583
+ url_variables = None
584
+ if timeout_ms is None:
585
+ timeout_ms = self.sdk_configuration.timeout_ms
586
+
587
+ if server_url is not None:
588
+ base_url = server_url
589
+ else:
590
+ base_url = self._get_url(base_url, url_variables)
591
+
592
+ request = models.UpdateProjectRequest(
593
+ project_id=project_id,
594
+ request_body=models.UpdateProjectProjectsRequestBody(
595
+ data=utils.get_pydantic_model(data, models.UpdateProjectProjectsData),
596
+ ),
597
+ )
598
+
599
+ req = self._build_request_async(
600
+ method="PATCH",
601
+ path="/projects/{project_id}",
602
+ base_url=base_url,
603
+ url_variables=url_variables,
604
+ request=request,
605
+ request_body_required=False,
606
+ request_has_path_params=True,
607
+ request_has_query_params=True,
608
+ user_agent_header="user-agent",
609
+ accept_header_value="application/vnd.api+json",
610
+ http_headers=http_headers,
611
+ security=self.sdk_configuration.security,
612
+ get_serialized_body=lambda: utils.serialize_request_body(
613
+ request.request_body,
614
+ False,
615
+ True,
616
+ "json",
617
+ Optional[models.UpdateProjectProjectsRequestBody],
618
+ ),
619
+ timeout_ms=timeout_ms,
620
+ )
621
+
622
+ if retries == UNSET:
623
+ if self.sdk_configuration.retry_config is not UNSET:
624
+ retries = self.sdk_configuration.retry_config
625
+
626
+ retry_config = None
627
+ if isinstance(retries, utils.RetryConfig):
628
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
629
+
630
+ http_res = await self.do_request_async(
631
+ hook_ctx=HookContext(
632
+ base_url=base_url or "",
633
+ operation_id="update-project",
634
+ oauth2_scopes=[],
635
+ security_source=get_security_from_env(
636
+ self.sdk_configuration.security, models.Security
637
+ ),
638
+ ),
639
+ request=req,
640
+ error_status_codes=["403", "404", "422", "4XX", "5XX"],
641
+ retry_config=retry_config,
642
+ )
643
+
644
+ response_data: Any = None
645
+ if utils.match_response(http_res, "200", "application/vnd.api+json"):
646
+ return utils.unmarshal_json(http_res.text, models.UpdateProjectResponseBody)
647
+ if utils.match_response(
648
+ http_res, ["403", "404", "422"], "application/vnd.api+json"
649
+ ):
650
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
651
+ raise models.ErrorObject(data=response_data)
652
+ if utils.match_response(http_res, "4XX", "*"):
653
+ http_res_text = await utils.stream_to_text_async(http_res)
654
+ raise models.APIError(
655
+ "API error occurred", http_res.status_code, http_res_text, http_res
656
+ )
657
+ if utils.match_response(http_res, "5XX", "*"):
658
+ http_res_text = await utils.stream_to_text_async(http_res)
659
+ raise models.APIError(
660
+ "API error occurred", http_res.status_code, http_res_text, http_res
661
+ )
662
+
663
+ content_type = http_res.headers.get("Content-Type")
664
+ http_res_text = await utils.stream_to_text_async(http_res)
665
+ raise models.APIError(
666
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
667
+ http_res.status_code,
668
+ http_res_text,
669
+ http_res,
670
+ )
671
+
672
+ def delete(
673
+ self,
674
+ *,
675
+ project_id: str,
676
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
677
+ server_url: Optional[str] = None,
678
+ timeout_ms: Optional[int] = None,
679
+ http_headers: Optional[Mapping[str, str]] = None,
680
+ ):
681
+ r"""Delete a Project
682
+
683
+ :param project_id: The project ID or Slug
684
+ :param retries: Override the default retry configuration for this method
685
+ :param server_url: Override the default server URL for this method
686
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
687
+ :param http_headers: Additional headers to set or replace on requests.
688
+ """
689
+ base_url = None
690
+ url_variables = None
691
+ if timeout_ms is None:
692
+ timeout_ms = self.sdk_configuration.timeout_ms
693
+
694
+ if server_url is not None:
695
+ base_url = server_url
696
+ else:
697
+ base_url = self._get_url(base_url, url_variables)
698
+
699
+ request = models.DeleteProjectRequest(
700
+ project_id=project_id,
701
+ )
702
+
703
+ req = self._build_request(
704
+ method="DELETE",
705
+ path="/projects/{project_id}",
706
+ base_url=base_url,
707
+ url_variables=url_variables,
708
+ request=request,
709
+ request_body_required=False,
710
+ request_has_path_params=True,
711
+ request_has_query_params=True,
712
+ user_agent_header="user-agent",
713
+ accept_header_value="application/vnd.api+json",
714
+ http_headers=http_headers,
715
+ security=self.sdk_configuration.security,
716
+ timeout_ms=timeout_ms,
717
+ )
718
+
719
+ if retries == UNSET:
720
+ if self.sdk_configuration.retry_config is not UNSET:
721
+ retries = self.sdk_configuration.retry_config
722
+
723
+ retry_config = None
724
+ if isinstance(retries, utils.RetryConfig):
725
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
726
+
727
+ http_res = self.do_request(
728
+ hook_ctx=HookContext(
729
+ base_url=base_url or "",
730
+ operation_id="delete-project",
731
+ oauth2_scopes=[],
732
+ security_source=get_security_from_env(
733
+ self.sdk_configuration.security, models.Security
734
+ ),
735
+ ),
736
+ request=req,
737
+ error_status_codes=["403", "404", "422", "4XX", "5XX"],
738
+ retry_config=retry_config,
739
+ )
740
+
741
+ response_data: Any = None
742
+ if utils.match_response(http_res, "204", "*"):
743
+ return
744
+ if utils.match_response(
745
+ http_res, ["403", "404", "422"], "application/vnd.api+json"
746
+ ):
747
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
748
+ raise models.ErrorObject(data=response_data)
749
+ if utils.match_response(http_res, "4XX", "*"):
750
+ http_res_text = utils.stream_to_text(http_res)
751
+ raise models.APIError(
752
+ "API error occurred", http_res.status_code, http_res_text, http_res
753
+ )
754
+ if utils.match_response(http_res, "5XX", "*"):
755
+ http_res_text = utils.stream_to_text(http_res)
756
+ raise models.APIError(
757
+ "API error occurred", http_res.status_code, http_res_text, http_res
758
+ )
759
+
760
+ content_type = http_res.headers.get("Content-Type")
761
+ http_res_text = utils.stream_to_text(http_res)
762
+ raise models.APIError(
763
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
764
+ http_res.status_code,
765
+ http_res_text,
766
+ http_res,
767
+ )
768
+
769
+ async def delete_async(
770
+ self,
771
+ *,
772
+ project_id: str,
773
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
774
+ server_url: Optional[str] = None,
775
+ timeout_ms: Optional[int] = None,
776
+ http_headers: Optional[Mapping[str, str]] = None,
777
+ ):
778
+ r"""Delete a Project
779
+
780
+ :param project_id: The project ID or Slug
781
+ :param retries: Override the default retry configuration for this method
782
+ :param server_url: Override the default server URL for this method
783
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
784
+ :param http_headers: Additional headers to set or replace on requests.
785
+ """
786
+ base_url = None
787
+ url_variables = None
788
+ if timeout_ms is None:
789
+ timeout_ms = self.sdk_configuration.timeout_ms
790
+
791
+ if server_url is not None:
792
+ base_url = server_url
793
+ else:
794
+ base_url = self._get_url(base_url, url_variables)
795
+
796
+ request = models.DeleteProjectRequest(
797
+ project_id=project_id,
798
+ )
799
+
800
+ req = self._build_request_async(
801
+ method="DELETE",
802
+ path="/projects/{project_id}",
803
+ base_url=base_url,
804
+ url_variables=url_variables,
805
+ request=request,
806
+ request_body_required=False,
807
+ request_has_path_params=True,
808
+ request_has_query_params=True,
809
+ user_agent_header="user-agent",
810
+ accept_header_value="application/vnd.api+json",
811
+ http_headers=http_headers,
812
+ security=self.sdk_configuration.security,
813
+ timeout_ms=timeout_ms,
814
+ )
815
+
816
+ if retries == UNSET:
817
+ if self.sdk_configuration.retry_config is not UNSET:
818
+ retries = self.sdk_configuration.retry_config
819
+
820
+ retry_config = None
821
+ if isinstance(retries, utils.RetryConfig):
822
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
823
+
824
+ http_res = await self.do_request_async(
825
+ hook_ctx=HookContext(
826
+ base_url=base_url or "",
827
+ operation_id="delete-project",
828
+ oauth2_scopes=[],
829
+ security_source=get_security_from_env(
830
+ self.sdk_configuration.security, models.Security
831
+ ),
832
+ ),
833
+ request=req,
834
+ error_status_codes=["403", "404", "422", "4XX", "5XX"],
835
+ retry_config=retry_config,
836
+ )
837
+
838
+ response_data: Any = None
839
+ if utils.match_response(http_res, "204", "*"):
840
+ return
841
+ if utils.match_response(
842
+ http_res, ["403", "404", "422"], "application/vnd.api+json"
843
+ ):
844
+ response_data = utils.unmarshal_json(http_res.text, models.ErrorObjectData)
845
+ raise models.ErrorObject(data=response_data)
846
+ if utils.match_response(http_res, "4XX", "*"):
847
+ http_res_text = await utils.stream_to_text_async(http_res)
848
+ raise models.APIError(
849
+ "API error occurred", http_res.status_code, http_res_text, http_res
850
+ )
851
+ if utils.match_response(http_res, "5XX", "*"):
852
+ http_res_text = await utils.stream_to_text_async(http_res)
853
+ raise models.APIError(
854
+ "API error occurred", http_res.status_code, http_res_text, http_res
855
+ )
856
+
857
+ content_type = http_res.headers.get("Content-Type")
858
+ http_res_text = await utils.stream_to_text_async(http_res)
859
+ raise models.APIError(
860
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
861
+ http_res.status_code,
862
+ http_res_text,
863
+ http_res,
864
+ )