mixpeek 0.12.0__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 (270) hide show
  1. mixpeek/__init__.py +5 -79
  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 +11 -3
  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 +19 -29
  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.12.0.dist-info → mixpeek-0.13.dist-info}/WHEEL +1 -1
  176. py.typed +1 -0
  177. mixpeek/_base_client.py +0 -2041
  178. mixpeek/_client.py +0 -444
  179. mixpeek/_compat.py +0 -221
  180. mixpeek/_constants.py +0 -14
  181. mixpeek/_exceptions.py +0 -108
  182. mixpeek/_files.py +0 -123
  183. mixpeek/_models.py +0 -788
  184. mixpeek/_qs.py +0 -150
  185. mixpeek/_resource.py +0 -43
  186. mixpeek/_response.py +0 -824
  187. mixpeek/_streaming.py +0 -333
  188. mixpeek/_types.py +0 -219
  189. mixpeek/_utils/__init__.py +0 -56
  190. mixpeek/_utils/_logs.py +0 -25
  191. mixpeek/_utils/_proxy.py +0 -62
  192. mixpeek/_utils/_reflection.py +0 -42
  193. mixpeek/_utils/_streams.py +0 -12
  194. mixpeek/_utils/_sync.py +0 -81
  195. mixpeek/_utils/_transform.py +0 -387
  196. mixpeek/_utils/_typing.py +0 -120
  197. mixpeek/_utils/_utils.py +0 -414
  198. mixpeek/lib/.keep +0 -4
  199. mixpeek/resources/__init__.py +0 -117
  200. mixpeek/resources/accounts.py +0 -271
  201. mixpeek/resources/assets/__init__.py +0 -33
  202. mixpeek/resources/assets/assets.py +0 -708
  203. mixpeek/resources/assets/features.py +0 -172
  204. mixpeek/resources/collections.py +0 -283
  205. mixpeek/resources/entities/__init__.py +0 -47
  206. mixpeek/resources/entities/entities.py +0 -134
  207. mixpeek/resources/entities/faces.py +0 -514
  208. mixpeek/resources/entities/labels.py +0 -388
  209. mixpeek/resources/features/__init__.py +0 -33
  210. mixpeek/resources/features/features.py +0 -562
  211. mixpeek/resources/features/search.py +0 -731
  212. mixpeek/resources/healthcheck.py +0 -135
  213. mixpeek/resources/index/__init__.py +0 -47
  214. mixpeek/resources/index/images.py +0 -249
  215. mixpeek/resources/index/index.py +0 -289
  216. mixpeek/resources/index/videos.py +0 -249
  217. mixpeek/resources/tasks.py +0 -258
  218. mixpeek/types/account_update_params.py +0 -28
  219. mixpeek/types/asset_create_params.py +0 -36
  220. mixpeek/types/asset_create_response.py +0 -15
  221. mixpeek/types/asset_response.py +0 -46
  222. mixpeek/types/asset_search_params.py +0 -43
  223. mixpeek/types/asset_search_response.py +0 -15
  224. mixpeek/types/asset_update_params.py +0 -25
  225. mixpeek/types/asset_update_response.py +0 -11
  226. mixpeek/types/assets/__init__.py +0 -3
  227. mixpeek/types/collection_list_params.py +0 -19
  228. mixpeek/types/collection_list_response.py +0 -14
  229. mixpeek/types/entities/__init__.py +0 -13
  230. mixpeek/types/entities/face_create_params.py +0 -21
  231. mixpeek/types/entities/face_list_params.py +0 -18
  232. mixpeek/types/entities/face_list_response.py +0 -15
  233. mixpeek/types/entities/face_response.py +0 -17
  234. mixpeek/types/entities/face_update_params.py +0 -22
  235. mixpeek/types/entities/label_list_params.py +0 -18
  236. mixpeek/types/entities/label_list_response.py +0 -30
  237. mixpeek/types/entities/label_response.py +0 -30
  238. mixpeek/types/entities/label_update_params.py +0 -21
  239. mixpeek/types/feature.py +0 -32
  240. mixpeek/types/feature_list_params.py +0 -37
  241. mixpeek/types/feature_list_response.py +0 -28
  242. mixpeek/types/feature_retrieve_params.py +0 -18
  243. mixpeek/types/feature_update_params.py +0 -16
  244. mixpeek/types/features/__init__.py +0 -8
  245. mixpeek/types/features/search_feedback_params.py +0 -23
  246. mixpeek/types/features/search_file_params.py +0 -29
  247. mixpeek/types/features/search_text_params.py +0 -72
  248. mixpeek/types/features/search_url_params.py +0 -72
  249. mixpeek/types/grouped_asset_data.py +0 -24
  250. mixpeek/types/health_check_response.py +0 -10
  251. mixpeek/types/index/__init__.py +0 -8
  252. mixpeek/types/index/image_url_params.py +0 -135
  253. mixpeek/types/index/image_url_response.py +0 -20
  254. mixpeek/types/index/video_url_params.py +0 -154
  255. mixpeek/types/index/video_url_response.py +0 -20
  256. mixpeek/types/index_text_params.py +0 -77
  257. mixpeek/types/index_text_response.py +0 -14
  258. mixpeek/types/shared/__init__.py +0 -7
  259. mixpeek/types/shared/filter_condition.py +0 -19
  260. mixpeek/types/shared/logical_operator.py +0 -12
  261. mixpeek/types/shared/model_pagination_response.py +0 -21
  262. mixpeek/types/shared/sort_option.py +0 -15
  263. mixpeek/types/shared/task_response.py +0 -15
  264. mixpeek/types/shared_params/__init__.py +0 -4
  265. mixpeek/types/shared_params/logical_operator.py +0 -13
  266. mixpeek/types/shared_params/sort_option.py +0 -15
  267. mixpeek/types/user.py +0 -34
  268. mixpeek-0.12.0.dist-info/METADATA +0 -345
  269. mixpeek-0.12.0.dist-info/RECORD +0 -99
  270. mixpeek-0.12.0.dist-info/licenses/LICENSE +0 -201
