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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. mixpeek/__init__.py +9 -1
  2. mixpeek/_hooks/__init__.py +5 -0
  3. mixpeek/_hooks/registration.py +13 -0
  4. mixpeek/_hooks/sdkhooks.py +76 -0
  5. mixpeek/_hooks/types.py +94 -0
  6. mixpeek/_version.py +12 -0
  7. mixpeek/assets.py +1561 -0
  8. mixpeek/basesdk.py +350 -0
  9. mixpeek/collections.py +1029 -0
  10. mixpeek/featureextractors.py +205 -0
  11. mixpeek/features.py +1181 -0
  12. mixpeek/health.py +167 -0
  13. mixpeek/httpclient.py +84 -0
  14. mixpeek/ingest.py +831 -0
  15. mixpeek/interactions.py +221 -0
  16. mixpeek/models/__init__.py +751 -0
  17. mixpeek/models/actionusage.py +16 -0
  18. mixpeek/models/apierror.py +22 -0
  19. mixpeek/models/apikey.py +25 -0
  20. mixpeek/models/apikeyupdate.py +49 -0
  21. mixpeek/models/assetfeatures.py +55 -0
  22. mixpeek/models/assetresponse.py +166 -0
  23. mixpeek/models/assets_model_searchquery.py +21 -0
  24. mixpeek/models/assetupdate.py +28 -0
  25. mixpeek/models/availableindexesresponse.py +23 -0
  26. mixpeek/models/availablemodels.py +12 -0
  27. mixpeek/models/boolindexparams.py +18 -0
  28. mixpeek/models/collectionmodel.py +70 -0
  29. mixpeek/models/collectionresult.py +73 -0
  30. mixpeek/models/create_api_key_organizations_users_user_email_api_keys_postop.py +23 -0
  31. mixpeek/models/create_collection_collections_postop.py +62 -0
  32. mixpeek/models/create_interaction_features_search_interactions_postop.py +59 -0
  33. mixpeek/models/createcollectionrequest.py +59 -0
  34. mixpeek/models/createnamespacerequest.py +62 -0
  35. mixpeek/models/datetimeindexparams.py +18 -0
  36. mixpeek/models/dateusage.py +22 -0
  37. mixpeek/models/db_model_paginationresponse.py +59 -0
  38. mixpeek/models/db_model_taskresponse.py +20 -0
  39. mixpeek/models/delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py +23 -0
  40. mixpeek/models/delete_asset_assets_asset_id_deleteop.py +57 -0
  41. mixpeek/models/delete_collection_collections_collection_deleteop.py +59 -0
  42. mixpeek/models/delete_feature_features_feature_id_deleteop.py +57 -0
  43. mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +59 -0
  44. mixpeek/models/delete_namespace_namespaces_namespace_deleteop.py +18 -0
  45. mixpeek/models/delete_user_organizations_users_user_email_deleteop.py +16 -0
  46. mixpeek/models/denseembedding.py +16 -0
  47. mixpeek/models/embeddingrequest.py +59 -0
  48. mixpeek/models/embeddingresponse.py +64 -0
  49. mixpeek/models/errormessage.py +13 -0
  50. mixpeek/models/errorresponse.py +21 -0
  51. mixpeek/models/facedetectsettings.py +52 -0
  52. mixpeek/models/featureextractionembeddingrequest.py +54 -0
  53. mixpeek/models/featureresponse.py +74 -0
  54. mixpeek/models/features_model_paginationresponse.py +59 -0
  55. mixpeek/models/featureupdaterequest.py +21 -0
  56. mixpeek/models/filtercondition.py +74 -0
  57. mixpeek/models/floatindexparams.py +18 -0
  58. mixpeek/models/full_asset_update_assets_asset_id_putop.py +69 -0
  59. mixpeek/models/full_feature_update_features_feature_id_putop.py +69 -0
  60. mixpeek/models/geoindexparams.py +18 -0
  61. mixpeek/models/get_asset_assets_asset_id_getop.py +73 -0
  62. mixpeek/models/get_asset_with_features_assets_asset_id_features_getop.py +73 -0
  63. mixpeek/models/get_collection_collections_collection_getop.py +59 -0
  64. mixpeek/models/get_feature_features_feature_id_getop.py +70 -0
  65. mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +59 -0
  66. mixpeek/models/get_namespace_namespaces_namespace_getop.py +18 -0
  67. mixpeek/models/get_task_tasks_task_id_getop.py +57 -0
  68. mixpeek/models/get_user_organizations_users_user_email_getop.py +16 -0
  69. mixpeek/models/groupbyoptions.py +71 -0
  70. mixpeek/models/groupbyoptionsasset.py +71 -0
  71. mixpeek/models/groupedassetdata.py +18 -0
  72. mixpeek/models/healthcheckresponse.py +13 -0
  73. mixpeek/models/httpvalidationerror.py +21 -0
  74. mixpeek/models/imagedescribesettings.py +82 -0
  75. mixpeek/models/imagedetectsettings.py +53 -0
  76. mixpeek/models/imagereadsettings.py +71 -0
  77. mixpeek/models/imagesettings.py +79 -0
  78. mixpeek/models/ingest_image_url_ingest_images_url_postop.py +59 -0
  79. mixpeek/models/ingest_text_ingest_text_postop.py +59 -0
  80. mixpeek/models/ingest_video_url_ingest_videos_url_postop.py +59 -0
  81. mixpeek/models/inputtype.py +11 -0
  82. mixpeek/models/integerindexparams.py +24 -0
  83. mixpeek/models/interactionresponse.py +87 -0
  84. mixpeek/models/interactiontype.py +11 -0
  85. mixpeek/models/jsonimageoutputsettings.py +55 -0
  86. mixpeek/models/jsontextoutputsettings.py +55 -0
  87. mixpeek/models/jsonvideooutputsettings.py +55 -0
  88. mixpeek/models/keywordindexparams.py +21 -0
  89. mixpeek/models/kill_task_tasks_task_id_deleteop.py +57 -0
  90. mixpeek/models/list_assets_assets_postop.py +77 -0
  91. mixpeek/models/list_collections_collections_getop.py +65 -0
  92. mixpeek/models/list_features_features_postop.py +79 -0
  93. mixpeek/models/list_interactions_features_search_interactions_getop.py +96 -0
  94. mixpeek/models/listassetsrequest.py +75 -0
  95. mixpeek/models/listassetsresponse.py +22 -0
  96. mixpeek/models/listcollectionsresponse.py +22 -0
  97. mixpeek/models/listfeaturesrequest.py +77 -0
  98. mixpeek/models/listfeaturesresponse.py +22 -0
  99. mixpeek/models/logicaloperator_input.py +88 -0
  100. mixpeek/models/logicaloperator_output.py +103 -0
  101. mixpeek/models/logodetectsettings.py +52 -0
  102. mixpeek/models/modality.py +13 -0
  103. mixpeek/models/modeldetails.py +57 -0
  104. mixpeek/models/namespaceresponse.py +54 -0
  105. mixpeek/models/organizationmodel.py +45 -0
  106. mixpeek/models/partial_asset_update_assets_asset_id_patchop.py +69 -0
  107. mixpeek/models/payloadindexconfig.py +94 -0
  108. mixpeek/models/payloadindextype.py +17 -0
  109. mixpeek/models/payloadschematype.py +15 -0
  110. mixpeek/models/percolaterequest.py +57 -0
  111. mixpeek/models/permission.py +10 -0
  112. mixpeek/models/processimageurlinput.py +99 -0
  113. mixpeek/models/processtextinput.py +94 -0
  114. mixpeek/models/processvideourlinput.py +99 -0
  115. mixpeek/models/querysettings.py +56 -0
  116. mixpeek/models/rerankingoptions.py +47 -0
  117. mixpeek/models/search_assets_assets_search_postop.py +59 -0
  118. mixpeek/models/search_features_features_search_postop.py +96 -0
  119. mixpeek/models/search_model_searchquery_input.py +76 -0
  120. mixpeek/models/searchassetsrequest.py +78 -0
  121. mixpeek/models/searchinteraction.py +82 -0
  122. mixpeek/models/searchquery_output.py +79 -0
  123. mixpeek/models/searchrequestfeatures_input.py +151 -0
  124. mixpeek/models/searchrequestfeatures_output.py +151 -0
  125. mixpeek/models/sortoption.py +28 -0
  126. mixpeek/models/sparseembedding.py +21 -0
  127. mixpeek/models/tasks_model_taskresponse.py +24 -0
  128. mixpeek/models/taskstatus.py +16 -0
  129. mixpeek/models/textindexparams.py +31 -0
  130. mixpeek/models/textsettings.py +61 -0
  131. mixpeek/models/tokenizertype.py +11 -0
  132. mixpeek/models/update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py +30 -0
  133. mixpeek/models/update_collection_collections_collection_putop.py +74 -0
  134. mixpeek/models/update_namespace_namespaces_namespace_putop.py +28 -0
  135. mixpeek/models/updateassetrequest.py +60 -0
  136. mixpeek/models/updatenamespacerequest.py +26 -0
  137. mixpeek/models/usage.py +18 -0
  138. mixpeek/models/usermodel_input.py +36 -0
  139. mixpeek/models/usermodel_output.py +36 -0
  140. mixpeek/models/uuidindexparams.py +21 -0
  141. mixpeek/models/validationerror.py +26 -0
  142. mixpeek/models/vectormodel.py +11 -0
  143. mixpeek/models/vectortype.py +9 -0
  144. mixpeek/models/videodescribesettings.py +82 -0
  145. mixpeek/models/videodetectsettings.py +53 -0
  146. mixpeek/models/videoreadsettings.py +71 -0
  147. mixpeek/models/videosettings.py +101 -0
  148. mixpeek/models/videotranscriptionsettings.py +69 -0
  149. mixpeek/namespaces.py +1143 -0
  150. mixpeek/organizations.py +1508 -0
  151. mixpeek/py.typed +1 -0
  152. mixpeek/sdk.py +135 -0
  153. mixpeek/sdkconfiguration.py +45 -0
  154. mixpeek/searchinteractions.py +647 -0
  155. mixpeek/tasks.py +387 -0
  156. mixpeek/types/__init__.py +21 -0
  157. mixpeek/types/basemodel.py +39 -0
  158. mixpeek/utils/__init__.py +97 -0
  159. mixpeek/utils/annotations.py +55 -0
  160. mixpeek/utils/enums.py +34 -0
  161. mixpeek/utils/eventstreaming.py +238 -0
  162. mixpeek/utils/forms.py +202 -0
  163. mixpeek/utils/headers.py +136 -0
  164. mixpeek/utils/logger.py +27 -0
  165. mixpeek/utils/metadata.py +118 -0
  166. mixpeek/utils/queryparams.py +205 -0
  167. mixpeek/utils/requestbodies.py +66 -0
  168. mixpeek/utils/retries.py +217 -0
  169. mixpeek/utils/security.py +174 -0
  170. mixpeek/utils/serializers.py +215 -0
  171. mixpeek/utils/url.py +155 -0
  172. mixpeek/utils/values.py +134 -0
  173. mixpeek-0.13.dist-info/METADATA +439 -0
  174. mixpeek-0.13.dist-info/RECORD +176 -0
  175. {mixpeek-0.11.2.dist-info → mixpeek-0.13.dist-info}/WHEEL +1 -2
  176. py.typed +1 -0
  177. mixpeek/client.py +0 -27
  178. mixpeek/endpoints/__init__.py +0 -0
  179. mixpeek/endpoints/collections.py +0 -86
  180. mixpeek/endpoints/embed.py +0 -66
  181. mixpeek/endpoints/index.py +0 -51
  182. mixpeek/endpoints/register.py +0 -34
  183. mixpeek/endpoints/search.py +0 -44
  184. mixpeek/endpoints/tasks.py +0 -26
  185. mixpeek/endpoints/tools.py +0 -138
  186. mixpeek/exceptions.py +0 -13
  187. mixpeek-0.11.2.dist-info/METADATA +0 -375
  188. mixpeek-0.11.2.dist-info/RECORD +0 -15
  189. mixpeek-0.11.2.dist-info/top_level.txt +0 -1
