mixpeek 0.17.9__py3-none-any.whl → 0.18.0__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.
- mixpeek/_version.py +2 -2
- mixpeek/assets.py +14 -14
- mixpeek/collections.py +10 -10
- mixpeek/{feature_extractors.py → featureextractors.py} +2 -2
- mixpeek/features.py +348 -8
- mixpeek/{ingest_assets.py → ingestassets.py} +6 -6
- mixpeek/namespaces.py +12 -12
- mixpeek/organizations.py +10 -626
- mixpeek/sdk.py +9 -6
- mixpeek/tasks.py +6 -6
- mixpeek/taxonomies.py +686 -0
- mixpeek/{taxonomy_entities.py → taxonomyentities.py} +14 -690
- mixpeek/users.py +626 -0
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.0.dist-info}/METADATA +57 -54
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.0.dist-info}/RECORD +16 -15
- mixpeek/feature_search.py +0 -350
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.0.dist-info}/WHEEL +0 -0
mixpeek/users.py
ADDED
@@ -0,0 +1,626 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from mixpeek import models, utils
|
5
|
+
from mixpeek._hooks import HookContext
|
6
|
+
from mixpeek.types import OptionalNullable, UNSET
|
7
|
+
from mixpeek.utils import get_security_from_env
|
8
|
+
from typing import Any, Mapping, Optional
|
9
|
+
|
10
|
+
|
11
|
+
class Users(BaseSDK):
|
12
|
+
def get(
|
13
|
+
self,
|
14
|
+
*,
|
15
|
+
user_email: str,
|
16
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
17
|
+
server_url: Optional[str] = None,
|
18
|
+
timeout_ms: Optional[int] = None,
|
19
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
20
|
+
) -> models.UserModelOutput:
|
21
|
+
r"""Get User
|
22
|
+
|
23
|
+
:param user_email:
|
24
|
+
:param retries: Override the default retry configuration for this method
|
25
|
+
:param server_url: Override the default server URL for this method
|
26
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
27
|
+
:param http_headers: Additional headers to set or replace on requests.
|
28
|
+
"""
|
29
|
+
base_url = None
|
30
|
+
url_variables = None
|
31
|
+
if timeout_ms is None:
|
32
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
33
|
+
|
34
|
+
if server_url is not None:
|
35
|
+
base_url = server_url
|
36
|
+
|
37
|
+
request = models.GetUserV1OrganizationsUsersUserEmailGetRequest(
|
38
|
+
user_email=user_email,
|
39
|
+
)
|
40
|
+
|
41
|
+
req = self._build_request(
|
42
|
+
method="GET",
|
43
|
+
path="/v1/organizations/users/{user_email}",
|
44
|
+
base_url=base_url,
|
45
|
+
url_variables=url_variables,
|
46
|
+
request=request,
|
47
|
+
request_body_required=False,
|
48
|
+
request_has_path_params=True,
|
49
|
+
request_has_query_params=True,
|
50
|
+
user_agent_header="user-agent",
|
51
|
+
accept_header_value="application/json",
|
52
|
+
http_headers=http_headers,
|
53
|
+
security=self.sdk_configuration.security,
|
54
|
+
timeout_ms=timeout_ms,
|
55
|
+
)
|
56
|
+
|
57
|
+
if retries == UNSET:
|
58
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
59
|
+
retries = self.sdk_configuration.retry_config
|
60
|
+
|
61
|
+
retry_config = None
|
62
|
+
if isinstance(retries, utils.RetryConfig):
|
63
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
64
|
+
|
65
|
+
http_res = self.do_request(
|
66
|
+
hook_ctx=HookContext(
|
67
|
+
operation_id="get_user_v1_organizations_users__user_email__get",
|
68
|
+
oauth2_scopes=[],
|
69
|
+
security_source=get_security_from_env(
|
70
|
+
self.sdk_configuration.security, models.Security
|
71
|
+
),
|
72
|
+
),
|
73
|
+
request=req,
|
74
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
75
|
+
retry_config=retry_config,
|
76
|
+
)
|
77
|
+
|
78
|
+
data: Any = None
|
79
|
+
if utils.match_response(http_res, "200", "application/json"):
|
80
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
81
|
+
if utils.match_response(
|
82
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
83
|
+
):
|
84
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
85
|
+
raise models.ErrorResponse(data=data)
|
86
|
+
if utils.match_response(http_res, "422", "application/json"):
|
87
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
88
|
+
raise models.HTTPValidationError(data=data)
|
89
|
+
if utils.match_response(http_res, "500", "application/json"):
|
90
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
91
|
+
raise models.ErrorResponse(data=data)
|
92
|
+
if utils.match_response(http_res, "4XX", "*"):
|
93
|
+
http_res_text = utils.stream_to_text(http_res)
|
94
|
+
raise models.APIError(
|
95
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
96
|
+
)
|
97
|
+
if utils.match_response(http_res, "5XX", "*"):
|
98
|
+
http_res_text = utils.stream_to_text(http_res)
|
99
|
+
raise models.APIError(
|
100
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
101
|
+
)
|
102
|
+
|
103
|
+
content_type = http_res.headers.get("Content-Type")
|
104
|
+
http_res_text = utils.stream_to_text(http_res)
|
105
|
+
raise models.APIError(
|
106
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
107
|
+
http_res.status_code,
|
108
|
+
http_res_text,
|
109
|
+
http_res,
|
110
|
+
)
|
111
|
+
|
112
|
+
async def get_async(
|
113
|
+
self,
|
114
|
+
*,
|
115
|
+
user_email: str,
|
116
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
117
|
+
server_url: Optional[str] = None,
|
118
|
+
timeout_ms: Optional[int] = None,
|
119
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
120
|
+
) -> models.UserModelOutput:
|
121
|
+
r"""Get User
|
122
|
+
|
123
|
+
:param user_email:
|
124
|
+
:param retries: Override the default retry configuration for this method
|
125
|
+
:param server_url: Override the default server URL for this method
|
126
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
127
|
+
:param http_headers: Additional headers to set or replace on requests.
|
128
|
+
"""
|
129
|
+
base_url = None
|
130
|
+
url_variables = None
|
131
|
+
if timeout_ms is None:
|
132
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
133
|
+
|
134
|
+
if server_url is not None:
|
135
|
+
base_url = server_url
|
136
|
+
|
137
|
+
request = models.GetUserV1OrganizationsUsersUserEmailGetRequest(
|
138
|
+
user_email=user_email,
|
139
|
+
)
|
140
|
+
|
141
|
+
req = self._build_request_async(
|
142
|
+
method="GET",
|
143
|
+
path="/v1/organizations/users/{user_email}",
|
144
|
+
base_url=base_url,
|
145
|
+
url_variables=url_variables,
|
146
|
+
request=request,
|
147
|
+
request_body_required=False,
|
148
|
+
request_has_path_params=True,
|
149
|
+
request_has_query_params=True,
|
150
|
+
user_agent_header="user-agent",
|
151
|
+
accept_header_value="application/json",
|
152
|
+
http_headers=http_headers,
|
153
|
+
security=self.sdk_configuration.security,
|
154
|
+
timeout_ms=timeout_ms,
|
155
|
+
)
|
156
|
+
|
157
|
+
if retries == UNSET:
|
158
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
159
|
+
retries = self.sdk_configuration.retry_config
|
160
|
+
|
161
|
+
retry_config = None
|
162
|
+
if isinstance(retries, utils.RetryConfig):
|
163
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
164
|
+
|
165
|
+
http_res = await self.do_request_async(
|
166
|
+
hook_ctx=HookContext(
|
167
|
+
operation_id="get_user_v1_organizations_users__user_email__get",
|
168
|
+
oauth2_scopes=[],
|
169
|
+
security_source=get_security_from_env(
|
170
|
+
self.sdk_configuration.security, models.Security
|
171
|
+
),
|
172
|
+
),
|
173
|
+
request=req,
|
174
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
175
|
+
retry_config=retry_config,
|
176
|
+
)
|
177
|
+
|
178
|
+
data: Any = None
|
179
|
+
if utils.match_response(http_res, "200", "application/json"):
|
180
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
181
|
+
if utils.match_response(
|
182
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
183
|
+
):
|
184
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
185
|
+
raise models.ErrorResponse(data=data)
|
186
|
+
if utils.match_response(http_res, "422", "application/json"):
|
187
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
188
|
+
raise models.HTTPValidationError(data=data)
|
189
|
+
if utils.match_response(http_res, "500", "application/json"):
|
190
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
191
|
+
raise models.ErrorResponse(data=data)
|
192
|
+
if utils.match_response(http_res, "4XX", "*"):
|
193
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
194
|
+
raise models.APIError(
|
195
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
196
|
+
)
|
197
|
+
if utils.match_response(http_res, "5XX", "*"):
|
198
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
199
|
+
raise models.APIError(
|
200
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
201
|
+
)
|
202
|
+
|
203
|
+
content_type = http_res.headers.get("Content-Type")
|
204
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
205
|
+
raise models.APIError(
|
206
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
207
|
+
http_res.status_code,
|
208
|
+
http_res_text,
|
209
|
+
http_res,
|
210
|
+
)
|
211
|
+
|
212
|
+
def delete(
|
213
|
+
self,
|
214
|
+
*,
|
215
|
+
user_email: str,
|
216
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
217
|
+
server_url: Optional[str] = None,
|
218
|
+
timeout_ms: Optional[int] = None,
|
219
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
220
|
+
) -> Any:
|
221
|
+
r"""Delete User
|
222
|
+
|
223
|
+
**Requirements:**
|
224
|
+
- Required permissions: admin
|
225
|
+
|
226
|
+
:param user_email:
|
227
|
+
:param retries: Override the default retry configuration for this method
|
228
|
+
:param server_url: Override the default server URL for this method
|
229
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
230
|
+
:param http_headers: Additional headers to set or replace on requests.
|
231
|
+
"""
|
232
|
+
base_url = None
|
233
|
+
url_variables = None
|
234
|
+
if timeout_ms is None:
|
235
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
236
|
+
|
237
|
+
if server_url is not None:
|
238
|
+
base_url = server_url
|
239
|
+
|
240
|
+
request = models.DeleteUserV1OrganizationsUsersUserEmailDeleteRequest(
|
241
|
+
user_email=user_email,
|
242
|
+
)
|
243
|
+
|
244
|
+
req = self._build_request(
|
245
|
+
method="DELETE",
|
246
|
+
path="/v1/organizations/users/{user_email}",
|
247
|
+
base_url=base_url,
|
248
|
+
url_variables=url_variables,
|
249
|
+
request=request,
|
250
|
+
request_body_required=False,
|
251
|
+
request_has_path_params=True,
|
252
|
+
request_has_query_params=True,
|
253
|
+
user_agent_header="user-agent",
|
254
|
+
accept_header_value="application/json",
|
255
|
+
http_headers=http_headers,
|
256
|
+
security=self.sdk_configuration.security,
|
257
|
+
timeout_ms=timeout_ms,
|
258
|
+
)
|
259
|
+
|
260
|
+
if retries == UNSET:
|
261
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
262
|
+
retries = self.sdk_configuration.retry_config
|
263
|
+
|
264
|
+
retry_config = None
|
265
|
+
if isinstance(retries, utils.RetryConfig):
|
266
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
267
|
+
|
268
|
+
http_res = self.do_request(
|
269
|
+
hook_ctx=HookContext(
|
270
|
+
operation_id="delete_user_v1_organizations_users__user_email__delete",
|
271
|
+
oauth2_scopes=[],
|
272
|
+
security_source=get_security_from_env(
|
273
|
+
self.sdk_configuration.security, models.Security
|
274
|
+
),
|
275
|
+
),
|
276
|
+
request=req,
|
277
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
278
|
+
retry_config=retry_config,
|
279
|
+
)
|
280
|
+
|
281
|
+
data: Any = None
|
282
|
+
if utils.match_response(http_res, "200", "application/json"):
|
283
|
+
return utils.unmarshal_json(http_res.text, Any)
|
284
|
+
if utils.match_response(
|
285
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
286
|
+
):
|
287
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
288
|
+
raise models.ErrorResponse(data=data)
|
289
|
+
if utils.match_response(http_res, "422", "application/json"):
|
290
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
291
|
+
raise models.HTTPValidationError(data=data)
|
292
|
+
if utils.match_response(http_res, "500", "application/json"):
|
293
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
294
|
+
raise models.ErrorResponse(data=data)
|
295
|
+
if utils.match_response(http_res, "4XX", "*"):
|
296
|
+
http_res_text = utils.stream_to_text(http_res)
|
297
|
+
raise models.APIError(
|
298
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
299
|
+
)
|
300
|
+
if utils.match_response(http_res, "5XX", "*"):
|
301
|
+
http_res_text = utils.stream_to_text(http_res)
|
302
|
+
raise models.APIError(
|
303
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
304
|
+
)
|
305
|
+
|
306
|
+
content_type = http_res.headers.get("Content-Type")
|
307
|
+
http_res_text = utils.stream_to_text(http_res)
|
308
|
+
raise models.APIError(
|
309
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
310
|
+
http_res.status_code,
|
311
|
+
http_res_text,
|
312
|
+
http_res,
|
313
|
+
)
|
314
|
+
|
315
|
+
async def delete_async(
|
316
|
+
self,
|
317
|
+
*,
|
318
|
+
user_email: str,
|
319
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
320
|
+
server_url: Optional[str] = None,
|
321
|
+
timeout_ms: Optional[int] = None,
|
322
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
323
|
+
) -> Any:
|
324
|
+
r"""Delete User
|
325
|
+
|
326
|
+
**Requirements:**
|
327
|
+
- Required permissions: admin
|
328
|
+
|
329
|
+
:param user_email:
|
330
|
+
:param retries: Override the default retry configuration for this method
|
331
|
+
:param server_url: Override the default server URL for this method
|
332
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
333
|
+
:param http_headers: Additional headers to set or replace on requests.
|
334
|
+
"""
|
335
|
+
base_url = None
|
336
|
+
url_variables = None
|
337
|
+
if timeout_ms is None:
|
338
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
339
|
+
|
340
|
+
if server_url is not None:
|
341
|
+
base_url = server_url
|
342
|
+
|
343
|
+
request = models.DeleteUserV1OrganizationsUsersUserEmailDeleteRequest(
|
344
|
+
user_email=user_email,
|
345
|
+
)
|
346
|
+
|
347
|
+
req = self._build_request_async(
|
348
|
+
method="DELETE",
|
349
|
+
path="/v1/organizations/users/{user_email}",
|
350
|
+
base_url=base_url,
|
351
|
+
url_variables=url_variables,
|
352
|
+
request=request,
|
353
|
+
request_body_required=False,
|
354
|
+
request_has_path_params=True,
|
355
|
+
request_has_query_params=True,
|
356
|
+
user_agent_header="user-agent",
|
357
|
+
accept_header_value="application/json",
|
358
|
+
http_headers=http_headers,
|
359
|
+
security=self.sdk_configuration.security,
|
360
|
+
timeout_ms=timeout_ms,
|
361
|
+
)
|
362
|
+
|
363
|
+
if retries == UNSET:
|
364
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
365
|
+
retries = self.sdk_configuration.retry_config
|
366
|
+
|
367
|
+
retry_config = None
|
368
|
+
if isinstance(retries, utils.RetryConfig):
|
369
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
370
|
+
|
371
|
+
http_res = await self.do_request_async(
|
372
|
+
hook_ctx=HookContext(
|
373
|
+
operation_id="delete_user_v1_organizations_users__user_email__delete",
|
374
|
+
oauth2_scopes=[],
|
375
|
+
security_source=get_security_from_env(
|
376
|
+
self.sdk_configuration.security, models.Security
|
377
|
+
),
|
378
|
+
),
|
379
|
+
request=req,
|
380
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
381
|
+
retry_config=retry_config,
|
382
|
+
)
|
383
|
+
|
384
|
+
data: Any = None
|
385
|
+
if utils.match_response(http_res, "200", "application/json"):
|
386
|
+
return utils.unmarshal_json(http_res.text, Any)
|
387
|
+
if utils.match_response(
|
388
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
389
|
+
):
|
390
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
391
|
+
raise models.ErrorResponse(data=data)
|
392
|
+
if utils.match_response(http_res, "422", "application/json"):
|
393
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
394
|
+
raise models.HTTPValidationError(data=data)
|
395
|
+
if utils.match_response(http_res, "500", "application/json"):
|
396
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
397
|
+
raise models.ErrorResponse(data=data)
|
398
|
+
if utils.match_response(http_res, "4XX", "*"):
|
399
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
400
|
+
raise models.APIError(
|
401
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
402
|
+
)
|
403
|
+
if utils.match_response(http_res, "5XX", "*"):
|
404
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
405
|
+
raise models.APIError(
|
406
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
407
|
+
)
|
408
|
+
|
409
|
+
content_type = http_res.headers.get("Content-Type")
|
410
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
411
|
+
raise models.APIError(
|
412
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
413
|
+
http_res.status_code,
|
414
|
+
http_res_text,
|
415
|
+
http_res,
|
416
|
+
)
|
417
|
+
|
418
|
+
def create_api_key(
|
419
|
+
self,
|
420
|
+
*,
|
421
|
+
user_email: str,
|
422
|
+
key_name: Optional[str] = "default",
|
423
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
424
|
+
server_url: Optional[str] = None,
|
425
|
+
timeout_ms: Optional[int] = None,
|
426
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
427
|
+
) -> models.APIKey:
|
428
|
+
r"""Create Api Key
|
429
|
+
|
430
|
+
Create a new API key for a specific user
|
431
|
+
|
432
|
+
:param user_email:
|
433
|
+
:param key_name:
|
434
|
+
:param retries: Override the default retry configuration for this method
|
435
|
+
:param server_url: Override the default server URL for this method
|
436
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
437
|
+
:param http_headers: Additional headers to set or replace on requests.
|
438
|
+
"""
|
439
|
+
base_url = None
|
440
|
+
url_variables = None
|
441
|
+
if timeout_ms is None:
|
442
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
443
|
+
|
444
|
+
if server_url is not None:
|
445
|
+
base_url = server_url
|
446
|
+
|
447
|
+
request = models.CreateAPIKeyV1OrganizationsUsersUserEmailAPIKeysPostRequest(
|
448
|
+
user_email=user_email,
|
449
|
+
key_name=key_name,
|
450
|
+
)
|
451
|
+
|
452
|
+
req = self._build_request(
|
453
|
+
method="POST",
|
454
|
+
path="/v1/organizations/users/{user_email}/api-keys",
|
455
|
+
base_url=base_url,
|
456
|
+
url_variables=url_variables,
|
457
|
+
request=request,
|
458
|
+
request_body_required=False,
|
459
|
+
request_has_path_params=True,
|
460
|
+
request_has_query_params=True,
|
461
|
+
user_agent_header="user-agent",
|
462
|
+
accept_header_value="application/json",
|
463
|
+
http_headers=http_headers,
|
464
|
+
security=self.sdk_configuration.security,
|
465
|
+
timeout_ms=timeout_ms,
|
466
|
+
)
|
467
|
+
|
468
|
+
if retries == UNSET:
|
469
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
470
|
+
retries = self.sdk_configuration.retry_config
|
471
|
+
|
472
|
+
retry_config = None
|
473
|
+
if isinstance(retries, utils.RetryConfig):
|
474
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
475
|
+
|
476
|
+
http_res = self.do_request(
|
477
|
+
hook_ctx=HookContext(
|
478
|
+
operation_id="create_api_key_v1_organizations_users__user_email__api_keys_post",
|
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=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
486
|
+
retry_config=retry_config,
|
487
|
+
)
|
488
|
+
|
489
|
+
data: Any = None
|
490
|
+
if utils.match_response(http_res, "200", "application/json"):
|
491
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
492
|
+
if utils.match_response(
|
493
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
494
|
+
):
|
495
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
496
|
+
raise models.ErrorResponse(data=data)
|
497
|
+
if utils.match_response(http_res, "422", "application/json"):
|
498
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
499
|
+
raise models.HTTPValidationError(data=data)
|
500
|
+
if utils.match_response(http_res, "500", "application/json"):
|
501
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
502
|
+
raise models.ErrorResponse(data=data)
|
503
|
+
if utils.match_response(http_res, "4XX", "*"):
|
504
|
+
http_res_text = utils.stream_to_text(http_res)
|
505
|
+
raise models.APIError(
|
506
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
507
|
+
)
|
508
|
+
if utils.match_response(http_res, "5XX", "*"):
|
509
|
+
http_res_text = utils.stream_to_text(http_res)
|
510
|
+
raise models.APIError(
|
511
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
512
|
+
)
|
513
|
+
|
514
|
+
content_type = http_res.headers.get("Content-Type")
|
515
|
+
http_res_text = utils.stream_to_text(http_res)
|
516
|
+
raise models.APIError(
|
517
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
518
|
+
http_res.status_code,
|
519
|
+
http_res_text,
|
520
|
+
http_res,
|
521
|
+
)
|
522
|
+
|
523
|
+
async def create_api_key_async(
|
524
|
+
self,
|
525
|
+
*,
|
526
|
+
user_email: str,
|
527
|
+
key_name: Optional[str] = "default",
|
528
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
529
|
+
server_url: Optional[str] = None,
|
530
|
+
timeout_ms: Optional[int] = None,
|
531
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
532
|
+
) -> models.APIKey:
|
533
|
+
r"""Create Api Key
|
534
|
+
|
535
|
+
Create a new API key for a specific user
|
536
|
+
|
537
|
+
:param user_email:
|
538
|
+
:param key_name:
|
539
|
+
:param retries: Override the default retry configuration for this method
|
540
|
+
:param server_url: Override the default server URL for this method
|
541
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
542
|
+
:param http_headers: Additional headers to set or replace on requests.
|
543
|
+
"""
|
544
|
+
base_url = None
|
545
|
+
url_variables = None
|
546
|
+
if timeout_ms is None:
|
547
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
548
|
+
|
549
|
+
if server_url is not None:
|
550
|
+
base_url = server_url
|
551
|
+
|
552
|
+
request = models.CreateAPIKeyV1OrganizationsUsersUserEmailAPIKeysPostRequest(
|
553
|
+
user_email=user_email,
|
554
|
+
key_name=key_name,
|
555
|
+
)
|
556
|
+
|
557
|
+
req = self._build_request_async(
|
558
|
+
method="POST",
|
559
|
+
path="/v1/organizations/users/{user_email}/api-keys",
|
560
|
+
base_url=base_url,
|
561
|
+
url_variables=url_variables,
|
562
|
+
request=request,
|
563
|
+
request_body_required=False,
|
564
|
+
request_has_path_params=True,
|
565
|
+
request_has_query_params=True,
|
566
|
+
user_agent_header="user-agent",
|
567
|
+
accept_header_value="application/json",
|
568
|
+
http_headers=http_headers,
|
569
|
+
security=self.sdk_configuration.security,
|
570
|
+
timeout_ms=timeout_ms,
|
571
|
+
)
|
572
|
+
|
573
|
+
if retries == UNSET:
|
574
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
575
|
+
retries = self.sdk_configuration.retry_config
|
576
|
+
|
577
|
+
retry_config = None
|
578
|
+
if isinstance(retries, utils.RetryConfig):
|
579
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
580
|
+
|
581
|
+
http_res = await self.do_request_async(
|
582
|
+
hook_ctx=HookContext(
|
583
|
+
operation_id="create_api_key_v1_organizations_users__user_email__api_keys_post",
|
584
|
+
oauth2_scopes=[],
|
585
|
+
security_source=get_security_from_env(
|
586
|
+
self.sdk_configuration.security, models.Security
|
587
|
+
),
|
588
|
+
),
|
589
|
+
request=req,
|
590
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
591
|
+
retry_config=retry_config,
|
592
|
+
)
|
593
|
+
|
594
|
+
data: Any = None
|
595
|
+
if utils.match_response(http_res, "200", "application/json"):
|
596
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
597
|
+
if utils.match_response(
|
598
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
599
|
+
):
|
600
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
601
|
+
raise models.ErrorResponse(data=data)
|
602
|
+
if utils.match_response(http_res, "422", "application/json"):
|
603
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
604
|
+
raise models.HTTPValidationError(data=data)
|
605
|
+
if utils.match_response(http_res, "500", "application/json"):
|
606
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
607
|
+
raise models.ErrorResponse(data=data)
|
608
|
+
if utils.match_response(http_res, "4XX", "*"):
|
609
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
610
|
+
raise models.APIError(
|
611
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
612
|
+
)
|
613
|
+
if utils.match_response(http_res, "5XX", "*"):
|
614
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
615
|
+
raise models.APIError(
|
616
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
617
|
+
)
|
618
|
+
|
619
|
+
content_type = http_res.headers.get("Content-Type")
|
620
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
621
|
+
raise models.APIError(
|
622
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
623
|
+
http_res.status_code,
|
624
|
+
http_res_text,
|
625
|
+
http_res,
|
626
|
+
)
|