mixpeek 0.12.0__py3-none-any.whl → 0.13.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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.1.dist-info/METADATA +427 -0
  174. mixpeek-0.13.1.dist-info/RECORD +176 -0
  175. {mixpeek-0.12.0.dist-info → mixpeek-0.13.1.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/assets.py ADDED
@@ -0,0 +1,1561 @@
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 Assets(BaseSDK):
11
+ def get(
12
+ self,
13
+ *,
14
+ asset_id: str,
15
+ return_url: Optional[bool] = True,
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.AssetResponse:
22
+ r"""Get Asset
23
+
24
+ Get basic asset details
25
+
26
+ :param asset_id: Unique identifier of the asset
27
+ :param return_url: Whether to generate and return presigned S3 URLs for the asset and preview. Set to false to improve performance when URLs aren't needed
28
+ :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.
29
+ :param retries: Override the default retry configuration for this method
30
+ :param server_url: Override the default server URL for this method
31
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
32
+ :param http_headers: Additional headers to set or replace on requests.
33
+ """
34
+ base_url = None
35
+ url_variables = None
36
+ if timeout_ms is None:
37
+ timeout_ms = self.sdk_configuration.timeout_ms
38
+
39
+ if server_url is not None:
40
+ base_url = server_url
41
+
42
+ request = models.GetAssetAssetsAssetIDGetRequest(
43
+ asset_id=asset_id,
44
+ return_url=return_url,
45
+ x_namespace=x_namespace,
46
+ )
47
+
48
+ req = self.build_request(
49
+ method="GET",
50
+ path="/assets/{asset_id}",
51
+ base_url=base_url,
52
+ url_variables=url_variables,
53
+ request=request,
54
+ request_body_required=False,
55
+ request_has_path_params=True,
56
+ request_has_query_params=True,
57
+ user_agent_header="user-agent",
58
+ accept_header_value="application/json",
59
+ http_headers=http_headers,
60
+ timeout_ms=timeout_ms,
61
+ )
62
+
63
+ if retries == UNSET:
64
+ if self.sdk_configuration.retry_config is not UNSET:
65
+ retries = self.sdk_configuration.retry_config
66
+
67
+ retry_config = None
68
+ if isinstance(retries, utils.RetryConfig):
69
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
70
+
71
+ http_res = self.do_request(
72
+ hook_ctx=HookContext(
73
+ operation_id="get_asset_assets__asset_id__get",
74
+ oauth2_scopes=[],
75
+ security_source=None,
76
+ ),
77
+ request=req,
78
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
79
+ retry_config=retry_config,
80
+ )
81
+
82
+ data: Any = None
83
+ if utils.match_response(http_res, "200", "application/json"):
84
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
85
+ if utils.match_response(
86
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
87
+ ):
88
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
89
+ raise models.ErrorResponse(data=data)
90
+ if utils.match_response(http_res, "422", "application/json"):
91
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
92
+ raise models.HTTPValidationError(data=data)
93
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
94
+ http_res_text = utils.stream_to_text(http_res)
95
+ raise models.APIError(
96
+ "API error occurred", http_res.status_code, http_res_text, http_res
97
+ )
98
+
99
+ content_type = http_res.headers.get("Content-Type")
100
+ http_res_text = utils.stream_to_text(http_res)
101
+ raise models.APIError(
102
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
103
+ http_res.status_code,
104
+ http_res_text,
105
+ http_res,
106
+ )
107
+
108
+ async def get_async(
109
+ self,
110
+ *,
111
+ asset_id: str,
112
+ return_url: Optional[bool] = True,
113
+ x_namespace: OptionalNullable[str] = UNSET,
114
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
115
+ server_url: Optional[str] = None,
116
+ timeout_ms: Optional[int] = None,
117
+ http_headers: Optional[Mapping[str, str]] = None,
118
+ ) -> models.AssetResponse:
119
+ r"""Get Asset
120
+
121
+ Get basic asset details
122
+
123
+ :param asset_id: Unique identifier of the asset
124
+ :param return_url: Whether to generate and return presigned S3 URLs for the asset and preview. Set to false to improve performance when URLs aren't needed
125
+ :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.
126
+ :param retries: Override the default retry configuration for this method
127
+ :param server_url: Override the default server URL for this method
128
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
129
+ :param http_headers: Additional headers to set or replace on requests.
130
+ """
131
+ base_url = None
132
+ url_variables = None
133
+ if timeout_ms is None:
134
+ timeout_ms = self.sdk_configuration.timeout_ms
135
+
136
+ if server_url is not None:
137
+ base_url = server_url
138
+
139
+ request = models.GetAssetAssetsAssetIDGetRequest(
140
+ asset_id=asset_id,
141
+ return_url=return_url,
142
+ x_namespace=x_namespace,
143
+ )
144
+
145
+ req = self.build_request_async(
146
+ method="GET",
147
+ path="/assets/{asset_id}",
148
+ base_url=base_url,
149
+ url_variables=url_variables,
150
+ request=request,
151
+ request_body_required=False,
152
+ request_has_path_params=True,
153
+ request_has_query_params=True,
154
+ user_agent_header="user-agent",
155
+ accept_header_value="application/json",
156
+ http_headers=http_headers,
157
+ timeout_ms=timeout_ms,
158
+ )
159
+
160
+ if retries == UNSET:
161
+ if self.sdk_configuration.retry_config is not UNSET:
162
+ retries = self.sdk_configuration.retry_config
163
+
164
+ retry_config = None
165
+ if isinstance(retries, utils.RetryConfig):
166
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
167
+
168
+ http_res = await self.do_request_async(
169
+ hook_ctx=HookContext(
170
+ operation_id="get_asset_assets__asset_id__get",
171
+ oauth2_scopes=[],
172
+ security_source=None,
173
+ ),
174
+ request=req,
175
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
176
+ retry_config=retry_config,
177
+ )
178
+
179
+ data: Any = None
180
+ if utils.match_response(http_res, "200", "application/json"):
181
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
182
+ if utils.match_response(
183
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
184
+ ):
185
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
186
+ raise models.ErrorResponse(data=data)
187
+ if utils.match_response(http_res, "422", "application/json"):
188
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
189
+ raise models.HTTPValidationError(data=data)
190
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
191
+ http_res_text = await utils.stream_to_text_async(http_res)
192
+ raise models.APIError(
193
+ "API error occurred", http_res.status_code, http_res_text, http_res
194
+ )
195
+
196
+ content_type = http_res.headers.get("Content-Type")
197
+ http_res_text = await utils.stream_to_text_async(http_res)
198
+ raise models.APIError(
199
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
200
+ http_res.status_code,
201
+ http_res_text,
202
+ http_res,
203
+ )
204
+
205
+ def delete(
206
+ self,
207
+ *,
208
+ asset_id: str,
209
+ x_namespace: OptionalNullable[str] = UNSET,
210
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
211
+ server_url: Optional[str] = None,
212
+ timeout_ms: Optional[int] = None,
213
+ http_headers: Optional[Mapping[str, str]] = None,
214
+ ) -> Any:
215
+ r"""Delete Asset
216
+
217
+ :param asset_id:
218
+ :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.
219
+ :param retries: Override the default retry configuration for this method
220
+ :param server_url: Override the default server URL for this method
221
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
222
+ :param http_headers: Additional headers to set or replace on requests.
223
+ """
224
+ base_url = None
225
+ url_variables = None
226
+ if timeout_ms is None:
227
+ timeout_ms = self.sdk_configuration.timeout_ms
228
+
229
+ if server_url is not None:
230
+ base_url = server_url
231
+
232
+ request = models.DeleteAssetAssetsAssetIDDeleteRequest(
233
+ asset_id=asset_id,
234
+ x_namespace=x_namespace,
235
+ )
236
+
237
+ req = self.build_request(
238
+ method="DELETE",
239
+ path="/assets/{asset_id}",
240
+ base_url=base_url,
241
+ url_variables=url_variables,
242
+ request=request,
243
+ request_body_required=False,
244
+ request_has_path_params=True,
245
+ request_has_query_params=False,
246
+ user_agent_header="user-agent",
247
+ accept_header_value="application/json",
248
+ http_headers=http_headers,
249
+ timeout_ms=timeout_ms,
250
+ )
251
+
252
+ if retries == UNSET:
253
+ if self.sdk_configuration.retry_config is not UNSET:
254
+ retries = self.sdk_configuration.retry_config
255
+
256
+ retry_config = None
257
+ if isinstance(retries, utils.RetryConfig):
258
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
259
+
260
+ http_res = self.do_request(
261
+ hook_ctx=HookContext(
262
+ operation_id="delete_asset_assets__asset_id__delete",
263
+ oauth2_scopes=[],
264
+ security_source=None,
265
+ ),
266
+ request=req,
267
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
268
+ retry_config=retry_config,
269
+ )
270
+
271
+ data: Any = None
272
+ if utils.match_response(http_res, "200", "application/json"):
273
+ return utils.unmarshal_json(http_res.text, Any)
274
+ if utils.match_response(
275
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
276
+ ):
277
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
278
+ raise models.ErrorResponse(data=data)
279
+ if utils.match_response(http_res, "422", "application/json"):
280
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
281
+ raise models.HTTPValidationError(data=data)
282
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
283
+ http_res_text = utils.stream_to_text(http_res)
284
+ raise models.APIError(
285
+ "API error occurred", http_res.status_code, http_res_text, http_res
286
+ )
287
+
288
+ content_type = http_res.headers.get("Content-Type")
289
+ http_res_text = utils.stream_to_text(http_res)
290
+ raise models.APIError(
291
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
292
+ http_res.status_code,
293
+ http_res_text,
294
+ http_res,
295
+ )
296
+
297
+ async def delete_async(
298
+ self,
299
+ *,
300
+ asset_id: str,
301
+ x_namespace: OptionalNullable[str] = UNSET,
302
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
303
+ server_url: Optional[str] = None,
304
+ timeout_ms: Optional[int] = None,
305
+ http_headers: Optional[Mapping[str, str]] = None,
306
+ ) -> Any:
307
+ r"""Delete Asset
308
+
309
+ :param asset_id:
310
+ :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.
311
+ :param retries: Override the default retry configuration for this method
312
+ :param server_url: Override the default server URL for this method
313
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
314
+ :param http_headers: Additional headers to set or replace on requests.
315
+ """
316
+ base_url = None
317
+ url_variables = None
318
+ if timeout_ms is None:
319
+ timeout_ms = self.sdk_configuration.timeout_ms
320
+
321
+ if server_url is not None:
322
+ base_url = server_url
323
+
324
+ request = models.DeleteAssetAssetsAssetIDDeleteRequest(
325
+ asset_id=asset_id,
326
+ x_namespace=x_namespace,
327
+ )
328
+
329
+ req = self.build_request_async(
330
+ method="DELETE",
331
+ path="/assets/{asset_id}",
332
+ base_url=base_url,
333
+ url_variables=url_variables,
334
+ request=request,
335
+ request_body_required=False,
336
+ request_has_path_params=True,
337
+ request_has_query_params=False,
338
+ user_agent_header="user-agent",
339
+ accept_header_value="application/json",
340
+ http_headers=http_headers,
341
+ timeout_ms=timeout_ms,
342
+ )
343
+
344
+ if retries == UNSET:
345
+ if self.sdk_configuration.retry_config is not UNSET:
346
+ retries = self.sdk_configuration.retry_config
347
+
348
+ retry_config = None
349
+ if isinstance(retries, utils.RetryConfig):
350
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
351
+
352
+ http_res = await self.do_request_async(
353
+ hook_ctx=HookContext(
354
+ operation_id="delete_asset_assets__asset_id__delete",
355
+ oauth2_scopes=[],
356
+ security_source=None,
357
+ ),
358
+ request=req,
359
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
360
+ retry_config=retry_config,
361
+ )
362
+
363
+ data: Any = None
364
+ if utils.match_response(http_res, "200", "application/json"):
365
+ return utils.unmarshal_json(http_res.text, Any)
366
+ if utils.match_response(
367
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
368
+ ):
369
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
370
+ raise models.ErrorResponse(data=data)
371
+ if utils.match_response(http_res, "422", "application/json"):
372
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
373
+ raise models.HTTPValidationError(data=data)
374
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
375
+ http_res_text = await utils.stream_to_text_async(http_res)
376
+ raise models.APIError(
377
+ "API error occurred", http_res.status_code, http_res_text, http_res
378
+ )
379
+
380
+ content_type = http_res.headers.get("Content-Type")
381
+ http_res_text = await utils.stream_to_text_async(http_res)
382
+ raise models.APIError(
383
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
384
+ http_res.status_code,
385
+ http_res_text,
386
+ http_res,
387
+ )
388
+
389
+ def update(
390
+ self,
391
+ *,
392
+ asset_id: str,
393
+ x_namespace: OptionalNullable[str] = UNSET,
394
+ propagate_features: OptionalNullable[bool] = UNSET,
395
+ metadata: Optional[
396
+ Union[
397
+ models.UpdateAssetRequestMetadata,
398
+ models.UpdateAssetRequestMetadataTypedDict,
399
+ ]
400
+ ] = None,
401
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
402
+ server_url: Optional[str] = None,
403
+ timeout_ms: Optional[int] = None,
404
+ http_headers: Optional[Mapping[str, str]] = None,
405
+ ) -> models.AssetResponse:
406
+ r"""Full Asset Update
407
+
408
+ :param asset_id:
409
+ :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.
410
+ :param propagate_features: If True, the features will be propagated to all assets with the same asset_id
411
+ :param metadata: Updated metadata for the asset. This can include any key-value pairs that should be updated or added to the asset's metadata.
412
+ :param retries: Override the default retry configuration for this method
413
+ :param server_url: Override the default server URL for this method
414
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
415
+ :param http_headers: Additional headers to set or replace on requests.
416
+ """
417
+ base_url = None
418
+ url_variables = None
419
+ if timeout_ms is None:
420
+ timeout_ms = self.sdk_configuration.timeout_ms
421
+
422
+ if server_url is not None:
423
+ base_url = server_url
424
+
425
+ request = models.FullAssetUpdateAssetsAssetIDPutRequest(
426
+ asset_id=asset_id,
427
+ x_namespace=x_namespace,
428
+ update_asset_request=models.UpdateAssetRequest(
429
+ propagate_features=propagate_features,
430
+ metadata=utils.get_pydantic_model(
431
+ metadata, Optional[models.UpdateAssetRequestMetadata]
432
+ ),
433
+ ),
434
+ )
435
+
436
+ req = self.build_request(
437
+ method="PUT",
438
+ path="/assets/{asset_id}",
439
+ base_url=base_url,
440
+ url_variables=url_variables,
441
+ request=request,
442
+ request_body_required=True,
443
+ request_has_path_params=True,
444
+ request_has_query_params=False,
445
+ user_agent_header="user-agent",
446
+ accept_header_value="application/json",
447
+ http_headers=http_headers,
448
+ get_serialized_body=lambda: utils.serialize_request_body(
449
+ request.update_asset_request,
450
+ False,
451
+ False,
452
+ "json",
453
+ models.UpdateAssetRequest,
454
+ ),
455
+ timeout_ms=timeout_ms,
456
+ )
457
+
458
+ if retries == UNSET:
459
+ if self.sdk_configuration.retry_config is not UNSET:
460
+ retries = self.sdk_configuration.retry_config
461
+
462
+ retry_config = None
463
+ if isinstance(retries, utils.RetryConfig):
464
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
465
+
466
+ http_res = self.do_request(
467
+ hook_ctx=HookContext(
468
+ operation_id="full_asset_update_assets__asset_id__put",
469
+ oauth2_scopes=[],
470
+ security_source=None,
471
+ ),
472
+ request=req,
473
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
474
+ retry_config=retry_config,
475
+ )
476
+
477
+ data: Any = None
478
+ if utils.match_response(http_res, "200", "application/json"):
479
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
480
+ if utils.match_response(
481
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
482
+ ):
483
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
484
+ raise models.ErrorResponse(data=data)
485
+ if utils.match_response(http_res, "422", "application/json"):
486
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
487
+ raise models.HTTPValidationError(data=data)
488
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
489
+ http_res_text = utils.stream_to_text(http_res)
490
+ raise models.APIError(
491
+ "API error occurred", http_res.status_code, http_res_text, http_res
492
+ )
493
+
494
+ content_type = http_res.headers.get("Content-Type")
495
+ http_res_text = utils.stream_to_text(http_res)
496
+ raise models.APIError(
497
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
498
+ http_res.status_code,
499
+ http_res_text,
500
+ http_res,
501
+ )
502
+
503
+ async def update_async(
504
+ self,
505
+ *,
506
+ asset_id: str,
507
+ x_namespace: OptionalNullable[str] = UNSET,
508
+ propagate_features: OptionalNullable[bool] = UNSET,
509
+ metadata: Optional[
510
+ Union[
511
+ models.UpdateAssetRequestMetadata,
512
+ models.UpdateAssetRequestMetadataTypedDict,
513
+ ]
514
+ ] = None,
515
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
516
+ server_url: Optional[str] = None,
517
+ timeout_ms: Optional[int] = None,
518
+ http_headers: Optional[Mapping[str, str]] = None,
519
+ ) -> models.AssetResponse:
520
+ r"""Full Asset Update
521
+
522
+ :param asset_id:
523
+ :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.
524
+ :param propagate_features: If True, the features will be propagated to all assets with the same asset_id
525
+ :param metadata: Updated metadata for the asset. This can include any key-value pairs that should be updated or added to the asset's metadata.
526
+ :param retries: Override the default retry configuration for this method
527
+ :param server_url: Override the default server URL for this method
528
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
529
+ :param http_headers: Additional headers to set or replace on requests.
530
+ """
531
+ base_url = None
532
+ url_variables = None
533
+ if timeout_ms is None:
534
+ timeout_ms = self.sdk_configuration.timeout_ms
535
+
536
+ if server_url is not None:
537
+ base_url = server_url
538
+
539
+ request = models.FullAssetUpdateAssetsAssetIDPutRequest(
540
+ asset_id=asset_id,
541
+ x_namespace=x_namespace,
542
+ update_asset_request=models.UpdateAssetRequest(
543
+ propagate_features=propagate_features,
544
+ metadata=utils.get_pydantic_model(
545
+ metadata, Optional[models.UpdateAssetRequestMetadata]
546
+ ),
547
+ ),
548
+ )
549
+
550
+ req = self.build_request_async(
551
+ method="PUT",
552
+ path="/assets/{asset_id}",
553
+ base_url=base_url,
554
+ url_variables=url_variables,
555
+ request=request,
556
+ request_body_required=True,
557
+ request_has_path_params=True,
558
+ request_has_query_params=False,
559
+ user_agent_header="user-agent",
560
+ accept_header_value="application/json",
561
+ http_headers=http_headers,
562
+ get_serialized_body=lambda: utils.serialize_request_body(
563
+ request.update_asset_request,
564
+ False,
565
+ False,
566
+ "json",
567
+ models.UpdateAssetRequest,
568
+ ),
569
+ timeout_ms=timeout_ms,
570
+ )
571
+
572
+ if retries == UNSET:
573
+ if self.sdk_configuration.retry_config is not UNSET:
574
+ retries = self.sdk_configuration.retry_config
575
+
576
+ retry_config = None
577
+ if isinstance(retries, utils.RetryConfig):
578
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
579
+
580
+ http_res = await self.do_request_async(
581
+ hook_ctx=HookContext(
582
+ operation_id="full_asset_update_assets__asset_id__put",
583
+ oauth2_scopes=[],
584
+ security_source=None,
585
+ ),
586
+ request=req,
587
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
588
+ retry_config=retry_config,
589
+ )
590
+
591
+ data: Any = None
592
+ if utils.match_response(http_res, "200", "application/json"):
593
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
594
+ if utils.match_response(
595
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
596
+ ):
597
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
598
+ raise models.ErrorResponse(data=data)
599
+ if utils.match_response(http_res, "422", "application/json"):
600
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
601
+ raise models.HTTPValidationError(data=data)
602
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
603
+ http_res_text = await utils.stream_to_text_async(http_res)
604
+ raise models.APIError(
605
+ "API error occurred", http_res.status_code, http_res_text, http_res
606
+ )
607
+
608
+ content_type = http_res.headers.get("Content-Type")
609
+ http_res_text = await utils.stream_to_text_async(http_res)
610
+ raise models.APIError(
611
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
612
+ http_res.status_code,
613
+ http_res_text,
614
+ http_res,
615
+ )
616
+
617
+ def partial_update(
618
+ self,
619
+ *,
620
+ asset_id: str,
621
+ x_namespace: OptionalNullable[str] = UNSET,
622
+ propagate_features: OptionalNullable[bool] = UNSET,
623
+ metadata: Optional[
624
+ Union[
625
+ models.UpdateAssetRequestMetadata,
626
+ models.UpdateAssetRequestMetadataTypedDict,
627
+ ]
628
+ ] = None,
629
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
630
+ server_url: Optional[str] = None,
631
+ timeout_ms: Optional[int] = None,
632
+ http_headers: Optional[Mapping[str, str]] = None,
633
+ ) -> models.AssetResponse:
634
+ r"""Partial Asset Update
635
+
636
+ :param asset_id:
637
+ :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.
638
+ :param propagate_features: If True, the features will be propagated to all assets with the same asset_id
639
+ :param metadata: Updated metadata for the asset. This can include any key-value pairs that should be updated or added to the asset's metadata.
640
+ :param retries: Override the default retry configuration for this method
641
+ :param server_url: Override the default server URL for this method
642
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
643
+ :param http_headers: Additional headers to set or replace on requests.
644
+ """
645
+ base_url = None
646
+ url_variables = None
647
+ if timeout_ms is None:
648
+ timeout_ms = self.sdk_configuration.timeout_ms
649
+
650
+ if server_url is not None:
651
+ base_url = server_url
652
+
653
+ request = models.PartialAssetUpdateAssetsAssetIDPatchRequest(
654
+ asset_id=asset_id,
655
+ x_namespace=x_namespace,
656
+ update_asset_request=models.UpdateAssetRequest(
657
+ propagate_features=propagate_features,
658
+ metadata=utils.get_pydantic_model(
659
+ metadata, Optional[models.UpdateAssetRequestMetadata]
660
+ ),
661
+ ),
662
+ )
663
+
664
+ req = self.build_request(
665
+ method="PATCH",
666
+ path="/assets/{asset_id}",
667
+ base_url=base_url,
668
+ url_variables=url_variables,
669
+ request=request,
670
+ request_body_required=True,
671
+ request_has_path_params=True,
672
+ request_has_query_params=False,
673
+ user_agent_header="user-agent",
674
+ accept_header_value="application/json",
675
+ http_headers=http_headers,
676
+ get_serialized_body=lambda: utils.serialize_request_body(
677
+ request.update_asset_request,
678
+ False,
679
+ False,
680
+ "json",
681
+ models.UpdateAssetRequest,
682
+ ),
683
+ timeout_ms=timeout_ms,
684
+ )
685
+
686
+ if retries == UNSET:
687
+ if self.sdk_configuration.retry_config is not UNSET:
688
+ retries = self.sdk_configuration.retry_config
689
+
690
+ retry_config = None
691
+ if isinstance(retries, utils.RetryConfig):
692
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
693
+
694
+ http_res = self.do_request(
695
+ hook_ctx=HookContext(
696
+ operation_id="partial_asset_update_assets__asset_id__patch",
697
+ oauth2_scopes=[],
698
+ security_source=None,
699
+ ),
700
+ request=req,
701
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
702
+ retry_config=retry_config,
703
+ )
704
+
705
+ data: Any = None
706
+ if utils.match_response(http_res, "200", "application/json"):
707
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
708
+ if utils.match_response(
709
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
710
+ ):
711
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
712
+ raise models.ErrorResponse(data=data)
713
+ if utils.match_response(http_res, "422", "application/json"):
714
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
715
+ raise models.HTTPValidationError(data=data)
716
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
717
+ http_res_text = utils.stream_to_text(http_res)
718
+ raise models.APIError(
719
+ "API error occurred", http_res.status_code, http_res_text, http_res
720
+ )
721
+
722
+ content_type = http_res.headers.get("Content-Type")
723
+ http_res_text = utils.stream_to_text(http_res)
724
+ raise models.APIError(
725
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
726
+ http_res.status_code,
727
+ http_res_text,
728
+ http_res,
729
+ )
730
+
731
+ async def partial_update_async(
732
+ self,
733
+ *,
734
+ asset_id: str,
735
+ x_namespace: OptionalNullable[str] = UNSET,
736
+ propagate_features: OptionalNullable[bool] = UNSET,
737
+ metadata: Optional[
738
+ Union[
739
+ models.UpdateAssetRequestMetadata,
740
+ models.UpdateAssetRequestMetadataTypedDict,
741
+ ]
742
+ ] = None,
743
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
744
+ server_url: Optional[str] = None,
745
+ timeout_ms: Optional[int] = None,
746
+ http_headers: Optional[Mapping[str, str]] = None,
747
+ ) -> models.AssetResponse:
748
+ r"""Partial Asset Update
749
+
750
+ :param asset_id:
751
+ :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.
752
+ :param propagate_features: If True, the features will be propagated to all assets with the same asset_id
753
+ :param metadata: Updated metadata for the asset. This can include any key-value pairs that should be updated or added to the asset's metadata.
754
+ :param retries: Override the default retry configuration for this method
755
+ :param server_url: Override the default server URL for this method
756
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
757
+ :param http_headers: Additional headers to set or replace on requests.
758
+ """
759
+ base_url = None
760
+ url_variables = None
761
+ if timeout_ms is None:
762
+ timeout_ms = self.sdk_configuration.timeout_ms
763
+
764
+ if server_url is not None:
765
+ base_url = server_url
766
+
767
+ request = models.PartialAssetUpdateAssetsAssetIDPatchRequest(
768
+ asset_id=asset_id,
769
+ x_namespace=x_namespace,
770
+ update_asset_request=models.UpdateAssetRequest(
771
+ propagate_features=propagate_features,
772
+ metadata=utils.get_pydantic_model(
773
+ metadata, Optional[models.UpdateAssetRequestMetadata]
774
+ ),
775
+ ),
776
+ )
777
+
778
+ req = self.build_request_async(
779
+ method="PATCH",
780
+ path="/assets/{asset_id}",
781
+ base_url=base_url,
782
+ url_variables=url_variables,
783
+ request=request,
784
+ request_body_required=True,
785
+ request_has_path_params=True,
786
+ request_has_query_params=False,
787
+ user_agent_header="user-agent",
788
+ accept_header_value="application/json",
789
+ http_headers=http_headers,
790
+ get_serialized_body=lambda: utils.serialize_request_body(
791
+ request.update_asset_request,
792
+ False,
793
+ False,
794
+ "json",
795
+ models.UpdateAssetRequest,
796
+ ),
797
+ timeout_ms=timeout_ms,
798
+ )
799
+
800
+ if retries == UNSET:
801
+ if self.sdk_configuration.retry_config is not UNSET:
802
+ retries = self.sdk_configuration.retry_config
803
+
804
+ retry_config = None
805
+ if isinstance(retries, utils.RetryConfig):
806
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
807
+
808
+ http_res = await self.do_request_async(
809
+ hook_ctx=HookContext(
810
+ operation_id="partial_asset_update_assets__asset_id__patch",
811
+ oauth2_scopes=[],
812
+ security_source=None,
813
+ ),
814
+ request=req,
815
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
816
+ retry_config=retry_config,
817
+ )
818
+
819
+ data: Any = None
820
+ if utils.match_response(http_res, "200", "application/json"):
821
+ return utils.unmarshal_json(http_res.text, models.AssetResponse)
822
+ if utils.match_response(
823
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
824
+ ):
825
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
826
+ raise models.ErrorResponse(data=data)
827
+ if utils.match_response(http_res, "422", "application/json"):
828
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
829
+ raise models.HTTPValidationError(data=data)
830
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
831
+ http_res_text = await utils.stream_to_text_async(http_res)
832
+ raise models.APIError(
833
+ "API error occurred", http_res.status_code, http_res_text, http_res
834
+ )
835
+
836
+ content_type = http_res.headers.get("Content-Type")
837
+ http_res_text = await utils.stream_to_text_async(http_res)
838
+ raise models.APIError(
839
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
840
+ http_res.status_code,
841
+ http_res_text,
842
+ http_res,
843
+ )
844
+
845
+ def get_features(
846
+ self,
847
+ *,
848
+ asset_id: str,
849
+ return_url: Optional[bool] = False,
850
+ x_namespace: OptionalNullable[str] = UNSET,
851
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
852
+ server_url: Optional[str] = None,
853
+ timeout_ms: Optional[int] = None,
854
+ http_headers: Optional[Mapping[str, str]] = None,
855
+ ) -> models.GroupedAssetData:
856
+ r"""Get Asset With Features
857
+
858
+ Get asset details including all related features
859
+
860
+ :param asset_id: Unique identifier of the asset
861
+ :param return_url: Whether to generate and return presigned S3 URLs for the asset and preview. Set to false to improve performance when URLs aren't needed
862
+ :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.
863
+ :param retries: Override the default retry configuration for this method
864
+ :param server_url: Override the default server URL for this method
865
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
866
+ :param http_headers: Additional headers to set or replace on requests.
867
+ """
868
+ base_url = None
869
+ url_variables = None
870
+ if timeout_ms is None:
871
+ timeout_ms = self.sdk_configuration.timeout_ms
872
+
873
+ if server_url is not None:
874
+ base_url = server_url
875
+
876
+ request = models.GetAssetWithFeaturesAssetsAssetIDFeaturesGetRequest(
877
+ asset_id=asset_id,
878
+ return_url=return_url,
879
+ x_namespace=x_namespace,
880
+ )
881
+
882
+ req = self.build_request(
883
+ method="GET",
884
+ path="/assets/{asset_id}/features",
885
+ base_url=base_url,
886
+ url_variables=url_variables,
887
+ request=request,
888
+ request_body_required=False,
889
+ request_has_path_params=True,
890
+ request_has_query_params=True,
891
+ user_agent_header="user-agent",
892
+ accept_header_value="application/json",
893
+ http_headers=http_headers,
894
+ timeout_ms=timeout_ms,
895
+ )
896
+
897
+ if retries == UNSET:
898
+ if self.sdk_configuration.retry_config is not UNSET:
899
+ retries = self.sdk_configuration.retry_config
900
+
901
+ retry_config = None
902
+ if isinstance(retries, utils.RetryConfig):
903
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
904
+
905
+ http_res = self.do_request(
906
+ hook_ctx=HookContext(
907
+ operation_id="get_asset_with_features_assets__asset_id__features_get",
908
+ oauth2_scopes=[],
909
+ security_source=None,
910
+ ),
911
+ request=req,
912
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
913
+ retry_config=retry_config,
914
+ )
915
+
916
+ data: Any = None
917
+ if utils.match_response(http_res, "200", "application/json"):
918
+ return utils.unmarshal_json(http_res.text, models.GroupedAssetData)
919
+ if utils.match_response(
920
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
921
+ ):
922
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
923
+ raise models.ErrorResponse(data=data)
924
+ if utils.match_response(http_res, "422", "application/json"):
925
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
926
+ raise models.HTTPValidationError(data=data)
927
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
928
+ http_res_text = utils.stream_to_text(http_res)
929
+ raise models.APIError(
930
+ "API error occurred", http_res.status_code, http_res_text, http_res
931
+ )
932
+
933
+ content_type = http_res.headers.get("Content-Type")
934
+ http_res_text = utils.stream_to_text(http_res)
935
+ raise models.APIError(
936
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
937
+ http_res.status_code,
938
+ http_res_text,
939
+ http_res,
940
+ )
941
+
942
+ async def get_features_async(
943
+ self,
944
+ *,
945
+ asset_id: str,
946
+ return_url: Optional[bool] = False,
947
+ x_namespace: OptionalNullable[str] = UNSET,
948
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
949
+ server_url: Optional[str] = None,
950
+ timeout_ms: Optional[int] = None,
951
+ http_headers: Optional[Mapping[str, str]] = None,
952
+ ) -> models.GroupedAssetData:
953
+ r"""Get Asset With Features
954
+
955
+ Get asset details including all related features
956
+
957
+ :param asset_id: Unique identifier of the asset
958
+ :param return_url: Whether to generate and return presigned S3 URLs for the asset and preview. Set to false to improve performance when URLs aren't needed
959
+ :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.
960
+ :param retries: Override the default retry configuration for this method
961
+ :param server_url: Override the default server URL for this method
962
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
963
+ :param http_headers: Additional headers to set or replace on requests.
964
+ """
965
+ base_url = None
966
+ url_variables = None
967
+ if timeout_ms is None:
968
+ timeout_ms = self.sdk_configuration.timeout_ms
969
+
970
+ if server_url is not None:
971
+ base_url = server_url
972
+
973
+ request = models.GetAssetWithFeaturesAssetsAssetIDFeaturesGetRequest(
974
+ asset_id=asset_id,
975
+ return_url=return_url,
976
+ x_namespace=x_namespace,
977
+ )
978
+
979
+ req = self.build_request_async(
980
+ method="GET",
981
+ path="/assets/{asset_id}/features",
982
+ base_url=base_url,
983
+ url_variables=url_variables,
984
+ request=request,
985
+ request_body_required=False,
986
+ request_has_path_params=True,
987
+ request_has_query_params=True,
988
+ user_agent_header="user-agent",
989
+ accept_header_value="application/json",
990
+ http_headers=http_headers,
991
+ timeout_ms=timeout_ms,
992
+ )
993
+
994
+ if retries == UNSET:
995
+ if self.sdk_configuration.retry_config is not UNSET:
996
+ retries = self.sdk_configuration.retry_config
997
+
998
+ retry_config = None
999
+ if isinstance(retries, utils.RetryConfig):
1000
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1001
+
1002
+ http_res = await self.do_request_async(
1003
+ hook_ctx=HookContext(
1004
+ operation_id="get_asset_with_features_assets__asset_id__features_get",
1005
+ oauth2_scopes=[],
1006
+ security_source=None,
1007
+ ),
1008
+ request=req,
1009
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1010
+ retry_config=retry_config,
1011
+ )
1012
+
1013
+ data: Any = None
1014
+ if utils.match_response(http_res, "200", "application/json"):
1015
+ return utils.unmarshal_json(http_res.text, models.GroupedAssetData)
1016
+ if utils.match_response(
1017
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1018
+ ):
1019
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1020
+ raise models.ErrorResponse(data=data)
1021
+ if utils.match_response(http_res, "422", "application/json"):
1022
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1023
+ raise models.HTTPValidationError(data=data)
1024
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1025
+ http_res_text = await utils.stream_to_text_async(http_res)
1026
+ raise models.APIError(
1027
+ "API error occurred", http_res.status_code, http_res_text, http_res
1028
+ )
1029
+
1030
+ content_type = http_res.headers.get("Content-Type")
1031
+ http_res_text = await utils.stream_to_text_async(http_res)
1032
+ raise models.APIError(
1033
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1034
+ http_res.status_code,
1035
+ http_res_text,
1036
+ http_res,
1037
+ )
1038
+
1039
+ def list(
1040
+ self,
1041
+ *,
1042
+ collections: List[str],
1043
+ page: OptionalNullable[int] = UNSET,
1044
+ page_size: Optional[int] = 10,
1045
+ x_namespace: OptionalNullable[str] = UNSET,
1046
+ filters: OptionalNullable[
1047
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
1048
+ ] = UNSET,
1049
+ group_by: OptionalNullable[
1050
+ Union[models.GroupByOptionsAsset, models.GroupByOptionsAssetTypedDict]
1051
+ ] = UNSET,
1052
+ sort: OptionalNullable[
1053
+ Union[models.SortOption, models.SortOptionTypedDict]
1054
+ ] = UNSET,
1055
+ select: OptionalNullable[List[str]] = UNSET,
1056
+ return_url: OptionalNullable[bool] = UNSET,
1057
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1058
+ server_url: Optional[str] = None,
1059
+ timeout_ms: Optional[int] = None,
1060
+ http_headers: Optional[Mapping[str, str]] = None,
1061
+ ) -> models.ListAssetsResponse:
1062
+ r"""List Assets
1063
+
1064
+ :param collections: List of Collection IDs or Names to search within, required
1065
+ :param page:
1066
+ :param page_size:
1067
+ :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.
1068
+ :param filters: Used for filtering across all indexes
1069
+ :param group_by: Grouping options for search results
1070
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
1071
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
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.ListAssetsAssetsPostRequest(
1087
+ page=page,
1088
+ page_size=page_size,
1089
+ x_namespace=x_namespace,
1090
+ list_assets_request=models.ListAssetsRequest(
1091
+ collections=collections,
1092
+ filters=utils.get_pydantic_model(
1093
+ filters, OptionalNullable[models.LogicalOperatorInput]
1094
+ ),
1095
+ group_by=utils.get_pydantic_model(
1096
+ group_by, OptionalNullable[models.GroupByOptionsAsset]
1097
+ ),
1098
+ sort=utils.get_pydantic_model(
1099
+ sort, OptionalNullable[models.SortOption]
1100
+ ),
1101
+ select=select,
1102
+ return_url=return_url,
1103
+ ),
1104
+ )
1105
+
1106
+ req = self.build_request(
1107
+ method="POST",
1108
+ path="/assets",
1109
+ base_url=base_url,
1110
+ url_variables=url_variables,
1111
+ request=request,
1112
+ request_body_required=True,
1113
+ request_has_path_params=False,
1114
+ request_has_query_params=True,
1115
+ user_agent_header="user-agent",
1116
+ accept_header_value="application/json",
1117
+ http_headers=http_headers,
1118
+ get_serialized_body=lambda: utils.serialize_request_body(
1119
+ request.list_assets_request,
1120
+ False,
1121
+ False,
1122
+ "json",
1123
+ models.ListAssetsRequest,
1124
+ ),
1125
+ timeout_ms=timeout_ms,
1126
+ )
1127
+
1128
+ if retries == UNSET:
1129
+ if self.sdk_configuration.retry_config is not UNSET:
1130
+ retries = self.sdk_configuration.retry_config
1131
+
1132
+ retry_config = None
1133
+ if isinstance(retries, utils.RetryConfig):
1134
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1135
+
1136
+ http_res = self.do_request(
1137
+ hook_ctx=HookContext(
1138
+ operation_id="list_assets_assets_post",
1139
+ oauth2_scopes=[],
1140
+ security_source=None,
1141
+ ),
1142
+ request=req,
1143
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1144
+ retry_config=retry_config,
1145
+ )
1146
+
1147
+ data: Any = None
1148
+ if utils.match_response(http_res, "200", "application/json"):
1149
+ return utils.unmarshal_json(http_res.text, models.ListAssetsResponse)
1150
+ if utils.match_response(
1151
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1152
+ ):
1153
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1154
+ raise models.ErrorResponse(data=data)
1155
+ if utils.match_response(http_res, "422", "application/json"):
1156
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1157
+ raise models.HTTPValidationError(data=data)
1158
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1159
+ http_res_text = utils.stream_to_text(http_res)
1160
+ raise models.APIError(
1161
+ "API error occurred", http_res.status_code, http_res_text, http_res
1162
+ )
1163
+
1164
+ content_type = http_res.headers.get("Content-Type")
1165
+ http_res_text = utils.stream_to_text(http_res)
1166
+ raise models.APIError(
1167
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1168
+ http_res.status_code,
1169
+ http_res_text,
1170
+ http_res,
1171
+ )
1172
+
1173
+ async def list_async(
1174
+ self,
1175
+ *,
1176
+ collections: List[str],
1177
+ page: OptionalNullable[int] = UNSET,
1178
+ page_size: Optional[int] = 10,
1179
+ x_namespace: OptionalNullable[str] = UNSET,
1180
+ filters: OptionalNullable[
1181
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
1182
+ ] = UNSET,
1183
+ group_by: OptionalNullable[
1184
+ Union[models.GroupByOptionsAsset, models.GroupByOptionsAssetTypedDict]
1185
+ ] = UNSET,
1186
+ sort: OptionalNullable[
1187
+ Union[models.SortOption, models.SortOptionTypedDict]
1188
+ ] = UNSET,
1189
+ select: OptionalNullable[List[str]] = UNSET,
1190
+ return_url: OptionalNullable[bool] = UNSET,
1191
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1192
+ server_url: Optional[str] = None,
1193
+ timeout_ms: Optional[int] = None,
1194
+ http_headers: Optional[Mapping[str, str]] = None,
1195
+ ) -> models.ListAssetsResponse:
1196
+ r"""List Assets
1197
+
1198
+ :param collections: List of Collection IDs or Names to search within, required
1199
+ :param page:
1200
+ :param page_size:
1201
+ :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.
1202
+ :param filters: Used for filtering across all indexes
1203
+ :param group_by: Grouping options for search results
1204
+ :param sort: List of fields to sort by, with direction (asc or desc). Supports dot notation for nested fields.
1205
+ :param select: List of fields to return in results, supports dot notation. If None, all fields are returned.
1206
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
1207
+ :param retries: Override the default retry configuration for this method
1208
+ :param server_url: Override the default server URL for this method
1209
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1210
+ :param http_headers: Additional headers to set or replace on requests.
1211
+ """
1212
+ base_url = None
1213
+ url_variables = None
1214
+ if timeout_ms is None:
1215
+ timeout_ms = self.sdk_configuration.timeout_ms
1216
+
1217
+ if server_url is not None:
1218
+ base_url = server_url
1219
+
1220
+ request = models.ListAssetsAssetsPostRequest(
1221
+ page=page,
1222
+ page_size=page_size,
1223
+ x_namespace=x_namespace,
1224
+ list_assets_request=models.ListAssetsRequest(
1225
+ collections=collections,
1226
+ filters=utils.get_pydantic_model(
1227
+ filters, OptionalNullable[models.LogicalOperatorInput]
1228
+ ),
1229
+ group_by=utils.get_pydantic_model(
1230
+ group_by, OptionalNullable[models.GroupByOptionsAsset]
1231
+ ),
1232
+ sort=utils.get_pydantic_model(
1233
+ sort, OptionalNullable[models.SortOption]
1234
+ ),
1235
+ select=select,
1236
+ return_url=return_url,
1237
+ ),
1238
+ )
1239
+
1240
+ req = self.build_request_async(
1241
+ method="POST",
1242
+ path="/assets",
1243
+ base_url=base_url,
1244
+ url_variables=url_variables,
1245
+ request=request,
1246
+ request_body_required=True,
1247
+ request_has_path_params=False,
1248
+ request_has_query_params=True,
1249
+ user_agent_header="user-agent",
1250
+ accept_header_value="application/json",
1251
+ http_headers=http_headers,
1252
+ get_serialized_body=lambda: utils.serialize_request_body(
1253
+ request.list_assets_request,
1254
+ False,
1255
+ False,
1256
+ "json",
1257
+ models.ListAssetsRequest,
1258
+ ),
1259
+ timeout_ms=timeout_ms,
1260
+ )
1261
+
1262
+ if retries == UNSET:
1263
+ if self.sdk_configuration.retry_config is not UNSET:
1264
+ retries = self.sdk_configuration.retry_config
1265
+
1266
+ retry_config = None
1267
+ if isinstance(retries, utils.RetryConfig):
1268
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1269
+
1270
+ http_res = await self.do_request_async(
1271
+ hook_ctx=HookContext(
1272
+ operation_id="list_assets_assets_post",
1273
+ oauth2_scopes=[],
1274
+ security_source=None,
1275
+ ),
1276
+ request=req,
1277
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1278
+ retry_config=retry_config,
1279
+ )
1280
+
1281
+ data: Any = None
1282
+ if utils.match_response(http_res, "200", "application/json"):
1283
+ return utils.unmarshal_json(http_res.text, models.ListAssetsResponse)
1284
+ if utils.match_response(
1285
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1286
+ ):
1287
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1288
+ raise models.ErrorResponse(data=data)
1289
+ if utils.match_response(http_res, "422", "application/json"):
1290
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1291
+ raise models.HTTPValidationError(data=data)
1292
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1293
+ http_res_text = await utils.stream_to_text_async(http_res)
1294
+ raise models.APIError(
1295
+ "API error occurred", http_res.status_code, http_res_text, http_res
1296
+ )
1297
+
1298
+ content_type = http_res.headers.get("Content-Type")
1299
+ http_res_text = await utils.stream_to_text_async(http_res)
1300
+ raise models.APIError(
1301
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1302
+ http_res.status_code,
1303
+ http_res_text,
1304
+ http_res,
1305
+ )
1306
+
1307
+ def search(
1308
+ self,
1309
+ *,
1310
+ collections: List[str],
1311
+ x_namespace: OptionalNullable[str] = UNSET,
1312
+ query: OptionalNullable[
1313
+ Union[models.AssetsModelSearchQuery, models.AssetsModelSearchQueryTypedDict]
1314
+ ] = UNSET,
1315
+ filters: OptionalNullable[
1316
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
1317
+ ] = UNSET,
1318
+ sort: OptionalNullable[
1319
+ Union[models.SortOption, models.SortOptionTypedDict]
1320
+ ] = UNSET,
1321
+ select: OptionalNullable[List[str]] = UNSET,
1322
+ return_url: OptionalNullable[bool] = UNSET,
1323
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1324
+ server_url: Optional[str] = None,
1325
+ timeout_ms: Optional[int] = None,
1326
+ http_headers: Optional[Mapping[str, str]] = None,
1327
+ ) -> models.ListAssetsResponse:
1328
+ r"""Search Assets
1329
+
1330
+ :param collections: List of Collection IDs or Names to search within, required
1331
+ :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.
1332
+ :param query: Structured query object specifying which fields to search in and what to search for
1333
+ :param filters: Complex nested query filters
1334
+ :param sort: List of fields to sort by
1335
+ :param select: List of fields to return in results
1336
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
1337
+ :param retries: Override the default retry configuration for this method
1338
+ :param server_url: Override the default server URL for this method
1339
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1340
+ :param http_headers: Additional headers to set or replace on requests.
1341
+ """
1342
+ base_url = None
1343
+ url_variables = None
1344
+ if timeout_ms is None:
1345
+ timeout_ms = self.sdk_configuration.timeout_ms
1346
+
1347
+ if server_url is not None:
1348
+ base_url = server_url
1349
+
1350
+ request = models.SearchAssetsAssetsSearchPostRequest(
1351
+ x_namespace=x_namespace,
1352
+ search_assets_request=models.SearchAssetsRequest(
1353
+ query=utils.get_pydantic_model(
1354
+ query, OptionalNullable[models.AssetsModelSearchQuery]
1355
+ ),
1356
+ collections=collections,
1357
+ filters=utils.get_pydantic_model(
1358
+ filters, OptionalNullable[models.LogicalOperatorInput]
1359
+ ),
1360
+ sort=utils.get_pydantic_model(
1361
+ sort, OptionalNullable[models.SortOption]
1362
+ ),
1363
+ select=select,
1364
+ return_url=return_url,
1365
+ ),
1366
+ )
1367
+
1368
+ req = self.build_request(
1369
+ method="POST",
1370
+ path="/assets/search",
1371
+ base_url=base_url,
1372
+ url_variables=url_variables,
1373
+ request=request,
1374
+ request_body_required=True,
1375
+ request_has_path_params=False,
1376
+ request_has_query_params=False,
1377
+ user_agent_header="user-agent",
1378
+ accept_header_value="application/json",
1379
+ http_headers=http_headers,
1380
+ get_serialized_body=lambda: utils.serialize_request_body(
1381
+ request.search_assets_request,
1382
+ False,
1383
+ False,
1384
+ "json",
1385
+ models.SearchAssetsRequest,
1386
+ ),
1387
+ timeout_ms=timeout_ms,
1388
+ )
1389
+
1390
+ if retries == UNSET:
1391
+ if self.sdk_configuration.retry_config is not UNSET:
1392
+ retries = self.sdk_configuration.retry_config
1393
+
1394
+ retry_config = None
1395
+ if isinstance(retries, utils.RetryConfig):
1396
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1397
+
1398
+ http_res = self.do_request(
1399
+ hook_ctx=HookContext(
1400
+ operation_id="search_assets_assets_search_post",
1401
+ oauth2_scopes=[],
1402
+ security_source=None,
1403
+ ),
1404
+ request=req,
1405
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1406
+ retry_config=retry_config,
1407
+ )
1408
+
1409
+ data: Any = None
1410
+ if utils.match_response(http_res, "200", "application/json"):
1411
+ return utils.unmarshal_json(http_res.text, models.ListAssetsResponse)
1412
+ if utils.match_response(
1413
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1414
+ ):
1415
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1416
+ raise models.ErrorResponse(data=data)
1417
+ if utils.match_response(http_res, "422", "application/json"):
1418
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1419
+ raise models.HTTPValidationError(data=data)
1420
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1421
+ http_res_text = utils.stream_to_text(http_res)
1422
+ raise models.APIError(
1423
+ "API error occurred", http_res.status_code, http_res_text, http_res
1424
+ )
1425
+
1426
+ content_type = http_res.headers.get("Content-Type")
1427
+ http_res_text = utils.stream_to_text(http_res)
1428
+ raise models.APIError(
1429
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1430
+ http_res.status_code,
1431
+ http_res_text,
1432
+ http_res,
1433
+ )
1434
+
1435
+ async def search_async(
1436
+ self,
1437
+ *,
1438
+ collections: List[str],
1439
+ x_namespace: OptionalNullable[str] = UNSET,
1440
+ query: OptionalNullable[
1441
+ Union[models.AssetsModelSearchQuery, models.AssetsModelSearchQueryTypedDict]
1442
+ ] = UNSET,
1443
+ filters: OptionalNullable[
1444
+ Union[models.LogicalOperatorInput, models.LogicalOperatorInputTypedDict]
1445
+ ] = UNSET,
1446
+ sort: OptionalNullable[
1447
+ Union[models.SortOption, models.SortOptionTypedDict]
1448
+ ] = UNSET,
1449
+ select: OptionalNullable[List[str]] = UNSET,
1450
+ return_url: OptionalNullable[bool] = UNSET,
1451
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1452
+ server_url: Optional[str] = None,
1453
+ timeout_ms: Optional[int] = None,
1454
+ http_headers: Optional[Mapping[str, str]] = None,
1455
+ ) -> models.ListAssetsResponse:
1456
+ r"""Search Assets
1457
+
1458
+ :param collections: List of Collection IDs or Names to search within, required
1459
+ :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.
1460
+ :param query: Structured query object specifying which fields to search in and what to search for
1461
+ :param filters: Complex nested query filters
1462
+ :param sort: List of fields to sort by
1463
+ :param select: List of fields to return in results
1464
+ :param return_url: Return the presigned URL for the asset and preview asset, this will introduce additional latency
1465
+ :param retries: Override the default retry configuration for this method
1466
+ :param server_url: Override the default server URL for this method
1467
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1468
+ :param http_headers: Additional headers to set or replace on requests.
1469
+ """
1470
+ base_url = None
1471
+ url_variables = None
1472
+ if timeout_ms is None:
1473
+ timeout_ms = self.sdk_configuration.timeout_ms
1474
+
1475
+ if server_url is not None:
1476
+ base_url = server_url
1477
+
1478
+ request = models.SearchAssetsAssetsSearchPostRequest(
1479
+ x_namespace=x_namespace,
1480
+ search_assets_request=models.SearchAssetsRequest(
1481
+ query=utils.get_pydantic_model(
1482
+ query, OptionalNullable[models.AssetsModelSearchQuery]
1483
+ ),
1484
+ collections=collections,
1485
+ filters=utils.get_pydantic_model(
1486
+ filters, OptionalNullable[models.LogicalOperatorInput]
1487
+ ),
1488
+ sort=utils.get_pydantic_model(
1489
+ sort, OptionalNullable[models.SortOption]
1490
+ ),
1491
+ select=select,
1492
+ return_url=return_url,
1493
+ ),
1494
+ )
1495
+
1496
+ req = self.build_request_async(
1497
+ method="POST",
1498
+ path="/assets/search",
1499
+ base_url=base_url,
1500
+ url_variables=url_variables,
1501
+ request=request,
1502
+ request_body_required=True,
1503
+ request_has_path_params=False,
1504
+ request_has_query_params=False,
1505
+ user_agent_header="user-agent",
1506
+ accept_header_value="application/json",
1507
+ http_headers=http_headers,
1508
+ get_serialized_body=lambda: utils.serialize_request_body(
1509
+ request.search_assets_request,
1510
+ False,
1511
+ False,
1512
+ "json",
1513
+ models.SearchAssetsRequest,
1514
+ ),
1515
+ timeout_ms=timeout_ms,
1516
+ )
1517
+
1518
+ if retries == UNSET:
1519
+ if self.sdk_configuration.retry_config is not UNSET:
1520
+ retries = self.sdk_configuration.retry_config
1521
+
1522
+ retry_config = None
1523
+ if isinstance(retries, utils.RetryConfig):
1524
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1525
+
1526
+ http_res = await self.do_request_async(
1527
+ hook_ctx=HookContext(
1528
+ operation_id="search_assets_assets_search_post",
1529
+ oauth2_scopes=[],
1530
+ security_source=None,
1531
+ ),
1532
+ request=req,
1533
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1534
+ retry_config=retry_config,
1535
+ )
1536
+
1537
+ data: Any = None
1538
+ if utils.match_response(http_res, "200", "application/json"):
1539
+ return utils.unmarshal_json(http_res.text, models.ListAssetsResponse)
1540
+ if utils.match_response(
1541
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
1542
+ ):
1543
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
1544
+ raise models.ErrorResponse(data=data)
1545
+ if utils.match_response(http_res, "422", "application/json"):
1546
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
1547
+ raise models.HTTPValidationError(data=data)
1548
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
1549
+ http_res_text = await utils.stream_to_text_async(http_res)
1550
+ raise models.APIError(
1551
+ "API error occurred", http_res.status_code, http_res_text, http_res
1552
+ )
1553
+
1554
+ content_type = http_res.headers.get("Content-Type")
1555
+ http_res_text = await utils.stream_to_text_async(http_res)
1556
+ raise models.APIError(
1557
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1558
+ http_res.status_code,
1559
+ http_res_text,
1560
+ http_res,
1561
+ )