mixpeek/tasks.py ADDED
@@ -0,0 +1,387 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from mixpeek import models, utils
5
+ from mixpeek._hooks import HookContext
6
+ from mixpeek.types import OptionalNullable, UNSET
7
+ from typing import Any, Mapping, Optional
8
+
9
+
10
+ class Tasks(BaseSDK):
11
+ def delete(
12
+ self,
13
+ *,
14
+ task_id: str,
15
+ x_namespace: OptionalNullable[str] = UNSET,
16
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
17
+ server_url: Optional[str] = None,
18
+ timeout_ms: Optional[int] = None,
19
+ http_headers: Optional[Mapping[str, str]] = None,
20
+ ) -> Any:
21
+ r"""Kill Task
22
+
23
+ :param task_id:
24
+ :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.
25
+ :param retries: Override the default retry configuration for this method
26
+ :param server_url: Override the default server URL for this method
27
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
28
+ :param http_headers: Additional headers to set or replace on requests.
29
+ """
30
+ base_url = None
31
+ url_variables = None
32
+ if timeout_ms is None:
33
+ timeout_ms = self.sdk_configuration.timeout_ms
34
+
35
+ if server_url is not None:
36
+ base_url = server_url
37
+
38
+ request = models.KillTaskTasksTaskIDDeleteRequest(
39
+ task_id=task_id,
40
+ x_namespace=x_namespace,
41
+ )
42
+
43
+ req = self.build_request(
44
+ method="DELETE",
45
+ path="/tasks/{task_id}",
46
+ base_url=base_url,
47
+ url_variables=url_variables,
48
+ request=request,
49
+ request_body_required=False,
50
+ request_has_path_params=True,
51
+ request_has_query_params=False,
52
+ user_agent_header="user-agent",
53
+ accept_header_value="application/json",
54
+ http_headers=http_headers,
55
+ timeout_ms=timeout_ms,
56
+ )
57
+
58
+ if retries == UNSET:
59
+ if self.sdk_configuration.retry_config is not UNSET:
60
+ retries = self.sdk_configuration.retry_config
61
+
62
+ retry_config = None
63
+ if isinstance(retries, utils.RetryConfig):
64
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
65
+
66
+ http_res = self.do_request(
67
+ hook_ctx=HookContext(
68
+ operation_id="kill_task_tasks__task_id__delete",
69
+ oauth2_scopes=[],
70
+ security_source=None,
71
+ ),
72
+ request=req,
73
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
74
+ retry_config=retry_config,
75
+ )
76
+
77
+ data: Any = None
78
+ if utils.match_response(http_res, "200", "application/json"):
79
+ return utils.unmarshal_json(http_res.text, Any)
80
+ if utils.match_response(
81
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
82
+ ):
83
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
84
+ raise models.ErrorResponse(data=data)
85
+ if utils.match_response(http_res, "422", "application/json"):
86
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
87
+ raise models.HTTPValidationError(data=data)
88
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
89
+ http_res_text = utils.stream_to_text(http_res)
90
+ raise models.APIError(
91
+ "API error occurred", http_res.status_code, http_res_text, http_res
92
+ )
93
+
94
+ content_type = http_res.headers.get("Content-Type")
95
+ http_res_text = utils.stream_to_text(http_res)
96
+ raise models.APIError(
97
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
98
+ http_res.status_code,
99
+ http_res_text,
100
+ http_res,
101
+ )
102
+
103
+ async def delete_async(
104
+ self,
105
+ *,
106
+ task_id: str,
107
+ x_namespace: OptionalNullable[str] = UNSET,
108
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
109
+ server_url: Optional[str] = None,
110
+ timeout_ms: Optional[int] = None,
111
+ http_headers: Optional[Mapping[str, str]] = None,
112
+ ) -> Any:
113
+ r"""Kill Task
114
+
115
+ :param task_id:
116
+ :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.
117
+ :param retries: Override the default retry configuration for this method
118
+ :param server_url: Override the default server URL for this method
119
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
120
+ :param http_headers: Additional headers to set or replace on requests.
121
+ """
122
+ base_url = None
123
+ url_variables = None
124
+ if timeout_ms is None:
125
+ timeout_ms = self.sdk_configuration.timeout_ms
126
+
127
+ if server_url is not None:
128
+ base_url = server_url
129
+
130
+ request = models.KillTaskTasksTaskIDDeleteRequest(
131
+ task_id=task_id,
132
+ x_namespace=x_namespace,
133
+ )
134
+
135
+ req = self.build_request_async(
136
+ method="DELETE",
137
+ path="/tasks/{task_id}",
138
+ base_url=base_url,
139
+ url_variables=url_variables,
140
+ request=request,
141
+ request_body_required=False,
142
+ request_has_path_params=True,
143
+ request_has_query_params=False,
144
+ user_agent_header="user-agent",
145
+ accept_header_value="application/json",
146
+ http_headers=http_headers,
147
+ timeout_ms=timeout_ms,
148
+ )
149
+
150
+ if retries == UNSET:
151
+ if self.sdk_configuration.retry_config is not UNSET:
152
+ retries = self.sdk_configuration.retry_config
153
+
154
+ retry_config = None
155
+ if isinstance(retries, utils.RetryConfig):
156
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
157
+
158
+ http_res = await self.do_request_async(
159
+ hook_ctx=HookContext(
160
+ operation_id="kill_task_tasks__task_id__delete",
161
+ oauth2_scopes=[],
162
+ security_source=None,
163
+ ),
164
+ request=req,
165
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
166
+ retry_config=retry_config,
167
+ )
168
+
169
+ data: Any = None
170
+ if utils.match_response(http_res, "200", "application/json"):
171
+ return utils.unmarshal_json(http_res.text, Any)
172
+ if utils.match_response(
173
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
174
+ ):
175
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
176
+ raise models.ErrorResponse(data=data)
177
+ if utils.match_response(http_res, "422", "application/json"):
178
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
179
+ raise models.HTTPValidationError(data=data)
180
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
181
+ http_res_text = await utils.stream_to_text_async(http_res)
182
+ raise models.APIError(
183
+ "API error occurred", http_res.status_code, http_res_text, http_res
184
+ )
185
+
186
+ content_type = http_res.headers.get("Content-Type")
187
+ http_res_text = await utils.stream_to_text_async(http_res)
188
+ raise models.APIError(
189
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
190
+ http_res.status_code,
191
+ http_res_text,
192
+ http_res,
193
+ )
194
+
195
+ def get(
196
+ self,
197
+ *,
198
+ task_id: str,
199
+ x_namespace: OptionalNullable[str] = UNSET,
200
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
201
+ server_url: Optional[str] = None,
202
+ timeout_ms: Optional[int] = None,
203
+ http_headers: Optional[Mapping[str, str]] = None,
204
+ ) -> models.TasksModelTaskResponse:
205
+ r"""Get Task Information
206
+
207
+ Retrieve a task by its ID.
208
+
209
+ A task may have an expiration time, after which it will still be returned but marked as expired.
210
+ This allows tracking of historical tasks while indicating their current validity state.
211
+
212
+ :param task_id:
213
+ :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.
214
+ :param retries: Override the default retry configuration for this method
215
+ :param server_url: Override the default server URL for this method
216
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
217
+ :param http_headers: Additional headers to set or replace on requests.
218
+ """
219
+ base_url = None
220
+ url_variables = None
221
+ if timeout_ms is None:
222
+ timeout_ms = self.sdk_configuration.timeout_ms
223
+
224
+ if server_url is not None:
225
+ base_url = server_url
226
+
227
+ request = models.GetTaskTasksTaskIDGetRequest(
228
+ task_id=task_id,
229
+ x_namespace=x_namespace,
230
+ )
231
+
232
+ req = self.build_request(
233
+ method="GET",
234
+ path="/tasks/{task_id}",
235
+ base_url=base_url,
236
+ url_variables=url_variables,
237
+ request=request,
238
+ request_body_required=False,
239
+ request_has_path_params=True,
240
+ request_has_query_params=False,
241
+ user_agent_header="user-agent",
242
+ accept_header_value="application/json",
243
+ http_headers=http_headers,
244
+ timeout_ms=timeout_ms,
245
+ )
246
+
247
+ if retries == UNSET:
248
+ if self.sdk_configuration.retry_config is not UNSET:
249
+ retries = self.sdk_configuration.retry_config
250
+
251
+ retry_config = None
252
+ if isinstance(retries, utils.RetryConfig):
253
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
254
+
255
+ http_res = self.do_request(
256
+ hook_ctx=HookContext(
257
+ operation_id="get_task_tasks__task_id__get",
258
+ oauth2_scopes=[],
259
+ security_source=None,
260
+ ),
261
+ request=req,
262
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
263
+ retry_config=retry_config,
264
+ )
265
+
266
+ data: Any = None
267
+ if utils.match_response(http_res, "200", "application/json"):
268
+ return utils.unmarshal_json(http_res.text, models.TasksModelTaskResponse)
269
+ if utils.match_response(
270
+ http_res, ["400", "401", "403", "404", "500"], "application/json"
271
+ ):
272
+ data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
273
+ raise models.ErrorResponse(data=data)
274
+ if utils.match_response(http_res, "422", "application/json"):
275
+ data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
276
+ raise models.HTTPValidationError(data=data)
277
+ if utils.match_response(http_res, ["4XX", "5XX"], "*"):
278
+ http_res_text = utils.stream_to_text(http_res)
279
+ raise models.APIError(
280
+ "API error occurred", http_res.status_code, http_res_text, http_res
281
+ )
282
+
283
+ content_type = http_res.headers.get("Content-Type")
284
+ http_res_text = utils.stream_to_text(http_res)
285
+ raise models.APIError(
286
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
287
+ http_res.status_code,
288
+ http_res_text,
289
+ http_res,
290
+ )
291
+
292
+ async def get_async(
293
+ self,
294
+ *,
295
+ task_id: str,
296
+ x_namespace: OptionalNullable[str] = UNSET,
297
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
298
+ server_url: Optional[str] = None,
299
+ timeout_ms: Optional[int] = None,
300
+ http_headers: Optional[Mapping[str, str]] = None,
301
+ ) -> models.TasksModelTaskResponse:
302
+ r"""Get Task Information
303
+
304
+ Retrieve a task by its ID.
305
+
306
+ A task may have an expiration time, after which it will still be returned but marked as expired.
307
+ This allows tracking of historical tasks while indicating their current validity state.
308
+
309
+ :param task_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.GetTaskTasksTaskIDGetRequest(
325
+ task_id=task_id,
326
+ x_namespace=x_namespace,
327
+ )
328
+
329
+ req = self.build_request_async(
330
+ method="GET",
331
+ path="/tasks/{task_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="get_task_tasks__task_id__get",
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, models.TasksModelTaskResponse)
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
+ )
@@ -0,0 +1,21 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basemodel import (
4
+ BaseModel,
5
+ Nullable,
6
+ OptionalNullable,
7
+ UnrecognizedInt,
8
+ UnrecognizedStr,
9
+ UNSET,
10
+ UNSET_SENTINEL,
11
+ )
12
+
13
+ __all__ = [
14
+ "BaseModel",
15
+ "Nullable",
16
+ "OptionalNullable",
17
+ "UnrecognizedInt",
18
+ "UnrecognizedStr",
19
+ "UNSET",
20
+ "UNSET_SENTINEL",
21
+ ]
@@ -0,0 +1,39 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from pydantic import ConfigDict, model_serializer
4
+ from pydantic import BaseModel as PydanticBaseModel
5
+ from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union, NewType
6
+ from typing_extensions import TypeAliasType, TypeAlias
7
+
8
+
9
+ class BaseModel(PydanticBaseModel):
10
+ model_config = ConfigDict(
11
+ populate_by_name=True, arbitrary_types_allowed=True, protected_namespaces=()
12
+ )
13
+
14
+
15
+ class Unset(BaseModel):
16
+ @model_serializer(mode="plain")
17
+ def serialize_model(self):
18
+ return UNSET_SENTINEL
19
+
20
+ def __bool__(self) -> Literal[False]:
21
+ return False
22
+
23
+
24
+ UNSET = Unset()
25
+ UNSET_SENTINEL = "~?~unset~?~sentinel~?~"
26
+
27
+
28
+ T = TypeVar("T")
29
+ if TYPE_CHECKING:
30
+ Nullable: TypeAlias = Union[T, None]
31
+ OptionalNullable: TypeAlias = Union[Optional[Nullable[T]], Unset]
32
+ else:
33
+ Nullable = TypeAliasType("Nullable", Union[T, None], type_params=(T,))
34
+ OptionalNullable = TypeAliasType(
35
+ "OptionalNullable", Union[Optional[Nullable[T]], Unset], type_params=(T,)
36
+ )
37
+
38
+ UnrecognizedInt = NewType("UnrecognizedInt", int)
39
+ UnrecognizedStr = NewType("UnrecognizedStr", str)
@@ -0,0 +1,97 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .annotations import get_discriminator
4
+ from .enums import OpenEnumMeta
5
+ from .headers import get_headers, get_response_headers
6
+ from .metadata import (
7
+ FieldMetadata,
8
+ find_metadata,
9
+ FormMetadata,
10
+ HeaderMetadata,
11
+ MultipartFormMetadata,
12
+ PathParamMetadata,
13
+ QueryParamMetadata,
14
+ RequestMetadata,
15
+ SecurityMetadata,
16
+ )
17
+ from .queryparams import get_query_params
18
+ from .retries import BackoffStrategy, Retries, retry, retry_async, RetryConfig
19
+ from .requestbodies import serialize_request_body, SerializedRequestBody
20
+ from .security import get_security
21
+ from .serializers import (
22
+ get_pydantic_model,
23
+ marshal_json,
24
+ unmarshal,
25
+ unmarshal_json,
26
+ serialize_decimal,
27
+ serialize_float,
28
+ serialize_int,
29
+ stream_to_text,
30
+ stream_to_text_async,
31
+ stream_to_bytes,
32
+ stream_to_bytes_async,
33
+ validate_const,
34
+ validate_decimal,
35
+ validate_float,
36
+ validate_int,
37
+ validate_open_enum,
38
+ )
39
+ from .url import generate_url, template_url, remove_suffix
40
+ from .values import (
41
+ get_global_from_env,
42
+ match_content_type,
43
+ match_status_codes,
44
+ match_response,
45
+ )
46
+ from .logger import Logger, get_body_content, get_default_logger
47
+
48
+ __all__ = [
49
+ "BackoffStrategy",
50
+ "FieldMetadata",
51
+ "find_metadata",
52
+ "FormMetadata",
53
+ "generate_url",
54
+ "get_body_content",
55
+ "get_default_logger",
56
+ "get_discriminator",
57
+ "get_global_from_env",
58
+ "get_headers",
59
+ "get_pydantic_model",
60
+ "get_query_params",
61
+ "get_response_headers",
62
+ "get_security",
63
+ "HeaderMetadata",
64
+ "Logger",
65
+ "marshal_json",
66
+ "match_content_type",
67
+ "match_status_codes",
68
+ "match_response",
69
+ "MultipartFormMetadata",
70
+ "OpenEnumMeta",
71
+ "PathParamMetadata",
72
+ "QueryParamMetadata",
73
+ "remove_suffix",
74
+ "Retries",
75
+ "retry",
76
+ "retry_async",
77
+ "RetryConfig",
78
+ "RequestMetadata",
79
+ "SecurityMetadata",
80
+ "serialize_decimal",
81
+ "serialize_float",
82
+ "serialize_int",
83
+ "serialize_request_body",
84
+ "SerializedRequestBody",
85
+ "stream_to_text",
86
+ "stream_to_text_async",
87
+ "stream_to_bytes",
88
+ "stream_to_bytes_async",
89
+ "template_url",
90
+ "unmarshal",
91
+ "unmarshal_json",
92
+ "validate_decimal",
93
+ "validate_const",
94
+ "validate_float",
95
+ "validate_int",
96
+ "validate_open_enum",
97
+ ]
@@ -0,0 +1,55 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from enum import Enum
4
+ from typing import Any, Optional
5
+
6
+ def get_discriminator(model: Any, fieldname: str, key: str) -> str:
7
+ """
8
+ Recursively search for the discriminator attribute in a model.
9
+
10
+ Args:
11
+ model (Any): The model to search within.
12
+ fieldname (str): The name of the field to search for.
13
+ key (str): The key to search for in dictionaries.
14
+
15
+ Returns:
16
+ str: The name of the discriminator attribute.
17
+
18
+ Raises:
19
+ ValueError: If the discriminator attribute is not found.
20
+ """
21
+ upper_fieldname = fieldname.upper()
22
+
23
+ def get_field_discriminator(field: Any) -> Optional[str]:
24
+ """Search for the discriminator attribute in a given field."""
25
+
26
+ if isinstance(field, dict):
27
+ if key in field:
28
+ return f'{field[key]}'
29
+
30
+ if hasattr(field, fieldname):
31
+ attr = getattr(field, fieldname)
32
+ if isinstance(attr, Enum):
33
+ return f'{attr.value}'
34
+ return f'{attr}'
35
+
36
+ if hasattr(field, upper_fieldname):
37
+ attr = getattr(field, upper_fieldname)
38
+ if isinstance(attr, Enum):
39
+ return f'{attr.value}'
40
+ return f'{attr}'
41
+
42
+ return None
43
+
44
+
45
+ if isinstance(model, list):
46
+ for field in model:
47
+ discriminator = get_field_discriminator(field)
48
+ if discriminator is not None:
49
+ return discriminator
50
+
51
+ discriminator = get_field_discriminator(model)
52
+ if discriminator is not None:
53
+ return discriminator
54
+
55
+ raise ValueError(f'Could not find discriminator field {fieldname} in {model}')
mixpeek/utils/enums.py ADDED
@@ -0,0 +1,34 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ import enum
4
+
5
+
6
+ class OpenEnumMeta(enum.EnumMeta):
7
+ def __call__(
8
+ cls, value, names=None, *, module=None, qualname=None, type=None, start=1
9
+ ):
10
+ # The `type` kwarg also happens to be a built-in that pylint flags as
11
+ # redeclared. Safe to ignore this lint rule with this scope.
12
+ # pylint: disable=redefined-builtin
13
+
14
+ if names is not None:
15
+ return super().__call__(
16
+ value,
17
+ names=names,
18
+ module=module,
19
+ qualname=qualname,
20
+ type=type,
21
+ start=start,
22
+ )
23
+
24
+ try:
25
+ return super().__call__(
26
+ value,
27
+ names=names, # pyright: ignore[reportArgumentType]
28
+ module=module,
29
+ qualname=qualname,
30
+ type=type,
31
+ start=start,
32
+ )
33
+ except ValueError:
34
+ return value