mixpeek 0.11.2__py3-none-any.whl → 0.13__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/__init__.py +9 -1
- mixpeek/_hooks/__init__.py +5 -0
- mixpeek/_hooks/registration.py +13 -0
- mixpeek/_hooks/sdkhooks.py +76 -0
- mixpeek/_hooks/types.py +94 -0
- mixpeek/_version.py +12 -0
- mixpeek/assets.py +1561 -0
- mixpeek/basesdk.py +350 -0
- mixpeek/collections.py +1029 -0
- mixpeek/featureextractors.py +205 -0
- mixpeek/features.py +1181 -0
- mixpeek/health.py +167 -0
- mixpeek/httpclient.py +84 -0
- mixpeek/ingest.py +831 -0
- mixpeek/interactions.py +221 -0
- mixpeek/models/__init__.py +751 -0
- mixpeek/models/actionusage.py +16 -0
- mixpeek/models/apierror.py +22 -0
- mixpeek/models/apikey.py +25 -0
- mixpeek/models/apikeyupdate.py +49 -0
- mixpeek/models/assetfeatures.py +55 -0
- mixpeek/models/assetresponse.py +166 -0
- mixpeek/models/assets_model_searchquery.py +21 -0
- mixpeek/models/assetupdate.py +28 -0
- mixpeek/models/availableindexesresponse.py +23 -0
- mixpeek/models/availablemodels.py +12 -0
- mixpeek/models/boolindexparams.py +18 -0
- mixpeek/models/collectionmodel.py +70 -0
- mixpeek/models/collectionresult.py +73 -0
- mixpeek/models/create_api_key_organizations_users_user_email_api_keys_postop.py +23 -0
- mixpeek/models/create_collection_collections_postop.py +62 -0
- mixpeek/models/create_interaction_features_search_interactions_postop.py +59 -0
- mixpeek/models/createcollectionrequest.py +59 -0
- mixpeek/models/createnamespacerequest.py +62 -0
- mixpeek/models/datetimeindexparams.py +18 -0
- mixpeek/models/dateusage.py +22 -0
- mixpeek/models/db_model_paginationresponse.py +59 -0
- mixpeek/models/db_model_taskresponse.py +20 -0
- mixpeek/models/delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py +23 -0
- mixpeek/models/delete_asset_assets_asset_id_deleteop.py +57 -0
- mixpeek/models/delete_collection_collections_collection_deleteop.py +59 -0
- mixpeek/models/delete_feature_features_feature_id_deleteop.py +57 -0
- mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +59 -0
- mixpeek/models/delete_namespace_namespaces_namespace_deleteop.py +18 -0
- mixpeek/models/delete_user_organizations_users_user_email_deleteop.py +16 -0
- mixpeek/models/denseembedding.py +16 -0
- mixpeek/models/embeddingrequest.py +59 -0
- mixpeek/models/embeddingresponse.py +64 -0
- mixpeek/models/errormessage.py +13 -0
- mixpeek/models/errorresponse.py +21 -0
- mixpeek/models/facedetectsettings.py +52 -0
- mixpeek/models/featureextractionembeddingrequest.py +54 -0
- mixpeek/models/featureresponse.py +74 -0
- mixpeek/models/features_model_paginationresponse.py +59 -0
- mixpeek/models/featureupdaterequest.py +21 -0
- mixpeek/models/filtercondition.py +74 -0
- mixpeek/models/floatindexparams.py +18 -0
- mixpeek/models/full_asset_update_assets_asset_id_putop.py +69 -0
- mixpeek/models/full_feature_update_features_feature_id_putop.py +69 -0
- mixpeek/models/geoindexparams.py +18 -0
- mixpeek/models/get_asset_assets_asset_id_getop.py +73 -0
- mixpeek/models/get_asset_with_features_assets_asset_id_features_getop.py +73 -0
- mixpeek/models/get_collection_collections_collection_getop.py +59 -0
- mixpeek/models/get_feature_features_feature_id_getop.py +70 -0
- mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +59 -0
- mixpeek/models/get_namespace_namespaces_namespace_getop.py +18 -0
- mixpeek/models/get_task_tasks_task_id_getop.py +57 -0
- mixpeek/models/get_user_organizations_users_user_email_getop.py +16 -0
- mixpeek/models/groupbyoptions.py +71 -0
- mixpeek/models/groupbyoptionsasset.py +71 -0
- mixpeek/models/groupedassetdata.py +18 -0
- mixpeek/models/healthcheckresponse.py +13 -0
- mixpeek/models/httpvalidationerror.py +21 -0
- mixpeek/models/imagedescribesettings.py +82 -0
- mixpeek/models/imagedetectsettings.py +53 -0
- mixpeek/models/imagereadsettings.py +71 -0
- mixpeek/models/imagesettings.py +79 -0
- mixpeek/models/ingest_image_url_ingest_images_url_postop.py +59 -0
- mixpeek/models/ingest_text_ingest_text_postop.py +59 -0
- mixpeek/models/ingest_video_url_ingest_videos_url_postop.py +59 -0
- mixpeek/models/inputtype.py +11 -0
- mixpeek/models/integerindexparams.py +24 -0
- mixpeek/models/interactionresponse.py +87 -0
- mixpeek/models/interactiontype.py +11 -0
- mixpeek/models/jsonimageoutputsettings.py +55 -0
- mixpeek/models/jsontextoutputsettings.py +55 -0
- mixpeek/models/jsonvideooutputsettings.py +55 -0
- mixpeek/models/keywordindexparams.py +21 -0
- mixpeek/models/kill_task_tasks_task_id_deleteop.py +57 -0
- mixpeek/models/list_assets_assets_postop.py +77 -0
- mixpeek/models/list_collections_collections_getop.py +65 -0
- mixpeek/models/list_features_features_postop.py +79 -0
- mixpeek/models/list_interactions_features_search_interactions_getop.py +96 -0
- mixpeek/models/listassetsrequest.py +75 -0
- mixpeek/models/listassetsresponse.py +22 -0
- mixpeek/models/listcollectionsresponse.py +22 -0
- mixpeek/models/listfeaturesrequest.py +77 -0
- mixpeek/models/listfeaturesresponse.py +22 -0
- mixpeek/models/logicaloperator_input.py +88 -0
- mixpeek/models/logicaloperator_output.py +103 -0
- mixpeek/models/logodetectsettings.py +52 -0
- mixpeek/models/modality.py +13 -0
- mixpeek/models/modeldetails.py +57 -0
- mixpeek/models/namespaceresponse.py +54 -0
- mixpeek/models/organizationmodel.py +45 -0
- mixpeek/models/partial_asset_update_assets_asset_id_patchop.py +69 -0
- mixpeek/models/payloadindexconfig.py +94 -0
- mixpeek/models/payloadindextype.py +17 -0
- mixpeek/models/payloadschematype.py +15 -0
- mixpeek/models/percolaterequest.py +57 -0
- mixpeek/models/permission.py +10 -0
- mixpeek/models/processimageurlinput.py +99 -0
- mixpeek/models/processtextinput.py +94 -0
- mixpeek/models/processvideourlinput.py +99 -0
- mixpeek/models/querysettings.py +56 -0
- mixpeek/models/rerankingoptions.py +47 -0
- mixpeek/models/search_assets_assets_search_postop.py +59 -0
- mixpeek/models/search_features_features_search_postop.py +96 -0
- mixpeek/models/search_model_searchquery_input.py +76 -0
- mixpeek/models/searchassetsrequest.py +78 -0
- mixpeek/models/searchinteraction.py +82 -0
- mixpeek/models/searchquery_output.py +79 -0
- mixpeek/models/searchrequestfeatures_input.py +151 -0
- mixpeek/models/searchrequestfeatures_output.py +151 -0
- mixpeek/models/sortoption.py +28 -0
- mixpeek/models/sparseembedding.py +21 -0
- mixpeek/models/tasks_model_taskresponse.py +24 -0
- mixpeek/models/taskstatus.py +16 -0
- mixpeek/models/textindexparams.py +31 -0
- mixpeek/models/textsettings.py +61 -0
- mixpeek/models/tokenizertype.py +11 -0
- mixpeek/models/update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py +30 -0
- mixpeek/models/update_collection_collections_collection_putop.py +74 -0
- mixpeek/models/update_namespace_namespaces_namespace_putop.py +28 -0
- mixpeek/models/updateassetrequest.py +60 -0
- mixpeek/models/updatenamespacerequest.py +26 -0
- mixpeek/models/usage.py +18 -0
- mixpeek/models/usermodel_input.py +36 -0
- mixpeek/models/usermodel_output.py +36 -0
- mixpeek/models/uuidindexparams.py +21 -0
- mixpeek/models/validationerror.py +26 -0
- mixpeek/models/vectormodel.py +11 -0
- mixpeek/models/vectortype.py +9 -0
- mixpeek/models/videodescribesettings.py +82 -0
- mixpeek/models/videodetectsettings.py +53 -0
- mixpeek/models/videoreadsettings.py +71 -0
- mixpeek/models/videosettings.py +101 -0
- mixpeek/models/videotranscriptionsettings.py +69 -0
- mixpeek/namespaces.py +1143 -0
- mixpeek/organizations.py +1508 -0
- mixpeek/py.typed +1 -0
- mixpeek/sdk.py +135 -0
- mixpeek/sdkconfiguration.py +45 -0
- mixpeek/searchinteractions.py +647 -0
- mixpeek/tasks.py +387 -0
- mixpeek/types/__init__.py +21 -0
- mixpeek/types/basemodel.py +39 -0
- mixpeek/utils/__init__.py +97 -0
- mixpeek/utils/annotations.py +55 -0
- mixpeek/utils/enums.py +34 -0
- mixpeek/utils/eventstreaming.py +238 -0
- mixpeek/utils/forms.py +202 -0
- mixpeek/utils/headers.py +136 -0
- mixpeek/utils/logger.py +27 -0
- mixpeek/utils/metadata.py +118 -0
- mixpeek/utils/queryparams.py +205 -0
- mixpeek/utils/requestbodies.py +66 -0
- mixpeek/utils/retries.py +217 -0
- mixpeek/utils/security.py +174 -0
- mixpeek/utils/serializers.py +215 -0
- mixpeek/utils/url.py +155 -0
- mixpeek/utils/values.py +134 -0
- mixpeek-0.13.dist-info/METADATA +439 -0
- mixpeek-0.13.dist-info/RECORD +176 -0
- {mixpeek-0.11.2.dist-info → mixpeek-0.13.dist-info}/WHEEL +1 -2
- py.typed +1 -0
- mixpeek/client.py +0 -27
- mixpeek/endpoints/__init__.py +0 -0
- mixpeek/endpoints/collections.py +0 -86
- mixpeek/endpoints/embed.py +0 -66
- mixpeek/endpoints/index.py +0 -51
- mixpeek/endpoints/register.py +0 -34
- mixpeek/endpoints/search.py +0 -44
- mixpeek/endpoints/tasks.py +0 -26
- mixpeek/endpoints/tools.py +0 -138
- mixpeek/exceptions.py +0 -13
- mixpeek-0.11.2.dist-info/METADATA +0 -375
- mixpeek-0.11.2.dist-info/RECORD +0 -15
- mixpeek-0.11.2.dist-info/top_level.txt +0 -1
mixpeek/organizations.py
ADDED
@@ -0,0 +1,1508 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from datetime import datetime
|
5
|
+
from mixpeek import models, utils
|
6
|
+
from mixpeek._hooks import HookContext
|
7
|
+
from mixpeek.types import OptionalNullable, UNSET
|
8
|
+
from typing import Any, List, Mapping, Optional, Union
|
9
|
+
|
10
|
+
|
11
|
+
class Organizations(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.OrganizationModel:
|
20
|
+
r"""Get Organization
|
21
|
+
|
22
|
+
:param retries: Override the default retry configuration for this method
|
23
|
+
:param server_url: Override the default server URL for this method
|
24
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
25
|
+
:param http_headers: Additional headers to set or replace on requests.
|
26
|
+
"""
|
27
|
+
base_url = None
|
28
|
+
url_variables = None
|
29
|
+
if timeout_ms is None:
|
30
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
31
|
+
|
32
|
+
if server_url is not None:
|
33
|
+
base_url = server_url
|
34
|
+
req = self.build_request(
|
35
|
+
method="GET",
|
36
|
+
path="/organizations",
|
37
|
+
base_url=base_url,
|
38
|
+
url_variables=url_variables,
|
39
|
+
request=None,
|
40
|
+
request_body_required=False,
|
41
|
+
request_has_path_params=False,
|
42
|
+
request_has_query_params=False,
|
43
|
+
user_agent_header="user-agent",
|
44
|
+
accept_header_value="application/json",
|
45
|
+
http_headers=http_headers,
|
46
|
+
timeout_ms=timeout_ms,
|
47
|
+
)
|
48
|
+
|
49
|
+
if retries == UNSET:
|
50
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
51
|
+
retries = self.sdk_configuration.retry_config
|
52
|
+
|
53
|
+
retry_config = None
|
54
|
+
if isinstance(retries, utils.RetryConfig):
|
55
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
56
|
+
|
57
|
+
http_res = self.do_request(
|
58
|
+
hook_ctx=HookContext(
|
59
|
+
operation_id="get_organization_organizations_get",
|
60
|
+
oauth2_scopes=[],
|
61
|
+
security_source=None,
|
62
|
+
),
|
63
|
+
request=req,
|
64
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
65
|
+
retry_config=retry_config,
|
66
|
+
)
|
67
|
+
|
68
|
+
data: Any = None
|
69
|
+
if utils.match_response(http_res, "200", "application/json"):
|
70
|
+
return utils.unmarshal_json(http_res.text, models.OrganizationModel)
|
71
|
+
if utils.match_response(
|
72
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
73
|
+
):
|
74
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
75
|
+
raise models.ErrorResponse(data=data)
|
76
|
+
if utils.match_response(http_res, "422", "application/json"):
|
77
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
78
|
+
raise models.HTTPValidationError(data=data)
|
79
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
80
|
+
http_res_text = utils.stream_to_text(http_res)
|
81
|
+
raise models.APIError(
|
82
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
83
|
+
)
|
84
|
+
|
85
|
+
content_type = http_res.headers.get("Content-Type")
|
86
|
+
http_res_text = utils.stream_to_text(http_res)
|
87
|
+
raise models.APIError(
|
88
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
89
|
+
http_res.status_code,
|
90
|
+
http_res_text,
|
91
|
+
http_res,
|
92
|
+
)
|
93
|
+
|
94
|
+
async def get_async(
|
95
|
+
self,
|
96
|
+
*,
|
97
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
98
|
+
server_url: Optional[str] = None,
|
99
|
+
timeout_ms: Optional[int] = None,
|
100
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
101
|
+
) -> models.OrganizationModel:
|
102
|
+
r"""Get Organization
|
103
|
+
|
104
|
+
:param retries: Override the default retry configuration for this method
|
105
|
+
:param server_url: Override the default server URL for this method
|
106
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
107
|
+
:param http_headers: Additional headers to set or replace on requests.
|
108
|
+
"""
|
109
|
+
base_url = None
|
110
|
+
url_variables = None
|
111
|
+
if timeout_ms is None:
|
112
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
113
|
+
|
114
|
+
if server_url is not None:
|
115
|
+
base_url = server_url
|
116
|
+
req = self.build_request_async(
|
117
|
+
method="GET",
|
118
|
+
path="/organizations",
|
119
|
+
base_url=base_url,
|
120
|
+
url_variables=url_variables,
|
121
|
+
request=None,
|
122
|
+
request_body_required=False,
|
123
|
+
request_has_path_params=False,
|
124
|
+
request_has_query_params=False,
|
125
|
+
user_agent_header="user-agent",
|
126
|
+
accept_header_value="application/json",
|
127
|
+
http_headers=http_headers,
|
128
|
+
timeout_ms=timeout_ms,
|
129
|
+
)
|
130
|
+
|
131
|
+
if retries == UNSET:
|
132
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
133
|
+
retries = self.sdk_configuration.retry_config
|
134
|
+
|
135
|
+
retry_config = None
|
136
|
+
if isinstance(retries, utils.RetryConfig):
|
137
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
138
|
+
|
139
|
+
http_res = await self.do_request_async(
|
140
|
+
hook_ctx=HookContext(
|
141
|
+
operation_id="get_organization_organizations_get",
|
142
|
+
oauth2_scopes=[],
|
143
|
+
security_source=None,
|
144
|
+
),
|
145
|
+
request=req,
|
146
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
147
|
+
retry_config=retry_config,
|
148
|
+
)
|
149
|
+
|
150
|
+
data: Any = None
|
151
|
+
if utils.match_response(http_res, "200", "application/json"):
|
152
|
+
return utils.unmarshal_json(http_res.text, models.OrganizationModel)
|
153
|
+
if utils.match_response(
|
154
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
155
|
+
):
|
156
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
157
|
+
raise models.ErrorResponse(data=data)
|
158
|
+
if utils.match_response(http_res, "422", "application/json"):
|
159
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
160
|
+
raise models.HTTPValidationError(data=data)
|
161
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
162
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
163
|
+
raise models.APIError(
|
164
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
165
|
+
)
|
166
|
+
|
167
|
+
content_type = http_res.headers.get("Content-Type")
|
168
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
169
|
+
raise models.APIError(
|
170
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
171
|
+
http_res.status_code,
|
172
|
+
http_res_text,
|
173
|
+
http_res,
|
174
|
+
)
|
175
|
+
|
176
|
+
def get_usage(
|
177
|
+
self,
|
178
|
+
*,
|
179
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
180
|
+
server_url: Optional[str] = None,
|
181
|
+
timeout_ms: Optional[int] = None,
|
182
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
183
|
+
) -> models.Usage:
|
184
|
+
r"""Get Usage
|
185
|
+
|
186
|
+
:param retries: Override the default retry configuration for this method
|
187
|
+
:param server_url: Override the default server URL for this method
|
188
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
189
|
+
:param http_headers: Additional headers to set or replace on requests.
|
190
|
+
"""
|
191
|
+
base_url = None
|
192
|
+
url_variables = None
|
193
|
+
if timeout_ms is None:
|
194
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
195
|
+
|
196
|
+
if server_url is not None:
|
197
|
+
base_url = server_url
|
198
|
+
req = self.build_request(
|
199
|
+
method="GET",
|
200
|
+
path="/organizations/usage",
|
201
|
+
base_url=base_url,
|
202
|
+
url_variables=url_variables,
|
203
|
+
request=None,
|
204
|
+
request_body_required=False,
|
205
|
+
request_has_path_params=False,
|
206
|
+
request_has_query_params=False,
|
207
|
+
user_agent_header="user-agent",
|
208
|
+
accept_header_value="application/json",
|
209
|
+
http_headers=http_headers,
|
210
|
+
timeout_ms=timeout_ms,
|
211
|
+
)
|
212
|
+
|
213
|
+
if retries == UNSET:
|
214
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
215
|
+
retries = self.sdk_configuration.retry_config
|
216
|
+
|
217
|
+
retry_config = None
|
218
|
+
if isinstance(retries, utils.RetryConfig):
|
219
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
220
|
+
|
221
|
+
http_res = self.do_request(
|
222
|
+
hook_ctx=HookContext(
|
223
|
+
operation_id="get_usage_organizations_usage_get",
|
224
|
+
oauth2_scopes=[],
|
225
|
+
security_source=None,
|
226
|
+
),
|
227
|
+
request=req,
|
228
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
229
|
+
retry_config=retry_config,
|
230
|
+
)
|
231
|
+
|
232
|
+
data: Any = None
|
233
|
+
if utils.match_response(http_res, "200", "application/json"):
|
234
|
+
return utils.unmarshal_json(http_res.text, models.Usage)
|
235
|
+
if utils.match_response(
|
236
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
237
|
+
):
|
238
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
239
|
+
raise models.ErrorResponse(data=data)
|
240
|
+
if utils.match_response(http_res, "422", "application/json"):
|
241
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
242
|
+
raise models.HTTPValidationError(data=data)
|
243
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
244
|
+
http_res_text = utils.stream_to_text(http_res)
|
245
|
+
raise models.APIError(
|
246
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
247
|
+
)
|
248
|
+
|
249
|
+
content_type = http_res.headers.get("Content-Type")
|
250
|
+
http_res_text = utils.stream_to_text(http_res)
|
251
|
+
raise models.APIError(
|
252
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
253
|
+
http_res.status_code,
|
254
|
+
http_res_text,
|
255
|
+
http_res,
|
256
|
+
)
|
257
|
+
|
258
|
+
async def get_usage_async(
|
259
|
+
self,
|
260
|
+
*,
|
261
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
262
|
+
server_url: Optional[str] = None,
|
263
|
+
timeout_ms: Optional[int] = None,
|
264
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
265
|
+
) -> models.Usage:
|
266
|
+
r"""Get Usage
|
267
|
+
|
268
|
+
:param retries: Override the default retry configuration for this method
|
269
|
+
:param server_url: Override the default server URL for this method
|
270
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
271
|
+
:param http_headers: Additional headers to set or replace on requests.
|
272
|
+
"""
|
273
|
+
base_url = None
|
274
|
+
url_variables = None
|
275
|
+
if timeout_ms is None:
|
276
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
277
|
+
|
278
|
+
if server_url is not None:
|
279
|
+
base_url = server_url
|
280
|
+
req = self.build_request_async(
|
281
|
+
method="GET",
|
282
|
+
path="/organizations/usage",
|
283
|
+
base_url=base_url,
|
284
|
+
url_variables=url_variables,
|
285
|
+
request=None,
|
286
|
+
request_body_required=False,
|
287
|
+
request_has_path_params=False,
|
288
|
+
request_has_query_params=False,
|
289
|
+
user_agent_header="user-agent",
|
290
|
+
accept_header_value="application/json",
|
291
|
+
http_headers=http_headers,
|
292
|
+
timeout_ms=timeout_ms,
|
293
|
+
)
|
294
|
+
|
295
|
+
if retries == UNSET:
|
296
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
297
|
+
retries = self.sdk_configuration.retry_config
|
298
|
+
|
299
|
+
retry_config = None
|
300
|
+
if isinstance(retries, utils.RetryConfig):
|
301
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
302
|
+
|
303
|
+
http_res = await self.do_request_async(
|
304
|
+
hook_ctx=HookContext(
|
305
|
+
operation_id="get_usage_organizations_usage_get",
|
306
|
+
oauth2_scopes=[],
|
307
|
+
security_source=None,
|
308
|
+
),
|
309
|
+
request=req,
|
310
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
311
|
+
retry_config=retry_config,
|
312
|
+
)
|
313
|
+
|
314
|
+
data: Any = None
|
315
|
+
if utils.match_response(http_res, "200", "application/json"):
|
316
|
+
return utils.unmarshal_json(http_res.text, models.Usage)
|
317
|
+
if utils.match_response(
|
318
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
319
|
+
):
|
320
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
321
|
+
raise models.ErrorResponse(data=data)
|
322
|
+
if utils.match_response(http_res, "422", "application/json"):
|
323
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
324
|
+
raise models.HTTPValidationError(data=data)
|
325
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
326
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
327
|
+
raise models.APIError(
|
328
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
329
|
+
)
|
330
|
+
|
331
|
+
content_type = http_res.headers.get("Content-Type")
|
332
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
333
|
+
raise models.APIError(
|
334
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
335
|
+
http_res.status_code,
|
336
|
+
http_res_text,
|
337
|
+
http_res,
|
338
|
+
)
|
339
|
+
|
340
|
+
def get_user(
|
341
|
+
self,
|
342
|
+
*,
|
343
|
+
user_email: str,
|
344
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
345
|
+
server_url: Optional[str] = None,
|
346
|
+
timeout_ms: Optional[int] = None,
|
347
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
348
|
+
) -> models.UserModelOutput:
|
349
|
+
r"""Get User
|
350
|
+
|
351
|
+
:param user_email:
|
352
|
+
:param retries: Override the default retry configuration for this method
|
353
|
+
:param server_url: Override the default server URL for this method
|
354
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
355
|
+
:param http_headers: Additional headers to set or replace on requests.
|
356
|
+
"""
|
357
|
+
base_url = None
|
358
|
+
url_variables = None
|
359
|
+
if timeout_ms is None:
|
360
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
361
|
+
|
362
|
+
if server_url is not None:
|
363
|
+
base_url = server_url
|
364
|
+
|
365
|
+
request = models.GetUserOrganizationsUsersUserEmailGetRequest(
|
366
|
+
user_email=user_email,
|
367
|
+
)
|
368
|
+
|
369
|
+
req = self.build_request(
|
370
|
+
method="GET",
|
371
|
+
path="/organizations/users/{user_email}",
|
372
|
+
base_url=base_url,
|
373
|
+
url_variables=url_variables,
|
374
|
+
request=request,
|
375
|
+
request_body_required=False,
|
376
|
+
request_has_path_params=True,
|
377
|
+
request_has_query_params=False,
|
378
|
+
user_agent_header="user-agent",
|
379
|
+
accept_header_value="application/json",
|
380
|
+
http_headers=http_headers,
|
381
|
+
timeout_ms=timeout_ms,
|
382
|
+
)
|
383
|
+
|
384
|
+
if retries == UNSET:
|
385
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
386
|
+
retries = self.sdk_configuration.retry_config
|
387
|
+
|
388
|
+
retry_config = None
|
389
|
+
if isinstance(retries, utils.RetryConfig):
|
390
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
391
|
+
|
392
|
+
http_res = self.do_request(
|
393
|
+
hook_ctx=HookContext(
|
394
|
+
operation_id="get_user_organizations_users__user_email__get",
|
395
|
+
oauth2_scopes=[],
|
396
|
+
security_source=None,
|
397
|
+
),
|
398
|
+
request=req,
|
399
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
400
|
+
retry_config=retry_config,
|
401
|
+
)
|
402
|
+
|
403
|
+
data: Any = None
|
404
|
+
if utils.match_response(http_res, "200", "application/json"):
|
405
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
406
|
+
if utils.match_response(
|
407
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
408
|
+
):
|
409
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
410
|
+
raise models.ErrorResponse(data=data)
|
411
|
+
if utils.match_response(http_res, "422", "application/json"):
|
412
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
413
|
+
raise models.HTTPValidationError(data=data)
|
414
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
415
|
+
http_res_text = utils.stream_to_text(http_res)
|
416
|
+
raise models.APIError(
|
417
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
418
|
+
)
|
419
|
+
|
420
|
+
content_type = http_res.headers.get("Content-Type")
|
421
|
+
http_res_text = utils.stream_to_text(http_res)
|
422
|
+
raise models.APIError(
|
423
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
424
|
+
http_res.status_code,
|
425
|
+
http_res_text,
|
426
|
+
http_res,
|
427
|
+
)
|
428
|
+
|
429
|
+
async def get_user_async(
|
430
|
+
self,
|
431
|
+
*,
|
432
|
+
user_email: str,
|
433
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
434
|
+
server_url: Optional[str] = None,
|
435
|
+
timeout_ms: Optional[int] = None,
|
436
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
437
|
+
) -> models.UserModelOutput:
|
438
|
+
r"""Get User
|
439
|
+
|
440
|
+
:param user_email:
|
441
|
+
:param retries: Override the default retry configuration for this method
|
442
|
+
:param server_url: Override the default server URL for this method
|
443
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
444
|
+
:param http_headers: Additional headers to set or replace on requests.
|
445
|
+
"""
|
446
|
+
base_url = None
|
447
|
+
url_variables = None
|
448
|
+
if timeout_ms is None:
|
449
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
450
|
+
|
451
|
+
if server_url is not None:
|
452
|
+
base_url = server_url
|
453
|
+
|
454
|
+
request = models.GetUserOrganizationsUsersUserEmailGetRequest(
|
455
|
+
user_email=user_email,
|
456
|
+
)
|
457
|
+
|
458
|
+
req = self.build_request_async(
|
459
|
+
method="GET",
|
460
|
+
path="/organizations/users/{user_email}",
|
461
|
+
base_url=base_url,
|
462
|
+
url_variables=url_variables,
|
463
|
+
request=request,
|
464
|
+
request_body_required=False,
|
465
|
+
request_has_path_params=True,
|
466
|
+
request_has_query_params=False,
|
467
|
+
user_agent_header="user-agent",
|
468
|
+
accept_header_value="application/json",
|
469
|
+
http_headers=http_headers,
|
470
|
+
timeout_ms=timeout_ms,
|
471
|
+
)
|
472
|
+
|
473
|
+
if retries == UNSET:
|
474
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
475
|
+
retries = self.sdk_configuration.retry_config
|
476
|
+
|
477
|
+
retry_config = None
|
478
|
+
if isinstance(retries, utils.RetryConfig):
|
479
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
480
|
+
|
481
|
+
http_res = await self.do_request_async(
|
482
|
+
hook_ctx=HookContext(
|
483
|
+
operation_id="get_user_organizations_users__user_email__get",
|
484
|
+
oauth2_scopes=[],
|
485
|
+
security_source=None,
|
486
|
+
),
|
487
|
+
request=req,
|
488
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
489
|
+
retry_config=retry_config,
|
490
|
+
)
|
491
|
+
|
492
|
+
data: Any = None
|
493
|
+
if utils.match_response(http_res, "200", "application/json"):
|
494
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
495
|
+
if utils.match_response(
|
496
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
497
|
+
):
|
498
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
499
|
+
raise models.ErrorResponse(data=data)
|
500
|
+
if utils.match_response(http_res, "422", "application/json"):
|
501
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
502
|
+
raise models.HTTPValidationError(data=data)
|
503
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
504
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
505
|
+
raise models.APIError(
|
506
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
507
|
+
)
|
508
|
+
|
509
|
+
content_type = http_res.headers.get("Content-Type")
|
510
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
511
|
+
raise models.APIError(
|
512
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
513
|
+
http_res.status_code,
|
514
|
+
http_res_text,
|
515
|
+
http_res,
|
516
|
+
)
|
517
|
+
|
518
|
+
def delete_user(
|
519
|
+
self,
|
520
|
+
*,
|
521
|
+
user_email: str,
|
522
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
523
|
+
server_url: Optional[str] = None,
|
524
|
+
timeout_ms: Optional[int] = None,
|
525
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
526
|
+
) -> Any:
|
527
|
+
r"""Delete User
|
528
|
+
|
529
|
+
:param user_email:
|
530
|
+
:param retries: Override the default retry configuration for this method
|
531
|
+
:param server_url: Override the default server URL for this method
|
532
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
533
|
+
:param http_headers: Additional headers to set or replace on requests.
|
534
|
+
"""
|
535
|
+
base_url = None
|
536
|
+
url_variables = None
|
537
|
+
if timeout_ms is None:
|
538
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
539
|
+
|
540
|
+
if server_url is not None:
|
541
|
+
base_url = server_url
|
542
|
+
|
543
|
+
request = models.DeleteUserOrganizationsUsersUserEmailDeleteRequest(
|
544
|
+
user_email=user_email,
|
545
|
+
)
|
546
|
+
|
547
|
+
req = self.build_request(
|
548
|
+
method="DELETE",
|
549
|
+
path="/organizations/users/{user_email}",
|
550
|
+
base_url=base_url,
|
551
|
+
url_variables=url_variables,
|
552
|
+
request=request,
|
553
|
+
request_body_required=False,
|
554
|
+
request_has_path_params=True,
|
555
|
+
request_has_query_params=False,
|
556
|
+
user_agent_header="user-agent",
|
557
|
+
accept_header_value="application/json",
|
558
|
+
http_headers=http_headers,
|
559
|
+
timeout_ms=timeout_ms,
|
560
|
+
)
|
561
|
+
|
562
|
+
if retries == UNSET:
|
563
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
564
|
+
retries = self.sdk_configuration.retry_config
|
565
|
+
|
566
|
+
retry_config = None
|
567
|
+
if isinstance(retries, utils.RetryConfig):
|
568
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
569
|
+
|
570
|
+
http_res = self.do_request(
|
571
|
+
hook_ctx=HookContext(
|
572
|
+
operation_id="delete_user_organizations_users__user_email__delete",
|
573
|
+
oauth2_scopes=[],
|
574
|
+
security_source=None,
|
575
|
+
),
|
576
|
+
request=req,
|
577
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
578
|
+
retry_config=retry_config,
|
579
|
+
)
|
580
|
+
|
581
|
+
data: Any = None
|
582
|
+
if utils.match_response(http_res, "200", "application/json"):
|
583
|
+
return utils.unmarshal_json(http_res.text, Any)
|
584
|
+
if utils.match_response(
|
585
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
586
|
+
):
|
587
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
588
|
+
raise models.ErrorResponse(data=data)
|
589
|
+
if utils.match_response(http_res, "422", "application/json"):
|
590
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
591
|
+
raise models.HTTPValidationError(data=data)
|
592
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
593
|
+
http_res_text = utils.stream_to_text(http_res)
|
594
|
+
raise models.APIError(
|
595
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
596
|
+
)
|
597
|
+
|
598
|
+
content_type = http_res.headers.get("Content-Type")
|
599
|
+
http_res_text = utils.stream_to_text(http_res)
|
600
|
+
raise models.APIError(
|
601
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
602
|
+
http_res.status_code,
|
603
|
+
http_res_text,
|
604
|
+
http_res,
|
605
|
+
)
|
606
|
+
|
607
|
+
async def delete_user_async(
|
608
|
+
self,
|
609
|
+
*,
|
610
|
+
user_email: str,
|
611
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
612
|
+
server_url: Optional[str] = None,
|
613
|
+
timeout_ms: Optional[int] = None,
|
614
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
615
|
+
) -> Any:
|
616
|
+
r"""Delete User
|
617
|
+
|
618
|
+
:param user_email:
|
619
|
+
:param retries: Override the default retry configuration for this method
|
620
|
+
:param server_url: Override the default server URL for this method
|
621
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
622
|
+
:param http_headers: Additional headers to set or replace on requests.
|
623
|
+
"""
|
624
|
+
base_url = None
|
625
|
+
url_variables = None
|
626
|
+
if timeout_ms is None:
|
627
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
628
|
+
|
629
|
+
if server_url is not None:
|
630
|
+
base_url = server_url
|
631
|
+
|
632
|
+
request = models.DeleteUserOrganizationsUsersUserEmailDeleteRequest(
|
633
|
+
user_email=user_email,
|
634
|
+
)
|
635
|
+
|
636
|
+
req = self.build_request_async(
|
637
|
+
method="DELETE",
|
638
|
+
path="/organizations/users/{user_email}",
|
639
|
+
base_url=base_url,
|
640
|
+
url_variables=url_variables,
|
641
|
+
request=request,
|
642
|
+
request_body_required=False,
|
643
|
+
request_has_path_params=True,
|
644
|
+
request_has_query_params=False,
|
645
|
+
user_agent_header="user-agent",
|
646
|
+
accept_header_value="application/json",
|
647
|
+
http_headers=http_headers,
|
648
|
+
timeout_ms=timeout_ms,
|
649
|
+
)
|
650
|
+
|
651
|
+
if retries == UNSET:
|
652
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
653
|
+
retries = self.sdk_configuration.retry_config
|
654
|
+
|
655
|
+
retry_config = None
|
656
|
+
if isinstance(retries, utils.RetryConfig):
|
657
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
658
|
+
|
659
|
+
http_res = await self.do_request_async(
|
660
|
+
hook_ctx=HookContext(
|
661
|
+
operation_id="delete_user_organizations_users__user_email__delete",
|
662
|
+
oauth2_scopes=[],
|
663
|
+
security_source=None,
|
664
|
+
),
|
665
|
+
request=req,
|
666
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
667
|
+
retry_config=retry_config,
|
668
|
+
)
|
669
|
+
|
670
|
+
data: Any = None
|
671
|
+
if utils.match_response(http_res, "200", "application/json"):
|
672
|
+
return utils.unmarshal_json(http_res.text, Any)
|
673
|
+
if utils.match_response(
|
674
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
675
|
+
):
|
676
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
677
|
+
raise models.ErrorResponse(data=data)
|
678
|
+
if utils.match_response(http_res, "422", "application/json"):
|
679
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
680
|
+
raise models.HTTPValidationError(data=data)
|
681
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
682
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
683
|
+
raise models.APIError(
|
684
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
685
|
+
)
|
686
|
+
|
687
|
+
content_type = http_res.headers.get("Content-Type")
|
688
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
689
|
+
raise models.APIError(
|
690
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
691
|
+
http_res.status_code,
|
692
|
+
http_res_text,
|
693
|
+
http_res,
|
694
|
+
)
|
695
|
+
|
696
|
+
def add_user(
|
697
|
+
self,
|
698
|
+
*,
|
699
|
+
email: str,
|
700
|
+
user_id: Optional[str] = None,
|
701
|
+
api_keys: Optional[
|
702
|
+
Union[List[models.APIKey], List[models.APIKeyTypedDict]]
|
703
|
+
] = None,
|
704
|
+
metadata: Optional[
|
705
|
+
Union[models.UserModelInputMetadata, models.UserModelInputMetadataTypedDict]
|
706
|
+
] = None,
|
707
|
+
created_at: Optional[datetime] = None,
|
708
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
709
|
+
server_url: Optional[str] = None,
|
710
|
+
timeout_ms: Optional[int] = None,
|
711
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
712
|
+
) -> models.UserModelOutput:
|
713
|
+
r"""Add User
|
714
|
+
|
715
|
+
:param email:
|
716
|
+
:param user_id:
|
717
|
+
:param api_keys:
|
718
|
+
:param metadata:
|
719
|
+
:param created_at:
|
720
|
+
:param retries: Override the default retry configuration for this method
|
721
|
+
:param server_url: Override the default server URL for this method
|
722
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
723
|
+
:param http_headers: Additional headers to set or replace on requests.
|
724
|
+
"""
|
725
|
+
base_url = None
|
726
|
+
url_variables = None
|
727
|
+
if timeout_ms is None:
|
728
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
729
|
+
|
730
|
+
if server_url is not None:
|
731
|
+
base_url = server_url
|
732
|
+
|
733
|
+
request = models.UserModelInput(
|
734
|
+
user_id=user_id,
|
735
|
+
email=email,
|
736
|
+
api_keys=utils.get_pydantic_model(api_keys, Optional[List[models.APIKey]]),
|
737
|
+
metadata=utils.get_pydantic_model(
|
738
|
+
metadata, Optional[models.UserModelInputMetadata]
|
739
|
+
),
|
740
|
+
created_at=created_at,
|
741
|
+
)
|
742
|
+
|
743
|
+
req = self.build_request(
|
744
|
+
method="POST",
|
745
|
+
path="/organizations/users",
|
746
|
+
base_url=base_url,
|
747
|
+
url_variables=url_variables,
|
748
|
+
request=request,
|
749
|
+
request_body_required=True,
|
750
|
+
request_has_path_params=False,
|
751
|
+
request_has_query_params=False,
|
752
|
+
user_agent_header="user-agent",
|
753
|
+
accept_header_value="application/json",
|
754
|
+
http_headers=http_headers,
|
755
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
756
|
+
request, False, False, "json", models.UserModelInput
|
757
|
+
),
|
758
|
+
timeout_ms=timeout_ms,
|
759
|
+
)
|
760
|
+
|
761
|
+
if retries == UNSET:
|
762
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
763
|
+
retries = self.sdk_configuration.retry_config
|
764
|
+
|
765
|
+
retry_config = None
|
766
|
+
if isinstance(retries, utils.RetryConfig):
|
767
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
768
|
+
|
769
|
+
http_res = self.do_request(
|
770
|
+
hook_ctx=HookContext(
|
771
|
+
operation_id="add_user_organizations_users_post",
|
772
|
+
oauth2_scopes=[],
|
773
|
+
security_source=None,
|
774
|
+
),
|
775
|
+
request=req,
|
776
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
777
|
+
retry_config=retry_config,
|
778
|
+
)
|
779
|
+
|
780
|
+
data: Any = None
|
781
|
+
if utils.match_response(http_res, "200", "application/json"):
|
782
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
783
|
+
if utils.match_response(
|
784
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
785
|
+
):
|
786
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
787
|
+
raise models.ErrorResponse(data=data)
|
788
|
+
if utils.match_response(http_res, "422", "application/json"):
|
789
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
790
|
+
raise models.HTTPValidationError(data=data)
|
791
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
792
|
+
http_res_text = utils.stream_to_text(http_res)
|
793
|
+
raise models.APIError(
|
794
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
795
|
+
)
|
796
|
+
|
797
|
+
content_type = http_res.headers.get("Content-Type")
|
798
|
+
http_res_text = utils.stream_to_text(http_res)
|
799
|
+
raise models.APIError(
|
800
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
801
|
+
http_res.status_code,
|
802
|
+
http_res_text,
|
803
|
+
http_res,
|
804
|
+
)
|
805
|
+
|
806
|
+
async def add_user_async(
|
807
|
+
self,
|
808
|
+
*,
|
809
|
+
email: str,
|
810
|
+
user_id: Optional[str] = None,
|
811
|
+
api_keys: Optional[
|
812
|
+
Union[List[models.APIKey], List[models.APIKeyTypedDict]]
|
813
|
+
] = None,
|
814
|
+
metadata: Optional[
|
815
|
+
Union[models.UserModelInputMetadata, models.UserModelInputMetadataTypedDict]
|
816
|
+
] = None,
|
817
|
+
created_at: Optional[datetime] = None,
|
818
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
819
|
+
server_url: Optional[str] = None,
|
820
|
+
timeout_ms: Optional[int] = None,
|
821
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
822
|
+
) -> models.UserModelOutput:
|
823
|
+
r"""Add User
|
824
|
+
|
825
|
+
:param email:
|
826
|
+
:param user_id:
|
827
|
+
:param api_keys:
|
828
|
+
:param metadata:
|
829
|
+
:param created_at:
|
830
|
+
:param retries: Override the default retry configuration for this method
|
831
|
+
:param server_url: Override the default server URL for this method
|
832
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
833
|
+
:param http_headers: Additional headers to set or replace on requests.
|
834
|
+
"""
|
835
|
+
base_url = None
|
836
|
+
url_variables = None
|
837
|
+
if timeout_ms is None:
|
838
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
839
|
+
|
840
|
+
if server_url is not None:
|
841
|
+
base_url = server_url
|
842
|
+
|
843
|
+
request = models.UserModelInput(
|
844
|
+
user_id=user_id,
|
845
|
+
email=email,
|
846
|
+
api_keys=utils.get_pydantic_model(api_keys, Optional[List[models.APIKey]]),
|
847
|
+
metadata=utils.get_pydantic_model(
|
848
|
+
metadata, Optional[models.UserModelInputMetadata]
|
849
|
+
),
|
850
|
+
created_at=created_at,
|
851
|
+
)
|
852
|
+
|
853
|
+
req = self.build_request_async(
|
854
|
+
method="POST",
|
855
|
+
path="/organizations/users",
|
856
|
+
base_url=base_url,
|
857
|
+
url_variables=url_variables,
|
858
|
+
request=request,
|
859
|
+
request_body_required=True,
|
860
|
+
request_has_path_params=False,
|
861
|
+
request_has_query_params=False,
|
862
|
+
user_agent_header="user-agent",
|
863
|
+
accept_header_value="application/json",
|
864
|
+
http_headers=http_headers,
|
865
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
866
|
+
request, False, False, "json", models.UserModelInput
|
867
|
+
),
|
868
|
+
timeout_ms=timeout_ms,
|
869
|
+
)
|
870
|
+
|
871
|
+
if retries == UNSET:
|
872
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
873
|
+
retries = self.sdk_configuration.retry_config
|
874
|
+
|
875
|
+
retry_config = None
|
876
|
+
if isinstance(retries, utils.RetryConfig):
|
877
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
878
|
+
|
879
|
+
http_res = await self.do_request_async(
|
880
|
+
hook_ctx=HookContext(
|
881
|
+
operation_id="add_user_organizations_users_post",
|
882
|
+
oauth2_scopes=[],
|
883
|
+
security_source=None,
|
884
|
+
),
|
885
|
+
request=req,
|
886
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
887
|
+
retry_config=retry_config,
|
888
|
+
)
|
889
|
+
|
890
|
+
data: Any = None
|
891
|
+
if utils.match_response(http_res, "200", "application/json"):
|
892
|
+
return utils.unmarshal_json(http_res.text, models.UserModelOutput)
|
893
|
+
if utils.match_response(
|
894
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
895
|
+
):
|
896
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
897
|
+
raise models.ErrorResponse(data=data)
|
898
|
+
if utils.match_response(http_res, "422", "application/json"):
|
899
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
900
|
+
raise models.HTTPValidationError(data=data)
|
901
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
902
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
903
|
+
raise models.APIError(
|
904
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
905
|
+
)
|
906
|
+
|
907
|
+
content_type = http_res.headers.get("Content-Type")
|
908
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
909
|
+
raise models.APIError(
|
910
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
911
|
+
http_res.status_code,
|
912
|
+
http_res_text,
|
913
|
+
http_res,
|
914
|
+
)
|
915
|
+
|
916
|
+
def create_api_key(
|
917
|
+
self,
|
918
|
+
*,
|
919
|
+
user_email: str,
|
920
|
+
key_name: Optional[str] = "default",
|
921
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
922
|
+
server_url: Optional[str] = None,
|
923
|
+
timeout_ms: Optional[int] = None,
|
924
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
925
|
+
) -> models.APIKey:
|
926
|
+
r"""Create Api Key
|
927
|
+
|
928
|
+
Create a new API key for a specific user
|
929
|
+
|
930
|
+
:param user_email:
|
931
|
+
:param key_name:
|
932
|
+
:param retries: Override the default retry configuration for this method
|
933
|
+
:param server_url: Override the default server URL for this method
|
934
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
935
|
+
:param http_headers: Additional headers to set or replace on requests.
|
936
|
+
"""
|
937
|
+
base_url = None
|
938
|
+
url_variables = None
|
939
|
+
if timeout_ms is None:
|
940
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
941
|
+
|
942
|
+
if server_url is not None:
|
943
|
+
base_url = server_url
|
944
|
+
|
945
|
+
request = models.CreateAPIKeyOrganizationsUsersUserEmailAPIKeysPostRequest(
|
946
|
+
user_email=user_email,
|
947
|
+
key_name=key_name,
|
948
|
+
)
|
949
|
+
|
950
|
+
req = self.build_request(
|
951
|
+
method="POST",
|
952
|
+
path="/organizations/users/{user_email}/api-keys",
|
953
|
+
base_url=base_url,
|
954
|
+
url_variables=url_variables,
|
955
|
+
request=request,
|
956
|
+
request_body_required=False,
|
957
|
+
request_has_path_params=True,
|
958
|
+
request_has_query_params=True,
|
959
|
+
user_agent_header="user-agent",
|
960
|
+
accept_header_value="application/json",
|
961
|
+
http_headers=http_headers,
|
962
|
+
timeout_ms=timeout_ms,
|
963
|
+
)
|
964
|
+
|
965
|
+
if retries == UNSET:
|
966
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
967
|
+
retries = self.sdk_configuration.retry_config
|
968
|
+
|
969
|
+
retry_config = None
|
970
|
+
if isinstance(retries, utils.RetryConfig):
|
971
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
972
|
+
|
973
|
+
http_res = self.do_request(
|
974
|
+
hook_ctx=HookContext(
|
975
|
+
operation_id="create_api_key_organizations_users__user_email__api_keys_post",
|
976
|
+
oauth2_scopes=[],
|
977
|
+
security_source=None,
|
978
|
+
),
|
979
|
+
request=req,
|
980
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
981
|
+
retry_config=retry_config,
|
982
|
+
)
|
983
|
+
|
984
|
+
data: Any = None
|
985
|
+
if utils.match_response(http_res, "200", "application/json"):
|
986
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
987
|
+
if utils.match_response(
|
988
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
989
|
+
):
|
990
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
991
|
+
raise models.ErrorResponse(data=data)
|
992
|
+
if utils.match_response(http_res, "422", "application/json"):
|
993
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
994
|
+
raise models.HTTPValidationError(data=data)
|
995
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
996
|
+
http_res_text = utils.stream_to_text(http_res)
|
997
|
+
raise models.APIError(
|
998
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
999
|
+
)
|
1000
|
+
|
1001
|
+
content_type = http_res.headers.get("Content-Type")
|
1002
|
+
http_res_text = utils.stream_to_text(http_res)
|
1003
|
+
raise models.APIError(
|
1004
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1005
|
+
http_res.status_code,
|
1006
|
+
http_res_text,
|
1007
|
+
http_res,
|
1008
|
+
)
|
1009
|
+
|
1010
|
+
async def create_api_key_async(
|
1011
|
+
self,
|
1012
|
+
*,
|
1013
|
+
user_email: str,
|
1014
|
+
key_name: Optional[str] = "default",
|
1015
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1016
|
+
server_url: Optional[str] = None,
|
1017
|
+
timeout_ms: Optional[int] = None,
|
1018
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1019
|
+
) -> models.APIKey:
|
1020
|
+
r"""Create Api Key
|
1021
|
+
|
1022
|
+
Create a new API key for a specific user
|
1023
|
+
|
1024
|
+
:param user_email:
|
1025
|
+
:param key_name:
|
1026
|
+
:param retries: Override the default retry configuration for this method
|
1027
|
+
:param server_url: Override the default server URL for this method
|
1028
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1029
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1030
|
+
"""
|
1031
|
+
base_url = None
|
1032
|
+
url_variables = None
|
1033
|
+
if timeout_ms is None:
|
1034
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1035
|
+
|
1036
|
+
if server_url is not None:
|
1037
|
+
base_url = server_url
|
1038
|
+
|
1039
|
+
request = models.CreateAPIKeyOrganizationsUsersUserEmailAPIKeysPostRequest(
|
1040
|
+
user_email=user_email,
|
1041
|
+
key_name=key_name,
|
1042
|
+
)
|
1043
|
+
|
1044
|
+
req = self.build_request_async(
|
1045
|
+
method="POST",
|
1046
|
+
path="/organizations/users/{user_email}/api-keys",
|
1047
|
+
base_url=base_url,
|
1048
|
+
url_variables=url_variables,
|
1049
|
+
request=request,
|
1050
|
+
request_body_required=False,
|
1051
|
+
request_has_path_params=True,
|
1052
|
+
request_has_query_params=True,
|
1053
|
+
user_agent_header="user-agent",
|
1054
|
+
accept_header_value="application/json",
|
1055
|
+
http_headers=http_headers,
|
1056
|
+
timeout_ms=timeout_ms,
|
1057
|
+
)
|
1058
|
+
|
1059
|
+
if retries == UNSET:
|
1060
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1061
|
+
retries = self.sdk_configuration.retry_config
|
1062
|
+
|
1063
|
+
retry_config = None
|
1064
|
+
if isinstance(retries, utils.RetryConfig):
|
1065
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1066
|
+
|
1067
|
+
http_res = await self.do_request_async(
|
1068
|
+
hook_ctx=HookContext(
|
1069
|
+
operation_id="create_api_key_organizations_users__user_email__api_keys_post",
|
1070
|
+
oauth2_scopes=[],
|
1071
|
+
security_source=None,
|
1072
|
+
),
|
1073
|
+
request=req,
|
1074
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1075
|
+
retry_config=retry_config,
|
1076
|
+
)
|
1077
|
+
|
1078
|
+
data: Any = None
|
1079
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1080
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
1081
|
+
if utils.match_response(
|
1082
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1083
|
+
):
|
1084
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1085
|
+
raise models.ErrorResponse(data=data)
|
1086
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1087
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1088
|
+
raise models.HTTPValidationError(data=data)
|
1089
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1090
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1091
|
+
raise models.APIError(
|
1092
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1093
|
+
)
|
1094
|
+
|
1095
|
+
content_type = http_res.headers.get("Content-Type")
|
1096
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1097
|
+
raise models.APIError(
|
1098
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1099
|
+
http_res.status_code,
|
1100
|
+
http_res_text,
|
1101
|
+
http_res,
|
1102
|
+
)
|
1103
|
+
|
1104
|
+
def delete_api_key(
|
1105
|
+
self,
|
1106
|
+
*,
|
1107
|
+
user_email: str,
|
1108
|
+
key_name: str,
|
1109
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1110
|
+
server_url: Optional[str] = None,
|
1111
|
+
timeout_ms: Optional[int] = None,
|
1112
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1113
|
+
) -> Any:
|
1114
|
+
r"""Delete Api Key
|
1115
|
+
|
1116
|
+
Delete a specific API key for a user
|
1117
|
+
|
1118
|
+
:param user_email:
|
1119
|
+
:param key_name:
|
1120
|
+
:param retries: Override the default retry configuration for this method
|
1121
|
+
:param server_url: Override the default server URL for this method
|
1122
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1123
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1124
|
+
"""
|
1125
|
+
base_url = None
|
1126
|
+
url_variables = None
|
1127
|
+
if timeout_ms is None:
|
1128
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1129
|
+
|
1130
|
+
if server_url is not None:
|
1131
|
+
base_url = server_url
|
1132
|
+
|
1133
|
+
request = (
|
1134
|
+
models.DeleteAPIKeyOrganizationsUsersUserEmailAPIKeysKeyNameDeleteRequest(
|
1135
|
+
user_email=user_email,
|
1136
|
+
key_name=key_name,
|
1137
|
+
)
|
1138
|
+
)
|
1139
|
+
|
1140
|
+
req = self.build_request(
|
1141
|
+
method="DELETE",
|
1142
|
+
path="/organizations/users/{user_email}/api-keys/{key_name}",
|
1143
|
+
base_url=base_url,
|
1144
|
+
url_variables=url_variables,
|
1145
|
+
request=request,
|
1146
|
+
request_body_required=False,
|
1147
|
+
request_has_path_params=True,
|
1148
|
+
request_has_query_params=False,
|
1149
|
+
user_agent_header="user-agent",
|
1150
|
+
accept_header_value="application/json",
|
1151
|
+
http_headers=http_headers,
|
1152
|
+
timeout_ms=timeout_ms,
|
1153
|
+
)
|
1154
|
+
|
1155
|
+
if retries == UNSET:
|
1156
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1157
|
+
retries = self.sdk_configuration.retry_config
|
1158
|
+
|
1159
|
+
retry_config = None
|
1160
|
+
if isinstance(retries, utils.RetryConfig):
|
1161
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1162
|
+
|
1163
|
+
http_res = self.do_request(
|
1164
|
+
hook_ctx=HookContext(
|
1165
|
+
operation_id="delete_api_key_organizations_users__user_email__api_keys__key_name__delete",
|
1166
|
+
oauth2_scopes=[],
|
1167
|
+
security_source=None,
|
1168
|
+
),
|
1169
|
+
request=req,
|
1170
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1171
|
+
retry_config=retry_config,
|
1172
|
+
)
|
1173
|
+
|
1174
|
+
data: Any = None
|
1175
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1176
|
+
return utils.unmarshal_json(http_res.text, Any)
|
1177
|
+
if utils.match_response(
|
1178
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1179
|
+
):
|
1180
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1181
|
+
raise models.ErrorResponse(data=data)
|
1182
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1183
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1184
|
+
raise models.HTTPValidationError(data=data)
|
1185
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1186
|
+
http_res_text = utils.stream_to_text(http_res)
|
1187
|
+
raise models.APIError(
|
1188
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1189
|
+
)
|
1190
|
+
|
1191
|
+
content_type = http_res.headers.get("Content-Type")
|
1192
|
+
http_res_text = utils.stream_to_text(http_res)
|
1193
|
+
raise models.APIError(
|
1194
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1195
|
+
http_res.status_code,
|
1196
|
+
http_res_text,
|
1197
|
+
http_res,
|
1198
|
+
)
|
1199
|
+
|
1200
|
+
async def delete_api_key_async(
|
1201
|
+
self,
|
1202
|
+
*,
|
1203
|
+
user_email: str,
|
1204
|
+
key_name: str,
|
1205
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1206
|
+
server_url: Optional[str] = None,
|
1207
|
+
timeout_ms: Optional[int] = None,
|
1208
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1209
|
+
) -> Any:
|
1210
|
+
r"""Delete Api Key
|
1211
|
+
|
1212
|
+
Delete a specific API key for a user
|
1213
|
+
|
1214
|
+
:param user_email:
|
1215
|
+
:param key_name:
|
1216
|
+
:param retries: Override the default retry configuration for this method
|
1217
|
+
:param server_url: Override the default server URL for this method
|
1218
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1219
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1220
|
+
"""
|
1221
|
+
base_url = None
|
1222
|
+
url_variables = None
|
1223
|
+
if timeout_ms is None:
|
1224
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1225
|
+
|
1226
|
+
if server_url is not None:
|
1227
|
+
base_url = server_url
|
1228
|
+
|
1229
|
+
request = (
|
1230
|
+
models.DeleteAPIKeyOrganizationsUsersUserEmailAPIKeysKeyNameDeleteRequest(
|
1231
|
+
user_email=user_email,
|
1232
|
+
key_name=key_name,
|
1233
|
+
)
|
1234
|
+
)
|
1235
|
+
|
1236
|
+
req = self.build_request_async(
|
1237
|
+
method="DELETE",
|
1238
|
+
path="/organizations/users/{user_email}/api-keys/{key_name}",
|
1239
|
+
base_url=base_url,
|
1240
|
+
url_variables=url_variables,
|
1241
|
+
request=request,
|
1242
|
+
request_body_required=False,
|
1243
|
+
request_has_path_params=True,
|
1244
|
+
request_has_query_params=False,
|
1245
|
+
user_agent_header="user-agent",
|
1246
|
+
accept_header_value="application/json",
|
1247
|
+
http_headers=http_headers,
|
1248
|
+
timeout_ms=timeout_ms,
|
1249
|
+
)
|
1250
|
+
|
1251
|
+
if retries == UNSET:
|
1252
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1253
|
+
retries = self.sdk_configuration.retry_config
|
1254
|
+
|
1255
|
+
retry_config = None
|
1256
|
+
if isinstance(retries, utils.RetryConfig):
|
1257
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1258
|
+
|
1259
|
+
http_res = await self.do_request_async(
|
1260
|
+
hook_ctx=HookContext(
|
1261
|
+
operation_id="delete_api_key_organizations_users__user_email__api_keys__key_name__delete",
|
1262
|
+
oauth2_scopes=[],
|
1263
|
+
security_source=None,
|
1264
|
+
),
|
1265
|
+
request=req,
|
1266
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1267
|
+
retry_config=retry_config,
|
1268
|
+
)
|
1269
|
+
|
1270
|
+
data: Any = None
|
1271
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1272
|
+
return utils.unmarshal_json(http_res.text, Any)
|
1273
|
+
if utils.match_response(
|
1274
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1275
|
+
):
|
1276
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1277
|
+
raise models.ErrorResponse(data=data)
|
1278
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1279
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1280
|
+
raise models.HTTPValidationError(data=data)
|
1281
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1282
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1283
|
+
raise models.APIError(
|
1284
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1285
|
+
)
|
1286
|
+
|
1287
|
+
content_type = http_res.headers.get("Content-Type")
|
1288
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1289
|
+
raise models.APIError(
|
1290
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1291
|
+
http_res.status_code,
|
1292
|
+
http_res_text,
|
1293
|
+
http_res,
|
1294
|
+
)
|
1295
|
+
|
1296
|
+
def update_api_key(
|
1297
|
+
self,
|
1298
|
+
*,
|
1299
|
+
user_email: str,
|
1300
|
+
key_name: str,
|
1301
|
+
name: OptionalNullable[str] = UNSET,
|
1302
|
+
permissions: OptionalNullable[List[models.Permission]] = UNSET,
|
1303
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1304
|
+
server_url: Optional[str] = None,
|
1305
|
+
timeout_ms: Optional[int] = None,
|
1306
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1307
|
+
) -> models.APIKey:
|
1308
|
+
r"""Update Api Key
|
1309
|
+
|
1310
|
+
Update an API key's name or permissions
|
1311
|
+
|
1312
|
+
:param user_email:
|
1313
|
+
:param key_name:
|
1314
|
+
:param name:
|
1315
|
+
:param permissions:
|
1316
|
+
:param retries: Override the default retry configuration for this method
|
1317
|
+
:param server_url: Override the default server URL for this method
|
1318
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1319
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1320
|
+
"""
|
1321
|
+
base_url = None
|
1322
|
+
url_variables = None
|
1323
|
+
if timeout_ms is None:
|
1324
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1325
|
+
|
1326
|
+
if server_url is not None:
|
1327
|
+
base_url = server_url
|
1328
|
+
|
1329
|
+
request = (
|
1330
|
+
models.UpdateAPIKeyOrganizationsUsersUserEmailAPIKeysKeyNamePatchRequest(
|
1331
|
+
user_email=user_email,
|
1332
|
+
key_name=key_name,
|
1333
|
+
api_key_update=models.APIKeyUpdate(
|
1334
|
+
name=name,
|
1335
|
+
permissions=permissions,
|
1336
|
+
),
|
1337
|
+
)
|
1338
|
+
)
|
1339
|
+
|
1340
|
+
req = self.build_request(
|
1341
|
+
method="PATCH",
|
1342
|
+
path="/organizations/users/{user_email}/api-keys/{key_name}",
|
1343
|
+
base_url=base_url,
|
1344
|
+
url_variables=url_variables,
|
1345
|
+
request=request,
|
1346
|
+
request_body_required=True,
|
1347
|
+
request_has_path_params=True,
|
1348
|
+
request_has_query_params=False,
|
1349
|
+
user_agent_header="user-agent",
|
1350
|
+
accept_header_value="application/json",
|
1351
|
+
http_headers=http_headers,
|
1352
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
1353
|
+
request.api_key_update, False, False, "json", models.APIKeyUpdate
|
1354
|
+
),
|
1355
|
+
timeout_ms=timeout_ms,
|
1356
|
+
)
|
1357
|
+
|
1358
|
+
if retries == UNSET:
|
1359
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1360
|
+
retries = self.sdk_configuration.retry_config
|
1361
|
+
|
1362
|
+
retry_config = None
|
1363
|
+
if isinstance(retries, utils.RetryConfig):
|
1364
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1365
|
+
|
1366
|
+
http_res = self.do_request(
|
1367
|
+
hook_ctx=HookContext(
|
1368
|
+
operation_id="update_api_key_organizations_users__user_email__api_keys__key_name__patch",
|
1369
|
+
oauth2_scopes=[],
|
1370
|
+
security_source=None,
|
1371
|
+
),
|
1372
|
+
request=req,
|
1373
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1374
|
+
retry_config=retry_config,
|
1375
|
+
)
|
1376
|
+
|
1377
|
+
data: Any = None
|
1378
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1379
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
1380
|
+
if utils.match_response(
|
1381
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1382
|
+
):
|
1383
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1384
|
+
raise models.ErrorResponse(data=data)
|
1385
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1386
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1387
|
+
raise models.HTTPValidationError(data=data)
|
1388
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1389
|
+
http_res_text = utils.stream_to_text(http_res)
|
1390
|
+
raise models.APIError(
|
1391
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1392
|
+
)
|
1393
|
+
|
1394
|
+
content_type = http_res.headers.get("Content-Type")
|
1395
|
+
http_res_text = utils.stream_to_text(http_res)
|
1396
|
+
raise models.APIError(
|
1397
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1398
|
+
http_res.status_code,
|
1399
|
+
http_res_text,
|
1400
|
+
http_res,
|
1401
|
+
)
|
1402
|
+
|
1403
|
+
async def update_api_key_async(
|
1404
|
+
self,
|
1405
|
+
*,
|
1406
|
+
user_email: str,
|
1407
|
+
key_name: str,
|
1408
|
+
name: OptionalNullable[str] = UNSET,
|
1409
|
+
permissions: OptionalNullable[List[models.Permission]] = UNSET,
|
1410
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
1411
|
+
server_url: Optional[str] = None,
|
1412
|
+
timeout_ms: Optional[int] = None,
|
1413
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
1414
|
+
) -> models.APIKey:
|
1415
|
+
r"""Update Api Key
|
1416
|
+
|
1417
|
+
Update an API key's name or permissions
|
1418
|
+
|
1419
|
+
:param user_email:
|
1420
|
+
:param key_name:
|
1421
|
+
:param name:
|
1422
|
+
:param permissions:
|
1423
|
+
:param retries: Override the default retry configuration for this method
|
1424
|
+
:param server_url: Override the default server URL for this method
|
1425
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
1426
|
+
:param http_headers: Additional headers to set or replace on requests.
|
1427
|
+
"""
|
1428
|
+
base_url = None
|
1429
|
+
url_variables = None
|
1430
|
+
if timeout_ms is None:
|
1431
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
1432
|
+
|
1433
|
+
if server_url is not None:
|
1434
|
+
base_url = server_url
|
1435
|
+
|
1436
|
+
request = (
|
1437
|
+
models.UpdateAPIKeyOrganizationsUsersUserEmailAPIKeysKeyNamePatchRequest(
|
1438
|
+
user_email=user_email,
|
1439
|
+
key_name=key_name,
|
1440
|
+
api_key_update=models.APIKeyUpdate(
|
1441
|
+
name=name,
|
1442
|
+
permissions=permissions,
|
1443
|
+
),
|
1444
|
+
)
|
1445
|
+
)
|
1446
|
+
|
1447
|
+
req = self.build_request_async(
|
1448
|
+
method="PATCH",
|
1449
|
+
path="/organizations/users/{user_email}/api-keys/{key_name}",
|
1450
|
+
base_url=base_url,
|
1451
|
+
url_variables=url_variables,
|
1452
|
+
request=request,
|
1453
|
+
request_body_required=True,
|
1454
|
+
request_has_path_params=True,
|
1455
|
+
request_has_query_params=False,
|
1456
|
+
user_agent_header="user-agent",
|
1457
|
+
accept_header_value="application/json",
|
1458
|
+
http_headers=http_headers,
|
1459
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
1460
|
+
request.api_key_update, False, False, "json", models.APIKeyUpdate
|
1461
|
+
),
|
1462
|
+
timeout_ms=timeout_ms,
|
1463
|
+
)
|
1464
|
+
|
1465
|
+
if retries == UNSET:
|
1466
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
1467
|
+
retries = self.sdk_configuration.retry_config
|
1468
|
+
|
1469
|
+
retry_config = None
|
1470
|
+
if isinstance(retries, utils.RetryConfig):
|
1471
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
1472
|
+
|
1473
|
+
http_res = await self.do_request_async(
|
1474
|
+
hook_ctx=HookContext(
|
1475
|
+
operation_id="update_api_key_organizations_users__user_email__api_keys__key_name__patch",
|
1476
|
+
oauth2_scopes=[],
|
1477
|
+
security_source=None,
|
1478
|
+
),
|
1479
|
+
request=req,
|
1480
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1481
|
+
retry_config=retry_config,
|
1482
|
+
)
|
1483
|
+
|
1484
|
+
data: Any = None
|
1485
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1486
|
+
return utils.unmarshal_json(http_res.text, models.APIKey)
|
1487
|
+
if utils.match_response(
|
1488
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1489
|
+
):
|
1490
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1491
|
+
raise models.ErrorResponse(data=data)
|
1492
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1493
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1494
|
+
raise models.HTTPValidationError(data=data)
|
1495
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1496
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1497
|
+
raise models.APIError(
|
1498
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1499
|
+
)
|
1500
|
+
|
1501
|
+
content_type = http_res.headers.get("Content-Type")
|
1502
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1503
|
+
raise models.APIError(
|
1504
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1505
|
+
http_res.status_code,
|
1506
|
+
http_res_text,
|
1507
|
+
http_res,
|
1508
|
+
)
|