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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. mixpeek/_version.py +1 -1
  2. mixpeek/assets.py +8 -8
  3. mixpeek/collections.py +4 -4
  4. mixpeek/featureextractors.py +6 -6
  5. mixpeek/features.py +20 -20
  6. mixpeek/ingest.py +12 -54
  7. mixpeek/models/__init__.py +27 -108
  8. mixpeek/models/assetresponse.py +4 -4
  9. mixpeek/models/availableindexesresponse.py +2 -2
  10. mixpeek/models/availablemodels.py +4 -0
  11. mixpeek/models/createnamespacerequest.py +4 -4
  12. mixpeek/models/embeddingrequest.py +2 -2
  13. mixpeek/models/entitysettings.py +50 -0
  14. mixpeek/models/featureextractionembeddingrequest.py +2 -2
  15. mixpeek/models/imagedescribesettings.py +6 -6
  16. mixpeek/models/imagereadsettings.py +6 -6
  17. mixpeek/models/imagesettings.py +17 -4
  18. mixpeek/models/internal/__init__.py +5 -0
  19. mixpeek/models/internal/globals.py +22 -0
  20. mixpeek/models/listassetsrequest.py +3 -3
  21. mixpeek/models/listfeaturesrequest.py +3 -3
  22. mixpeek/models/{logicaloperator_input.py → logicaloperator.py} +8 -8
  23. mixpeek/models/namespaceresponse.py +2 -2
  24. mixpeek/models/processimageurlinput.py +1 -13
  25. mixpeek/models/processtextinput.py +1 -13
  26. mixpeek/models/processvideourlinput.py +1 -13
  27. mixpeek/models/search_features_features_search_postop.py +4 -7
  28. mixpeek/models/{search_model_searchquery_input.py → search_model_searchquery.py} +7 -7
  29. mixpeek/models/searchassetsrequest.py +3 -3
  30. mixpeek/models/{searchrequestfeatures_output.py → searchrequestfeatures.py} +11 -11
  31. mixpeek/models/security.py +2 -2
  32. mixpeek/models/{percolaterequest.py → taskresponse.py} +15 -17
  33. mixpeek/models/taskstatus.py +1 -0
  34. mixpeek/models/taxonomyextractionconfig.py +31 -0
  35. mixpeek/models/textsettings.py +10 -4
  36. mixpeek/models/vectormodel.py +4 -0
  37. mixpeek/models/videodescribesettings.py +6 -6
  38. mixpeek/models/videoreadsettings.py +6 -6
  39. mixpeek/models/videosettings.py +17 -3
  40. mixpeek/models/videotranscriptionsettings.py +6 -6
  41. mixpeek/namespaces.py +6 -6
  42. mixpeek/sdk.py +15 -11
  43. mixpeek/sdkconfiguration.py +4 -2
  44. mixpeek/tasks.py +4 -4
  45. mixpeek/utils/security.py +2 -2
  46. {mixpeek-0.14.0.dist-info → mixpeek-0.15.1.dist-info}/METADATA +12 -22
  47. {mixpeek-0.14.0.dist-info → mixpeek-0.15.1.dist-info}/RECORD +48 -58
  48. mixpeek/interactions.py +0 -228
  49. mixpeek/models/create_interaction_features_search_interactions_postop.py +0 -59
  50. mixpeek/models/db_model_taskresponse.py +0 -20
  51. mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +0 -59
  52. mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +0 -59
  53. mixpeek/models/interactionresponse.py +0 -87
  54. mixpeek/models/interactiontype.py +0 -11
  55. mixpeek/models/list_interactions_features_search_interactions_getop.py +0 -96
  56. mixpeek/models/logicaloperator_output.py +0 -103
  57. mixpeek/models/searchinteraction.py +0 -82
  58. mixpeek/models/searchquery_output.py +0 -79
  59. mixpeek/models/searchrequestfeatures_input.py +0 -151
  60. mixpeek/models/tasks_model_taskresponse.py +0 -24
  61. mixpeek/searchinteractions.py +0 -666
  62. {mixpeek-0.14.0.dist-info → mixpeek-0.15.1.dist-info}/WHEEL +0 -0
