mixpeek 0.15.1__py3-none-any.whl → 0.16.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. mixpeek/_hooks/__init__.py +0 -1
  2. mixpeek/_hooks/sdkhooks.py +0 -2
  3. mixpeek/_version.py +1 -1
  4. mixpeek/assets.py +74 -56
  5. mixpeek/collections.py +46 -40
  6. mixpeek/{featureextractors.py → feature_extractors.py} +6 -6
  7. mixpeek/feature_search.py +330 -0
  8. mixpeek/features.py +44 -356
  9. mixpeek/health.py +3 -15
  10. mixpeek/{ingest.py → ingest_assets.py} +43 -25
  11. mixpeek/models/__init__.py +291 -160
  12. mixpeek/models/assignmentconfig.py +25 -0
  13. mixpeek/models/availablemodels.py +2 -1
  14. mixpeek/models/{availableindexesresponse.py → availablemodelsresponse.py} +8 -4
  15. mixpeek/models/classificationmatch.py +72 -0
  16. mixpeek/models/classificationwithfeature.py +73 -0
  17. mixpeek/models/classify_features_v1_entities_taxonomies_taxonomy_classify_postop.py +73 -0
  18. mixpeek/models/{create_api_key_organizations_users_user_email_api_keys_postop.py → create_api_key_v1_organizations_users_user_email_api_keys_postop.py} +2 -2
  19. mixpeek/models/{create_collection_collections_postop.py → create_collection_v1_collections_postop.py} +2 -2
  20. mixpeek/models/create_taxonomy_v1_entities_taxonomies_postop.py +59 -0
  21. mixpeek/models/createnamespacerequest.py +2 -2
  22. mixpeek/models/{delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py → delete_api_key_v1_organizations_users_user_email_api_keys_key_name_deleteop.py} +2 -2
  23. mixpeek/models/{delete_asset_assets_asset_id_deleteop.py → delete_asset_v1_assets_asset_id_deleteop.py} +2 -2
  24. mixpeek/models/delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_deleteop.py +70 -0
  25. mixpeek/models/{delete_collection_collections_collection_deleteop.py → delete_collection_v1_collections_collection_deleteop.py} +2 -2
  26. mixpeek/models/{delete_feature_features_feature_id_deleteop.py → delete_feature_v1_features_feature_id_deleteop.py} +2 -2
  27. mixpeek/models/{delete_namespace_namespaces_namespace_deleteop.py → delete_namespace_v1_namespaces_namespace_deleteop.py} +2 -2
  28. mixpeek/models/delete_taxonomy_v1_entities_taxonomies_taxonomy_deleteop.py +59 -0
  29. mixpeek/models/{delete_user_organizations_users_user_email_deleteop.py → delete_user_v1_organizations_users_user_email_deleteop.py} +2 -2
  30. mixpeek/models/discoverrequest.py +74 -0
  31. mixpeek/models/embeddingconfig.py +33 -0
  32. mixpeek/models/embeddingrequest.py +40 -7
  33. mixpeek/models/featureoptions.py +25 -0
  34. mixpeek/models/{full_asset_update_assets_asset_id_putop.py → full_asset_update_v1_assets_asset_id_putop.py} +2 -2
  35. mixpeek/models/{full_feature_update_features_feature_id_putop.py → full_feature_update_v1_features_feature_id_putop.py} +2 -2
  36. mixpeek/models/genericsuccessresponse.py +17 -0
  37. mixpeek/models/{get_asset_assets_asset_id_getop.py → get_asset_v1_assets_asset_id_getop.py} +2 -2
  38. mixpeek/models/{get_asset_with_features_assets_asset_id_features_getop.py → get_asset_with_features_v1_assets_asset_id_features_getop.py} +2 -2
  39. mixpeek/models/{get_collection_collections_collection_getop.py → get_collection_v1_collections_collection_getop.py} +2 -2
  40. mixpeek/models/{get_feature_features_feature_id_getop.py → get_feature_v1_features_feature_id_getop.py} +2 -2
  41. mixpeek/models/{get_namespace_namespaces_namespace_getop.py → get_namespace_v1_namespaces_namespace_getop.py} +2 -2
  42. mixpeek/models/{get_task_tasks_task_id_getop.py → get_task_v1_tasks_task_id_getop.py} +2 -2
  43. mixpeek/models/get_taxonomy_node_v1_entities_taxonomies_nodes_node_getop.py +59 -0
  44. mixpeek/models/get_taxonomy_v1_entities_taxonomies_taxonomy_getop.py +59 -0
  45. mixpeek/models/{get_user_organizations_users_user_email_getop.py → get_user_v1_organizations_users_user_email_getop.py} +2 -2
  46. mixpeek/models/{ingest_image_url_ingest_images_url_postop.py → ingest_image_url_v1_ingest_images_url_postop.py} +2 -2
  47. mixpeek/models/{ingest_text_ingest_text_postop.py → ingest_text_v1_ingest_text_postop.py} +2 -2
  48. mixpeek/models/{ingest_video_url_ingest_videos_url_postop.py → ingest_video_url_v1_ingest_videos_url_postop.py} +2 -2
  49. mixpeek/models/{kill_task_tasks_task_id_deleteop.py → kill_task_v1_tasks_task_id_deleteop.py} +2 -2
  50. mixpeek/models/{list_assets_assets_postop.py → list_assets_v1_assets_postop.py} +2 -2
  51. mixpeek/models/list_classifications_v1_entities_taxonomies_taxonomy_classifications_postop.py +92 -0
  52. mixpeek/models/{list_collections_collections_getop.py → list_collections_v1_collections_getop.py} +2 -2
  53. mixpeek/models/{list_features_features_postop.py → list_features_v1_features_postop.py} +2 -2
  54. mixpeek/models/list_taxonomies_v1_entities_taxonomies_getop.py +67 -0
  55. mixpeek/models/listclassificationsrequest.py +69 -0
  56. mixpeek/models/listclassificationsresponse.py +31 -0
  57. mixpeek/models/listtaxonomiesresponse.py +24 -0
  58. mixpeek/models/modeldetails.py +9 -5
  59. mixpeek/models/nodeoptions.py +16 -0
  60. mixpeek/models/nodeupdate.py +51 -0
  61. mixpeek/models/{partial_asset_update_assets_asset_id_patchop.py → partial_asset_update_v1_assets_asset_id_patchop.py} +2 -2
  62. mixpeek/models/permission.py +12 -0
  63. mixpeek/models/{search_assets_assets_search_postop.py → search_assets_v1_assets_search_postop.py} +2 -2
  64. mixpeek/models/{search_features_features_search_postop.py → search_features_v1_features_search_postop.py} +4 -4
  65. mixpeek/models/taxonomycreate.py +20 -0
  66. mixpeek/models/taxonomymodel.py +27 -0
  67. mixpeek/models/taxonomynode.py +101 -0
  68. mixpeek/models/taxonomynodecreate.py +63 -0
  69. mixpeek/models/taxonomyupdate.py +55 -0
  70. mixpeek/models/{update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py → update_api_key_v1_organizations_users_user_email_api_keys_key_name_patchop.py} +2 -2
  71. mixpeek/models/{update_collection_collections_collection_putop.py → update_collection_v1_collections_collection_putop.py} +2 -2
  72. mixpeek/models/{update_namespace_namespaces_namespace_putop.py → update_namespace_v1_namespaces_namespace_putop.py} +2 -2
  73. mixpeek/models/update_node_v1_entities_taxonomies_nodes_node_patchop.py +71 -0
  74. mixpeek/models/update_taxonomy_v1_entities_taxonomies_taxonomy_patchop.py +71 -0
  75. mixpeek/models/vectormodel.py +1 -0
  76. mixpeek/namespaces.py +56 -56
  77. mixpeek/organizations.py +82 -58
  78. mixpeek/sdk.py +12 -6
  79. mixpeek/sdkconfiguration.py +4 -4
  80. mixpeek/tasks.py +22 -16
  81. mixpeek/taxonomy_entities.py +2214 -0
  82. {mixpeek-0.15.1.dist-info → mixpeek-0.16.0.dist-info}/METADATA +64 -49
  83. {mixpeek-0.15.1.dist-info → mixpeek-0.16.0.dist-info}/RECORD +84 -55
  84. {mixpeek-0.15.1.dist-info → mixpeek-0.16.0.dist-info}/WHEEL +1 -1
