mixpeek 0.11.2__py3-none-any.whl → 0.13__py3-none-any.whl

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