mixpeek/features.py ADDED
@@ -0,0 +1,1181 @@
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, List, Mapping, Optional, Union
8
+
9
+
10
+ class Features(BaseSDK):
11
+ def get(
12
+ self,
13
+ *,
14
+ feature_id: str,
15
+ return_vectors: OptionalNullable[bool] = UNSET,
16
+ x_namespace: OptionalNullable[str] = UNSET,
17
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
18
+ server_url: Optional[str] = None,
19
+ timeout_ms: Optional[int] = None,
20
+ http_headers: Optional[Mapping[str, str]] = None,
21
+ ) -> models.FeatureResponse:
22
+ r"""Get Feature
23
+
24
+ :param feature_id:
25
+ :param return_vectors: When true, includes the feature's vector embeddings in the response
26
+ :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.
27
+ :param retries: Override the default retry configuration for this method
28
+ :param server_url: Override the default server URL for this method
29
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
30
+ :param http_headers: Additional headers to set or replace on requests.
31
+ """
32
+ base_url = None
33
+ url_variables = None
34
+ if timeout_ms is None:
35
+ timeout_ms = self.sdk_configuration.timeout_ms
36
+
37
+ if server_url is not None:
38
+ base_url = server_url
39
+
40
+ request = models.GetFeatureFeaturesFeatureIDGetRequest(
41
+ feature_id=feature_id,
42
+ return_vectors=return_vectors,
43
+ x_namespace=x_namespace,
44
+ )
45
+
46
+ req = self.build_request(
47
+ method="GET",
48
+ path="/features/{feature_id}",
49
+ base_url=base_url,
50
+ url_variables=url_variables,
51
+ request=request,
52
+ request_body_required=False,
53
+ request_has_path_params=True,
54
+ request_has_query_params=True,
55
+ user_agent_header="user-agent",
56
+ accept_header_value="application/json",
57
+ http_headers=http_headers,
58
+ timeout_ms=timeout_ms,
59
+ )
60
+
61
+ if retries == UNSET:
62
+ if self.sdk_configuration.retry_config is not UNSET:
63
+ retries = self.sdk_configuration.retry_config
64
+
65
+ retry_config = None
66
+ if isinstance(retries, utils.RetryConfig):
67
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
68
+
69
+ http_res = self.do_request(
70
+ hook_ctx=HookContext(
71
+ operation_id="get_feature_features__feature_id__get",
72
+ oauth2_scopes=[],
73
+ security_source=None,
74
+ ),
75
+ request=req,
76
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
77
+ retry_config=retry_config,
78
+ )
79
+
80
+ data: Any = None
81
+ if utils.match_response(http_res, "200", "application/json"):
82
+ return utils.unmarshal_json(http_res.text, models.FeatureResponse)
83
+ if utils.match_response(
84
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
85
+ ):
86
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
87
+ raise models.ErrorResponse(data=data)
88
+ if utils.match_response(http_res, "422", "application/json"):
89
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
90
+ raise models.HTTPValidationError(data=data)
91
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
92
+ http_res_text = utils.stream_to_text(http_res)
93
+ raise models.APIError(
94
+ "API error occurred", http_res.status_code, http_res_text, http_res
95
+ )
96
+
97
+ content_type = http_res.headers.get("Content-Type")
98
+ http_res_text = utils.stream_to_text(http_res)
99
+ raise models.APIError(
100
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
101
+ http_res.status_code,
102
+ http_res_text,
103
+ http_res,
104
+ )
105
+
106
+ async def get_async(
107
+ self,
108
+ *,
109
+ feature_id: str,
110
+ return_vectors: OptionalNullable[bool] = UNSET,
111
+ x_namespace: OptionalNullable[str] = UNSET,
112
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
113
+ server_url: Optional[str] = None,
114
+ timeout_ms: Optional[int] = None,
115
+ http_headers: Optional[Mapping[str, str]] = None,
116
+ ) -> models.FeatureResponse:
117
+ r"""Get Feature
118
+
119
+ :param feature_id:
120
+ :param return_vectors: When true, includes the feature's vector embeddings in the response
121
+ :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.
122
+ :param retries: Override the default retry configuration for this method
123
+ :param server_url: Override the default server URL for this method
124
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
125
+ :param http_headers: Additional headers to set or replace on requests.
126
+ """
127
+ base_url = None
128
+ url_variables = None
129
+ if timeout_ms is None:
130
+ timeout_ms = self.sdk_configuration.timeout_ms
131
+
132
+ if server_url is not None:
133
+ base_url = server_url
134
+
135
+ request = models.GetFeatureFeaturesFeatureIDGetRequest(
136
+ feature_id=feature_id,
137
+ return_vectors=return_vectors,
138
+ x_namespace=x_namespace,
139
+ )
140
+
141
+ req = self.build_request_async(
142
+ method="GET",
143
+ path="/features/{feature_id}",
144
+ base_url=base_url,
145
+ url_variables=url_variables,
146
+ request=request,
147
+ request_body_required=False,
148
+ request_has_path_params=True,
149
+ request_has_query_params=True,
150
+ user_agent_header="user-agent",
151
+ accept_header_value="application/json",
152
+ http_headers=http_headers,
153
+ timeout_ms=timeout_ms,
154
+ )
155
+
156
+ if retries == UNSET:
157
+ if self.sdk_configuration.retry_config is not UNSET:
158
+ retries = self.sdk_configuration.retry_config
159
+
160
+ retry_config = None
161
+ if isinstance(retries, utils.RetryConfig):
162
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
163
+
164
+ http_res = await self.do_request_async(
165
+ hook_ctx=HookContext(
166
+ operation_id="get_feature_features__feature_id__get",
167
+ oauth2_scopes=[],
168
+ security_source=None,
169
+ ),
170
+ request=req,
171
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
172
+ retry_config=retry_config,
173
+ )
174
+
175
+ data: Any = None
176
+ if utils.match_response(http_res, "200", "application/json"):
177
+ return utils.unmarshal_json(http_res.text, models.FeatureResponse)
178
+ if utils.match_response(
179
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
180
+ ):
181
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
182
+ raise models.ErrorResponse(data=data)
183
+ if utils.match_response(http_res, "422", "application/json"):
184
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
185
+ raise models.HTTPValidationError(data=data)
186
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
187
+ http_res_text = await utils.stream_to_text_async(http_res)
188
+ raise models.APIError(
189
+ "API error occurred", http_res.status_code, http_res_text, http_res
190
+ )
191
+
192
+ content_type = http_res.headers.get("Content-Type")
193
+ http_res_text = await utils.stream_to_text_async(http_res)
194
+ raise models.APIError(
195
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
196
+ http_res.status_code,
197
+ http_res_text,
198
+ http_res,
199
+ )
200
+
201
+ def delete(
202
+ self,
203
+ *,
204
+ feature_id: str,
205
+ x_namespace: OptionalNullable[str] = UNSET,
206
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
207
+ server_url: Optional[str] = None,
208
+ timeout_ms: Optional[int] = None,
209
+ http_headers: Optional[Mapping[str, str]] = None,
210
+ ) -> Any:
211
+ r"""Delete Feature
212
+
213
+ :param feature_id:
214
+ :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.
215
+ :param retries: Override the default retry configuration for this method
216
+ :param server_url: Override the default server URL for this method
217
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
218
+ :param http_headers: Additional headers to set or replace on requests.
219
+ """
220
+ base_url = None
221
+ url_variables = None
222
+ if timeout_ms is None:
223
+ timeout_ms = self.sdk_configuration.timeout_ms
224
+
225
+ if server_url is not None:
226
+ base_url = server_url
227
+
228
+ request = models.DeleteFeatureFeaturesFeatureIDDeleteRequest(
229
+ feature_id=feature_id,
230
+ x_namespace=x_namespace,
231
+ )
232
+
233
+ req = self.build_request(
234
+ method="DELETE",
235
+ path="/features/{feature_id}",
236
+ base_url=base_url,
237
+ url_variables=url_variables,
238
+ request=request,
239
+ request_body_required=False,
240
+ request_has_path_params=True,
241
+ request_has_query_params=False,
242
+ user_agent_header="user-agent",
243
+ accept_header_value="application/json",
244
+ http_headers=http_headers,
245
+ timeout_ms=timeout_ms,
246
+ )
247
+
248
+ if retries == UNSET:
249
+ if self.sdk_configuration.retry_config is not UNSET:
250
+ retries = self.sdk_configuration.retry_config
251
+
252
+ retry_config = None
253
+ if isinstance(retries, utils.RetryConfig):
254
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
255
+
256
+ http_res = self.do_request(
257
+ hook_ctx=HookContext(
258
+ operation_id="delete_feature_features__feature_id__delete",
259
+ oauth2_scopes=[],
260
+ security_source=None,
261
+ ),
262
+ request=req,
263
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
264
+ retry_config=retry_config,
265
+ )
266
+
267
+ data: Any = None
268
+ if utils.match_response(http_res, "200", "application/json"):
269
+ return utils.unmarshal_json(http_res.text, Any)
270
+ if utils.match_response(
271
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
272
+ ):
273
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
274
+ raise models.ErrorResponse(data=data)
275
+ if utils.match_response(http_res, "422", "application/json"):
276
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
277
+ raise models.HTTPValidationError(data=data)
278
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
279
+ http_res_text = utils.stream_to_text(http_res)
280
+ raise models.APIError(
281
+ "API error occurred", http_res.status_code, http_res_text, http_res
282
+ )
283
+
284
+ content_type = http_res.headers.get("Content-Type")
285
+ http_res_text = utils.stream_to_text(http_res)
286
+ raise models.APIError(
287
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
288
+ http_res.status_code,
289
+ http_res_text,
290
+ http_res,
291
+ )
292
+
293
+ async def delete_async(
294
+ self,
295
+ *,
296
+ feature_id: str,
297
+ x_namespace: OptionalNullable[str] = UNSET,
298
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
299
+ server_url: Optional[str] = None,
300
+ timeout_ms: Optional[int] = None,
301
+ http_headers: Optional[Mapping[str, str]] = None,
302
+ ) -> Any:
303
+ r"""Delete Feature
304
+
305
+ :param feature_id:
306
+ :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.
307
+ :param retries: Override the default retry configuration for this method
308
+ :param server_url: Override the default server URL for this method
309
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
310
+ :param http_headers: Additional headers to set or replace on requests.
311
+ """
312
+ base_url = None
313
+ url_variables = None
314
+ if timeout_ms is None:
315
+ timeout_ms = self.sdk_configuration.timeout_ms
316
+
317
+ if server_url is not None:
318
+ base_url = server_url
319
+
320
+ request = models.DeleteFeatureFeaturesFeatureIDDeleteRequest(
321
+ feature_id=feature_id,
322
+ x_namespace=x_namespace,
323
+ )
324
+
325
+ req = self.build_request_async(
326
+ method="DELETE",
327
+ path="/features/{feature_id}",
328
+ base_url=base_url,
329
+ url_variables=url_variables,
330
+ request=request,
331
+ request_body_required=False,
332
+ request_has_path_params=True,
333
+ request_has_query_params=False,
334
+ user_agent_header="user-agent",
335
+ accept_header_value="application/json",
336
+ http_headers=http_headers,
337
+ timeout_ms=timeout_ms,
338
+ )
339
+
340
+ if retries == UNSET:
341
+ if self.sdk_configuration.retry_config is not UNSET:
342
+ retries = self.sdk_configuration.retry_config
343
+
344
+ retry_config = None
345
+ if isinstance(retries, utils.RetryConfig):
346
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
347
+
348
+ http_res = await self.do_request_async(
349
+ hook_ctx=HookContext(
350
+ operation_id="delete_feature_features__feature_id__delete",
351
+ oauth2_scopes=[],
352
+ security_source=None,
353
+ ),
354
+ request=req,
355
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
356
+ retry_config=retry_config,
357
+ )
358
+
359
+ data: Any = None
360
+ if utils.match_response(http_res, "200", "application/json"):
361
+ return utils.unmarshal_json(http_res.text, Any)
362
+ if utils.match_response(
363
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
364
+ ):
365
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
366
+ raise models.ErrorResponse(data=data)
367
+ if utils.match_response(http_res, "422", "application/json"):
368
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
369
+ raise models.HTTPValidationError(data=data)
370
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
371
+ http_res_text = await utils.stream_to_text_async(http_res)
372
+ raise models.APIError(
373
+ "API error occurred", http_res.status_code, http_res_text, http_res
374
+ )
375
+
376
+ content_type = http_res.headers.get("Content-Type")
377
+ http_res_text = await utils.stream_to_text_async(http_res)
378
+ raise models.APIError(
379
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
380
+ http_res.status_code,
381
+ http_res_text,
382
+ http_res,
383
+ )
384
+
385
+ def update(
386
+ self,
387
+ *,
388
+ feature_id: str,
389
+ metadata: Union[
390
+ models.FeatureUpdateRequestMetadata,
391
+ models.FeatureUpdateRequestMetadataTypedDict,
392
+ ],
393
+ x_namespace: OptionalNullable[str] = UNSET,
394
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
395
+ server_url: Optional[str] = None,
396
+ timeout_ms: Optional[int] = None,
397
+ http_headers: Optional[Mapping[str, str]] = None,
398
+ ) -> models.FeatureResponse:
399
+ r"""Full Feature Update
400
+
401
+ :param feature_id:
402
+ :param metadata:
403
+ :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.
404
+ :param retries: Override the default retry configuration for this method
405
+ :param server_url: Override the default server URL for this method
406
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
407
+ :param http_headers: Additional headers to set or replace on requests.
408
+ """
409
+ base_url = None
410
+ url_variables = None
411
+ if timeout_ms is None:
412
+ timeout_ms = self.sdk_configuration.timeout_ms
413
+
414
+ if server_url is not None:
415
+ base_url = server_url
416
+
417
+ request = models.FullFeatureUpdateFeaturesFeatureIDPutRequest(
418
+ feature_id=feature_id,
419
+ x_namespace=x_namespace,
420
+ feature_update_request=models.FeatureUpdateRequest(
421
+ metadata=utils.get_pydantic_model(
422
+ metadata, models.FeatureUpdateRequestMetadata
423
+ ),
424
+ ),
425
+ )
426
+
427
+ req = self.build_request(
428
+ method="PUT",
429
+ path="/features/{feature_id}",
430
+ base_url=base_url,
431
+ url_variables=url_variables,
432
+ request=request,
433
+ request_body_required=True,
434
+ request_has_path_params=True,
435
+ request_has_query_params=False,
436
+ user_agent_header="user-agent",
437
+ accept_header_value="application/json",
438
+ http_headers=http_headers,
439
+ get_serialized_body=lambda: utils.serialize_request_body(
440
+ request.feature_update_request,
441
+ False,
442
+ False,
443
+ "json",
444
+ models.FeatureUpdateRequest,
445
+ ),
446
+ timeout_ms=timeout_ms,
447
+ )
448
+
449
+ if retries == UNSET:
450
+ if self.sdk_configuration.retry_config is not UNSET:
451
+ retries = self.sdk_configuration.retry_config
452
+
453
+ retry_config = None
454
+ if isinstance(retries, utils.RetryConfig):
455
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
456
+
457
+ http_res = self.do_request(
458
+ hook_ctx=HookContext(
459
+ operation_id="full_feature_update_features__feature_id__put",
460
+ oauth2_scopes=[],
461
+ security_source=None,
462
+ ),
463
+ request=req,
464
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
465
+ retry_config=retry_config,
466
+ )
467
+
468
+ data: Any = None
469
+ if utils.match_response(http_res, "200", "application/json"):
470
+ return utils.unmarshal_json(http_res.text, models.FeatureResponse)
471
+ if utils.match_response(
472
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
473
+ ):
474
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
475
+ raise models.ErrorResponse(data=data)
476
+ if utils.match_response(http_res, "422", "application/json"):
477
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
478
+ raise models.HTTPValidationError(data=data)
479
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
480
+ http_res_text = utils.stream_to_text(http_res)
481
+ raise models.APIError(
482
+ "API error occurred", http_res.status_code, http_res_text, http_res
483
+ )
484
+
485
+ content_type = http_res.headers.get("Content-Type")
486
+ http_res_text = utils.stream_to_text(http_res)
487
+ raise models.APIError(
488
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
489
+ http_res.status_code,
490
+ http_res_text,
491
+ http_res,
492
+ )
493
+
494
+ async def update_async(
495
+ self,
496
+ *,
497
+ feature_id: str,
498
+ metadata: Union[
499
+ models.FeatureUpdateRequestMetadata,
500
+ models.FeatureUpdateRequestMetadataTypedDict,
501
+ ],
502
+ x_namespace: OptionalNullable[str] = UNSET,
503
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
504
+ server_url: Optional[str] = None,
505
+ timeout_ms: Optional[int] = None,
506
+ http_headers: Optional[Mapping[str, str]] = None,
507
+ ) -> models.FeatureResponse:
508
+ r"""Full Feature Update
509
+
510
+ :param feature_id:
511
+ :param metadata:
512
+ :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.
513
+ :param retries: Override the default retry configuration for this method
514
+ :param server_url: Override the default server URL for this method
515
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
516
+ :param http_headers: Additional headers to set or replace on requests.
517
+ """
518
+ base_url = None
519
+ url_variables = None
520
+ if timeout_ms is None:
521
+ timeout_ms = self.sdk_configuration.timeout_ms
522
+
523
+ if server_url is not None:
524
+ base_url = server_url
525
+
526
+ request = models.FullFeatureUpdateFeaturesFeatureIDPutRequest(
527
+ feature_id=feature_id,
528
+ x_namespace=x_namespace,
529
+ feature_update_request=models.FeatureUpdateRequest(
530
+ metadata=utils.get_pydantic_model(
531
+ metadata, models.FeatureUpdateRequestMetadata
532
+ ),
533
+ ),
534
+ )
535
+
536
+ req = self.build_request_async(
537
+ method="PUT",
538
+ path="/features/{feature_id}",
539
+ base_url=base_url,
540
+ url_variables=url_variables,
541
+ request=request,
542
+ request_body_required=True,
543
+ request_has_path_params=True,
544
+ request_has_query_params=False,
545
+ user_agent_header="user-agent",
546
+ accept_header_value="application/json",
547
+ http_headers=http_headers,
548
+ get_serialized_body=lambda: utils.serialize_request_body(
549
+ request.feature_update_request,
550
+ False,
551
+ False,
552
+ "json",
553
+ models.FeatureUpdateRequest,
554
+ ),
555
+ timeout_ms=timeout_ms,
556
+ )
557
+
558
+ if retries == UNSET:
559
+ if self.sdk_configuration.retry_config is not UNSET:
560
+ retries = self.sdk_configuration.retry_config
561
+
562
+ retry_config = None
563
+ if isinstance(retries, utils.RetryConfig):
564
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
565
+
566
+ http_res = await self.do_request_async(
567
+ hook_ctx=HookContext(
568
+ operation_id="full_feature_update_features__feature_id__put",
569
+ oauth2_scopes=[],
570
+ security_source=None,
571
+ ),
572
+ request=req,
573
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
574
+ retry_config=retry_config,
575
+ )
576
+
577
+ data: Any = None
578
+ if utils.match_response(http_res, "200", "application/json"):
579
+ return utils.unmarshal_json(http_res.text, models.FeatureResponse)
580
+ if utils.match_response(
581
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
582
+ ):
583
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
584
+ raise models.ErrorResponse(data=data)
585
+ if utils.match_response(http_res, "422", "application/json"):
586
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
587
+ raise models.HTTPValidationError(data=data)
588
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
589
+ http_res_text = await utils.stream_to_text_async(http_res)
590
+ raise models.APIError(
591
+ "API error occurred", http_res.status_code, http_res_text, http_res
592
+ )
593
+
594
+ content_type = http_res.headers.get("Content-Type")
595
+ http_res_text = await utils.stream_to_text_async(http_res)
596
+ raise models.APIError(
597
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
598
+ http_res.status_code,
599
+ http_res_text,
600
+ http_res,
601
+ )
602
+
603
+ def list(
604
+ self,
605
+ *,
606
+ collections: List[str],
607
+ offset_feature_id: OptionalNullable[str] = UNSET,
608
+ page_size: Optional[int] = 10,
609
+ x_namespace: OptionalNullable[str] = UNSET,
610
+ filters: OptionalNullable[
611
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
612
+ ] = UNSET,
613
+ sort: OptionalNullable[
614
+ Union[models.SortOption, models.SortOptionTypedDict]
615
+ ] = UNSET,
616
+ select: OptionalNullable[List[Any]] = UNSET,
617
+ return_urls: Optional[bool] = False,
618
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
619
+ server_url: Optional[str] = None,
620
+ timeout_ms: Optional[int] = None,
621
+ http_headers: Optional[Mapping[str, str]] = None,
622
+ ) -> models.ListFeaturesResponse:
623
+ r"""List Features
624
+
625
+ Retrieves a list of features based on
626
+ the provided filters and sorting criteria.
627
+ If you provide a sort, then pagination isn't supported.
628
+
629
+ :param collections: Collection identifiers - can be either collection IDs or collection names
630
+ :param offset_feature_id: The offset id to start returning results from. Used for pagination
631
+ :param page_size:
632
+ :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.
633
+ :param filters: Complex nested query filters
634
+ :param sort: List of fields to sort by, with direction (asc or desc). NOTE: fields will require a specialty index to use this, consult with the team.
635
+ :param select: List of fields to return in results, supports dot notation. Everything else is excluded.
636
+ :param return_urls: When true, generates presigned URLs for assets
637
+ :param retries: Override the default retry configuration for this method
638
+ :param server_url: Override the default server URL for this method
639
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
640
+ :param http_headers: Additional headers to set or replace on requests.
641
+ """
642
+ base_url = None
643
+ url_variables = None
644
+ if timeout_ms is None:
645
+ timeout_ms = self.sdk_configuration.timeout_ms
646
+
647
+ if server_url is not None:
648
+ base_url = server_url
649
+
650
+ request = models.ListFeaturesFeaturesPostRequest(
651
+ offset_feature_id=offset_feature_id,
652
+ page_size=page_size,
653
+ x_namespace=x_namespace,
654
+ list_features_request=models.ListFeaturesRequest(
655
+ collections=collections,
656
+ filters=utils.get_pydantic_model(
657
+ filters, OptionalNullable[models.LogicalOperatorInput]
658
+ ),
659
+ sort=utils.get_pydantic_model(
660
+ sort, OptionalNullable[models.SortOption]
661
+ ),
662
+ select=select,
663
+ return_urls=return_urls,
664
+ ),
665
+ )
666
+
667
+ req = self.build_request(
668
+ method="POST",
669
+ path="/features",
670
+ base_url=base_url,
671
+ url_variables=url_variables,
672
+ request=request,
673
+ request_body_required=True,
674
+ request_has_path_params=False,
675
+ request_has_query_params=True,
676
+ user_agent_header="user-agent",
677
+ accept_header_value="application/json",
678
+ http_headers=http_headers,
679
+ get_serialized_body=lambda: utils.serialize_request_body(
680
+ request.list_features_request,
681
+ False,
682
+ False,
683
+ "json",
684
+ models.ListFeaturesRequest,
685
+ ),
686
+ timeout_ms=timeout_ms,
687
+ )
688
+
689
+ if retries == UNSET:
690
+ if self.sdk_configuration.retry_config is not UNSET:
691
+ retries = self.sdk_configuration.retry_config
692
+
693
+ retry_config = None
694
+ if isinstance(retries, utils.RetryConfig):
695
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
696
+
697
+ http_res = self.do_request(
698
+ hook_ctx=HookContext(
699
+ operation_id="list_features_features_post",
700
+ oauth2_scopes=[],
701
+ security_source=None,
702
+ ),
703
+ request=req,
704
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
705
+ retry_config=retry_config,
706
+ )
707
+
708
+ data: Any = None
709
+ if utils.match_response(http_res, "200", "application/json"):
710
+ return utils.unmarshal_json(http_res.text, models.ListFeaturesResponse)
711
+ if utils.match_response(
712
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
713
+ ):
714
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
715
+ raise models.ErrorResponse(data=data)
716
+ if utils.match_response(http_res, "422", "application/json"):
717
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
718
+ raise models.HTTPValidationError(data=data)
719
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
720
+ http_res_text = utils.stream_to_text(http_res)
721
+ raise models.APIError(
722
+ "API error occurred", http_res.status_code, http_res_text, http_res
723
+ )
724
+
725
+ content_type = http_res.headers.get("Content-Type")
726
+ http_res_text = utils.stream_to_text(http_res)
727
+ raise models.APIError(
728
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
729
+ http_res.status_code,
730
+ http_res_text,
731
+ http_res,
732
+ )
733
+
734
+ async def list_async(
735
+ self,
736
+ *,
737
+ collections: List[str],
738
+ offset_feature_id: OptionalNullable[str] = UNSET,
739
+ page_size: Optional[int] = 10,
740
+ x_namespace: OptionalNullable[str] = UNSET,
741
+ filters: OptionalNullable[
742
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
743
+ ] = UNSET,
744
+ sort: OptionalNullable[
745
+ Union[models.SortOption, models.SortOptionTypedDict]
746
+ ] = UNSET,
747
+ select: OptionalNullable[List[Any]] = UNSET,
748
+ return_urls: Optional[bool] = False,
749
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
750
+ server_url: Optional[str] = None,
751
+ timeout_ms: Optional[int] = None,
752
+ http_headers: Optional[Mapping[str, str]] = None,
753
+ ) -> models.ListFeaturesResponse:
754
+ r"""List Features
755
+
756
+ Retrieves a list of features based on
757
+ the provided filters and sorting criteria.
758
+ If you provide a sort, then pagination isn't supported.
759
+
760
+ :param collections: Collection identifiers - can be either collection IDs or collection names
761
+ :param offset_feature_id: The offset id to start returning results from. Used for pagination
762
+ :param page_size:
763
+ :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.
764
+ :param filters: Complex nested query filters
765
+ :param sort: List of fields to sort by, with direction (asc or desc). NOTE: fields will require a specialty index to use this, consult with the team.
766
+ :param select: List of fields to return in results, supports dot notation. Everything else is excluded.
767
+ :param return_urls: When true, generates presigned URLs for assets
768
+ :param retries: Override the default retry configuration for this method
769
+ :param server_url: Override the default server URL for this method
770
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
771
+ :param http_headers: Additional headers to set or replace on requests.
772
+ """
773
+ base_url = None
774
+ url_variables = None
775
+ if timeout_ms is None:
776
+ timeout_ms = self.sdk_configuration.timeout_ms
777
+
778
+ if server_url is not None:
779
+ base_url = server_url
780
+
781
+ request = models.ListFeaturesFeaturesPostRequest(
782
+ offset_feature_id=offset_feature_id,
783
+ page_size=page_size,
784
+ x_namespace=x_namespace,
785
+ list_features_request=models.ListFeaturesRequest(
786
+ collections=collections,
787
+ filters=utils.get_pydantic_model(
788
+ filters, OptionalNullable[models.LogicalOperatorInput]
789
+ ),
790
+ sort=utils.get_pydantic_model(
791
+ sort, OptionalNullable[models.SortOption]
792
+ ),
793
+ select=select,
794
+ return_urls=return_urls,
795
+ ),
796
+ )
797
+
798
+ req = self.build_request_async(
799
+ method="POST",
800
+ path="/features",
801
+ base_url=base_url,
802
+ url_variables=url_variables,
803
+ request=request,
804
+ request_body_required=True,
805
+ request_has_path_params=False,
806
+ request_has_query_params=True,
807
+ user_agent_header="user-agent",
808
+ accept_header_value="application/json",
809
+ http_headers=http_headers,
810
+ get_serialized_body=lambda: utils.serialize_request_body(
811
+ request.list_features_request,
812
+ False,
813
+ False,
814
+ "json",
815
+ models.ListFeaturesRequest,
816
+ ),
817
+ timeout_ms=timeout_ms,
818
+ )
819
+
820
+ if retries == UNSET:
821
+ if self.sdk_configuration.retry_config is not UNSET:
822
+ retries = self.sdk_configuration.retry_config
823
+
824
+ retry_config = None
825
+ if isinstance(retries, utils.RetryConfig):
826
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
827
+
828
+ http_res = await self.do_request_async(
829
+ hook_ctx=HookContext(
830
+ operation_id="list_features_features_post",
831
+ oauth2_scopes=[],
832
+ security_source=None,
833
+ ),
834
+ request=req,
835
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
836
+ retry_config=retry_config,
837
+ )
838
+
839
+ data: Any = None
840
+ if utils.match_response(http_res, "200", "application/json"):
841
+ return utils.unmarshal_json(http_res.text, models.ListFeaturesResponse)
842
+ if utils.match_response(
843
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
844
+ ):
845
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
846
+ raise models.ErrorResponse(data=data)
847
+ if utils.match_response(http_res, "422", "application/json"):
848
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
849
+ raise models.HTTPValidationError(data=data)
850
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
851
+ http_res_text = await utils.stream_to_text_async(http_res)
852
+ raise models.APIError(
853
+ "API error occurred", http_res.status_code, http_res_text, http_res
854
+ )
855
+
856
+ content_type = http_res.headers.get("Content-Type")
857
+ http_res_text = await utils.stream_to_text_async(http_res)
858
+ raise models.APIError(
859
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
860
+ http_res.status_code,
861
+ http_res_text,
862
+ http_res,
863
+ )
864
+
865
+ def search(
866
+ self,
867
+ *,
868
+ queries: Union[
869
+ List[models.SearchModelSearchQueryInput],
870
+ List[models.SearchModelSearchQueryInputTypedDict],
871
+ ],
872
+ collections: List[str],
873
+ offset_position: OptionalNullable[int] = UNSET,
874
+ page_size: Optional[int] = 10,
875
+ x_namespace: OptionalNullable[str] = UNSET,
876
+ filters: OptionalNullable[
877
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
878
+ ] = UNSET,
879
+ group_by: OptionalNullable[
880
+ Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
881
+ ] = UNSET,
882
+ sort: OptionalNullable[
883
+ Union[models.SortOption, models.SortOptionTypedDict]
884
+ ] = UNSET,
885
+ select: OptionalNullable[List[str]] = UNSET,
886
+ reranking_options: OptionalNullable[
887
+ Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
888
+ ] = UNSET,
889
+ session_id: OptionalNullable[str] = UNSET,
890
+ return_url: OptionalNullable[bool] = UNSET,
891
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
892
+ server_url: Optional[str] = None,
893
+ timeout_ms: Optional[int] = None,
894
+ http_headers: Optional[Mapping[str, str]] = None,
895
+ ) -> (
896
+ models.SearchFeaturesFeaturesSearchPostResponseSearchFeaturesFeaturesSearchPost
897
+ ):
898
+ r"""Search Features
899
+
900
+ This endpoint allows you to search features.
901
+
902
+ :param queries: List of search queries to perform. Behavior: - Single query: Results are returned directly from that query - Multiple queries: Results are combined using Reciprocal Rank Fusion (RRF) RRF combines results from multiple queries by: 1. Taking each item's rank position in each result list 2. Re-ranking all items by their combined RRF scores When merging lists from different sources, RRF considers all items that appear in any of the input lists, not just items that appear in all lists. This helps surface items that rank well across multiple queries while reducing the impact of outlier high rankings in single queries. NOTE: If query array is empty, it will return all features.
903
+ :param collections: List of Collection names to search within, required
904
+ :param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
905
+ :param page_size: Number of results to return per page.
906
+ :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.
907
+ :param filters: Used for filtering across all indexes
908
+ :param group_by: Grouping options for search results
909
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
910
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
911
+ :param reranking_options: Options for ranking the search results, including weights and feedback application
912
+ :param session_id: Identifier for tracking search session interactions
913
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
914
+ :param retries: Override the default retry configuration for this method
915
+ :param server_url: Override the default server URL for this method
916
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
917
+ :param http_headers: Additional headers to set or replace on requests.
918
+ """
919
+ base_url = None
920
+ url_variables = None
921
+ if timeout_ms is None:
922
+ timeout_ms = self.sdk_configuration.timeout_ms
923
+
924
+ if server_url is not None:
925
+ base_url = server_url
926
+
927
+ request = models.SearchFeaturesFeaturesSearchPostRequest(
928
+ offset_position=offset_position,
929
+ page_size=page_size,
930
+ x_namespace=x_namespace,
931
+ search_request_features_input=models.SearchRequestFeaturesInput(
932
+ queries=utils.get_pydantic_model(
933
+ queries, List[models.SearchModelSearchQueryInput]
934
+ ),
935
+ collections=collections,
936
+ filters=utils.get_pydantic_model(
937
+ filters, OptionalNullable[models.LogicalOperatorInput]
938
+ ),
939
+ group_by=utils.get_pydantic_model(
940
+ group_by, OptionalNullable[models.GroupByOptions]
941
+ ),
942
+ sort=utils.get_pydantic_model(
943
+ sort, OptionalNullable[models.SortOption]
944
+ ),
945
+ select=select,
946
+ reranking_options=utils.get_pydantic_model(
947
+ reranking_options, OptionalNullable[models.RerankingOptions]
948
+ ),
949
+ session_id=session_id,
950
+ return_url=return_url,
951
+ ),
952
+ )
953
+
954
+ req = self.build_request(
955
+ method="POST",
956
+ path="/features/search",
957
+ base_url=base_url,
958
+ url_variables=url_variables,
959
+ request=request,
960
+ request_body_required=True,
961
+ request_has_path_params=False,
962
+ request_has_query_params=True,
963
+ user_agent_header="user-agent",
964
+ accept_header_value="application/json",
965
+ http_headers=http_headers,
966
+ get_serialized_body=lambda: utils.serialize_request_body(
967
+ request.search_request_features_input,
968
+ False,
969
+ False,
970
+ "json",
971
+ models.SearchRequestFeaturesInput,
972
+ ),
973
+ timeout_ms=timeout_ms,
974
+ )
975
+
976
+ if retries == UNSET:
977
+ if self.sdk_configuration.retry_config is not UNSET:
978
+ retries = self.sdk_configuration.retry_config
979
+
980
+ retry_config = None
981
+ if isinstance(retries, utils.RetryConfig):
982
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
983
+
984
+ http_res = self.do_request(
985
+ hook_ctx=HookContext(
986
+ operation_id="search_features_features_search_post",
987
+ oauth2_scopes=[],
988
+ security_source=None,
989
+ ),
990
+ request=req,
991
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
992
+ retry_config=retry_config,
993
+ )
994
+
995
+ data: Any = None
996
+ if utils.match_response(http_res, "200", "application/json"):
997
+ return utils.unmarshal_json(
998
+ http_res.text,
999
+ models.SearchFeaturesFeaturesSearchPostResponseSearchFeaturesFeaturesSearchPost,
1000
+ )
1001
+ if utils.match_response(
1002
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1003
+ ):
1004
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1005
+ raise models.ErrorResponse(data=data)
1006
+ if utils.match_response(http_res, "422", "application/json"):
1007
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1008
+ raise models.HTTPValidationError(data=data)
1009
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1010
+ http_res_text = utils.stream_to_text(http_res)
1011
+ raise models.APIError(
1012
+ "API error occurred", http_res.status_code, http_res_text, http_res
1013
+ )
1014
+
1015
+ content_type = http_res.headers.get("Content-Type")
1016
+ http_res_text = utils.stream_to_text(http_res)
1017
+ raise models.APIError(
1018
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1019
+ http_res.status_code,
1020
+ http_res_text,
1021
+ http_res,
1022
+ )
1023
+
1024
+ async def search_async(
1025
+ self,
1026
+ *,
1027
+ queries: Union[
1028
+ List[models.SearchModelSearchQueryInput],
1029
+ List[models.SearchModelSearchQueryInputTypedDict],
1030
+ ],
1031
+ collections: List[str],
1032
+ offset_position: OptionalNullable[int] = UNSET,
1033
+ page_size: Optional[int] = 10,
1034
+ x_namespace: OptionalNullable[str] = UNSET,
1035
+ filters: OptionalNullable[
1036
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
1037
+ ] = UNSET,
1038
+ group_by: OptionalNullable[
1039
+ Union[models.GroupByOptions, models.GroupByOptionsTypedDict]
1040
+ ] = UNSET,
1041
+ sort: OptionalNullable[
1042
+ Union[models.SortOption, models.SortOptionTypedDict]
1043
+ ] = UNSET,
1044
+ select: OptionalNullable[List[str]] = UNSET,
1045
+ reranking_options: OptionalNullable[
1046
+ Union[models.RerankingOptions, models.RerankingOptionsTypedDict]
1047
+ ] = UNSET,
1048
+ session_id: OptionalNullable[str] = UNSET,
1049
+ return_url: OptionalNullable[bool] = UNSET,
1050
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1051
+ server_url: Optional[str] = None,
1052
+ timeout_ms: Optional[int] = None,
1053
+ http_headers: Optional[Mapping[str, str]] = None,
1054
+ ) -> (
1055
+ models.SearchFeaturesFeaturesSearchPostResponseSearchFeaturesFeaturesSearchPost
1056
+ ):
1057
+ r"""Search Features
1058
+
1059
+ This endpoint allows you to search features.
1060
+
1061
+ :param queries: List of search queries to perform. Behavior: - Single query: Results are returned directly from that query - Multiple queries: Results are combined using Reciprocal Rank Fusion (RRF) RRF combines results from multiple queries by: 1. Taking each item's rank position in each result list 2. Re-ranking all items by their combined RRF scores When merging lists from different sources, RRF considers all items that appear in any of the input lists, not just items that appear in all lists. This helps surface items that rank well across multiple queries while reducing the impact of outlier high rankings in single queries. NOTE: If query array is empty, it will return all features.
1062
+ :param collections: List of Collection names to search within, required
1063
+ :param offset_position: The position to start returning results from. Used for pagination. Does not work with group_by
1064
+ :param page_size: Number of results to return per page.
1065
+ :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.
1066
+ :param filters: Used for filtering across all indexes
1067
+ :param group_by: Grouping options for search results
1068
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
1069
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
1070
+ :param reranking_options: Options for ranking the search results, including weights and feedback application
1071
+ :param session_id: Identifier for tracking search session interactions
1072
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
1073
+ :param retries: Override the default retry configuration for this method
1074
+ :param server_url: Override the default server URL for this method
1075
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1076
+ :param http_headers: Additional headers to set or replace on requests.
1077
+ """
1078
+ base_url = None
1079
+ url_variables = None
1080
+ if timeout_ms is None:
1081
+ timeout_ms = self.sdk_configuration.timeout_ms
1082
+
1083
+ if server_url is not None:
1084
+ base_url = server_url
1085
+
1086
+ request = models.SearchFeaturesFeaturesSearchPostRequest(
1087
+ offset_position=offset_position,
1088
+ page_size=page_size,
1089
+ x_namespace=x_namespace,
1090
+ search_request_features_input=models.SearchRequestFeaturesInput(
1091
+ queries=utils.get_pydantic_model(
1092
+ queries, List[models.SearchModelSearchQueryInput]
1093
+ ),
1094
+ collections=collections,
1095
+ filters=utils.get_pydantic_model(
1096
+ filters, OptionalNullable[models.LogicalOperatorInput]
1097
+ ),
1098
+ group_by=utils.get_pydantic_model(
1099
+ group_by, OptionalNullable[models.GroupByOptions]
1100
+ ),
1101
+ sort=utils.get_pydantic_model(
1102
+ sort, OptionalNullable[models.SortOption]
1103
+ ),
1104
+ select=select,
1105
+ reranking_options=utils.get_pydantic_model(
1106
+ reranking_options, OptionalNullable[models.RerankingOptions]
1107
+ ),
1108
+ session_id=session_id,
1109
+ return_url=return_url,
1110
+ ),
1111
+ )
1112
+
1113
+ req = self.build_request_async(
1114
+ method="POST",
1115
+ path="/features/search",
1116
+ base_url=base_url,
1117
+ url_variables=url_variables,
1118
+ request=request,
1119
+ request_body_required=True,
1120
+ request_has_path_params=False,
1121
+ request_has_query_params=True,
1122
+ user_agent_header="user-agent",
1123
+ accept_header_value="application/json",
1124
+ http_headers=http_headers,
1125
+ get_serialized_body=lambda: utils.serialize_request_body(
1126
+ request.search_request_features_input,
1127
+ False,
1128
+ False,
1129
+ "json",
1130
+ models.SearchRequestFeaturesInput,
1131
+ ),
1132
+ timeout_ms=timeout_ms,
1133
+ )
1134
+
1135
+ if retries == UNSET:
1136
+ if self.sdk_configuration.retry_config is not UNSET:
1137
+ retries = self.sdk_configuration.retry_config
1138
+
1139
+ retry_config = None
1140
+ if isinstance(retries, utils.RetryConfig):
1141
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1142
+
1143
+ http_res = await self.do_request_async(
1144
+ hook_ctx=HookContext(
1145
+ operation_id="search_features_features_search_post",
1146
+ oauth2_scopes=[],
1147
+ security_source=None,
1148
+ ),
1149
+ request=req,
1150
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1151
+ retry_config=retry_config,
1152
+ )
1153
+
1154
+ data: Any = None
1155
+ if utils.match_response(http_res, "200", "application/json"):
1156
+ return utils.unmarshal_json(
1157
+ http_res.text,
1158
+ models.SearchFeaturesFeaturesSearchPostResponseSearchFeaturesFeaturesSearchPost,
1159
+ )
1160
+ if utils.match_response(
1161
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1162
+ ):
1163
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1164
+ raise models.ErrorResponse(data=data)
1165
+ if utils.match_response(http_res, "422", "application/json"):
1166
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1167
+ raise models.HTTPValidationError(data=data)
1168
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1169
+ http_res_text = await utils.stream_to_text_async(http_res)
1170
+ raise models.APIError(
1171
+ "API error occurred", http_res.status_code, http_res_text, http_res
1172
+ )
1173
+
1174
+ content_type = http_res.headers.get("Content-Type")
1175
+ http_res_text = await utils.stream_to_text_async(http_res)
1176
+ raise models.APIError(
1177
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1178
+ http_res.status_code,
1179
+ http_res_text,
1180
+ http_res,
1181
+ )