@@ -0,0 +1,2214 @@
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, List, Mapping, Optional, Union
9
+
10
+
11
+ class TaxonomyEntities(BaseSDK):
12
+ def create_taxonomy_v1_entities_taxonomies_post(
13
+ self,
14
+ *,
15
+ taxonomy_name: str,
16
+ nodes: Union[
17
+ List[models.TaxonomyNodeCreate], List[models.TaxonomyNodeCreateTypedDict]
18
+ ],
19
+ x_namespace: OptionalNullable[str] = UNSET,
20
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
21
+ server_url: Optional[str] = None,
22
+ timeout_ms: Optional[int] = None,
23
+ http_headers: Optional[Mapping[str, str]] = None,
24
+ ) -> models.TaskResponse:
25
+ r"""Create Taxonomy
26
+
27
+ Register new taxonomies with their descriptions
28
+
29
+ **Requirements:**
30
+ - Required permissions: write
31
+
32
+ :param taxonomy_name: Taxonomy name (must not contain spaces or special characters)
33
+ :param nodes:
34
+ :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.
35
+ :param retries: Override the default retry configuration for this method
36
+ :param server_url: Override the default server URL for this method
37
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
38
+ :param http_headers: Additional headers to set or replace on requests.
39
+ """
40
+ base_url = None
41
+ url_variables = None
42
+ if timeout_ms is None:
43
+ timeout_ms = self.sdk_configuration.timeout_ms
44
+
45
+ if server_url is not None:
46
+ base_url = server_url
47
+
48
+ request = models.CreateTaxonomyV1EntitiesTaxonomiesPostRequest(
49
+ x_namespace=x_namespace,
50
+ taxonomy_create=models.TaxonomyCreate(
51
+ taxonomy_name=taxonomy_name,
52
+ nodes=utils.get_pydantic_model(nodes, List[models.TaxonomyNodeCreate]),
53
+ ),
54
+ )
55
+
56
+ req = self._build_request(
57
+ method="POST",
58
+ path="/v1/entities/taxonomies",
59
+ base_url=base_url,
60
+ url_variables=url_variables,
61
+ request=request,
62
+ request_body_required=True,
63
+ request_has_path_params=False,
64
+ request_has_query_params=True,
65
+ user_agent_header="user-agent",
66
+ accept_header_value="application/json",
67
+ http_headers=http_headers,
68
+ security=self.sdk_configuration.security,
69
+ get_serialized_body=lambda: utils.serialize_request_body(
70
+ request.taxonomy_create, False, False, "json", models.TaxonomyCreate
71
+ ),
72
+ timeout_ms=timeout_ms,
73
+ )
74
+
75
+ if retries == UNSET:
76
+ if self.sdk_configuration.retry_config is not UNSET:
77
+ retries = self.sdk_configuration.retry_config
78
+
79
+ retry_config = None
80
+ if isinstance(retries, utils.RetryConfig):
81
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
82
+
83
+ http_res = self.do_request(
84
+ hook_ctx=HookContext(
85
+ operation_id="create_taxonomy_v1_entities_taxonomies_post",
86
+ oauth2_scopes=[],
87
+ security_source=get_security_from_env(
88
+ self.sdk_configuration.security, models.Security
89
+ ),
90
+ ),
91
+ request=req,
92
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
93
+ retry_config=retry_config,
94
+ )
95
+
96
+ data: Any = None
97
+ if utils.match_response(http_res, "200", "application/json"):
98
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
99
+ if utils.match_response(
100
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
101
+ ):
102
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
103
+ raise models.ErrorResponse(data=data)
104
+ if utils.match_response(http_res, "422", "application/json"):
105
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
106
+ raise models.HTTPValidationError(data=data)
107
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
108
+ http_res_text = utils.stream_to_text(http_res)
109
+ raise models.APIError(
110
+ "API error occurred", http_res.status_code, http_res_text, http_res
111
+ )
112
+
113
+ content_type = http_res.headers.get("Content-Type")
114
+ http_res_text = utils.stream_to_text(http_res)
115
+ raise models.APIError(
116
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
117
+ http_res.status_code,
118
+ http_res_text,
119
+ http_res,
120
+ )
121
+
122
+ async def create_taxonomy_v1_entities_taxonomies_post_async(
123
+ self,
124
+ *,
125
+ taxonomy_name: str,
126
+ nodes: Union[
127
+ List[models.TaxonomyNodeCreate], List[models.TaxonomyNodeCreateTypedDict]
128
+ ],
129
+ x_namespace: OptionalNullable[str] = UNSET,
130
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
131
+ server_url: Optional[str] = None,
132
+ timeout_ms: Optional[int] = None,
133
+ http_headers: Optional[Mapping[str, str]] = None,
134
+ ) -> models.TaskResponse:
135
+ r"""Create Taxonomy
136
+
137
+ Register new taxonomies with their descriptions
138
+
139
+ **Requirements:**
140
+ - Required permissions: write
141
+
142
+ :param taxonomy_name: Taxonomy name (must not contain spaces or special characters)
143
+ :param nodes:
144
+ :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.
145
+ :param retries: Override the default retry configuration for this method
146
+ :param server_url: Override the default server URL for this method
147
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
148
+ :param http_headers: Additional headers to set or replace on requests.
149
+ """
150
+ base_url = None
151
+ url_variables = None
152
+ if timeout_ms is None:
153
+ timeout_ms = self.sdk_configuration.timeout_ms
154
+
155
+ if server_url is not None:
156
+ base_url = server_url
157
+
158
+ request = models.CreateTaxonomyV1EntitiesTaxonomiesPostRequest(
159
+ x_namespace=x_namespace,
160
+ taxonomy_create=models.TaxonomyCreate(
161
+ taxonomy_name=taxonomy_name,
162
+ nodes=utils.get_pydantic_model(nodes, List[models.TaxonomyNodeCreate]),
163
+ ),
164
+ )
165
+
166
+ req = self._build_request_async(
167
+ method="POST",
168
+ path="/v1/entities/taxonomies",
169
+ base_url=base_url,
170
+ url_variables=url_variables,
171
+ request=request,
172
+ request_body_required=True,
173
+ request_has_path_params=False,
174
+ request_has_query_params=True,
175
+ user_agent_header="user-agent",
176
+ accept_header_value="application/json",
177
+ http_headers=http_headers,
178
+ security=self.sdk_configuration.security,
179
+ get_serialized_body=lambda: utils.serialize_request_body(
180
+ request.taxonomy_create, False, False, "json", models.TaxonomyCreate
181
+ ),
182
+ timeout_ms=timeout_ms,
183
+ )
184
+
185
+ if retries == UNSET:
186
+ if self.sdk_configuration.retry_config is not UNSET:
187
+ retries = self.sdk_configuration.retry_config
188
+
189
+ retry_config = None
190
+ if isinstance(retries, utils.RetryConfig):
191
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
192
+
193
+ http_res = await self.do_request_async(
194
+ hook_ctx=HookContext(
195
+ operation_id="create_taxonomy_v1_entities_taxonomies_post",
196
+ oauth2_scopes=[],
197
+ security_source=get_security_from_env(
198
+ self.sdk_configuration.security, models.Security
199
+ ),
200
+ ),
201
+ request=req,
202
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
203
+ retry_config=retry_config,
204
+ )
205
+
206
+ data: Any = None
207
+ if utils.match_response(http_res, "200", "application/json"):
208
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
209
+ if utils.match_response(
210
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
211
+ ):
212
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
213
+ raise models.ErrorResponse(data=data)
214
+ if utils.match_response(http_res, "422", "application/json"):
215
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
216
+ raise models.HTTPValidationError(data=data)
217
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
218
+ http_res_text = await utils.stream_to_text_async(http_res)
219
+ raise models.APIError(
220
+ "API error occurred", http_res.status_code, http_res_text, http_res
221
+ )
222
+
223
+ content_type = http_res.headers.get("Content-Type")
224
+ http_res_text = await utils.stream_to_text_async(http_res)
225
+ raise models.APIError(
226
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
227
+ http_res.status_code,
228
+ http_res_text,
229
+ http_res,
230
+ )
231
+
232
+ def list_taxonomies_v1_entities_taxonomies_get(
233
+ self,
234
+ *,
235
+ offset_id: OptionalNullable[str] = UNSET,
236
+ page_size: Optional[int] = 10,
237
+ x_namespace: OptionalNullable[str] = UNSET,
238
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
239
+ server_url: Optional[str] = None,
240
+ timeout_ms: Optional[int] = None,
241
+ http_headers: Optional[Mapping[str, str]] = None,
242
+ ) -> models.ListTaxonomiesResponse:
243
+ r"""List Taxonomies
244
+
245
+ Get all taxonomies for the current namespace
246
+
247
+ :param offset_id: The offset id to start returning results from. Used for pagination
248
+ :param page_size:
249
+ :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.
250
+ :param retries: Override the default retry configuration for this method
251
+ :param server_url: Override the default server URL for this method
252
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
253
+ :param http_headers: Additional headers to set or replace on requests.
254
+ """
255
+ base_url = None
256
+ url_variables = None
257
+ if timeout_ms is None:
258
+ timeout_ms = self.sdk_configuration.timeout_ms
259
+
260
+ if server_url is not None:
261
+ base_url = server_url
262
+
263
+ request = models.ListTaxonomiesV1EntitiesTaxonomiesGetRequest(
264
+ offset_id=offset_id,
265
+ page_size=page_size,
266
+ x_namespace=x_namespace,
267
+ )
268
+
269
+ req = self._build_request(
270
+ method="GET",
271
+ path="/v1/entities/taxonomies",
272
+ base_url=base_url,
273
+ url_variables=url_variables,
274
+ request=request,
275
+ request_body_required=False,
276
+ request_has_path_params=False,
277
+ request_has_query_params=True,
278
+ user_agent_header="user-agent",
279
+ accept_header_value="application/json",
280
+ http_headers=http_headers,
281
+ security=self.sdk_configuration.security,
282
+ timeout_ms=timeout_ms,
283
+ )
284
+
285
+ if retries == UNSET:
286
+ if self.sdk_configuration.retry_config is not UNSET:
287
+ retries = self.sdk_configuration.retry_config
288
+
289
+ retry_config = None
290
+ if isinstance(retries, utils.RetryConfig):
291
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
292
+
293
+ http_res = self.do_request(
294
+ hook_ctx=HookContext(
295
+ operation_id="list_taxonomies_v1_entities_taxonomies_get",
296
+ oauth2_scopes=[],
297
+ security_source=get_security_from_env(
298
+ self.sdk_configuration.security, models.Security
299
+ ),
300
+ ),
301
+ request=req,
302
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
303
+ retry_config=retry_config,
304
+ )
305
+
306
+ data: Any = None
307
+ if utils.match_response(http_res, "200", "application/json"):
308
+ return utils.unmarshal_json(http_res.text, models.ListTaxonomiesResponse)
309
+ if utils.match_response(
310
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
311
+ ):
312
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
313
+ raise models.ErrorResponse(data=data)
314
+ if utils.match_response(http_res, "422", "application/json"):
315
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
316
+ raise models.HTTPValidationError(data=data)
317
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
318
+ http_res_text = utils.stream_to_text(http_res)
319
+ raise models.APIError(
320
+ "API error occurred", http_res.status_code, http_res_text, http_res
321
+ )
322
+
323
+ content_type = http_res.headers.get("Content-Type")
324
+ http_res_text = utils.stream_to_text(http_res)
325
+ raise models.APIError(
326
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
327
+ http_res.status_code,
328
+ http_res_text,
329
+ http_res,
330
+ )
331
+
332
+ async def list_taxonomies_v1_entities_taxonomies_get_async(
333
+ self,
334
+ *,
335
+ offset_id: OptionalNullable[str] = UNSET,
336
+ page_size: Optional[int] = 10,
337
+ x_namespace: OptionalNullable[str] = UNSET,
338
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
339
+ server_url: Optional[str] = None,
340
+ timeout_ms: Optional[int] = None,
341
+ http_headers: Optional[Mapping[str, str]] = None,
342
+ ) -> models.ListTaxonomiesResponse:
343
+ r"""List Taxonomies
344
+
345
+ Get all taxonomies for the current namespace
346
+
347
+ :param offset_id: The offset id to start returning results from. Used for pagination
348
+ :param page_size:
349
+ :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.
350
+ :param retries: Override the default retry configuration for this method
351
+ :param server_url: Override the default server URL for this method
352
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
353
+ :param http_headers: Additional headers to set or replace on requests.
354
+ """
355
+ base_url = None
356
+ url_variables = None
357
+ if timeout_ms is None:
358
+ timeout_ms = self.sdk_configuration.timeout_ms
359
+
360
+ if server_url is not None:
361
+ base_url = server_url
362
+
363
+ request = models.ListTaxonomiesV1EntitiesTaxonomiesGetRequest(
364
+ offset_id=offset_id,
365
+ page_size=page_size,
366
+ x_namespace=x_namespace,
367
+ )
368
+
369
+ req = self._build_request_async(
370
+ method="GET",
371
+ path="/v1/entities/taxonomies",
372
+ base_url=base_url,
373
+ url_variables=url_variables,
374
+ request=request,
375
+ request_body_required=False,
376
+ request_has_path_params=False,
377
+ request_has_query_params=True,
378
+ user_agent_header="user-agent",
379
+ accept_header_value="application/json",
380
+ http_headers=http_headers,
381
+ security=self.sdk_configuration.security,
382
+ timeout_ms=timeout_ms,
383
+ )
384
+
385
+ if retries == UNSET:
386
+ if self.sdk_configuration.retry_config is not UNSET:
387
+ retries = self.sdk_configuration.retry_config
388
+
389
+ retry_config = None
390
+ if isinstance(retries, utils.RetryConfig):
391
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
392
+
393
+ http_res = await self.do_request_async(
394
+ hook_ctx=HookContext(
395
+ operation_id="list_taxonomies_v1_entities_taxonomies_get",
396
+ oauth2_scopes=[],
397
+ security_source=get_security_from_env(
398
+ self.sdk_configuration.security, models.Security
399
+ ),
400
+ ),
401
+ request=req,
402
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
403
+ retry_config=retry_config,
404
+ )
405
+
406
+ data: Any = None
407
+ if utils.match_response(http_res, "200", "application/json"):
408
+ return utils.unmarshal_json(http_res.text, models.ListTaxonomiesResponse)
409
+ if utils.match_response(
410
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
411
+ ):
412
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
413
+ raise models.ErrorResponse(data=data)
414
+ if utils.match_response(http_res, "422", "application/json"):
415
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
416
+ raise models.HTTPValidationError(data=data)
417
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
418
+ http_res_text = await utils.stream_to_text_async(http_res)
419
+ raise models.APIError(
420
+ "API error occurred", http_res.status_code, http_res_text, http_res
421
+ )
422
+
423
+ content_type = http_res.headers.get("Content-Type")
424
+ http_res_text = await utils.stream_to_text_async(http_res)
425
+ raise models.APIError(
426
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
427
+ http_res.status_code,
428
+ http_res_text,
429
+ http_res,
430
+ )
431
+
432
+ def get_taxonomy_v1_entities_taxonomies_taxonomy_get(
433
+ self,
434
+ *,
435
+ taxonomy: str,
436
+ x_namespace: OptionalNullable[str] = UNSET,
437
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
438
+ server_url: Optional[str] = None,
439
+ timeout_ms: Optional[int] = None,
440
+ http_headers: Optional[Mapping[str, str]] = None,
441
+ ) -> models.TaxonomyModel:
442
+ r"""Get Taxonomy
443
+
444
+ Get the complete taxonomy that contains the specified node
445
+
446
+ :param taxonomy: The name or id of the taxonomy to find
447
+ :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.
448
+ :param retries: Override the default retry configuration for this method
449
+ :param server_url: Override the default server URL for this method
450
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
451
+ :param http_headers: Additional headers to set or replace on requests.
452
+ """
453
+ base_url = None
454
+ url_variables = None
455
+ if timeout_ms is None:
456
+ timeout_ms = self.sdk_configuration.timeout_ms
457
+
458
+ if server_url is not None:
459
+ base_url = server_url
460
+
461
+ request = models.GetTaxonomyV1EntitiesTaxonomiesTaxonomyGetRequest(
462
+ taxonomy=taxonomy,
463
+ x_namespace=x_namespace,
464
+ )
465
+
466
+ req = self._build_request(
467
+ method="GET",
468
+ path="/v1/entities/taxonomies/{taxonomy}",
469
+ base_url=base_url,
470
+ url_variables=url_variables,
471
+ request=request,
472
+ request_body_required=False,
473
+ request_has_path_params=True,
474
+ request_has_query_params=True,
475
+ user_agent_header="user-agent",
476
+ accept_header_value="application/json",
477
+ http_headers=http_headers,
478
+ security=self.sdk_configuration.security,
479
+ timeout_ms=timeout_ms,
480
+ )
481
+
482
+ if retries == UNSET:
483
+ if self.sdk_configuration.retry_config is not UNSET:
484
+ retries = self.sdk_configuration.retry_config
485
+
486
+ retry_config = None
487
+ if isinstance(retries, utils.RetryConfig):
488
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
489
+
490
+ http_res = self.do_request(
491
+ hook_ctx=HookContext(
492
+ operation_id="get_taxonomy_v1_entities_taxonomies__taxonomy__get",
493
+ oauth2_scopes=[],
494
+ security_source=get_security_from_env(
495
+ self.sdk_configuration.security, models.Security
496
+ ),
497
+ ),
498
+ request=req,
499
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
500
+ retry_config=retry_config,
501
+ )
502
+
503
+ data: Any = None
504
+ if utils.match_response(http_res, "200", "application/json"):
505
+ return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
506
+ if utils.match_response(
507
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
508
+ ):
509
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
510
+ raise models.ErrorResponse(data=data)
511
+ if utils.match_response(http_res, "422", "application/json"):
512
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
513
+ raise models.HTTPValidationError(data=data)
514
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
515
+ http_res_text = utils.stream_to_text(http_res)
516
+ raise models.APIError(
517
+ "API error occurred", http_res.status_code, http_res_text, http_res
518
+ )
519
+
520
+ content_type = http_res.headers.get("Content-Type")
521
+ http_res_text = utils.stream_to_text(http_res)
522
+ raise models.APIError(
523
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
524
+ http_res.status_code,
525
+ http_res_text,
526
+ http_res,
527
+ )
528
+
529
+ async def get_taxonomy_v1_entities_taxonomies_taxonomy_get_async(
530
+ self,
531
+ *,
532
+ taxonomy: str,
533
+ x_namespace: OptionalNullable[str] = UNSET,
534
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
535
+ server_url: Optional[str] = None,
536
+ timeout_ms: Optional[int] = None,
537
+ http_headers: Optional[Mapping[str, str]] = None,
538
+ ) -> models.TaxonomyModel:
539
+ r"""Get Taxonomy
540
+
541
+ Get the complete taxonomy that contains the specified node
542
+
543
+ :param taxonomy: The name or id of the taxonomy to find
544
+ :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.
545
+ :param retries: Override the default retry configuration for this method
546
+ :param server_url: Override the default server URL for this method
547
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
548
+ :param http_headers: Additional headers to set or replace on requests.
549
+ """
550
+ base_url = None
551
+ url_variables = None
552
+ if timeout_ms is None:
553
+ timeout_ms = self.sdk_configuration.timeout_ms
554
+
555
+ if server_url is not None:
556
+ base_url = server_url
557
+
558
+ request = models.GetTaxonomyV1EntitiesTaxonomiesTaxonomyGetRequest(
559
+ taxonomy=taxonomy,
560
+ x_namespace=x_namespace,
561
+ )
562
+
563
+ req = self._build_request_async(
564
+ method="GET",
565
+ path="/v1/entities/taxonomies/{taxonomy}",
566
+ base_url=base_url,
567
+ url_variables=url_variables,
568
+ request=request,
569
+ request_body_required=False,
570
+ request_has_path_params=True,
571
+ request_has_query_params=True,
572
+ user_agent_header="user-agent",
573
+ accept_header_value="application/json",
574
+ http_headers=http_headers,
575
+ security=self.sdk_configuration.security,
576
+ timeout_ms=timeout_ms,
577
+ )
578
+
579
+ if retries == UNSET:
580
+ if self.sdk_configuration.retry_config is not UNSET:
581
+ retries = self.sdk_configuration.retry_config
582
+
583
+ retry_config = None
584
+ if isinstance(retries, utils.RetryConfig):
585
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
586
+
587
+ http_res = await self.do_request_async(
588
+ hook_ctx=HookContext(
589
+ operation_id="get_taxonomy_v1_entities_taxonomies__taxonomy__get",
590
+ oauth2_scopes=[],
591
+ security_source=get_security_from_env(
592
+ self.sdk_configuration.security, models.Security
593
+ ),
594
+ ),
595
+ request=req,
596
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
597
+ retry_config=retry_config,
598
+ )
599
+
600
+ data: Any = None
601
+ if utils.match_response(http_res, "200", "application/json"):
602
+ return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
603
+ if utils.match_response(
604
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
605
+ ):
606
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
607
+ raise models.ErrorResponse(data=data)
608
+ if utils.match_response(http_res, "422", "application/json"):
609
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
610
+ raise models.HTTPValidationError(data=data)
611
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
612
+ http_res_text = await utils.stream_to_text_async(http_res)
613
+ raise models.APIError(
614
+ "API error occurred", http_res.status_code, http_res_text, http_res
615
+ )
616
+
617
+ content_type = http_res.headers.get("Content-Type")
618
+ http_res_text = await utils.stream_to_text_async(http_res)
619
+ raise models.APIError(
620
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
621
+ http_res.status_code,
622
+ http_res_text,
623
+ http_res,
624
+ )
625
+
626
+ def delete_taxonomy_v1_entities_taxonomies_taxonomy_delete(
627
+ self,
628
+ *,
629
+ taxonomy: str,
630
+ x_namespace: OptionalNullable[str] = UNSET,
631
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
632
+ server_url: Optional[str] = None,
633
+ timeout_ms: Optional[int] = None,
634
+ http_headers: Optional[Mapping[str, str]] = None,
635
+ ) -> models.GenericSuccessResponse:
636
+ r"""Delete Taxonomy
637
+
638
+ Delete an existing taxonomy and remove all associated node classifications from features.
639
+
640
+ This operation:
641
+ - Deletes the taxonomy and all its nodes
642
+ - Removes any node classifications associated with this taxonomy from all features
643
+ - This action cannot be undone
644
+
645
+
646
+ **Requirements:**
647
+ - Required permissions: write
648
+
649
+ :param taxonomy: The ID or name of the taxonomy to delete
650
+ :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.
651
+ :param retries: Override the default retry configuration for this method
652
+ :param server_url: Override the default server URL for this method
653
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
654
+ :param http_headers: Additional headers to set or replace on requests.
655
+ """
656
+ base_url = None
657
+ url_variables = None
658
+ if timeout_ms is None:
659
+ timeout_ms = self.sdk_configuration.timeout_ms
660
+
661
+ if server_url is not None:
662
+ base_url = server_url
663
+
664
+ request = models.DeleteTaxonomyV1EntitiesTaxonomiesTaxonomyDeleteRequest(
665
+ taxonomy=taxonomy,
666
+ x_namespace=x_namespace,
667
+ )
668
+
669
+ req = self._build_request(
670
+ method="DELETE",
671
+ path="/v1/entities/taxonomies/{taxonomy}",
672
+ base_url=base_url,
673
+ url_variables=url_variables,
674
+ request=request,
675
+ request_body_required=False,
676
+ request_has_path_params=True,
677
+ request_has_query_params=True,
678
+ user_agent_header="user-agent",
679
+ accept_header_value="application/json",
680
+ http_headers=http_headers,
681
+ security=self.sdk_configuration.security,
682
+ timeout_ms=timeout_ms,
683
+ )
684
+
685
+ if retries == UNSET:
686
+ if self.sdk_configuration.retry_config is not UNSET:
687
+ retries = self.sdk_configuration.retry_config
688
+
689
+ retry_config = None
690
+ if isinstance(retries, utils.RetryConfig):
691
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
692
+
693
+ http_res = self.do_request(
694
+ hook_ctx=HookContext(
695
+ operation_id="delete_taxonomy_v1_entities_taxonomies__taxonomy__delete",
696
+ oauth2_scopes=[],
697
+ security_source=get_security_from_env(
698
+ self.sdk_configuration.security, models.Security
699
+ ),
700
+ ),
701
+ request=req,
702
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
703
+ retry_config=retry_config,
704
+ )
705
+
706
+ data: Any = None
707
+ if utils.match_response(http_res, "200", "application/json"):
708
+ return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
709
+ if utils.match_response(
710
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
711
+ ):
712
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
713
+ raise models.ErrorResponse(data=data)
714
+ if utils.match_response(http_res, "422", "application/json"):
715
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
716
+ raise models.HTTPValidationError(data=data)
717
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
718
+ http_res_text = utils.stream_to_text(http_res)
719
+ raise models.APIError(
720
+ "API error occurred", http_res.status_code, http_res_text, http_res
721
+ )
722
+
723
+ content_type = http_res.headers.get("Content-Type")
724
+ http_res_text = utils.stream_to_text(http_res)
725
+ raise models.APIError(
726
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
727
+ http_res.status_code,
728
+ http_res_text,
729
+ http_res,
730
+ )
731
+
732
+ async def delete_taxonomy_v1_entities_taxonomies_taxonomy_delete_async(
733
+ self,
734
+ *,
735
+ taxonomy: str,
736
+ x_namespace: OptionalNullable[str] = UNSET,
737
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
738
+ server_url: Optional[str] = None,
739
+ timeout_ms: Optional[int] = None,
740
+ http_headers: Optional[Mapping[str, str]] = None,
741
+ ) -> models.GenericSuccessResponse:
742
+ r"""Delete Taxonomy
743
+
744
+ Delete an existing taxonomy and remove all associated node classifications from features.
745
+
746
+ This operation:
747
+ - Deletes the taxonomy and all its nodes
748
+ - Removes any node classifications associated with this taxonomy from all features
749
+ - This action cannot be undone
750
+
751
+
752
+ **Requirements:**
753
+ - Required permissions: write
754
+
755
+ :param taxonomy: The ID or name of the taxonomy to delete
756
+ :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.
757
+ :param retries: Override the default retry configuration for this method
758
+ :param server_url: Override the default server URL for this method
759
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
760
+ :param http_headers: Additional headers to set or replace on requests.
761
+ """
762
+ base_url = None
763
+ url_variables = None
764
+ if timeout_ms is None:
765
+ timeout_ms = self.sdk_configuration.timeout_ms
766
+
767
+ if server_url is not None:
768
+ base_url = server_url
769
+
770
+ request = models.DeleteTaxonomyV1EntitiesTaxonomiesTaxonomyDeleteRequest(
771
+ taxonomy=taxonomy,
772
+ x_namespace=x_namespace,
773
+ )
774
+
775
+ req = self._build_request_async(
776
+ method="DELETE",
777
+ path="/v1/entities/taxonomies/{taxonomy}",
778
+ base_url=base_url,
779
+ url_variables=url_variables,
780
+ request=request,
781
+ request_body_required=False,
782
+ request_has_path_params=True,
783
+ request_has_query_params=True,
784
+ user_agent_header="user-agent",
785
+ accept_header_value="application/json",
786
+ http_headers=http_headers,
787
+ security=self.sdk_configuration.security,
788
+ timeout_ms=timeout_ms,
789
+ )
790
+
791
+ if retries == UNSET:
792
+ if self.sdk_configuration.retry_config is not UNSET:
793
+ retries = self.sdk_configuration.retry_config
794
+
795
+ retry_config = None
796
+ if isinstance(retries, utils.RetryConfig):
797
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
798
+
799
+ http_res = await self.do_request_async(
800
+ hook_ctx=HookContext(
801
+ operation_id="delete_taxonomy_v1_entities_taxonomies__taxonomy__delete",
802
+ oauth2_scopes=[],
803
+ security_source=get_security_from_env(
804
+ self.sdk_configuration.security, models.Security
805
+ ),
806
+ ),
807
+ request=req,
808
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
809
+ retry_config=retry_config,
810
+ )
811
+
812
+ data: Any = None
813
+ if utils.match_response(http_res, "200", "application/json"):
814
+ return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
815
+ if utils.match_response(
816
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
817
+ ):
818
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
819
+ raise models.ErrorResponse(data=data)
820
+ if utils.match_response(http_res, "422", "application/json"):
821
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
822
+ raise models.HTTPValidationError(data=data)
823
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
824
+ http_res_text = await utils.stream_to_text_async(http_res)
825
+ raise models.APIError(
826
+ "API error occurred", http_res.status_code, http_res_text, http_res
827
+ )
828
+
829
+ content_type = http_res.headers.get("Content-Type")
830
+ http_res_text = await utils.stream_to_text_async(http_res)
831
+ raise models.APIError(
832
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
833
+ http_res.status_code,
834
+ http_res_text,
835
+ http_res,
836
+ )
837
+
838
+ def update_taxonomy_v1_entities_taxonomies_taxonomy_patch(
839
+ self,
840
+ *,
841
+ taxonomy: str,
842
+ x_namespace: OptionalNullable[str] = UNSET,
843
+ taxonomy_name: OptionalNullable[str] = UNSET,
844
+ description: OptionalNullable[str] = UNSET,
845
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
846
+ server_url: Optional[str] = None,
847
+ timeout_ms: Optional[int] = None,
848
+ http_headers: Optional[Mapping[str, str]] = None,
849
+ ) -> models.TaxonomyModel:
850
+ r"""Update Taxonomy
851
+
852
+ Update an existing taxonomy's metadata
853
+
854
+ **Requirements:**
855
+ - Required permissions: write
856
+
857
+ :param taxonomy: The ID or name of the taxonomy to update
858
+ :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.
859
+ :param taxonomy_name: Updated taxonomy name (must not contain spaces or special characters)
860
+ :param description: Updated taxonomy description
861
+ :param retries: Override the default retry configuration for this method
862
+ :param server_url: Override the default server URL for this method
863
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
864
+ :param http_headers: Additional headers to set or replace on requests.
865
+ """
866
+ base_url = None
867
+ url_variables = None
868
+ if timeout_ms is None:
869
+ timeout_ms = self.sdk_configuration.timeout_ms
870
+
871
+ if server_url is not None:
872
+ base_url = server_url
873
+
874
+ request = models.UpdateTaxonomyV1EntitiesTaxonomiesTaxonomyPatchRequest(
875
+ taxonomy=taxonomy,
876
+ x_namespace=x_namespace,
877
+ taxonomy_update=models.TaxonomyUpdate(
878
+ taxonomy_name=taxonomy_name,
879
+ description=description,
880
+ ),
881
+ )
882
+
883
+ req = self._build_request(
884
+ method="PATCH",
885
+ path="/v1/entities/taxonomies/{taxonomy}",
886
+ base_url=base_url,
887
+ url_variables=url_variables,
888
+ request=request,
889
+ request_body_required=True,
890
+ request_has_path_params=True,
891
+ request_has_query_params=True,
892
+ user_agent_header="user-agent",
893
+ accept_header_value="application/json",
894
+ http_headers=http_headers,
895
+ security=self.sdk_configuration.security,
896
+ get_serialized_body=lambda: utils.serialize_request_body(
897
+ request.taxonomy_update, False, False, "json", models.TaxonomyUpdate
898
+ ),
899
+ timeout_ms=timeout_ms,
900
+ )
901
+
902
+ if retries == UNSET:
903
+ if self.sdk_configuration.retry_config is not UNSET:
904
+ retries = self.sdk_configuration.retry_config
905
+
906
+ retry_config = None
907
+ if isinstance(retries, utils.RetryConfig):
908
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
909
+
910
+ http_res = self.do_request(
911
+ hook_ctx=HookContext(
912
+ operation_id="update_taxonomy_v1_entities_taxonomies__taxonomy__patch",
913
+ oauth2_scopes=[],
914
+ security_source=get_security_from_env(
915
+ self.sdk_configuration.security, models.Security
916
+ ),
917
+ ),
918
+ request=req,
919
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
920
+ retry_config=retry_config,
921
+ )
922
+
923
+ data: Any = None
924
+ if utils.match_response(http_res, "200", "application/json"):
925
+ return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
926
+ if utils.match_response(
927
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
928
+ ):
929
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
930
+ raise models.ErrorResponse(data=data)
931
+ if utils.match_response(http_res, "422", "application/json"):
932
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
933
+ raise models.HTTPValidationError(data=data)
934
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
935
+ http_res_text = utils.stream_to_text(http_res)
936
+ raise models.APIError(
937
+ "API error occurred", http_res.status_code, http_res_text, http_res
938
+ )
939
+
940
+ content_type = http_res.headers.get("Content-Type")
941
+ http_res_text = utils.stream_to_text(http_res)
942
+ raise models.APIError(
943
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
944
+ http_res.status_code,
945
+ http_res_text,
946
+ http_res,
947
+ )
948
+
949
+ async def update_taxonomy_v1_entities_taxonomies_taxonomy_patch_async(
950
+ self,
951
+ *,
952
+ taxonomy: str,
953
+ x_namespace: OptionalNullable[str] = UNSET,
954
+ taxonomy_name: OptionalNullable[str] = UNSET,
955
+ description: OptionalNullable[str] = UNSET,
956
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
957
+ server_url: Optional[str] = None,
958
+ timeout_ms: Optional[int] = None,
959
+ http_headers: Optional[Mapping[str, str]] = None,
960
+ ) -> models.TaxonomyModel:
961
+ r"""Update Taxonomy
962
+
963
+ Update an existing taxonomy's metadata
964
+
965
+ **Requirements:**
966
+ - Required permissions: write
967
+
968
+ :param taxonomy: The ID or name of the taxonomy to update
969
+ :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.
970
+ :param taxonomy_name: Updated taxonomy name (must not contain spaces or special characters)
971
+ :param description: Updated taxonomy description
972
+ :param retries: Override the default retry configuration for this method
973
+ :param server_url: Override the default server URL for this method
974
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
975
+ :param http_headers: Additional headers to set or replace on requests.
976
+ """
977
+ base_url = None
978
+ url_variables = None
979
+ if timeout_ms is None:
980
+ timeout_ms = self.sdk_configuration.timeout_ms
981
+
982
+ if server_url is not None:
983
+ base_url = server_url
984
+
985
+ request = models.UpdateTaxonomyV1EntitiesTaxonomiesTaxonomyPatchRequest(
986
+ taxonomy=taxonomy,
987
+ x_namespace=x_namespace,
988
+ taxonomy_update=models.TaxonomyUpdate(
989
+ taxonomy_name=taxonomy_name,
990
+ description=description,
991
+ ),
992
+ )
993
+
994
+ req = self._build_request_async(
995
+ method="PATCH",
996
+ path="/v1/entities/taxonomies/{taxonomy}",
997
+ base_url=base_url,
998
+ url_variables=url_variables,
999
+ request=request,
1000
+ request_body_required=True,
1001
+ request_has_path_params=True,
1002
+ request_has_query_params=True,
1003
+ user_agent_header="user-agent",
1004
+ accept_header_value="application/json",
1005
+ http_headers=http_headers,
1006
+ security=self.sdk_configuration.security,
1007
+ get_serialized_body=lambda: utils.serialize_request_body(
1008
+ request.taxonomy_update, False, False, "json", models.TaxonomyUpdate
1009
+ ),
1010
+ timeout_ms=timeout_ms,
1011
+ )
1012
+
1013
+ if retries == UNSET:
1014
+ if self.sdk_configuration.retry_config is not UNSET:
1015
+ retries = self.sdk_configuration.retry_config
1016
+
1017
+ retry_config = None
1018
+ if isinstance(retries, utils.RetryConfig):
1019
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1020
+
1021
+ http_res = await self.do_request_async(
1022
+ hook_ctx=HookContext(
1023
+ operation_id="update_taxonomy_v1_entities_taxonomies__taxonomy__patch",
1024
+ oauth2_scopes=[],
1025
+ security_source=get_security_from_env(
1026
+ self.sdk_configuration.security, models.Security
1027
+ ),
1028
+ ),
1029
+ request=req,
1030
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1031
+ retry_config=retry_config,
1032
+ )
1033
+
1034
+ data: Any = None
1035
+ if utils.match_response(http_res, "200", "application/json"):
1036
+ return utils.unmarshal_json(http_res.text, models.TaxonomyModel)
1037
+ if utils.match_response(
1038
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1039
+ ):
1040
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1041
+ raise models.ErrorResponse(data=data)
1042
+ if utils.match_response(http_res, "422", "application/json"):
1043
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1044
+ raise models.HTTPValidationError(data=data)
1045
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1046
+ http_res_text = await utils.stream_to_text_async(http_res)
1047
+ raise models.APIError(
1048
+ "API error occurred", http_res.status_code, http_res_text, http_res
1049
+ )
1050
+
1051
+ content_type = http_res.headers.get("Content-Type")
1052
+ http_res_text = await utils.stream_to_text_async(http_res)
1053
+ raise models.APIError(
1054
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1055
+ http_res.status_code,
1056
+ http_res_text,
1057
+ http_res,
1058
+ )
1059
+
1060
+ def get_taxonomy_node_v1_entities_taxonomies_nodes_node_get(
1061
+ self,
1062
+ *,
1063
+ node: str,
1064
+ x_namespace: OptionalNullable[str] = UNSET,
1065
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1066
+ server_url: Optional[str] = None,
1067
+ timeout_ms: Optional[int] = None,
1068
+ http_headers: Optional[Mapping[str, str]] = None,
1069
+ ) -> models.TaxonomyNode:
1070
+ r"""Get Taxonomy Node
1071
+
1072
+ Get the complete taxonomy that contains the specified node
1073
+
1074
+ :param node: The ID or name of the node to find the taxonomy for
1075
+ :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.
1076
+ :param retries: Override the default retry configuration for this method
1077
+ :param server_url: Override the default server URL for this method
1078
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1079
+ :param http_headers: Additional headers to set or replace on requests.
1080
+ """
1081
+ base_url = None
1082
+ url_variables = None
1083
+ if timeout_ms is None:
1084
+ timeout_ms = self.sdk_configuration.timeout_ms
1085
+
1086
+ if server_url is not None:
1087
+ base_url = server_url
1088
+
1089
+ request = models.GetTaxonomyNodeV1EntitiesTaxonomiesNodesNodeGetRequest(
1090
+ node=node,
1091
+ x_namespace=x_namespace,
1092
+ )
1093
+
1094
+ req = self._build_request(
1095
+ method="GET",
1096
+ path="/v1/entities/taxonomies/nodes/{node}",
1097
+ base_url=base_url,
1098
+ url_variables=url_variables,
1099
+ request=request,
1100
+ request_body_required=False,
1101
+ request_has_path_params=True,
1102
+ request_has_query_params=True,
1103
+ user_agent_header="user-agent",
1104
+ accept_header_value="application/json",
1105
+ http_headers=http_headers,
1106
+ security=self.sdk_configuration.security,
1107
+ timeout_ms=timeout_ms,
1108
+ )
1109
+
1110
+ if retries == UNSET:
1111
+ if self.sdk_configuration.retry_config is not UNSET:
1112
+ retries = self.sdk_configuration.retry_config
1113
+
1114
+ retry_config = None
1115
+ if isinstance(retries, utils.RetryConfig):
1116
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1117
+
1118
+ http_res = self.do_request(
1119
+ hook_ctx=HookContext(
1120
+ operation_id="get_taxonomy_node_v1_entities_taxonomies_nodes__node__get",
1121
+ oauth2_scopes=[],
1122
+ security_source=get_security_from_env(
1123
+ self.sdk_configuration.security, models.Security
1124
+ ),
1125
+ ),
1126
+ request=req,
1127
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1128
+ retry_config=retry_config,
1129
+ )
1130
+
1131
+ data: Any = None
1132
+ if utils.match_response(http_res, "200", "application/json"):
1133
+ return utils.unmarshal_json(http_res.text, models.TaxonomyNode)
1134
+ if utils.match_response(
1135
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1136
+ ):
1137
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1138
+ raise models.ErrorResponse(data=data)
1139
+ if utils.match_response(http_res, "422", "application/json"):
1140
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1141
+ raise models.HTTPValidationError(data=data)
1142
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1143
+ http_res_text = utils.stream_to_text(http_res)
1144
+ raise models.APIError(
1145
+ "API error occurred", http_res.status_code, http_res_text, http_res
1146
+ )
1147
+
1148
+ content_type = http_res.headers.get("Content-Type")
1149
+ http_res_text = utils.stream_to_text(http_res)
1150
+ raise models.APIError(
1151
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1152
+ http_res.status_code,
1153
+ http_res_text,
1154
+ http_res,
1155
+ )
1156
+
1157
+ async def get_taxonomy_node_v1_entities_taxonomies_nodes_node_get_async(
1158
+ self,
1159
+ *,
1160
+ node: str,
1161
+ x_namespace: OptionalNullable[str] = UNSET,
1162
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1163
+ server_url: Optional[str] = None,
1164
+ timeout_ms: Optional[int] = None,
1165
+ http_headers: Optional[Mapping[str, str]] = None,
1166
+ ) -> models.TaxonomyNode:
1167
+ r"""Get Taxonomy Node
1168
+
1169
+ Get the complete taxonomy that contains the specified node
1170
+
1171
+ :param node: The ID or name of the node to find the taxonomy for
1172
+ :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.
1173
+ :param retries: Override the default retry configuration for this method
1174
+ :param server_url: Override the default server URL for this method
1175
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1176
+ :param http_headers: Additional headers to set or replace on requests.
1177
+ """
1178
+ base_url = None
1179
+ url_variables = None
1180
+ if timeout_ms is None:
1181
+ timeout_ms = self.sdk_configuration.timeout_ms
1182
+
1183
+ if server_url is not None:
1184
+ base_url = server_url
1185
+
1186
+ request = models.GetTaxonomyNodeV1EntitiesTaxonomiesNodesNodeGetRequest(
1187
+ node=node,
1188
+ x_namespace=x_namespace,
1189
+ )
1190
+
1191
+ req = self._build_request_async(
1192
+ method="GET",
1193
+ path="/v1/entities/taxonomies/nodes/{node}",
1194
+ base_url=base_url,
1195
+ url_variables=url_variables,
1196
+ request=request,
1197
+ request_body_required=False,
1198
+ request_has_path_params=True,
1199
+ request_has_query_params=True,
1200
+ user_agent_header="user-agent",
1201
+ accept_header_value="application/json",
1202
+ http_headers=http_headers,
1203
+ security=self.sdk_configuration.security,
1204
+ timeout_ms=timeout_ms,
1205
+ )
1206
+
1207
+ if retries == UNSET:
1208
+ if self.sdk_configuration.retry_config is not UNSET:
1209
+ retries = self.sdk_configuration.retry_config
1210
+
1211
+ retry_config = None
1212
+ if isinstance(retries, utils.RetryConfig):
1213
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1214
+
1215
+ http_res = await self.do_request_async(
1216
+ hook_ctx=HookContext(
1217
+ operation_id="get_taxonomy_node_v1_entities_taxonomies_nodes__node__get",
1218
+ oauth2_scopes=[],
1219
+ security_source=get_security_from_env(
1220
+ self.sdk_configuration.security, models.Security
1221
+ ),
1222
+ ),
1223
+ request=req,
1224
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1225
+ retry_config=retry_config,
1226
+ )
1227
+
1228
+ data: Any = None
1229
+ if utils.match_response(http_res, "200", "application/json"):
1230
+ return utils.unmarshal_json(http_res.text, models.TaxonomyNode)
1231
+ if utils.match_response(
1232
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1233
+ ):
1234
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1235
+ raise models.ErrorResponse(data=data)
1236
+ if utils.match_response(http_res, "422", "application/json"):
1237
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1238
+ raise models.HTTPValidationError(data=data)
1239
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1240
+ http_res_text = await utils.stream_to_text_async(http_res)
1241
+ raise models.APIError(
1242
+ "API error occurred", http_res.status_code, http_res_text, http_res
1243
+ )
1244
+
1245
+ content_type = http_res.headers.get("Content-Type")
1246
+ http_res_text = await utils.stream_to_text_async(http_res)
1247
+ raise models.APIError(
1248
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1249
+ http_res.status_code,
1250
+ http_res_text,
1251
+ http_res,
1252
+ )
1253
+
1254
+ def update_node_v1_entities_taxonomies_nodes_node_patch(
1255
+ self,
1256
+ *,
1257
+ node: str,
1258
+ node_name: str,
1259
+ x_namespace: OptionalNullable[str] = UNSET,
1260
+ node_description: OptionalNullable[str] = UNSET,
1261
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1262
+ server_url: Optional[str] = None,
1263
+ timeout_ms: Optional[int] = None,
1264
+ http_headers: Optional[Mapping[str, str]] = None,
1265
+ ) -> models.TaxonomyNode:
1266
+ r"""Update Node
1267
+
1268
+ Update an existing taxonomy node
1269
+
1270
+ **Requirements:**
1271
+ - Required permissions: write
1272
+
1273
+ :param node: The ID or name of the node to update
1274
+ :param node_name: Name of the taxonomy node (must be lowercase without spaces)
1275
+ :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.
1276
+ :param node_description: Optional description of what this node represents
1277
+ :param retries: Override the default retry configuration for this method
1278
+ :param server_url: Override the default server URL for this method
1279
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1280
+ :param http_headers: Additional headers to set or replace on requests.
1281
+ """
1282
+ base_url = None
1283
+ url_variables = None
1284
+ if timeout_ms is None:
1285
+ timeout_ms = self.sdk_configuration.timeout_ms
1286
+
1287
+ if server_url is not None:
1288
+ base_url = server_url
1289
+
1290
+ request = models.UpdateNodeV1EntitiesTaxonomiesNodesNodePatchRequest(
1291
+ node=node,
1292
+ x_namespace=x_namespace,
1293
+ node_update=models.NodeUpdate(
1294
+ node_name=node_name,
1295
+ node_description=node_description,
1296
+ ),
1297
+ )
1298
+
1299
+ req = self._build_request(
1300
+ method="PATCH",
1301
+ path="/v1/entities/taxonomies/nodes/{node}",
1302
+ base_url=base_url,
1303
+ url_variables=url_variables,
1304
+ request=request,
1305
+ request_body_required=True,
1306
+ request_has_path_params=True,
1307
+ request_has_query_params=True,
1308
+ user_agent_header="user-agent",
1309
+ accept_header_value="application/json",
1310
+ http_headers=http_headers,
1311
+ security=self.sdk_configuration.security,
1312
+ get_serialized_body=lambda: utils.serialize_request_body(
1313
+ request.node_update, False, False, "json", models.NodeUpdate
1314
+ ),
1315
+ timeout_ms=timeout_ms,
1316
+ )
1317
+
1318
+ if retries == UNSET:
1319
+ if self.sdk_configuration.retry_config is not UNSET:
1320
+ retries = self.sdk_configuration.retry_config
1321
+
1322
+ retry_config = None
1323
+ if isinstance(retries, utils.RetryConfig):
1324
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1325
+
1326
+ http_res = self.do_request(
1327
+ hook_ctx=HookContext(
1328
+ operation_id="update_node_v1_entities_taxonomies_nodes__node__patch",
1329
+ oauth2_scopes=[],
1330
+ security_source=get_security_from_env(
1331
+ self.sdk_configuration.security, models.Security
1332
+ ),
1333
+ ),
1334
+ request=req,
1335
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1336
+ retry_config=retry_config,
1337
+ )
1338
+
1339
+ data: Any = None
1340
+ if utils.match_response(http_res, "200", "application/json"):
1341
+ return utils.unmarshal_json(http_res.text, models.TaxonomyNode)
1342
+ if utils.match_response(
1343
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1344
+ ):
1345
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1346
+ raise models.ErrorResponse(data=data)
1347
+ if utils.match_response(http_res, "422", "application/json"):
1348
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1349
+ raise models.HTTPValidationError(data=data)
1350
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1351
+ http_res_text = utils.stream_to_text(http_res)
1352
+ raise models.APIError(
1353
+ "API error occurred", http_res.status_code, http_res_text, http_res
1354
+ )
1355
+
1356
+ content_type = http_res.headers.get("Content-Type")
1357
+ http_res_text = utils.stream_to_text(http_res)
1358
+ raise models.APIError(
1359
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1360
+ http_res.status_code,
1361
+ http_res_text,
1362
+ http_res,
1363
+ )
1364
+
1365
+ async def update_node_v1_entities_taxonomies_nodes_node_patch_async(
1366
+ self,
1367
+ *,
1368
+ node: str,
1369
+ node_name: str,
1370
+ x_namespace: OptionalNullable[str] = UNSET,
1371
+ node_description: OptionalNullable[str] = UNSET,
1372
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1373
+ server_url: Optional[str] = None,
1374
+ timeout_ms: Optional[int] = None,
1375
+ http_headers: Optional[Mapping[str, str]] = None,
1376
+ ) -> models.TaxonomyNode:
1377
+ r"""Update Node
1378
+
1379
+ Update an existing taxonomy node
1380
+
1381
+ **Requirements:**
1382
+ - Required permissions: write
1383
+
1384
+ :param node: The ID or name of the node to update
1385
+ :param node_name: Name of the taxonomy node (must be lowercase without spaces)
1386
+ :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.
1387
+ :param node_description: Optional description of what this node represents
1388
+ :param retries: Override the default retry configuration for this method
1389
+ :param server_url: Override the default server URL for this method
1390
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1391
+ :param http_headers: Additional headers to set or replace on requests.
1392
+ """
1393
+ base_url = None
1394
+ url_variables = None
1395
+ if timeout_ms is None:
1396
+ timeout_ms = self.sdk_configuration.timeout_ms
1397
+
1398
+ if server_url is not None:
1399
+ base_url = server_url
1400
+
1401
+ request = models.UpdateNodeV1EntitiesTaxonomiesNodesNodePatchRequest(
1402
+ node=node,
1403
+ x_namespace=x_namespace,
1404
+ node_update=models.NodeUpdate(
1405
+ node_name=node_name,
1406
+ node_description=node_description,
1407
+ ),
1408
+ )
1409
+
1410
+ req = self._build_request_async(
1411
+ method="PATCH",
1412
+ path="/v1/entities/taxonomies/nodes/{node}",
1413
+ base_url=base_url,
1414
+ url_variables=url_variables,
1415
+ request=request,
1416
+ request_body_required=True,
1417
+ request_has_path_params=True,
1418
+ request_has_query_params=True,
1419
+ user_agent_header="user-agent",
1420
+ accept_header_value="application/json",
1421
+ http_headers=http_headers,
1422
+ security=self.sdk_configuration.security,
1423
+ get_serialized_body=lambda: utils.serialize_request_body(
1424
+ request.node_update, False, False, "json", models.NodeUpdate
1425
+ ),
1426
+ timeout_ms=timeout_ms,
1427
+ )
1428
+
1429
+ if retries == UNSET:
1430
+ if self.sdk_configuration.retry_config is not UNSET:
1431
+ retries = self.sdk_configuration.retry_config
1432
+
1433
+ retry_config = None
1434
+ if isinstance(retries, utils.RetryConfig):
1435
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1436
+
1437
+ http_res = await self.do_request_async(
1438
+ hook_ctx=HookContext(
1439
+ operation_id="update_node_v1_entities_taxonomies_nodes__node__patch",
1440
+ oauth2_scopes=[],
1441
+ security_source=get_security_from_env(
1442
+ self.sdk_configuration.security, models.Security
1443
+ ),
1444
+ ),
1445
+ request=req,
1446
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1447
+ retry_config=retry_config,
1448
+ )
1449
+
1450
+ data: Any = None
1451
+ if utils.match_response(http_res, "200", "application/json"):
1452
+ return utils.unmarshal_json(http_res.text, models.TaxonomyNode)
1453
+ if utils.match_response(
1454
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1455
+ ):
1456
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1457
+ raise models.ErrorResponse(data=data)
1458
+ if utils.match_response(http_res, "422", "application/json"):
1459
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1460
+ raise models.HTTPValidationError(data=data)
1461
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1462
+ http_res_text = await utils.stream_to_text_async(http_res)
1463
+ raise models.APIError(
1464
+ "API error occurred", http_res.status_code, http_res_text, http_res
1465
+ )
1466
+
1467
+ content_type = http_res.headers.get("Content-Type")
1468
+ http_res_text = await utils.stream_to_text_async(http_res)
1469
+ raise models.APIError(
1470
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1471
+ http_res.status_code,
1472
+ http_res_text,
1473
+ http_res,
1474
+ )
1475
+
1476
+ def classify_features_v1_entities_taxonomies_taxonomy_classify_post(
1477
+ self,
1478
+ *,
1479
+ taxonomy: str,
1480
+ collections: List[str],
1481
+ x_namespace: OptionalNullable[str] = UNSET,
1482
+ filters: OptionalNullable[
1483
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
1484
+ ] = UNSET,
1485
+ confidence_threshold: Optional[float] = 0.8,
1486
+ assignment: Optional[
1487
+ Union[models.AssignmentConfig, models.AssignmentConfigTypedDict]
1488
+ ] = None,
1489
+ sample_size: OptionalNullable[int] = UNSET,
1490
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1491
+ server_url: Optional[str] = None,
1492
+ timeout_ms: Optional[int] = None,
1493
+ http_headers: Optional[Mapping[str, str]] = None,
1494
+ ) -> models.TaskResponse:
1495
+ r"""Classify Features against Taxonomy
1496
+
1497
+ Starts an asynchronous task to classify features within collections for a given taxonomy.
1498
+
1499
+ :param taxonomy: The name or id of the taxonomy to use for discovery
1500
+ :param collections: List of collection names or ids to search for features
1501
+ :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.
1502
+ :param filters: Filters to apply to the discovery task
1503
+ :param confidence_threshold: Minimum confidence score required for classification
1504
+ :param assignment: Configuration for how classifications should be assigned to features
1505
+ :param sample_size: Number of feature samples to process
1506
+ :param retries: Override the default retry configuration for this method
1507
+ :param server_url: Override the default server URL for this method
1508
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1509
+ :param http_headers: Additional headers to set or replace on requests.
1510
+ """
1511
+ base_url = None
1512
+ url_variables = None
1513
+ if timeout_ms is None:
1514
+ timeout_ms = self.sdk_configuration.timeout_ms
1515
+
1516
+ if server_url is not None:
1517
+ base_url = server_url
1518
+
1519
+ request = (
1520
+ models.ClassifyFeaturesV1EntitiesTaxonomiesTaxonomyClassifyPostRequest(
1521
+ taxonomy=taxonomy,
1522
+ x_namespace=x_namespace,
1523
+ discover_request=models.DiscoverRequest(
1524
+ collections=collections,
1525
+ filters=utils.get_pydantic_model(
1526
+ filters, OptionalNullable[models.LogicalOperator]
1527
+ ),
1528
+ confidence_threshold=confidence_threshold,
1529
+ assignment=utils.get_pydantic_model(
1530
+ assignment, Optional[models.AssignmentConfig]
1531
+ ),
1532
+ sample_size=sample_size,
1533
+ ),
1534
+ )
1535
+ )
1536
+
1537
+ req = self._build_request(
1538
+ method="POST",
1539
+ path="/v1/entities/taxonomies/{taxonomy}/classify",
1540
+ base_url=base_url,
1541
+ url_variables=url_variables,
1542
+ request=request,
1543
+ request_body_required=True,
1544
+ request_has_path_params=True,
1545
+ request_has_query_params=True,
1546
+ user_agent_header="user-agent",
1547
+ accept_header_value="application/json",
1548
+ http_headers=http_headers,
1549
+ security=self.sdk_configuration.security,
1550
+ get_serialized_body=lambda: utils.serialize_request_body(
1551
+ request.discover_request, False, False, "json", models.DiscoverRequest
1552
+ ),
1553
+ timeout_ms=timeout_ms,
1554
+ )
1555
+
1556
+ if retries == UNSET:
1557
+ if self.sdk_configuration.retry_config is not UNSET:
1558
+ retries = self.sdk_configuration.retry_config
1559
+
1560
+ retry_config = None
1561
+ if isinstance(retries, utils.RetryConfig):
1562
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1563
+
1564
+ http_res = self.do_request(
1565
+ hook_ctx=HookContext(
1566
+ operation_id="classify_features_v1_entities_taxonomies__taxonomy__classify_post",
1567
+ oauth2_scopes=[],
1568
+ security_source=get_security_from_env(
1569
+ self.sdk_configuration.security, models.Security
1570
+ ),
1571
+ ),
1572
+ request=req,
1573
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1574
+ retry_config=retry_config,
1575
+ )
1576
+
1577
+ data: Any = None
1578
+ if utils.match_response(http_res, "200", "application/json"):
1579
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
1580
+ if utils.match_response(
1581
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1582
+ ):
1583
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1584
+ raise models.ErrorResponse(data=data)
1585
+ if utils.match_response(http_res, "422", "application/json"):
1586
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1587
+ raise models.HTTPValidationError(data=data)
1588
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1589
+ http_res_text = utils.stream_to_text(http_res)
1590
+ raise models.APIError(
1591
+ "API error occurred", http_res.status_code, http_res_text, http_res
1592
+ )
1593
+
1594
+ content_type = http_res.headers.get("Content-Type")
1595
+ http_res_text = utils.stream_to_text(http_res)
1596
+ raise models.APIError(
1597
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1598
+ http_res.status_code,
1599
+ http_res_text,
1600
+ http_res,
1601
+ )
1602
+
1603
+ async def classify_features_v1_entities_taxonomies_taxonomy_classify_post_async(
1604
+ self,
1605
+ *,
1606
+ taxonomy: str,
1607
+ collections: List[str],
1608
+ x_namespace: OptionalNullable[str] = UNSET,
1609
+ filters: OptionalNullable[
1610
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
1611
+ ] = UNSET,
1612
+ confidence_threshold: Optional[float] = 0.8,
1613
+ assignment: Optional[
1614
+ Union[models.AssignmentConfig, models.AssignmentConfigTypedDict]
1615
+ ] = None,
1616
+ sample_size: OptionalNullable[int] = UNSET,
1617
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1618
+ server_url: Optional[str] = None,
1619
+ timeout_ms: Optional[int] = None,
1620
+ http_headers: Optional[Mapping[str, str]] = None,
1621
+ ) -> models.TaskResponse:
1622
+ r"""Classify Features against Taxonomy
1623
+
1624
+ Starts an asynchronous task to classify features within collections for a given taxonomy.
1625
+
1626
+ :param taxonomy: The name or id of the taxonomy to use for discovery
1627
+ :param collections: List of collection names or ids to search for features
1628
+ :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.
1629
+ :param filters: Filters to apply to the discovery task
1630
+ :param confidence_threshold: Minimum confidence score required for classification
1631
+ :param assignment: Configuration for how classifications should be assigned to features
1632
+ :param sample_size: Number of feature samples to process
1633
+ :param retries: Override the default retry configuration for this method
1634
+ :param server_url: Override the default server URL for this method
1635
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1636
+ :param http_headers: Additional headers to set or replace on requests.
1637
+ """
1638
+ base_url = None
1639
+ url_variables = None
1640
+ if timeout_ms is None:
1641
+ timeout_ms = self.sdk_configuration.timeout_ms
1642
+
1643
+ if server_url is not None:
1644
+ base_url = server_url
1645
+
1646
+ request = (
1647
+ models.ClassifyFeaturesV1EntitiesTaxonomiesTaxonomyClassifyPostRequest(
1648
+ taxonomy=taxonomy,
1649
+ x_namespace=x_namespace,
1650
+ discover_request=models.DiscoverRequest(
1651
+ collections=collections,
1652
+ filters=utils.get_pydantic_model(
1653
+ filters, OptionalNullable[models.LogicalOperator]
1654
+ ),
1655
+ confidence_threshold=confidence_threshold,
1656
+ assignment=utils.get_pydantic_model(
1657
+ assignment, Optional[models.AssignmentConfig]
1658
+ ),
1659
+ sample_size=sample_size,
1660
+ ),
1661
+ )
1662
+ )
1663
+
1664
+ req = self._build_request_async(
1665
+ method="POST",
1666
+ path="/v1/entities/taxonomies/{taxonomy}/classify",
1667
+ base_url=base_url,
1668
+ url_variables=url_variables,
1669
+ request=request,
1670
+ request_body_required=True,
1671
+ request_has_path_params=True,
1672
+ request_has_query_params=True,
1673
+ user_agent_header="user-agent",
1674
+ accept_header_value="application/json",
1675
+ http_headers=http_headers,
1676
+ security=self.sdk_configuration.security,
1677
+ get_serialized_body=lambda: utils.serialize_request_body(
1678
+ request.discover_request, False, False, "json", models.DiscoverRequest
1679
+ ),
1680
+ timeout_ms=timeout_ms,
1681
+ )
1682
+
1683
+ if retries == UNSET:
1684
+ if self.sdk_configuration.retry_config is not UNSET:
1685
+ retries = self.sdk_configuration.retry_config
1686
+
1687
+ retry_config = None
1688
+ if isinstance(retries, utils.RetryConfig):
1689
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1690
+
1691
+ http_res = await self.do_request_async(
1692
+ hook_ctx=HookContext(
1693
+ operation_id="classify_features_v1_entities_taxonomies__taxonomy__classify_post",
1694
+ oauth2_scopes=[],
1695
+ security_source=get_security_from_env(
1696
+ self.sdk_configuration.security, models.Security
1697
+ ),
1698
+ ),
1699
+ request=req,
1700
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1701
+ retry_config=retry_config,
1702
+ )
1703
+
1704
+ data: Any = None
1705
+ if utils.match_response(http_res, "200", "application/json"):
1706
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
1707
+ if utils.match_response(
1708
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1709
+ ):
1710
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1711
+ raise models.ErrorResponse(data=data)
1712
+ if utils.match_response(http_res, "422", "application/json"):
1713
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1714
+ raise models.HTTPValidationError(data=data)
1715
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1716
+ http_res_text = await utils.stream_to_text_async(http_res)
1717
+ raise models.APIError(
1718
+ "API error occurred", http_res.status_code, http_res_text, http_res
1719
+ )
1720
+
1721
+ content_type = http_res.headers.get("Content-Type")
1722
+ http_res_text = await utils.stream_to_text_async(http_res)
1723
+ raise models.APIError(
1724
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1725
+ http_res.status_code,
1726
+ http_res_text,
1727
+ http_res,
1728
+ )
1729
+
1730
+ def list_classifications_v1_entities_taxonomies_taxonomy_classifications_post(
1731
+ self,
1732
+ *,
1733
+ taxonomy: str,
1734
+ page: OptionalNullable[int] = UNSET,
1735
+ page_size: Optional[int] = 10,
1736
+ x_namespace: OptionalNullable[str] = UNSET,
1737
+ filters: OptionalNullable[
1738
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
1739
+ ] = UNSET,
1740
+ sort: OptionalNullable[
1741
+ Union[models.SortOption, models.SortOptionTypedDict]
1742
+ ] = UNSET,
1743
+ feature_options: OptionalNullable[
1744
+ Union[models.FeatureOptions, models.FeatureOptionsTypedDict]
1745
+ ] = UNSET,
1746
+ node_options: OptionalNullable[
1747
+ Union[models.NodeOptions, models.NodeOptionsTypedDict]
1748
+ ] = UNSET,
1749
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1750
+ server_url: Optional[str] = None,
1751
+ timeout_ms: Optional[int] = None,
1752
+ http_headers: Optional[Mapping[str, str]] = None,
1753
+ ) -> models.ListClassificationsResponse:
1754
+ r"""List Taxonomy Classifications
1755
+
1756
+ Retrieves a paginated list of classification entries with optional filtering.
1757
+
1758
+ :param taxonomy: The ID or name of the taxonomy
1759
+ :param page:
1760
+ :param page_size:
1761
+ :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.
1762
+ :param filters: Complex nested query filters for classifications
1763
+ :param sort: Sort options for ordering classifications
1764
+ :param feature_options: Controls what feature data to include in the response. Note: Including additional data increases response latency.
1765
+ :param node_options: Controls what node data to include in the response. Note: Including additional data increases response latency.
1766
+ :param retries: Override the default retry configuration for this method
1767
+ :param server_url: Override the default server URL for this method
1768
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1769
+ :param http_headers: Additional headers to set or replace on requests.
1770
+ """
1771
+ base_url = None
1772
+ url_variables = None
1773
+ if timeout_ms is None:
1774
+ timeout_ms = self.sdk_configuration.timeout_ms
1775
+
1776
+ if server_url is not None:
1777
+ base_url = server_url
1778
+
1779
+ request = models.ListClassificationsV1EntitiesTaxonomiesTaxonomyClassificationsPostRequest(
1780
+ taxonomy=taxonomy,
1781
+ page=page,
1782
+ page_size=page_size,
1783
+ x_namespace=x_namespace,
1784
+ list_classifications_request=models.ListClassificationsRequest(
1785
+ filters=utils.get_pydantic_model(
1786
+ filters, OptionalNullable[models.LogicalOperator]
1787
+ ),
1788
+ sort=utils.get_pydantic_model(
1789
+ sort, OptionalNullable[models.SortOption]
1790
+ ),
1791
+ feature_options=utils.get_pydantic_model(
1792
+ feature_options, OptionalNullable[models.FeatureOptions]
1793
+ ),
1794
+ node_options=utils.get_pydantic_model(
1795
+ node_options, OptionalNullable[models.NodeOptions]
1796
+ ),
1797
+ ),
1798
+ )
1799
+
1800
+ req = self._build_request(
1801
+ method="POST",
1802
+ path="/v1/entities/taxonomies/{taxonomy}/classifications",
1803
+ base_url=base_url,
1804
+ url_variables=url_variables,
1805
+ request=request,
1806
+ request_body_required=True,
1807
+ request_has_path_params=True,
1808
+ request_has_query_params=True,
1809
+ user_agent_header="user-agent",
1810
+ accept_header_value="application/json",
1811
+ http_headers=http_headers,
1812
+ security=self.sdk_configuration.security,
1813
+ get_serialized_body=lambda: utils.serialize_request_body(
1814
+ request.list_classifications_request,
1815
+ False,
1816
+ False,
1817
+ "json",
1818
+ models.ListClassificationsRequest,
1819
+ ),
1820
+ timeout_ms=timeout_ms,
1821
+ )
1822
+
1823
+ if retries == UNSET:
1824
+ if self.sdk_configuration.retry_config is not UNSET:
1825
+ retries = self.sdk_configuration.retry_config
1826
+
1827
+ retry_config = None
1828
+ if isinstance(retries, utils.RetryConfig):
1829
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1830
+
1831
+ http_res = self.do_request(
1832
+ hook_ctx=HookContext(
1833
+ operation_id="list_classifications_v1_entities_taxonomies__taxonomy__classifications_post",
1834
+ oauth2_scopes=[],
1835
+ security_source=get_security_from_env(
1836
+ self.sdk_configuration.security, models.Security
1837
+ ),
1838
+ ),
1839
+ request=req,
1840
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1841
+ retry_config=retry_config,
1842
+ )
1843
+
1844
+ data: Any = None
1845
+ if utils.match_response(http_res, "200", "application/json"):
1846
+ return utils.unmarshal_json(
1847
+ http_res.text, models.ListClassificationsResponse
1848
+ )
1849
+ if utils.match_response(
1850
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1851
+ ):
1852
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1853
+ raise models.ErrorResponse(data=data)
1854
+ if utils.match_response(http_res, "422", "application/json"):
1855
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1856
+ raise models.HTTPValidationError(data=data)
1857
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1858
+ http_res_text = utils.stream_to_text(http_res)
1859
+ raise models.APIError(
1860
+ "API error occurred", http_res.status_code, http_res_text, http_res
1861
+ )
1862
+
1863
+ content_type = http_res.headers.get("Content-Type")
1864
+ http_res_text = utils.stream_to_text(http_res)
1865
+ raise models.APIError(
1866
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1867
+ http_res.status_code,
1868
+ http_res_text,
1869
+ http_res,
1870
+ )
1871
+
1872
+ async def list_classifications_v1_entities_taxonomies_taxonomy_classifications_post_async(
1873
+ self,
1874
+ *,
1875
+ taxonomy: str,
1876
+ page: OptionalNullable[int] = UNSET,
1877
+ page_size: Optional[int] = 10,
1878
+ x_namespace: OptionalNullable[str] = UNSET,
1879
+ filters: OptionalNullable[
1880
+ Union[models.LogicalOperator, models.LogicalOperatorTypedDict]
1881
+ ] = UNSET,
1882
+ sort: OptionalNullable[
1883
+ Union[models.SortOption, models.SortOptionTypedDict]
1884
+ ] = UNSET,
1885
+ feature_options: OptionalNullable[
1886
+ Union[models.FeatureOptions, models.FeatureOptionsTypedDict]
1887
+ ] = UNSET,
1888
+ node_options: OptionalNullable[
1889
+ Union[models.NodeOptions, models.NodeOptionsTypedDict]
1890
+ ] = UNSET,
1891
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1892
+ server_url: Optional[str] = None,
1893
+ timeout_ms: Optional[int] = None,
1894
+ http_headers: Optional[Mapping[str, str]] = None,
1895
+ ) -> models.ListClassificationsResponse:
1896
+ r"""List Taxonomy Classifications
1897
+
1898
+ Retrieves a paginated list of classification entries with optional filtering.
1899
+
1900
+ :param taxonomy: The ID or name of the taxonomy
1901
+ :param page:
1902
+ :param page_size:
1903
+ :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.
1904
+ :param filters: Complex nested query filters for classifications
1905
+ :param sort: Sort options for ordering classifications
1906
+ :param feature_options: Controls what feature data to include in the response. Note: Including additional data increases response latency.
1907
+ :param node_options: Controls what node data to include in the response. Note: Including additional data increases response latency.
1908
+ :param retries: Override the default retry configuration for this method
1909
+ :param server_url: Override the default server URL for this method
1910
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1911
+ :param http_headers: Additional headers to set or replace on requests.
1912
+ """
1913
+ base_url = None
1914
+ url_variables = None
1915
+ if timeout_ms is None:
1916
+ timeout_ms = self.sdk_configuration.timeout_ms
1917
+
1918
+ if server_url is not None:
1919
+ base_url = server_url
1920
+
1921
+ request = models.ListClassificationsV1EntitiesTaxonomiesTaxonomyClassificationsPostRequest(
1922
+ taxonomy=taxonomy,
1923
+ page=page,
1924
+ page_size=page_size,
1925
+ x_namespace=x_namespace,
1926
+ list_classifications_request=models.ListClassificationsRequest(
1927
+ filters=utils.get_pydantic_model(
1928
+ filters, OptionalNullable[models.LogicalOperator]
1929
+ ),
1930
+ sort=utils.get_pydantic_model(
1931
+ sort, OptionalNullable[models.SortOption]
1932
+ ),
1933
+ feature_options=utils.get_pydantic_model(
1934
+ feature_options, OptionalNullable[models.FeatureOptions]
1935
+ ),
1936
+ node_options=utils.get_pydantic_model(
1937
+ node_options, OptionalNullable[models.NodeOptions]
1938
+ ),
1939
+ ),
1940
+ )
1941
+
1942
+ req = self._build_request_async(
1943
+ method="POST",
1944
+ path="/v1/entities/taxonomies/{taxonomy}/classifications",
1945
+ base_url=base_url,
1946
+ url_variables=url_variables,
1947
+ request=request,
1948
+ request_body_required=True,
1949
+ request_has_path_params=True,
1950
+ request_has_query_params=True,
1951
+ user_agent_header="user-agent",
1952
+ accept_header_value="application/json",
1953
+ http_headers=http_headers,
1954
+ security=self.sdk_configuration.security,
1955
+ get_serialized_body=lambda: utils.serialize_request_body(
1956
+ request.list_classifications_request,
1957
+ False,
1958
+ False,
1959
+ "json",
1960
+ models.ListClassificationsRequest,
1961
+ ),
1962
+ timeout_ms=timeout_ms,
1963
+ )
1964
+
1965
+ if retries == UNSET:
1966
+ if self.sdk_configuration.retry_config is not UNSET:
1967
+ retries = self.sdk_configuration.retry_config
1968
+
1969
+ retry_config = None
1970
+ if isinstance(retries, utils.RetryConfig):
1971
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1972
+
1973
+ http_res = await self.do_request_async(
1974
+ hook_ctx=HookContext(
1975
+ operation_id="list_classifications_v1_entities_taxonomies__taxonomy__classifications_post",
1976
+ oauth2_scopes=[],
1977
+ security_source=get_security_from_env(
1978
+ self.sdk_configuration.security, models.Security
1979
+ ),
1980
+ ),
1981
+ request=req,
1982
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1983
+ retry_config=retry_config,
1984
+ )
1985
+
1986
+ data: Any = None
1987
+ if utils.match_response(http_res, "200", "application/json"):
1988
+ return utils.unmarshal_json(
1989
+ http_res.text, models.ListClassificationsResponse
1990
+ )
1991
+ if utils.match_response(
1992
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1993
+ ):
1994
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1995
+ raise models.ErrorResponse(data=data)
1996
+ if utils.match_response(http_res, "422", "application/json"):
1997
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1998
+ raise models.HTTPValidationError(data=data)
1999
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
2000
+ http_res_text = await utils.stream_to_text_async(http_res)
2001
+ raise models.APIError(
2002
+ "API error occurred", http_res.status_code, http_res_text, http_res
2003
+ )
2004
+
2005
+ content_type = http_res.headers.get("Content-Type")
2006
+ http_res_text = await utils.stream_to_text_async(http_res)
2007
+ raise models.APIError(
2008
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2009
+ http_res.status_code,
2010
+ http_res_text,
2011
+ http_res,
2012
+ )
2013
+
2014
+ def delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_delete(
2015
+ self,
2016
+ *,
2017
+ taxonomy: str,
2018
+ classification_id: str,
2019
+ x_namespace: OptionalNullable[str] = UNSET,
2020
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2021
+ server_url: Optional[str] = None,
2022
+ timeout_ms: Optional[int] = None,
2023
+ http_headers: Optional[Mapping[str, str]] = None,
2024
+ ) -> models.GenericSuccessResponse:
2025
+ r"""Delete Classifications
2026
+
2027
+ **Requirements:**
2028
+ - Required permissions: write
2029
+
2030
+ :param taxonomy: The id or name of the taxonomy
2031
+ :param classification_id: The id of the classification to delete
2032
+ :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.
2033
+ :param retries: Override the default retry configuration for this method
2034
+ :param server_url: Override the default server URL for this method
2035
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2036
+ :param http_headers: Additional headers to set or replace on requests.
2037
+ """
2038
+ base_url = None
2039
+ url_variables = None
2040
+ if timeout_ms is None:
2041
+ timeout_ms = self.sdk_configuration.timeout_ms
2042
+
2043
+ if server_url is not None:
2044
+ base_url = server_url
2045
+
2046
+ request = models.DeleteClassificationsV1EntitiesTaxonomiesTaxonomyClassificationsClassificationIDDeleteRequest(
2047
+ taxonomy=taxonomy,
2048
+ classification_id=classification_id,
2049
+ x_namespace=x_namespace,
2050
+ )
2051
+
2052
+ req = self._build_request(
2053
+ method="DELETE",
2054
+ path="/v1/entities/taxonomies/{taxonomy}/classifications/{classification_id}",
2055
+ base_url=base_url,
2056
+ url_variables=url_variables,
2057
+ request=request,
2058
+ request_body_required=False,
2059
+ request_has_path_params=True,
2060
+ request_has_query_params=True,
2061
+ user_agent_header="user-agent",
2062
+ accept_header_value="application/json",
2063
+ http_headers=http_headers,
2064
+ security=self.sdk_configuration.security,
2065
+ timeout_ms=timeout_ms,
2066
+ )
2067
+
2068
+ if retries == UNSET:
2069
+ if self.sdk_configuration.retry_config is not UNSET:
2070
+ retries = self.sdk_configuration.retry_config
2071
+
2072
+ retry_config = None
2073
+ if isinstance(retries, utils.RetryConfig):
2074
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2075
+
2076
+ http_res = self.do_request(
2077
+ hook_ctx=HookContext(
2078
+ operation_id="delete_classifications_v1_entities_taxonomies__taxonomy__classifications__classification_id__delete",
2079
+ oauth2_scopes=[],
2080
+ security_source=get_security_from_env(
2081
+ self.sdk_configuration.security, models.Security
2082
+ ),
2083
+ ),
2084
+ request=req,
2085
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
2086
+ retry_config=retry_config,
2087
+ )
2088
+
2089
+ data: Any = None
2090
+ if utils.match_response(http_res, "200", "application/json"):
2091
+ return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
2092
+ if utils.match_response(
2093
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
2094
+ ):
2095
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
2096
+ raise models.ErrorResponse(data=data)
2097
+ if utils.match_response(http_res, "422", "application/json"):
2098
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
2099
+ raise models.HTTPValidationError(data=data)
2100
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
2101
+ http_res_text = utils.stream_to_text(http_res)
2102
+ raise models.APIError(
2103
+ "API error occurred", http_res.status_code, http_res_text, http_res
2104
+ )
2105
+
2106
+ content_type = http_res.headers.get("Content-Type")
2107
+ http_res_text = utils.stream_to_text(http_res)
2108
+ raise models.APIError(
2109
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2110
+ http_res.status_code,
2111
+ http_res_text,
2112
+ http_res,
2113
+ )
2114
+
2115
+ async def delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_delete_async(
2116
+ self,
2117
+ *,
2118
+ taxonomy: str,
2119
+ classification_id: str,
2120
+ x_namespace: OptionalNullable[str] = UNSET,
2121
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
2122
+ server_url: Optional[str] = None,
2123
+ timeout_ms: Optional[int] = None,
2124
+ http_headers: Optional[Mapping[str, str]] = None,
2125
+ ) -> models.GenericSuccessResponse:
2126
+ r"""Delete Classifications
2127
+
2128
+ **Requirements:**
2129
+ - Required permissions: write
2130
+
2131
+ :param taxonomy: The id or name of the taxonomy
2132
+ :param classification_id: The id of the classification to delete
2133
+ :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.
2134
+ :param retries: Override the default retry configuration for this method
2135
+ :param server_url: Override the default server URL for this method
2136
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
2137
+ :param http_headers: Additional headers to set or replace on requests.
2138
+ """
2139
+ base_url = None
2140
+ url_variables = None
2141
+ if timeout_ms is None:
2142
+ timeout_ms = self.sdk_configuration.timeout_ms
2143
+
2144
+ if server_url is not None:
2145
+ base_url = server_url
2146
+
2147
+ request = models.DeleteClassificationsV1EntitiesTaxonomiesTaxonomyClassificationsClassificationIDDeleteRequest(
2148
+ taxonomy=taxonomy,
2149
+ classification_id=classification_id,
2150
+ x_namespace=x_namespace,
2151
+ )
2152
+
2153
+ req = self._build_request_async(
2154
+ method="DELETE",
2155
+ path="/v1/entities/taxonomies/{taxonomy}/classifications/{classification_id}",
2156
+ base_url=base_url,
2157
+ url_variables=url_variables,
2158
+ request=request,
2159
+ request_body_required=False,
2160
+ request_has_path_params=True,
2161
+ request_has_query_params=True,
2162
+ user_agent_header="user-agent",
2163
+ accept_header_value="application/json",
2164
+ http_headers=http_headers,
2165
+ security=self.sdk_configuration.security,
2166
+ timeout_ms=timeout_ms,
2167
+ )
2168
+
2169
+ if retries == UNSET:
2170
+ if self.sdk_configuration.retry_config is not UNSET:
2171
+ retries = self.sdk_configuration.retry_config
2172
+
2173
+ retry_config = None
2174
+ if isinstance(retries, utils.RetryConfig):
2175
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
2176
+
2177
+ http_res = await self.do_request_async(
2178
+ hook_ctx=HookContext(
2179
+ operation_id="delete_classifications_v1_entities_taxonomies__taxonomy__classifications__classification_id__delete",
2180
+ oauth2_scopes=[],
2181
+ security_source=get_security_from_env(
2182
+ self.sdk_configuration.security, models.Security
2183
+ ),
2184
+ ),
2185
+ request=req,
2186
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
2187
+ retry_config=retry_config,
2188
+ )
2189
+
2190
+ data: Any = None
2191
+ if utils.match_response(http_res, "200", "application/json"):
2192
+ return utils.unmarshal_json(http_res.text, models.GenericSuccessResponse)
2193
+ if utils.match_response(
2194
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
2195
+ ):
2196
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
2197
+ raise models.ErrorResponse(data=data)
2198
+ if utils.match_response(http_res, "422", "application/json"):
2199
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
2200
+ raise models.HTTPValidationError(data=data)
2201
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
2202
+ http_res_text = await utils.stream_to_text_async(http_res)
2203
+ raise models.APIError(
2204
+ "API error occurred", http_res.status_code, http_res_text, http_res
2205
+ )
2206
+
2207
+ content_type = http_res.headers.get("Content-Type")
2208
+ http_res_text = await utils.stream_to_text_async(http_res)
2209
+ raise models.APIError(
2210
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2211
+ http_res.status_code,
2212
+ http_res_text,
2213
+ http_res,
2214
+ )