@@ -1,666 +0,0 @@
1
- """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
-
3
- from .basesdk import BaseSDK
4
- from mixpeek import models, utils
5
- from mixpeek._hooks import HookContext
6
- from mixpeek.types import OptionalNullable, UNSET
7
- from mixpeek.utils import get_security_from_env
8
- from typing import Any, Mapping, Optional, Union
9
-
10
-
11
- class SearchInteractions(BaseSDK):
12
- def create(
13
- self,
14
- *,
15
- feature_id: str,
16
- interaction_type: models.InteractionType,
17
- x_namespace: OptionalNullable[str] = UNSET,
18
- search_request: OptionalNullable[
19
- Union[
20
- models.SearchRequestFeaturesInput,
21
- models.SearchRequestFeaturesInputTypedDict,
22
- ]
23
- ] = UNSET,
24
- position: OptionalNullable[int] = UNSET,
25
- metadata: OptionalNullable[
26
- Union[models.Metadata, models.MetadataTypedDict]
27
- ] = UNSET,
28
- session_id: OptionalNullable[str] = UNSET,
29
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
30
- server_url: Optional[str] = None,
31
- timeout_ms: Optional[int] = None,
32
- http_headers: Optional[Mapping[str, str]] = None,
33
- ) -> models.InteractionResponse:
34
- r"""Create Interaction
35
-
36
- Record a search interaction (view, click, feedback, etc.)
37
-
38
- :param feature_id: ID of the item that was interacted with
39
- :param interaction_type:
40
- :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.
41
- :param search_request: The search request that led to this interaction
42
- :param position: Position in search results where interaction occurred
43
- :param metadata: Additional context about the interaction
44
- :param session_id: Search session identifier
45
- :param retries: Override the default retry configuration for this method
46
- :param server_url: Override the default server URL for this method
47
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
48
- :param http_headers: Additional headers to set or replace on requests.
49
- """
50
- base_url = None
51
- url_variables = None
52
- if timeout_ms is None:
53
- timeout_ms = self.sdk_configuration.timeout_ms
54
-
55
- if server_url is not None:
56
- base_url = server_url
57
-
58
- request = models.CreateInteractionFeaturesSearchInteractionsPostRequest(
59
- x_namespace=x_namespace,
60
- search_interaction=models.SearchInteraction(
61
- feature_id=feature_id,
62
- interaction_type=interaction_type,
63
- search_request=utils.get_pydantic_model(
64
- search_request, OptionalNullable[models.SearchRequestFeaturesInput]
65
- ),
66
- position=position,
67
- metadata=utils.get_pydantic_model(
68
- metadata, OptionalNullable[models.Metadata]
69
- ),
70
- session_id=session_id,
71
- ),
72
- )
73
-
74
- req = self._build_request(
75
- method="POST",
76
- path="/features/search/interactions",
77
- base_url=base_url,
78
- url_variables=url_variables,
79
- request=request,
80
- request_body_required=True,
81
- request_has_path_params=False,
82
- request_has_query_params=True,
83
- user_agent_header="user-agent",
84
- accept_header_value="application/json",
85
- http_headers=http_headers,
86
- security=self.sdk_configuration.security,
87
- get_serialized_body=lambda: utils.serialize_request_body(
88
- request.search_interaction,
89
- False,
90
- False,
91
- "json",
92
- models.SearchInteraction,
93
- ),
94
- timeout_ms=timeout_ms,
95
- )
96
-
97
- if retries == UNSET:
98
- if self.sdk_configuration.retry_config is not UNSET:
99
- retries = self.sdk_configuration.retry_config
100
-
101
- retry_config = None
102
- if isinstance(retries, utils.RetryConfig):
103
- retry_config = (retries, ["429", "500", "502", "503", "504"])
104
-
105
- http_res = self.do_request(
106
- hook_ctx=HookContext(
107
- operation_id="create_interaction_features_search_interactions_post",
108
- oauth2_scopes=[],
109
- security_source=get_security_from_env(
110
- self.sdk_configuration.security, models.Security
111
- ),
112
- ),
113
- request=req,
114
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
115
- retry_config=retry_config,
116
- )
117
-
118
- data: Any = None
119
- if utils.match_response(http_res, "200", "application/json"):
120
- return utils.unmarshal_json(http_res.text, models.InteractionResponse)
121
- if utils.match_response(
122
- http_res, ["400", "401", "403", "404", "500"], "application/json"
123
- ):
124
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
125
- raise models.ErrorResponse(data=data)
126
- if utils.match_response(http_res, "422", "application/json"):
127
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
128
- raise models.HTTPValidationError(data=data)
129
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
130
- http_res_text = utils.stream_to_text(http_res)
131
- raise models.APIError(
132
- "API error occurred", http_res.status_code, http_res_text, http_res
133
- )
134
-
135
- content_type = http_res.headers.get("Content-Type")
136
- http_res_text = utils.stream_to_text(http_res)
137
- raise models.APIError(
138
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
139
- http_res.status_code,
140
- http_res_text,
141
- http_res,
142
- )
143
-
144
- async def create_async(
145
- self,
146
- *,
147
- feature_id: str,
148
- interaction_type: models.InteractionType,
149
- x_namespace: OptionalNullable[str] = UNSET,
150
- search_request: OptionalNullable[
151
- Union[
152
- models.SearchRequestFeaturesInput,
153
- models.SearchRequestFeaturesInputTypedDict,
154
- ]
155
- ] = UNSET,
156
- position: OptionalNullable[int] = UNSET,
157
- metadata: OptionalNullable[
158
- Union[models.Metadata, models.MetadataTypedDict]
159
- ] = UNSET,
160
- session_id: OptionalNullable[str] = UNSET,
161
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
162
- server_url: Optional[str] = None,
163
- timeout_ms: Optional[int] = None,
164
- http_headers: Optional[Mapping[str, str]] = None,
165
- ) -> models.InteractionResponse:
166
- r"""Create Interaction
167
-
168
- Record a search interaction (view, click, feedback, etc.)
169
-
170
- :param feature_id: ID of the item that was interacted with
171
- :param interaction_type:
172
- :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.
173
- :param search_request: The search request that led to this interaction
174
- :param position: Position in search results where interaction occurred
175
- :param metadata: Additional context about the interaction
176
- :param session_id: Search session identifier
177
- :param retries: Override the default retry configuration for this method
178
- :param server_url: Override the default server URL for this method
179
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
180
- :param http_headers: Additional headers to set or replace on requests.
181
- """
182
- base_url = None
183
- url_variables = None
184
- if timeout_ms is None:
185
- timeout_ms = self.sdk_configuration.timeout_ms
186
-
187
- if server_url is not None:
188
- base_url = server_url
189
-
190
- request = models.CreateInteractionFeaturesSearchInteractionsPostRequest(
191
- x_namespace=x_namespace,
192
- search_interaction=models.SearchInteraction(
193
- feature_id=feature_id,
194
- interaction_type=interaction_type,
195
- search_request=utils.get_pydantic_model(
196
- search_request, OptionalNullable[models.SearchRequestFeaturesInput]
197
- ),
198
- position=position,
199
- metadata=utils.get_pydantic_model(
200
- metadata, OptionalNullable[models.Metadata]
201
- ),
202
- session_id=session_id,
203
- ),
204
- )
205
-
206
- req = self._build_request_async(
207
- method="POST",
208
- path="/features/search/interactions",
209
- base_url=base_url,
210
- url_variables=url_variables,
211
- request=request,
212
- request_body_required=True,
213
- request_has_path_params=False,
214
- request_has_query_params=True,
215
- user_agent_header="user-agent",
216
- accept_header_value="application/json",
217
- http_headers=http_headers,
218
- security=self.sdk_configuration.security,
219
- get_serialized_body=lambda: utils.serialize_request_body(
220
- request.search_interaction,
221
- False,
222
- False,
223
- "json",
224
- models.SearchInteraction,
225
- ),
226
- timeout_ms=timeout_ms,
227
- )
228
-
229
- if retries == UNSET:
230
- if self.sdk_configuration.retry_config is not UNSET:
231
- retries = self.sdk_configuration.retry_config
232
-
233
- retry_config = None
234
- if isinstance(retries, utils.RetryConfig):
235
- retry_config = (retries, ["429", "500", "502", "503", "504"])
236
-
237
- http_res = await self.do_request_async(
238
- hook_ctx=HookContext(
239
- operation_id="create_interaction_features_search_interactions_post",
240
- oauth2_scopes=[],
241
- security_source=get_security_from_env(
242
- self.sdk_configuration.security, models.Security
243
- ),
244
- ),
245
- request=req,
246
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
247
- retry_config=retry_config,
248
- )
249
-
250
- data: Any = None
251
- if utils.match_response(http_res, "200", "application/json"):
252
- return utils.unmarshal_json(http_res.text, models.InteractionResponse)
253
- if utils.match_response(
254
- http_res, ["400", "401", "403", "404", "500"], "application/json"
255
- ):
256
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
257
- raise models.ErrorResponse(data=data)
258
- if utils.match_response(http_res, "422", "application/json"):
259
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
260
- raise models.HTTPValidationError(data=data)
261
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
262
- http_res_text = await utils.stream_to_text_async(http_res)
263
- raise models.APIError(
264
- "API error occurred", http_res.status_code, http_res_text, http_res
265
- )
266
-
267
- content_type = http_res.headers.get("Content-Type")
268
- http_res_text = await utils.stream_to_text_async(http_res)
269
- raise models.APIError(
270
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
271
- http_res.status_code,
272
- http_res_text,
273
- http_res,
274
- )
275
-
276
- def get_interaction(
277
- self,
278
- *,
279
- interaction_id: str,
280
- x_namespace: OptionalNullable[str] = UNSET,
281
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
282
- server_url: Optional[str] = None,
283
- timeout_ms: Optional[int] = None,
284
- http_headers: Optional[Mapping[str, str]] = None,
285
- ) -> models.InteractionResponse:
286
- r"""Get Interaction
287
-
288
- Get a specific interaction
289
-
290
- :param interaction_id:
291
- :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.
292
- :param retries: Override the default retry configuration for this method
293
- :param server_url: Override the default server URL for this method
294
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
295
- :param http_headers: Additional headers to set or replace on requests.
296
- """
297
- base_url = None
298
- url_variables = None
299
- if timeout_ms is None:
300
- timeout_ms = self.sdk_configuration.timeout_ms
301
-
302
- if server_url is not None:
303
- base_url = server_url
304
-
305
- request = (
306
- models.GetInteractionFeaturesSearchInteractionsInteractionIDGetRequest(
307
- interaction_id=interaction_id,
308
- x_namespace=x_namespace,
309
- )
310
- )
311
-
312
- req = self._build_request(
313
- method="GET",
314
- path="/features/search/interactions/{interaction_id}",
315
- base_url=base_url,
316
- url_variables=url_variables,
317
- request=request,
318
- request_body_required=False,
319
- request_has_path_params=True,
320
- request_has_query_params=True,
321
- user_agent_header="user-agent",
322
- accept_header_value="application/json",
323
- http_headers=http_headers,
324
- security=self.sdk_configuration.security,
325
- timeout_ms=timeout_ms,
326
- )
327
-
328
- if retries == UNSET:
329
- if self.sdk_configuration.retry_config is not UNSET:
330
- retries = self.sdk_configuration.retry_config
331
-
332
- retry_config = None
333
- if isinstance(retries, utils.RetryConfig):
334
- retry_config = (retries, ["429", "500", "502", "503", "504"])
335
-
336
- http_res = self.do_request(
337
- hook_ctx=HookContext(
338
- operation_id="get_interaction_features_search_interactions__interaction_id__get",
339
- oauth2_scopes=[],
340
- security_source=get_security_from_env(
341
- self.sdk_configuration.security, models.Security
342
- ),
343
- ),
344
- request=req,
345
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
346
- retry_config=retry_config,
347
- )
348
-
349
- data: Any = None
350
- if utils.match_response(http_res, "200", "application/json"):
351
- return utils.unmarshal_json(http_res.text, models.InteractionResponse)
352
- if utils.match_response(
353
- http_res, ["400", "401", "403", "404", "500"], "application/json"
354
- ):
355
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
356
- raise models.ErrorResponse(data=data)
357
- if utils.match_response(http_res, "422", "application/json"):
358
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
359
- raise models.HTTPValidationError(data=data)
360
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
361
- http_res_text = utils.stream_to_text(http_res)
362
- raise models.APIError(
363
- "API error occurred", http_res.status_code, http_res_text, http_res
364
- )
365
-
366
- content_type = http_res.headers.get("Content-Type")
367
- http_res_text = utils.stream_to_text(http_res)
368
- raise models.APIError(
369
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
370
- http_res.status_code,
371
- http_res_text,
372
- http_res,
373
- )
374
-
375
- async def get_interaction_async(
376
- self,
377
- *,
378
- interaction_id: str,
379
- x_namespace: OptionalNullable[str] = UNSET,
380
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
381
- server_url: Optional[str] = None,
382
- timeout_ms: Optional[int] = None,
383
- http_headers: Optional[Mapping[str, str]] = None,
384
- ) -> models.InteractionResponse:
385
- r"""Get Interaction
386
-
387
- Get a specific interaction
388
-
389
- :param interaction_id:
390
- :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.
391
- :param retries: Override the default retry configuration for this method
392
- :param server_url: Override the default server URL for this method
393
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
394
- :param http_headers: Additional headers to set or replace on requests.
395
- """
396
- base_url = None
397
- url_variables = None
398
- if timeout_ms is None:
399
- timeout_ms = self.sdk_configuration.timeout_ms
400
-
401
- if server_url is not None:
402
- base_url = server_url
403
-
404
- request = (
405
- models.GetInteractionFeaturesSearchInteractionsInteractionIDGetRequest(
406
- interaction_id=interaction_id,
407
- x_namespace=x_namespace,
408
- )
409
- )
410
-
411
- req = self._build_request_async(
412
- method="GET",
413
- path="/features/search/interactions/{interaction_id}",
414
- base_url=base_url,
415
- url_variables=url_variables,
416
- request=request,
417
- request_body_required=False,
418
- request_has_path_params=True,
419
- request_has_query_params=True,
420
- user_agent_header="user-agent",
421
- accept_header_value="application/json",
422
- http_headers=http_headers,
423
- security=self.sdk_configuration.security,
424
- timeout_ms=timeout_ms,
425
- )
426
-
427
- if retries == UNSET:
428
- if self.sdk_configuration.retry_config is not UNSET:
429
- retries = self.sdk_configuration.retry_config
430
-
431
- retry_config = None
432
- if isinstance(retries, utils.RetryConfig):
433
- retry_config = (retries, ["429", "500", "502", "503", "504"])
434
-
435
- http_res = await self.do_request_async(
436
- hook_ctx=HookContext(
437
- operation_id="get_interaction_features_search_interactions__interaction_id__get",
438
- oauth2_scopes=[],
439
- security_source=get_security_from_env(
440
- self.sdk_configuration.security, models.Security
441
- ),
442
- ),
443
- request=req,
444
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
445
- retry_config=retry_config,
446
- )
447
-
448
- data: Any = None
449
- if utils.match_response(http_res, "200", "application/json"):
450
- return utils.unmarshal_json(http_res.text, models.InteractionResponse)
451
- if utils.match_response(
452
- http_res, ["400", "401", "403", "404", "500"], "application/json"
453
- ):
454
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
455
- raise models.ErrorResponse(data=data)
456
- if utils.match_response(http_res, "422", "application/json"):
457
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
458
- raise models.HTTPValidationError(data=data)
459
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
460
- http_res_text = await utils.stream_to_text_async(http_res)
461
- raise models.APIError(
462
- "API error occurred", http_res.status_code, http_res_text, http_res
463
- )
464
-
465
- content_type = http_res.headers.get("Content-Type")
466
- http_res_text = await utils.stream_to_text_async(http_res)
467
- raise models.APIError(
468
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
469
- http_res.status_code,
470
- http_res_text,
471
- http_res,
472
- )
473
-
474
- def delete(
475
- self,
476
- *,
477
- interaction_id: str,
478
- x_namespace: OptionalNullable[str] = UNSET,
479
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
480
- server_url: Optional[str] = None,
481
- timeout_ms: Optional[int] = None,
482
- http_headers: Optional[Mapping[str, str]] = None,
483
- ) -> Any:
484
- r"""Delete Interaction
485
-
486
- Delete a specific interaction
487
-
488
- :param interaction_id:
489
- :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.
490
- :param retries: Override the default retry configuration for this method
491
- :param server_url: Override the default server URL for this method
492
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
493
- :param http_headers: Additional headers to set or replace on requests.
494
- """
495
- base_url = None
496
- url_variables = None
497
- if timeout_ms is None:
498
- timeout_ms = self.sdk_configuration.timeout_ms
499
-
500
- if server_url is not None:
501
- base_url = server_url
502
-
503
- request = models.DeleteInteractionFeaturesSearchInteractionsInteractionIDDeleteRequest(
504
- interaction_id=interaction_id,
505
- x_namespace=x_namespace,
506
- )
507
-
508
- req = self._build_request(
509
- method="DELETE",
510
- path="/features/search/interactions/{interaction_id}",
511
- base_url=base_url,
512
- url_variables=url_variables,
513
- request=request,
514
- request_body_required=False,
515
- request_has_path_params=True,
516
- request_has_query_params=True,
517
- user_agent_header="user-agent",
518
- accept_header_value="application/json",
519
- http_headers=http_headers,
520
- security=self.sdk_configuration.security,
521
- timeout_ms=timeout_ms,
522
- )
523
-
524
- if retries == UNSET:
525
- if self.sdk_configuration.retry_config is not UNSET:
526
- retries = self.sdk_configuration.retry_config
527
-
528
- retry_config = None
529
- if isinstance(retries, utils.RetryConfig):
530
- retry_config = (retries, ["429", "500", "502", "503", "504"])
531
-
532
- http_res = self.do_request(
533
- hook_ctx=HookContext(
534
- operation_id="delete_interaction_features_search_interactions__interaction_id__delete",
535
- oauth2_scopes=[],
536
- security_source=get_security_from_env(
537
- self.sdk_configuration.security, models.Security
538
- ),
539
- ),
540
- request=req,
541
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
542
- retry_config=retry_config,
543
- )
544
-
545
- data: Any = None
546
- if utils.match_response(http_res, "200", "application/json"):
547
- return utils.unmarshal_json(http_res.text, Any)
548
- if utils.match_response(
549
- http_res, ["400", "401", "403", "404", "500"], "application/json"
550
- ):
551
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
552
- raise models.ErrorResponse(data=data)
553
- if utils.match_response(http_res, "422", "application/json"):
554
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
555
- raise models.HTTPValidationError(data=data)
556
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
557
- http_res_text = utils.stream_to_text(http_res)
558
- raise models.APIError(
559
- "API error occurred", http_res.status_code, http_res_text, http_res
560
- )
561
-
562
- content_type = http_res.headers.get("Content-Type")
563
- http_res_text = utils.stream_to_text(http_res)
564
- raise models.APIError(
565
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
566
- http_res.status_code,
567
- http_res_text,
568
- http_res,
569
- )
570
-
571
- async def delete_async(
572
- self,
573
- *,
574
- interaction_id: str,
575
- x_namespace: OptionalNullable[str] = UNSET,
576
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
577
- server_url: Optional[str] = None,
578
- timeout_ms: Optional[int] = None,
579
- http_headers: Optional[Mapping[str, str]] = None,
580
- ) -> Any:
581
- r"""Delete Interaction
582
-
583
- Delete a specific interaction
584
-
585
- :param interaction_id:
586
- :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.
587
- :param retries: Override the default retry configuration for this method
588
- :param server_url: Override the default server URL for this method
589
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
590
- :param http_headers: Additional headers to set or replace on requests.
591
- """
592
- base_url = None
593
- url_variables = None
594
- if timeout_ms is None:
595
- timeout_ms = self.sdk_configuration.timeout_ms
596
-
597
- if server_url is not None:
598
- base_url = server_url
599
-
600
- request = models.DeleteInteractionFeaturesSearchInteractionsInteractionIDDeleteRequest(
601
- interaction_id=interaction_id,
602
- x_namespace=x_namespace,
603
- )
604
-
605
- req = self._build_request_async(
606
- method="DELETE",
607
- path="/features/search/interactions/{interaction_id}",
608
- base_url=base_url,
609
- url_variables=url_variables,
610
- request=request,
611
- request_body_required=False,
612
- request_has_path_params=True,
613
- request_has_query_params=True,
614
- user_agent_header="user-agent",
615
- accept_header_value="application/json",
616
- http_headers=http_headers,
617
- security=self.sdk_configuration.security,
618
- timeout_ms=timeout_ms,
619
- )
620
-
621
- if retries == UNSET:
622
- if self.sdk_configuration.retry_config is not UNSET:
623
- retries = self.sdk_configuration.retry_config
624
-
625
- retry_config = None
626
- if isinstance(retries, utils.RetryConfig):
627
- retry_config = (retries, ["429", "500", "502", "503", "504"])
628
-
629
- http_res = await self.do_request_async(
630
- hook_ctx=HookContext(
631
- operation_id="delete_interaction_features_search_interactions__interaction_id__delete",
632
- oauth2_scopes=[],
633
- security_source=get_security_from_env(
634
- self.sdk_configuration.security, models.Security
635
- ),
636
- ),
637
- request=req,
638
- error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
639
- retry_config=retry_config,
640
- )
641
-
642
- data: Any = None
643
- if utils.match_response(http_res, "200", "application/json"):
644
- return utils.unmarshal_json(http_res.text, Any)
645
- if utils.match_response(
646
- http_res, ["400", "401", "403", "404", "500"], "application/json"
647
- ):
648
- data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
649
- raise models.ErrorResponse(data=data)
650
- if utils.match_response(http_res, "422", "application/json"):
651
- data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
652
- raise models.HTTPValidationError(data=data)
653
- if utils.match_response(http_res, ["4XX", "5XX"], "*"):
654
- http_res_text = await utils.stream_to_text_async(http_res)
655
- raise models.APIError(
656
- "API error occurred", http_res.status_code, http_res_text, http_res
657
- )
658
-
659
- content_type = http_res.headers.get("Content-Type")
660
- http_res_text = await utils.stream_to_text_async(http_res)
661
- raise models.APIError(
662
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
663
- http_res.status_code,
664
- http_res_text,
665
- http_res,
666
- )