mixpeek 0.17.9__py3-none-any.whl → 0.18.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.1.dist-info}/METADATA +57 -54
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.1.dist-info}/RECORD +16 -15
- mixpeek/feature_search.py +0 -350
- {mixpeek-0.17.9.dist-info → mixpeek-0.18.1.dist-info}/WHEEL +0 -0
mixpeek/taxonomies.py
ADDED
@@ -0,0 +1,686 @@
|
|
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 Taxonomies(BaseSDK):
|
12
|
+
def get(
|
13
|
+
self,
|
14
|
+
*,
|
15
|
+
taxonomy: str,
|
16
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
17
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
18
|
+
server_url: Optional[str] = None,
|
19
|
+
timeout_ms: Optional[int] = None,
|
20
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
21
|
+
) -> models.TaxonomyModel:
|
22
|
+
r"""Get Taxonomy
|
23
|
+
|
24
|
+
Get the complete taxonomy that contains the specified node
|
25
|
+
|
26
|
+
:param taxonomy: The name or id of the taxonomy to find
|
27
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
28
|
+
:param retries: Override the default retry configuration for this method
|
29
|
+
:param server_url: Override the default server URL for this method
|
30
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
31
|
+
:param http_headers: Additional headers to set or replace on requests.
|
32
|
+
"""
|
33
|
+
base_url = None
|
34
|
+
url_variables = None
|
35
|
+
if timeout_ms is None:
|
36
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
37
|
+
|
38
|
+
if server_url is not None:
|
39
|
+
base_url = server_url
|
40
|
+
|
41
|
+
request = models.GetTaxonomyV1EntitiesTaxonomiesTaxonomyGetRequest(
|
42
|
+
taxonomy=taxonomy,
|
43
|
+
x_namespace=x_namespace,
|
44
|
+
)
|
45
|
+
|
46
|
+
req = self._build_request(
|
47
|
+
method="GET",
|
48
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
49
|
+
base_url=base_url,
|
50
|
+
url_variables=url_variables,
|
51
|
+
request=request,
|
52
|
+
request_body_required=False,
|
53
|
+
request_has_path_params=True,
|
54
|
+
request_has_query_params=True,
|
55
|
+
user_agent_header="user-agent",
|
56
|
+
accept_header_value="application/json",
|
57
|
+
http_headers=http_headers,
|
58
|
+
security=self.sdk_configuration.security,
|
59
|
+
timeout_ms=timeout_ms,
|
60
|
+
)
|
61
|
+
|
62
|
+
if retries == UNSET:
|
63
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
64
|
+
retries = self.sdk_configuration.retry_config
|
65
|
+
|
66
|
+
retry_config = None
|
67
|
+
if isinstance(retries, utils.RetryConfig):
|
68
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
69
|
+
|
70
|
+
http_res = self.do_request(
|
71
|
+
hook_ctx=HookContext(
|
72
|
+
operation_id="get_taxonomy_v1_entities_taxonomies__taxonomy__get",
|
73
|
+
oauth2_scopes=[],
|
74
|
+
security_source=get_security_from_env(
|
75
|
+
self.sdk_configuration.security, models.Security
|
76
|
+
),
|
77
|
+
),
|
78
|
+
request=req,
|
79
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
80
|
+
retry_config=retry_config,
|
81
|
+
)
|
82
|
+
|
83
|
+
data: Any = None
|
84
|
+
if utils.match_response(http_res, "200", "application/json"):
|
85
|
+
return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
|
86
|
+
if utils.match_response(
|
87
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
88
|
+
):
|
89
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
90
|
+
raise models.ErrorResponse(data=data)
|
91
|
+
if utils.match_response(http_res, "422", "application/json"):
|
92
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
93
|
+
raise models.HTTPValidationError(data=data)
|
94
|
+
if utils.match_response(http_res, "500", "application/json"):
|
95
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
96
|
+
raise models.ErrorResponse(data=data)
|
97
|
+
if utils.match_response(http_res, "4XX", "*"):
|
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
|
+
if utils.match_response(http_res, "5XX", "*"):
|
103
|
+
http_res_text = utils.stream_to_text(http_res)
|
104
|
+
raise models.APIError(
|
105
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
106
|
+
)
|
107
|
+
|
108
|
+
content_type = http_res.headers.get("Content-Type")
|
109
|
+
http_res_text = utils.stream_to_text(http_res)
|
110
|
+
raise models.APIError(
|
111
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
112
|
+
http_res.status_code,
|
113
|
+
http_res_text,
|
114
|
+
http_res,
|
115
|
+
)
|
116
|
+
|
117
|
+
async def get_async(
|
118
|
+
self,
|
119
|
+
*,
|
120
|
+
taxonomy: str,
|
121
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
122
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
123
|
+
server_url: Optional[str] = None,
|
124
|
+
timeout_ms: Optional[int] = None,
|
125
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
126
|
+
) -> models.TaxonomyModel:
|
127
|
+
r"""Get Taxonomy
|
128
|
+
|
129
|
+
Get the complete taxonomy that contains the specified node
|
130
|
+
|
131
|
+
:param taxonomy: The name or id of the taxonomy to find
|
132
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
133
|
+
:param retries: Override the default retry configuration for this method
|
134
|
+
:param server_url: Override the default server URL for this method
|
135
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
136
|
+
:param http_headers: Additional headers to set or replace on requests.
|
137
|
+
"""
|
138
|
+
base_url = None
|
139
|
+
url_variables = None
|
140
|
+
if timeout_ms is None:
|
141
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
142
|
+
|
143
|
+
if server_url is not None:
|
144
|
+
base_url = server_url
|
145
|
+
|
146
|
+
request = models.GetTaxonomyV1EntitiesTaxonomiesTaxonomyGetRequest(
|
147
|
+
taxonomy=taxonomy,
|
148
|
+
x_namespace=x_namespace,
|
149
|
+
)
|
150
|
+
|
151
|
+
req = self._build_request_async(
|
152
|
+
method="GET",
|
153
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
154
|
+
base_url=base_url,
|
155
|
+
url_variables=url_variables,
|
156
|
+
request=request,
|
157
|
+
request_body_required=False,
|
158
|
+
request_has_path_params=True,
|
159
|
+
request_has_query_params=True,
|
160
|
+
user_agent_header="user-agent",
|
161
|
+
accept_header_value="application/json",
|
162
|
+
http_headers=http_headers,
|
163
|
+
security=self.sdk_configuration.security,
|
164
|
+
timeout_ms=timeout_ms,
|
165
|
+
)
|
166
|
+
|
167
|
+
if retries == UNSET:
|
168
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
169
|
+
retries = self.sdk_configuration.retry_config
|
170
|
+
|
171
|
+
retry_config = None
|
172
|
+
if isinstance(retries, utils.RetryConfig):
|
173
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
174
|
+
|
175
|
+
http_res = await self.do_request_async(
|
176
|
+
hook_ctx=HookContext(
|
177
|
+
operation_id="get_taxonomy_v1_entities_taxonomies__taxonomy__get",
|
178
|
+
oauth2_scopes=[],
|
179
|
+
security_source=get_security_from_env(
|
180
|
+
self.sdk_configuration.security, models.Security
|
181
|
+
),
|
182
|
+
),
|
183
|
+
request=req,
|
184
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
185
|
+
retry_config=retry_config,
|
186
|
+
)
|
187
|
+
|
188
|
+
data: Any = None
|
189
|
+
if utils.match_response(http_res, "200", "application/json"):
|
190
|
+
return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
|
191
|
+
if utils.match_response(
|
192
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
193
|
+
):
|
194
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
195
|
+
raise models.ErrorResponse(data=data)
|
196
|
+
if utils.match_response(http_res, "422", "application/json"):
|
197
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
198
|
+
raise models.HTTPValidationError(data=data)
|
199
|
+
if utils.match_response(http_res, "500", "application/json"):
|
200
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
201
|
+
raise models.ErrorResponse(data=data)
|
202
|
+
if utils.match_response(http_res, "4XX", "*"):
|
203
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
204
|
+
raise models.APIError(
|
205
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
206
|
+
)
|
207
|
+
if utils.match_response(http_res, "5XX", "*"):
|
208
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
209
|
+
raise models.APIError(
|
210
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
211
|
+
)
|
212
|
+
|
213
|
+
content_type = http_res.headers.get("Content-Type")
|
214
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
215
|
+
raise models.APIError(
|
216
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
217
|
+
http_res.status_code,
|
218
|
+
http_res_text,
|
219
|
+
http_res,
|
220
|
+
)
|
221
|
+
|
222
|
+
def delete(
|
223
|
+
self,
|
224
|
+
*,
|
225
|
+
taxonomy: str,
|
226
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
227
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
228
|
+
server_url: Optional[str] = None,
|
229
|
+
timeout_ms: Optional[int] = None,
|
230
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
231
|
+
) -> models.GenericSuccessResponse:
|
232
|
+
r"""Delete Taxonomy
|
233
|
+
|
234
|
+
Delete an existing taxonomy and remove all associated node classifications from features.
|
235
|
+
|
236
|
+
This operation:
|
237
|
+
- Deletes the taxonomy and all its nodes
|
238
|
+
- Removes any node classifications associated with this taxonomy from all features
|
239
|
+
- This action cannot be undone
|
240
|
+
|
241
|
+
|
242
|
+
**Requirements:**
|
243
|
+
- Required permissions: write
|
244
|
+
|
245
|
+
:param taxonomy: The ID or name of the taxonomy to delete
|
246
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
247
|
+
:param retries: Override the default retry configuration for this method
|
248
|
+
:param server_url: Override the default server URL for this method
|
249
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
250
|
+
:param http_headers: Additional headers to set or replace on requests.
|
251
|
+
"""
|
252
|
+
base_url = None
|
253
|
+
url_variables = None
|
254
|
+
if timeout_ms is None:
|
255
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
256
|
+
|
257
|
+
if server_url is not None:
|
258
|
+
base_url = server_url
|
259
|
+
|
260
|
+
request = models.DeleteTaxonomyV1EntitiesTaxonomiesTaxonomyDeleteRequest(
|
261
|
+
taxonomy=taxonomy,
|
262
|
+
x_namespace=x_namespace,
|
263
|
+
)
|
264
|
+
|
265
|
+
req = self._build_request(
|
266
|
+
method="DELETE",
|
267
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
268
|
+
base_url=base_url,
|
269
|
+
url_variables=url_variables,
|
270
|
+
request=request,
|
271
|
+
request_body_required=False,
|
272
|
+
request_has_path_params=True,
|
273
|
+
request_has_query_params=True,
|
274
|
+
user_agent_header="user-agent",
|
275
|
+
accept_header_value="application/json",
|
276
|
+
http_headers=http_headers,
|
277
|
+
security=self.sdk_configuration.security,
|
278
|
+
timeout_ms=timeout_ms,
|
279
|
+
)
|
280
|
+
|
281
|
+
if retries == UNSET:
|
282
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
283
|
+
retries = self.sdk_configuration.retry_config
|
284
|
+
|
285
|
+
retry_config = None
|
286
|
+
if isinstance(retries, utils.RetryConfig):
|
287
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
288
|
+
|
289
|
+
http_res = self.do_request(
|
290
|
+
hook_ctx=HookContext(
|
291
|
+
operation_id="delete_taxonomy_v1_entities_taxonomies__taxonomy__delete",
|
292
|
+
oauth2_scopes=[],
|
293
|
+
security_source=get_security_from_env(
|
294
|
+
self.sdk_configuration.security, models.Security
|
295
|
+
),
|
296
|
+
),
|
297
|
+
request=req,
|
298
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
299
|
+
retry_config=retry_config,
|
300
|
+
)
|
301
|
+
|
302
|
+
data: Any = None
|
303
|
+
if utils.match_response(http_res, "200", "application/json"):
|
304
|
+
return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
|
305
|
+
if utils.match_response(
|
306
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
307
|
+
):
|
308
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
309
|
+
raise models.ErrorResponse(data=data)
|
310
|
+
if utils.match_response(http_res, "422", "application/json"):
|
311
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
312
|
+
raise models.HTTPValidationError(data=data)
|
313
|
+
if utils.match_response(http_res, "500", "application/json"):
|
314
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
315
|
+
raise models.ErrorResponse(data=data)
|
316
|
+
if utils.match_response(http_res, "4XX", "*"):
|
317
|
+
http_res_text = utils.stream_to_text(http_res)
|
318
|
+
raise models.APIError(
|
319
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
320
|
+
)
|
321
|
+
if utils.match_response(http_res, "5XX", "*"):
|
322
|
+
http_res_text = utils.stream_to_text(http_res)
|
323
|
+
raise models.APIError(
|
324
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
325
|
+
)
|
326
|
+
|
327
|
+
content_type = http_res.headers.get("Content-Type")
|
328
|
+
http_res_text = utils.stream_to_text(http_res)
|
329
|
+
raise models.APIError(
|
330
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
331
|
+
http_res.status_code,
|
332
|
+
http_res_text,
|
333
|
+
http_res,
|
334
|
+
)
|
335
|
+
|
336
|
+
async def delete_async(
|
337
|
+
self,
|
338
|
+
*,
|
339
|
+
taxonomy: str,
|
340
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
341
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
342
|
+
server_url: Optional[str] = None,
|
343
|
+
timeout_ms: Optional[int] = None,
|
344
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
345
|
+
) -> models.GenericSuccessResponse:
|
346
|
+
r"""Delete Taxonomy
|
347
|
+
|
348
|
+
Delete an existing taxonomy and remove all associated node classifications from features.
|
349
|
+
|
350
|
+
This operation:
|
351
|
+
- Deletes the taxonomy and all its nodes
|
352
|
+
- Removes any node classifications associated with this taxonomy from all features
|
353
|
+
- This action cannot be undone
|
354
|
+
|
355
|
+
|
356
|
+
**Requirements:**
|
357
|
+
- Required permissions: write
|
358
|
+
|
359
|
+
:param taxonomy: The ID or name of the taxonomy to delete
|
360
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
361
|
+
:param retries: Override the default retry configuration for this method
|
362
|
+
:param server_url: Override the default server URL for this method
|
363
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
364
|
+
:param http_headers: Additional headers to set or replace on requests.
|
365
|
+
"""
|
366
|
+
base_url = None
|
367
|
+
url_variables = None
|
368
|
+
if timeout_ms is None:
|
369
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
370
|
+
|
371
|
+
if server_url is not None:
|
372
|
+
base_url = server_url
|
373
|
+
|
374
|
+
request = models.DeleteTaxonomyV1EntitiesTaxonomiesTaxonomyDeleteRequest(
|
375
|
+
taxonomy=taxonomy,
|
376
|
+
x_namespace=x_namespace,
|
377
|
+
)
|
378
|
+
|
379
|
+
req = self._build_request_async(
|
380
|
+
method="DELETE",
|
381
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
382
|
+
base_url=base_url,
|
383
|
+
url_variables=url_variables,
|
384
|
+
request=request,
|
385
|
+
request_body_required=False,
|
386
|
+
request_has_path_params=True,
|
387
|
+
request_has_query_params=True,
|
388
|
+
user_agent_header="user-agent",
|
389
|
+
accept_header_value="application/json",
|
390
|
+
http_headers=http_headers,
|
391
|
+
security=self.sdk_configuration.security,
|
392
|
+
timeout_ms=timeout_ms,
|
393
|
+
)
|
394
|
+
|
395
|
+
if retries == UNSET:
|
396
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
397
|
+
retries = self.sdk_configuration.retry_config
|
398
|
+
|
399
|
+
retry_config = None
|
400
|
+
if isinstance(retries, utils.RetryConfig):
|
401
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
402
|
+
|
403
|
+
http_res = await self.do_request_async(
|
404
|
+
hook_ctx=HookContext(
|
405
|
+
operation_id="delete_taxonomy_v1_entities_taxonomies__taxonomy__delete",
|
406
|
+
oauth2_scopes=[],
|
407
|
+
security_source=get_security_from_env(
|
408
|
+
self.sdk_configuration.security, models.Security
|
409
|
+
),
|
410
|
+
),
|
411
|
+
request=req,
|
412
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
413
|
+
retry_config=retry_config,
|
414
|
+
)
|
415
|
+
|
416
|
+
data: Any = None
|
417
|
+
if utils.match_response(http_res, "200", "application/json"):
|
418
|
+
return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
|
419
|
+
if utils.match_response(
|
420
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
421
|
+
):
|
422
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
423
|
+
raise models.ErrorResponse(data=data)
|
424
|
+
if utils.match_response(http_res, "422", "application/json"):
|
425
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
426
|
+
raise models.HTTPValidationError(data=data)
|
427
|
+
if utils.match_response(http_res, "500", "application/json"):
|
428
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
429
|
+
raise models.ErrorResponse(data=data)
|
430
|
+
if utils.match_response(http_res, "4XX", "*"):
|
431
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
432
|
+
raise models.APIError(
|
433
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
434
|
+
)
|
435
|
+
if utils.match_response(http_res, "5XX", "*"):
|
436
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
437
|
+
raise models.APIError(
|
438
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
439
|
+
)
|
440
|
+
|
441
|
+
content_type = http_res.headers.get("Content-Type")
|
442
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
443
|
+
raise models.APIError(
|
444
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
445
|
+
http_res.status_code,
|
446
|
+
http_res_text,
|
447
|
+
http_res,
|
448
|
+
)
|
449
|
+
|
450
|
+
def update(
|
451
|
+
self,
|
452
|
+
*,
|
453
|
+
taxonomy: str,
|
454
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
455
|
+
taxonomy_name: OptionalNullable[str] = UNSET,
|
456
|
+
description: OptionalNullable[str] = UNSET,
|
457
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
458
|
+
server_url: Optional[str] = None,
|
459
|
+
timeout_ms: Optional[int] = None,
|
460
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
461
|
+
) -> models.TaxonomyModel:
|
462
|
+
r"""Update Taxonomy
|
463
|
+
|
464
|
+
Update an existing taxonomy's metadata
|
465
|
+
|
466
|
+
**Requirements:**
|
467
|
+
- Required permissions: write
|
468
|
+
|
469
|
+
:param taxonomy: The ID or name of the taxonomy to update
|
470
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
471
|
+
:param taxonomy_name: Updated taxonomy name (must not contain spaces or special characters)
|
472
|
+
:param description: Updated taxonomy description
|
473
|
+
:param retries: Override the default retry configuration for this method
|
474
|
+
:param server_url: Override the default server URL for this method
|
475
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
476
|
+
:param http_headers: Additional headers to set or replace on requests.
|
477
|
+
"""
|
478
|
+
base_url = None
|
479
|
+
url_variables = None
|
480
|
+
if timeout_ms is None:
|
481
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
482
|
+
|
483
|
+
if server_url is not None:
|
484
|
+
base_url = server_url
|
485
|
+
|
486
|
+
request = models.UpdateTaxonomyV1EntitiesTaxonomiesTaxonomyPatchRequest(
|
487
|
+
taxonomy=taxonomy,
|
488
|
+
x_namespace=x_namespace,
|
489
|
+
taxonomy_update=models.TaxonomyUpdate(
|
490
|
+
taxonomy_name=taxonomy_name,
|
491
|
+
description=description,
|
492
|
+
),
|
493
|
+
)
|
494
|
+
|
495
|
+
req = self._build_request(
|
496
|
+
method="PATCH",
|
497
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
498
|
+
base_url=base_url,
|
499
|
+
url_variables=url_variables,
|
500
|
+
request=request,
|
501
|
+
request_body_required=True,
|
502
|
+
request_has_path_params=True,
|
503
|
+
request_has_query_params=True,
|
504
|
+
user_agent_header="user-agent",
|
505
|
+
accept_header_value="application/json",
|
506
|
+
http_headers=http_headers,
|
507
|
+
security=self.sdk_configuration.security,
|
508
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
509
|
+
request.taxonomy_update, False, False, "json", models.TaxonomyUpdate
|
510
|
+
),
|
511
|
+
timeout_ms=timeout_ms,
|
512
|
+
)
|
513
|
+
|
514
|
+
if retries == UNSET:
|
515
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
516
|
+
retries = self.sdk_configuration.retry_config
|
517
|
+
|
518
|
+
retry_config = None
|
519
|
+
if isinstance(retries, utils.RetryConfig):
|
520
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
521
|
+
|
522
|
+
http_res = self.do_request(
|
523
|
+
hook_ctx=HookContext(
|
524
|
+
operation_id="update_taxonomy_v1_entities_taxonomies__taxonomy__patch",
|
525
|
+
oauth2_scopes=[],
|
526
|
+
security_source=get_security_from_env(
|
527
|
+
self.sdk_configuration.security, models.Security
|
528
|
+
),
|
529
|
+
),
|
530
|
+
request=req,
|
531
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
532
|
+
retry_config=retry_config,
|
533
|
+
)
|
534
|
+
|
535
|
+
data: Any = None
|
536
|
+
if utils.match_response(http_res, "200", "application/json"):
|
537
|
+
return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
|
538
|
+
if utils.match_response(
|
539
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
540
|
+
):
|
541
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
542
|
+
raise models.ErrorResponse(data=data)
|
543
|
+
if utils.match_response(http_res, "422", "application/json"):
|
544
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
545
|
+
raise models.HTTPValidationError(data=data)
|
546
|
+
if utils.match_response(http_res, "500", "application/json"):
|
547
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
548
|
+
raise models.ErrorResponse(data=data)
|
549
|
+
if utils.match_response(http_res, "4XX", "*"):
|
550
|
+
http_res_text = utils.stream_to_text(http_res)
|
551
|
+
raise models.APIError(
|
552
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
553
|
+
)
|
554
|
+
if utils.match_response(http_res, "5XX", "*"):
|
555
|
+
http_res_text = utils.stream_to_text(http_res)
|
556
|
+
raise models.APIError(
|
557
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
558
|
+
)
|
559
|
+
|
560
|
+
content_type = http_res.headers.get("Content-Type")
|
561
|
+
http_res_text = utils.stream_to_text(http_res)
|
562
|
+
raise models.APIError(
|
563
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
564
|
+
http_res.status_code,
|
565
|
+
http_res_text,
|
566
|
+
http_res,
|
567
|
+
)
|
568
|
+
|
569
|
+
async def update_async(
|
570
|
+
self,
|
571
|
+
*,
|
572
|
+
taxonomy: str,
|
573
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
574
|
+
taxonomy_name: OptionalNullable[str] = UNSET,
|
575
|
+
description: OptionalNullable[str] = UNSET,
|
576
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
577
|
+
server_url: Optional[str] = None,
|
578
|
+
timeout_ms: Optional[int] = None,
|
579
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
580
|
+
) -> models.TaxonomyModel:
|
581
|
+
r"""Update Taxonomy
|
582
|
+
|
583
|
+
Update an existing taxonomy's metadata
|
584
|
+
|
585
|
+
**Requirements:**
|
586
|
+
- Required permissions: write
|
587
|
+
|
588
|
+
:param taxonomy: The ID or name of the taxonomy to update
|
589
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
590
|
+
:param taxonomy_name: Updated taxonomy name (must not contain spaces or special characters)
|
591
|
+
:param description: Updated taxonomy description
|
592
|
+
:param retries: Override the default retry configuration for this method
|
593
|
+
:param server_url: Override the default server URL for this method
|
594
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
595
|
+
:param http_headers: Additional headers to set or replace on requests.
|
596
|
+
"""
|
597
|
+
base_url = None
|
598
|
+
url_variables = None
|
599
|
+
if timeout_ms is None:
|
600
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
601
|
+
|
602
|
+
if server_url is not None:
|
603
|
+
base_url = server_url
|
604
|
+
|
605
|
+
request = models.UpdateTaxonomyV1EntitiesTaxonomiesTaxonomyPatchRequest(
|
606
|
+
taxonomy=taxonomy,
|
607
|
+
x_namespace=x_namespace,
|
608
|
+
taxonomy_update=models.TaxonomyUpdate(
|
609
|
+
taxonomy_name=taxonomy_name,
|
610
|
+
description=description,
|
611
|
+
),
|
612
|
+
)
|
613
|
+
|
614
|
+
req = self._build_request_async(
|
615
|
+
method="PATCH",
|
616
|
+
path="/v1/entities/taxonomies/{taxonomy}",
|
617
|
+
base_url=base_url,
|
618
|
+
url_variables=url_variables,
|
619
|
+
request=request,
|
620
|
+
request_body_required=True,
|
621
|
+
request_has_path_params=True,
|
622
|
+
request_has_query_params=True,
|
623
|
+
user_agent_header="user-agent",
|
624
|
+
accept_header_value="application/json",
|
625
|
+
http_headers=http_headers,
|
626
|
+
security=self.sdk_configuration.security,
|
627
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
628
|
+
request.taxonomy_update, False, False, "json", models.TaxonomyUpdate
|
629
|
+
),
|
630
|
+
timeout_ms=timeout_ms,
|
631
|
+
)
|
632
|
+
|
633
|
+
if retries == UNSET:
|
634
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
635
|
+
retries = self.sdk_configuration.retry_config
|
636
|
+
|
637
|
+
retry_config = None
|
638
|
+
if isinstance(retries, utils.RetryConfig):
|
639
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
640
|
+
|
641
|
+
http_res = await self.do_request_async(
|
642
|
+
hook_ctx=HookContext(
|
643
|
+
operation_id="update_taxonomy_v1_entities_taxonomies__taxonomy__patch",
|
644
|
+
oauth2_scopes=[],
|
645
|
+
security_source=get_security_from_env(
|
646
|
+
self.sdk_configuration.security, models.Security
|
647
|
+
),
|
648
|
+
),
|
649
|
+
request=req,
|
650
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
651
|
+
retry_config=retry_config,
|
652
|
+
)
|
653
|
+
|
654
|
+
data: Any = None
|
655
|
+
if utils.match_response(http_res, "200", "application/json"):
|
656
|
+
return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
|
657
|
+
if utils.match_response(
|
658
|
+
http_res, ["400", "401", "403", "404"], "application/json"
|
659
|
+
):
|
660
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
661
|
+
raise models.ErrorResponse(data=data)
|
662
|
+
if utils.match_response(http_res, "422", "application/json"):
|
663
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
664
|
+
raise models.HTTPValidationError(data=data)
|
665
|
+
if utils.match_response(http_res, "500", "application/json"):
|
666
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
667
|
+
raise models.ErrorResponse(data=data)
|
668
|
+
if utils.match_response(http_res, "4XX", "*"):
|
669
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
670
|
+
raise models.APIError(
|
671
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
672
|
+
)
|
673
|
+
if utils.match_response(http_res, "5XX", "*"):
|
674
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
675
|
+
raise models.APIError(
|
676
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
677
|
+
)
|
678
|
+
|
679
|
+
content_type = http_res.headers.get("Content-Type")
|
680
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
681
|
+
raise models.APIError(
|
682
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
683
|
+
http_res.status_code,
|
684
|
+
http_res_text,
|
685
|
+
http_res,
|
686
|
+
)
|