mixpeek 0.12.0__py3-none-any.whl → 0.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mixpeek/__init__.py +5 -79
- mixpeek/_hooks/__init__.py +5 -0
- mixpeek/_hooks/registration.py +13 -0
- mixpeek/_hooks/sdkhooks.py +76 -0
- mixpeek/_hooks/types.py +94 -0
- mixpeek/_version.py +11 -3
- mixpeek/assets.py +1561 -0
- mixpeek/basesdk.py +350 -0
- mixpeek/collections.py +1029 -0
- mixpeek/featureextractors.py +205 -0
- mixpeek/features.py +1181 -0
- mixpeek/health.py +167 -0
- mixpeek/httpclient.py +84 -0
- mixpeek/ingest.py +831 -0
- mixpeek/interactions.py +221 -0
- mixpeek/models/__init__.py +751 -0
- mixpeek/models/actionusage.py +16 -0
- mixpeek/models/apierror.py +22 -0
- mixpeek/models/apikey.py +25 -0
- mixpeek/models/apikeyupdate.py +49 -0
- mixpeek/models/assetfeatures.py +55 -0
- mixpeek/models/assetresponse.py +166 -0
- mixpeek/models/assets_model_searchquery.py +21 -0
- mixpeek/models/assetupdate.py +28 -0
- mixpeek/models/availableindexesresponse.py +23 -0
- mixpeek/models/availablemodels.py +12 -0
- mixpeek/models/boolindexparams.py +18 -0
- mixpeek/models/collectionmodel.py +70 -0
- mixpeek/models/collectionresult.py +73 -0
- mixpeek/models/create_api_key_organizations_users_user_email_api_keys_postop.py +23 -0
- mixpeek/models/create_collection_collections_postop.py +62 -0
- mixpeek/models/create_interaction_features_search_interactions_postop.py +59 -0
- mixpeek/models/createcollectionrequest.py +59 -0
- mixpeek/models/createnamespacerequest.py +62 -0
- mixpeek/models/datetimeindexparams.py +18 -0
- mixpeek/models/dateusage.py +22 -0
- mixpeek/models/db_model_paginationresponse.py +59 -0
- mixpeek/models/db_model_taskresponse.py +20 -0
- mixpeek/models/delete_api_key_organizations_users_user_email_api_keys_key_name_deleteop.py +23 -0
- mixpeek/models/delete_asset_assets_asset_id_deleteop.py +57 -0
- mixpeek/models/delete_collection_collections_collection_deleteop.py +59 -0
- mixpeek/models/delete_feature_features_feature_id_deleteop.py +57 -0
- mixpeek/models/delete_interaction_features_search_interactions_interaction_id_deleteop.py +59 -0
- mixpeek/models/delete_namespace_namespaces_namespace_deleteop.py +18 -0
- mixpeek/models/delete_user_organizations_users_user_email_deleteop.py +16 -0
- mixpeek/models/denseembedding.py +16 -0
- mixpeek/models/embeddingrequest.py +59 -0
- mixpeek/models/embeddingresponse.py +64 -0
- mixpeek/models/errormessage.py +13 -0
- mixpeek/models/errorresponse.py +21 -0
- mixpeek/models/facedetectsettings.py +52 -0
- mixpeek/models/featureextractionembeddingrequest.py +54 -0
- mixpeek/models/featureresponse.py +74 -0
- mixpeek/models/features_model_paginationresponse.py +59 -0
- mixpeek/models/featureupdaterequest.py +21 -0
- mixpeek/models/filtercondition.py +74 -0
- mixpeek/models/floatindexparams.py +18 -0
- mixpeek/models/full_asset_update_assets_asset_id_putop.py +69 -0
- mixpeek/models/full_feature_update_features_feature_id_putop.py +69 -0
- mixpeek/models/geoindexparams.py +18 -0
- mixpeek/models/get_asset_assets_asset_id_getop.py +73 -0
- mixpeek/models/get_asset_with_features_assets_asset_id_features_getop.py +73 -0
- mixpeek/models/get_collection_collections_collection_getop.py +59 -0
- mixpeek/models/get_feature_features_feature_id_getop.py +70 -0
- mixpeek/models/get_interaction_features_search_interactions_interaction_id_getop.py +59 -0
- mixpeek/models/get_namespace_namespaces_namespace_getop.py +18 -0
- mixpeek/models/get_task_tasks_task_id_getop.py +57 -0
- mixpeek/models/get_user_organizations_users_user_email_getop.py +16 -0
- mixpeek/models/groupbyoptions.py +71 -0
- mixpeek/models/groupbyoptionsasset.py +71 -0
- mixpeek/models/groupedassetdata.py +18 -0
- mixpeek/models/healthcheckresponse.py +13 -0
- mixpeek/models/httpvalidationerror.py +21 -0
- mixpeek/models/imagedescribesettings.py +82 -0
- mixpeek/models/imagedetectsettings.py +53 -0
- mixpeek/models/imagereadsettings.py +71 -0
- mixpeek/models/imagesettings.py +79 -0
- mixpeek/models/ingest_image_url_ingest_images_url_postop.py +59 -0
- mixpeek/models/ingest_text_ingest_text_postop.py +59 -0
- mixpeek/models/ingest_video_url_ingest_videos_url_postop.py +59 -0
- mixpeek/models/inputtype.py +11 -0
- mixpeek/models/integerindexparams.py +24 -0
- mixpeek/models/interactionresponse.py +87 -0
- mixpeek/models/interactiontype.py +11 -0
- mixpeek/models/jsonimageoutputsettings.py +55 -0
- mixpeek/models/jsontextoutputsettings.py +55 -0
- mixpeek/models/jsonvideooutputsettings.py +55 -0
- mixpeek/models/keywordindexparams.py +21 -0
- mixpeek/models/kill_task_tasks_task_id_deleteop.py +57 -0
- mixpeek/models/list_assets_assets_postop.py +77 -0
- mixpeek/models/list_collections_collections_getop.py +65 -0
- mixpeek/models/list_features_features_postop.py +79 -0
- mixpeek/models/list_interactions_features_search_interactions_getop.py +96 -0
- mixpeek/models/listassetsrequest.py +75 -0
- mixpeek/models/listassetsresponse.py +22 -0
- mixpeek/models/listcollectionsresponse.py +22 -0
- mixpeek/models/listfeaturesrequest.py +77 -0
- mixpeek/models/listfeaturesresponse.py +22 -0
- mixpeek/models/logicaloperator_input.py +88 -0
- mixpeek/models/logicaloperator_output.py +103 -0
- mixpeek/models/logodetectsettings.py +52 -0
- mixpeek/models/modality.py +13 -0
- mixpeek/models/modeldetails.py +57 -0
- mixpeek/models/namespaceresponse.py +54 -0
- mixpeek/models/organizationmodel.py +45 -0
- mixpeek/models/partial_asset_update_assets_asset_id_patchop.py +69 -0
- mixpeek/models/payloadindexconfig.py +94 -0
- mixpeek/models/payloadindextype.py +17 -0
- mixpeek/models/payloadschematype.py +15 -0
- mixpeek/models/percolaterequest.py +57 -0
- mixpeek/models/permission.py +10 -0
- mixpeek/models/processimageurlinput.py +99 -0
- mixpeek/models/processtextinput.py +94 -0
- mixpeek/models/processvideourlinput.py +99 -0
- mixpeek/models/querysettings.py +56 -0
- mixpeek/models/rerankingoptions.py +47 -0
- mixpeek/models/search_assets_assets_search_postop.py +59 -0
- mixpeek/models/search_features_features_search_postop.py +96 -0
- mixpeek/models/search_model_searchquery_input.py +76 -0
- mixpeek/models/searchassetsrequest.py +78 -0
- mixpeek/models/searchinteraction.py +82 -0
- mixpeek/models/searchquery_output.py +79 -0
- mixpeek/models/searchrequestfeatures_input.py +151 -0
- mixpeek/models/searchrequestfeatures_output.py +151 -0
- mixpeek/models/sortoption.py +28 -0
- mixpeek/models/sparseembedding.py +21 -0
- mixpeek/models/tasks_model_taskresponse.py +24 -0
- mixpeek/models/taskstatus.py +16 -0
- mixpeek/models/textindexparams.py +31 -0
- mixpeek/models/textsettings.py +61 -0
- mixpeek/models/tokenizertype.py +11 -0
- mixpeek/models/update_api_key_organizations_users_user_email_api_keys_key_name_patchop.py +30 -0
- mixpeek/models/update_collection_collections_collection_putop.py +74 -0
- mixpeek/models/update_namespace_namespaces_namespace_putop.py +28 -0
- mixpeek/models/updateassetrequest.py +60 -0
- mixpeek/models/updatenamespacerequest.py +26 -0
- mixpeek/models/usage.py +18 -0
- mixpeek/models/usermodel_input.py +36 -0
- mixpeek/models/usermodel_output.py +36 -0
- mixpeek/models/uuidindexparams.py +21 -0
- mixpeek/models/validationerror.py +26 -0
- mixpeek/models/vectormodel.py +11 -0
- mixpeek/models/vectortype.py +9 -0
- mixpeek/models/videodescribesettings.py +82 -0
- mixpeek/models/videodetectsettings.py +53 -0
- mixpeek/models/videoreadsettings.py +71 -0
- mixpeek/models/videosettings.py +101 -0
- mixpeek/models/videotranscriptionsettings.py +69 -0
- mixpeek/namespaces.py +1143 -0
- mixpeek/organizations.py +1508 -0
- mixpeek/py.typed +1 -0
- mixpeek/sdk.py +135 -0
- mixpeek/sdkconfiguration.py +45 -0
- mixpeek/searchinteractions.py +647 -0
- mixpeek/tasks.py +387 -0
- mixpeek/types/__init__.py +19 -29
- mixpeek/types/basemodel.py +39 -0
- mixpeek/utils/__init__.py +97 -0
- mixpeek/utils/annotations.py +55 -0
- mixpeek/utils/enums.py +34 -0
- mixpeek/utils/eventstreaming.py +238 -0
- mixpeek/utils/forms.py +202 -0
- mixpeek/utils/headers.py +136 -0
- mixpeek/utils/logger.py +27 -0
- mixpeek/utils/metadata.py +118 -0
- mixpeek/utils/queryparams.py +205 -0
- mixpeek/utils/requestbodies.py +66 -0
- mixpeek/utils/retries.py +217 -0
- mixpeek/utils/security.py +174 -0
- mixpeek/utils/serializers.py +215 -0
- mixpeek/utils/url.py +155 -0
- mixpeek/utils/values.py +134 -0
- mixpeek-0.13.dist-info/METADATA +439 -0
- mixpeek-0.13.dist-info/RECORD +176 -0
- {mixpeek-0.12.0.dist-info → mixpeek-0.13.dist-info}/WHEEL +1 -1
- py.typed +1 -0
- mixpeek/_base_client.py +0 -2041
- mixpeek/_client.py +0 -444
- mixpeek/_compat.py +0 -221
- mixpeek/_constants.py +0 -14
- mixpeek/_exceptions.py +0 -108
- mixpeek/_files.py +0 -123
- mixpeek/_models.py +0 -788
- mixpeek/_qs.py +0 -150
- mixpeek/_resource.py +0 -43
- mixpeek/_response.py +0 -824
- mixpeek/_streaming.py +0 -333
- mixpeek/_types.py +0 -219
- mixpeek/_utils/__init__.py +0 -56
- mixpeek/_utils/_logs.py +0 -25
- mixpeek/_utils/_proxy.py +0 -62
- mixpeek/_utils/_reflection.py +0 -42
- mixpeek/_utils/_streams.py +0 -12
- mixpeek/_utils/_sync.py +0 -81
- mixpeek/_utils/_transform.py +0 -387
- mixpeek/_utils/_typing.py +0 -120
- mixpeek/_utils/_utils.py +0 -414
- mixpeek/lib/.keep +0 -4
- mixpeek/resources/__init__.py +0 -117
- mixpeek/resources/accounts.py +0 -271
- mixpeek/resources/assets/__init__.py +0 -33
- mixpeek/resources/assets/assets.py +0 -708
- mixpeek/resources/assets/features.py +0 -172
- mixpeek/resources/collections.py +0 -283
- mixpeek/resources/entities/__init__.py +0 -47
- mixpeek/resources/entities/entities.py +0 -134
- mixpeek/resources/entities/faces.py +0 -514
- mixpeek/resources/entities/labels.py +0 -388
- mixpeek/resources/features/__init__.py +0 -33
- mixpeek/resources/features/features.py +0 -562
- mixpeek/resources/features/search.py +0 -731
- mixpeek/resources/healthcheck.py +0 -135
- mixpeek/resources/index/__init__.py +0 -47
- mixpeek/resources/index/images.py +0 -249
- mixpeek/resources/index/index.py +0 -289
- mixpeek/resources/index/videos.py +0 -249
- mixpeek/resources/tasks.py +0 -258
- mixpeek/types/account_update_params.py +0 -28
- mixpeek/types/asset_create_params.py +0 -36
- mixpeek/types/asset_create_response.py +0 -15
- mixpeek/types/asset_response.py +0 -46
- mixpeek/types/asset_search_params.py +0 -43
- mixpeek/types/asset_search_response.py +0 -15
- mixpeek/types/asset_update_params.py +0 -25
- mixpeek/types/asset_update_response.py +0 -11
- mixpeek/types/assets/__init__.py +0 -3
- mixpeek/types/collection_list_params.py +0 -19
- mixpeek/types/collection_list_response.py +0 -14
- mixpeek/types/entities/__init__.py +0 -13
- mixpeek/types/entities/face_create_params.py +0 -21
- mixpeek/types/entities/face_list_params.py +0 -18
- mixpeek/types/entities/face_list_response.py +0 -15
- mixpeek/types/entities/face_response.py +0 -17
- mixpeek/types/entities/face_update_params.py +0 -22
- mixpeek/types/entities/label_list_params.py +0 -18
- mixpeek/types/entities/label_list_response.py +0 -30
- mixpeek/types/entities/label_response.py +0 -30
- mixpeek/types/entities/label_update_params.py +0 -21
- mixpeek/types/feature.py +0 -32
- mixpeek/types/feature_list_params.py +0 -37
- mixpeek/types/feature_list_response.py +0 -28
- mixpeek/types/feature_retrieve_params.py +0 -18
- mixpeek/types/feature_update_params.py +0 -16
- mixpeek/types/features/__init__.py +0 -8
- mixpeek/types/features/search_feedback_params.py +0 -23
- mixpeek/types/features/search_file_params.py +0 -29
- mixpeek/types/features/search_text_params.py +0 -72
- mixpeek/types/features/search_url_params.py +0 -72
- mixpeek/types/grouped_asset_data.py +0 -24
- mixpeek/types/health_check_response.py +0 -10
- mixpeek/types/index/__init__.py +0 -8
- mixpeek/types/index/image_url_params.py +0 -135
- mixpeek/types/index/image_url_response.py +0 -20
- mixpeek/types/index/video_url_params.py +0 -154
- mixpeek/types/index/video_url_response.py +0 -20
- mixpeek/types/index_text_params.py +0 -77
- mixpeek/types/index_text_response.py +0 -14
- mixpeek/types/shared/__init__.py +0 -7
- mixpeek/types/shared/filter_condition.py +0 -19
- mixpeek/types/shared/logical_operator.py +0 -12
- mixpeek/types/shared/model_pagination_response.py +0 -21
- mixpeek/types/shared/sort_option.py +0 -15
- mixpeek/types/shared/task_response.py +0 -15
- mixpeek/types/shared_params/__init__.py +0 -4
- mixpeek/types/shared_params/logical_operator.py +0 -13
- mixpeek/types/shared_params/sort_option.py +0 -15
- mixpeek/types/user.py +0 -34
- mixpeek-0.12.0.dist-info/METADATA +0 -345
- mixpeek-0.12.0.dist-info/RECORD +0 -99
- mixpeek-0.12.0.dist-info/licenses/LICENSE +0 -201
mixpeek/collections.py
ADDED
@@ -0,0 +1,1029 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from mixpeek import models, utils
|
5
|
+
from mixpeek._hooks import HookContext
|
6
|
+
from mixpeek.types import OptionalNullable, UNSET
|
7
|
+
from typing import Any, Mapping, Optional, Union
|
8
|
+
|
9
|
+
|
10
|
+
class Collections(BaseSDK):
|
11
|
+
def list(
|
12
|
+
self,
|
13
|
+
*,
|
14
|
+
page: OptionalNullable[int] = UNSET,
|
15
|
+
page_size: Optional[int] = 10,
|
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.ListCollectionsResponse:
|
22
|
+
r"""List Collections
|
23
|
+
|
24
|
+
:param page:
|
25
|
+
:param page_size:
|
26
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
27
|
+
:param retries: Override the default retry configuration for this method
|
28
|
+
:param server_url: Override the default server URL for this method
|
29
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
30
|
+
:param http_headers: Additional headers to set or replace on requests.
|
31
|
+
"""
|
32
|
+
base_url = None
|
33
|
+
url_variables = None
|
34
|
+
if timeout_ms is None:
|
35
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
36
|
+
|
37
|
+
if server_url is not None:
|
38
|
+
base_url = server_url
|
39
|
+
|
40
|
+
request = models.ListCollectionsCollectionsGetRequest(
|
41
|
+
page=page,
|
42
|
+
page_size=page_size,
|
43
|
+
x_namespace=x_namespace,
|
44
|
+
)
|
45
|
+
|
46
|
+
req = self.build_request(
|
47
|
+
method="GET",
|
48
|
+
path="/collections",
|
49
|
+
base_url=base_url,
|
50
|
+
url_variables=url_variables,
|
51
|
+
request=request,
|
52
|
+
request_body_required=False,
|
53
|
+
request_has_path_params=False,
|
54
|
+
request_has_query_params=True,
|
55
|
+
user_agent_header="user-agent",
|
56
|
+
accept_header_value="application/json",
|
57
|
+
http_headers=http_headers,
|
58
|
+
timeout_ms=timeout_ms,
|
59
|
+
)
|
60
|
+
|
61
|
+
if retries == UNSET:
|
62
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
63
|
+
retries = self.sdk_configuration.retry_config
|
64
|
+
|
65
|
+
retry_config = None
|
66
|
+
if isinstance(retries, utils.RetryConfig):
|
67
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
68
|
+
|
69
|
+
http_res = self.do_request(
|
70
|
+
hook_ctx=HookContext(
|
71
|
+
operation_id="list_collections_collections_get",
|
72
|
+
oauth2_scopes=[],
|
73
|
+
security_source=None,
|
74
|
+
),
|
75
|
+
request=req,
|
76
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
77
|
+
retry_config=retry_config,
|
78
|
+
)
|
79
|
+
|
80
|
+
data: Any = None
|
81
|
+
if utils.match_response(http_res, "200", "application/json"):
|
82
|
+
return utils.unmarshal_json(http_res.text, models.ListCollectionsResponse)
|
83
|
+
if utils.match_response(
|
84
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
85
|
+
):
|
86
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
87
|
+
raise models.ErrorResponse(data=data)
|
88
|
+
if utils.match_response(http_res, "422", "application/json"):
|
89
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
90
|
+
raise models.HTTPValidationError(data=data)
|
91
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
92
|
+
http_res_text = utils.stream_to_text(http_res)
|
93
|
+
raise models.APIError(
|
94
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
95
|
+
)
|
96
|
+
|
97
|
+
content_type = http_res.headers.get("Content-Type")
|
98
|
+
http_res_text = utils.stream_to_text(http_res)
|
99
|
+
raise models.APIError(
|
100
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
101
|
+
http_res.status_code,
|
102
|
+
http_res_text,
|
103
|
+
http_res,
|
104
|
+
)
|
105
|
+
|
106
|
+
async def list_async(
|
107
|
+
self,
|
108
|
+
*,
|
109
|
+
page: OptionalNullable[int] = UNSET,
|
110
|
+
page_size: Optional[int] = 10,
|
111
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
112
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
113
|
+
server_url: Optional[str] = None,
|
114
|
+
timeout_ms: Optional[int] = None,
|
115
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
116
|
+
) -> models.ListCollectionsResponse:
|
117
|
+
r"""List Collections
|
118
|
+
|
119
|
+
:param page:
|
120
|
+
:param page_size:
|
121
|
+
:param x_namespace: Optional namespace for data isolation. This can be a namespace name or namespace ID. Example: 'netflix_prod' or 'ns_1234567890'. To create a namespace, use the /namespaces endpoint.
|
122
|
+
:param retries: Override the default retry configuration for this method
|
123
|
+
:param server_url: Override the default server URL for this method
|
124
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
125
|
+
:param http_headers: Additional headers to set or replace on requests.
|
126
|
+
"""
|
127
|
+
base_url = None
|
128
|
+
url_variables = None
|
129
|
+
if timeout_ms is None:
|
130
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
131
|
+
|
132
|
+
if server_url is not None:
|
133
|
+
base_url = server_url
|
134
|
+
|
135
|
+
request = models.ListCollectionsCollectionsGetRequest(
|
136
|
+
page=page,
|
137
|
+
page_size=page_size,
|
138
|
+
x_namespace=x_namespace,
|
139
|
+
)
|
140
|
+
|
141
|
+
req = self.build_request_async(
|
142
|
+
method="GET",
|
143
|
+
path="/collections",
|
144
|
+
base_url=base_url,
|
145
|
+
url_variables=url_variables,
|
146
|
+
request=request,
|
147
|
+
request_body_required=False,
|
148
|
+
request_has_path_params=False,
|
149
|
+
request_has_query_params=True,
|
150
|
+
user_agent_header="user-agent",
|
151
|
+
accept_header_value="application/json",
|
152
|
+
http_headers=http_headers,
|
153
|
+
timeout_ms=timeout_ms,
|
154
|
+
)
|
155
|
+
|
156
|
+
if retries == UNSET:
|
157
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
158
|
+
retries = self.sdk_configuration.retry_config
|
159
|
+
|
160
|
+
retry_config = None
|
161
|
+
if isinstance(retries, utils.RetryConfig):
|
162
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
163
|
+
|
164
|
+
http_res = await self.do_request_async(
|
165
|
+
hook_ctx=HookContext(
|
166
|
+
operation_id="list_collections_collections_get",
|
167
|
+
oauth2_scopes=[],
|
168
|
+
security_source=None,
|
169
|
+
),
|
170
|
+
request=req,
|
171
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
172
|
+
retry_config=retry_config,
|
173
|
+
)
|
174
|
+
|
175
|
+
data: Any = None
|
176
|
+
if utils.match_response(http_res, "200", "application/json"):
|
177
|
+
return utils.unmarshal_json(http_res.text, models.ListCollectionsResponse)
|
178
|
+
if utils.match_response(
|
179
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
180
|
+
):
|
181
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
182
|
+
raise models.ErrorResponse(data=data)
|
183
|
+
if utils.match_response(http_res, "422", "application/json"):
|
184
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
185
|
+
raise models.HTTPValidationError(data=data)
|
186
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
187
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
188
|
+
raise models.APIError(
|
189
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
190
|
+
)
|
191
|
+
|
192
|
+
content_type = http_res.headers.get("Content-Type")
|
193
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
194
|
+
raise models.APIError(
|
195
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
196
|
+
http_res.status_code,
|
197
|
+
http_res_text,
|
198
|
+
http_res,
|
199
|
+
)
|
200
|
+
|
201
|
+
def create(
|
202
|
+
self,
|
203
|
+
*,
|
204
|
+
collection_name: str,
|
205
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
206
|
+
metadata: OptionalNullable[
|
207
|
+
Union[
|
208
|
+
models.CreateCollectionRequestMetadata,
|
209
|
+
models.CreateCollectionRequestMetadataTypedDict,
|
210
|
+
]
|
211
|
+
] = UNSET,
|
212
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
213
|
+
server_url: Optional[str] = None,
|
214
|
+
timeout_ms: Optional[int] = None,
|
215
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
216
|
+
) -> models.CollectionModel:
|
217
|
+
r"""Create Collection
|
218
|
+
|
219
|
+
:param collection_name: Name for the collection
|
220
|
+
: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.
|
221
|
+
:param metadata: Optional metadata for the collection
|
222
|
+
:param retries: Override the default retry configuration for this method
|
223
|
+
:param server_url: Override the default server URL for this method
|
224
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
225
|
+
:param http_headers: Additional headers to set or replace on requests.
|
226
|
+
"""
|
227
|
+
base_url = None
|
228
|
+
url_variables = None
|
229
|
+
if timeout_ms is None:
|
230
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
231
|
+
|
232
|
+
if server_url is not None:
|
233
|
+
base_url = server_url
|
234
|
+
|
235
|
+
request = models.CreateCollectionCollectionsPostRequest(
|
236
|
+
x_namespace=x_namespace,
|
237
|
+
create_collection_request=models.CreateCollectionRequest(
|
238
|
+
collection_name=collection_name,
|
239
|
+
metadata=utils.get_pydantic_model(
|
240
|
+
metadata, OptionalNullable[models.CreateCollectionRequestMetadata]
|
241
|
+
),
|
242
|
+
),
|
243
|
+
)
|
244
|
+
|
245
|
+
req = self.build_request(
|
246
|
+
method="POST",
|
247
|
+
path="/collections",
|
248
|
+
base_url=base_url,
|
249
|
+
url_variables=url_variables,
|
250
|
+
request=request,
|
251
|
+
request_body_required=True,
|
252
|
+
request_has_path_params=False,
|
253
|
+
request_has_query_params=False,
|
254
|
+
user_agent_header="user-agent",
|
255
|
+
accept_header_value="application/json",
|
256
|
+
http_headers=http_headers,
|
257
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
258
|
+
request.create_collection_request,
|
259
|
+
False,
|
260
|
+
False,
|
261
|
+
"json",
|
262
|
+
models.CreateCollectionRequest,
|
263
|
+
),
|
264
|
+
timeout_ms=timeout_ms,
|
265
|
+
)
|
266
|
+
|
267
|
+
if retries == UNSET:
|
268
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
269
|
+
retries = self.sdk_configuration.retry_config
|
270
|
+
|
271
|
+
retry_config = None
|
272
|
+
if isinstance(retries, utils.RetryConfig):
|
273
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
274
|
+
|
275
|
+
http_res = self.do_request(
|
276
|
+
hook_ctx=HookContext(
|
277
|
+
operation_id="create_collection_collections_post",
|
278
|
+
oauth2_scopes=[],
|
279
|
+
security_source=None,
|
280
|
+
),
|
281
|
+
request=req,
|
282
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
283
|
+
retry_config=retry_config,
|
284
|
+
)
|
285
|
+
|
286
|
+
data: Any = None
|
287
|
+
if utils.match_response(http_res, "200", "application/json"):
|
288
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
289
|
+
if utils.match_response(
|
290
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
291
|
+
):
|
292
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
293
|
+
raise models.ErrorResponse(data=data)
|
294
|
+
if utils.match_response(http_res, "422", "application/json"):
|
295
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
296
|
+
raise models.HTTPValidationError(data=data)
|
297
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
298
|
+
http_res_text = utils.stream_to_text(http_res)
|
299
|
+
raise models.APIError(
|
300
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
301
|
+
)
|
302
|
+
|
303
|
+
content_type = http_res.headers.get("Content-Type")
|
304
|
+
http_res_text = utils.stream_to_text(http_res)
|
305
|
+
raise models.APIError(
|
306
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
307
|
+
http_res.status_code,
|
308
|
+
http_res_text,
|
309
|
+
http_res,
|
310
|
+
)
|
311
|
+
|
312
|
+
async def create_async(
|
313
|
+
self,
|
314
|
+
*,
|
315
|
+
collection_name: str,
|
316
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
317
|
+
metadata: OptionalNullable[
|
318
|
+
Union[
|
319
|
+
models.CreateCollectionRequestMetadata,
|
320
|
+
models.CreateCollectionRequestMetadataTypedDict,
|
321
|
+
]
|
322
|
+
] = UNSET,
|
323
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
324
|
+
server_url: Optional[str] = None,
|
325
|
+
timeout_ms: Optional[int] = None,
|
326
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
327
|
+
) -> models.CollectionModel:
|
328
|
+
r"""Create Collection
|
329
|
+
|
330
|
+
:param collection_name: Name for the collection
|
331
|
+
: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.
|
332
|
+
:param metadata: Optional metadata for the collection
|
333
|
+
:param retries: Override the default retry configuration for this method
|
334
|
+
:param server_url: Override the default server URL for this method
|
335
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
336
|
+
:param http_headers: Additional headers to set or replace on requests.
|
337
|
+
"""
|
338
|
+
base_url = None
|
339
|
+
url_variables = None
|
340
|
+
if timeout_ms is None:
|
341
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
342
|
+
|
343
|
+
if server_url is not None:
|
344
|
+
base_url = server_url
|
345
|
+
|
346
|
+
request = models.CreateCollectionCollectionsPostRequest(
|
347
|
+
x_namespace=x_namespace,
|
348
|
+
create_collection_request=models.CreateCollectionRequest(
|
349
|
+
collection_name=collection_name,
|
350
|
+
metadata=utils.get_pydantic_model(
|
351
|
+
metadata, OptionalNullable[models.CreateCollectionRequestMetadata]
|
352
|
+
),
|
353
|
+
),
|
354
|
+
)
|
355
|
+
|
356
|
+
req = self.build_request_async(
|
357
|
+
method="POST",
|
358
|
+
path="/collections",
|
359
|
+
base_url=base_url,
|
360
|
+
url_variables=url_variables,
|
361
|
+
request=request,
|
362
|
+
request_body_required=True,
|
363
|
+
request_has_path_params=False,
|
364
|
+
request_has_query_params=False,
|
365
|
+
user_agent_header="user-agent",
|
366
|
+
accept_header_value="application/json",
|
367
|
+
http_headers=http_headers,
|
368
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
369
|
+
request.create_collection_request,
|
370
|
+
False,
|
371
|
+
False,
|
372
|
+
"json",
|
373
|
+
models.CreateCollectionRequest,
|
374
|
+
),
|
375
|
+
timeout_ms=timeout_ms,
|
376
|
+
)
|
377
|
+
|
378
|
+
if retries == UNSET:
|
379
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
380
|
+
retries = self.sdk_configuration.retry_config
|
381
|
+
|
382
|
+
retry_config = None
|
383
|
+
if isinstance(retries, utils.RetryConfig):
|
384
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
385
|
+
|
386
|
+
http_res = await self.do_request_async(
|
387
|
+
hook_ctx=HookContext(
|
388
|
+
operation_id="create_collection_collections_post",
|
389
|
+
oauth2_scopes=[],
|
390
|
+
security_source=None,
|
391
|
+
),
|
392
|
+
request=req,
|
393
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
394
|
+
retry_config=retry_config,
|
395
|
+
)
|
396
|
+
|
397
|
+
data: Any = None
|
398
|
+
if utils.match_response(http_res, "200", "application/json"):
|
399
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
400
|
+
if utils.match_response(
|
401
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
402
|
+
):
|
403
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
404
|
+
raise models.ErrorResponse(data=data)
|
405
|
+
if utils.match_response(http_res, "422", "application/json"):
|
406
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
407
|
+
raise models.HTTPValidationError(data=data)
|
408
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
409
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
410
|
+
raise models.APIError(
|
411
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
412
|
+
)
|
413
|
+
|
414
|
+
content_type = http_res.headers.get("Content-Type")
|
415
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
416
|
+
raise models.APIError(
|
417
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
418
|
+
http_res.status_code,
|
419
|
+
http_res_text,
|
420
|
+
http_res,
|
421
|
+
)
|
422
|
+
|
423
|
+
def delete(
|
424
|
+
self,
|
425
|
+
*,
|
426
|
+
collection: str,
|
427
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
428
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
429
|
+
server_url: Optional[str] = None,
|
430
|
+
timeout_ms: Optional[int] = None,
|
431
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
432
|
+
) -> Any:
|
433
|
+
r"""Delete Collection
|
434
|
+
|
435
|
+
Delete a collection using either its name or ID
|
436
|
+
|
437
|
+
:param collection: Either the collection name or collection ID
|
438
|
+
: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.
|
439
|
+
:param retries: Override the default retry configuration for this method
|
440
|
+
:param server_url: Override the default server URL for this method
|
441
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
442
|
+
:param http_headers: Additional headers to set or replace on requests.
|
443
|
+
"""
|
444
|
+
base_url = None
|
445
|
+
url_variables = None
|
446
|
+
if timeout_ms is None:
|
447
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
448
|
+
|
449
|
+
if server_url is not None:
|
450
|
+
base_url = server_url
|
451
|
+
|
452
|
+
request = models.DeleteCollectionCollectionsCollectionDeleteRequest(
|
453
|
+
collection=collection,
|
454
|
+
x_namespace=x_namespace,
|
455
|
+
)
|
456
|
+
|
457
|
+
req = self.build_request(
|
458
|
+
method="DELETE",
|
459
|
+
path="/collections/{collection}",
|
460
|
+
base_url=base_url,
|
461
|
+
url_variables=url_variables,
|
462
|
+
request=request,
|
463
|
+
request_body_required=False,
|
464
|
+
request_has_path_params=True,
|
465
|
+
request_has_query_params=False,
|
466
|
+
user_agent_header="user-agent",
|
467
|
+
accept_header_value="application/json",
|
468
|
+
http_headers=http_headers,
|
469
|
+
timeout_ms=timeout_ms,
|
470
|
+
)
|
471
|
+
|
472
|
+
if retries == UNSET:
|
473
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
474
|
+
retries = self.sdk_configuration.retry_config
|
475
|
+
|
476
|
+
retry_config = None
|
477
|
+
if isinstance(retries, utils.RetryConfig):
|
478
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
479
|
+
|
480
|
+
http_res = self.do_request(
|
481
|
+
hook_ctx=HookContext(
|
482
|
+
operation_id="delete_collection_collections__collection__delete",
|
483
|
+
oauth2_scopes=[],
|
484
|
+
security_source=None,
|
485
|
+
),
|
486
|
+
request=req,
|
487
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
488
|
+
retry_config=retry_config,
|
489
|
+
)
|
490
|
+
|
491
|
+
data: Any = None
|
492
|
+
if utils.match_response(http_res, "200", "application/json"):
|
493
|
+
return utils.unmarshal_json(http_res.text, Any)
|
494
|
+
if utils.match_response(
|
495
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
496
|
+
):
|
497
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
498
|
+
raise models.ErrorResponse(data=data)
|
499
|
+
if utils.match_response(http_res, "422", "application/json"):
|
500
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
501
|
+
raise models.HTTPValidationError(data=data)
|
502
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
503
|
+
http_res_text = utils.stream_to_text(http_res)
|
504
|
+
raise models.APIError(
|
505
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
506
|
+
)
|
507
|
+
|
508
|
+
content_type = http_res.headers.get("Content-Type")
|
509
|
+
http_res_text = utils.stream_to_text(http_res)
|
510
|
+
raise models.APIError(
|
511
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
512
|
+
http_res.status_code,
|
513
|
+
http_res_text,
|
514
|
+
http_res,
|
515
|
+
)
|
516
|
+
|
517
|
+
async def delete_async(
|
518
|
+
self,
|
519
|
+
*,
|
520
|
+
collection: str,
|
521
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
522
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
523
|
+
server_url: Optional[str] = None,
|
524
|
+
timeout_ms: Optional[int] = None,
|
525
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
526
|
+
) -> Any:
|
527
|
+
r"""Delete Collection
|
528
|
+
|
529
|
+
Delete a collection using either its name or ID
|
530
|
+
|
531
|
+
:param collection: Either the collection name or collection ID
|
532
|
+
: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.
|
533
|
+
:param retries: Override the default retry configuration for this method
|
534
|
+
:param server_url: Override the default server URL for this method
|
535
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
536
|
+
:param http_headers: Additional headers to set or replace on requests.
|
537
|
+
"""
|
538
|
+
base_url = None
|
539
|
+
url_variables = None
|
540
|
+
if timeout_ms is None:
|
541
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
542
|
+
|
543
|
+
if server_url is not None:
|
544
|
+
base_url = server_url
|
545
|
+
|
546
|
+
request = models.DeleteCollectionCollectionsCollectionDeleteRequest(
|
547
|
+
collection=collection,
|
548
|
+
x_namespace=x_namespace,
|
549
|
+
)
|
550
|
+
|
551
|
+
req = self.build_request_async(
|
552
|
+
method="DELETE",
|
553
|
+
path="/collections/{collection}",
|
554
|
+
base_url=base_url,
|
555
|
+
url_variables=url_variables,
|
556
|
+
request=request,
|
557
|
+
request_body_required=False,
|
558
|
+
request_has_path_params=True,
|
559
|
+
request_has_query_params=False,
|
560
|
+
user_agent_header="user-agent",
|
561
|
+
accept_header_value="application/json",
|
562
|
+
http_headers=http_headers,
|
563
|
+
timeout_ms=timeout_ms,
|
564
|
+
)
|
565
|
+
|
566
|
+
if retries == UNSET:
|
567
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
568
|
+
retries = self.sdk_configuration.retry_config
|
569
|
+
|
570
|
+
retry_config = None
|
571
|
+
if isinstance(retries, utils.RetryConfig):
|
572
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
573
|
+
|
574
|
+
http_res = await self.do_request_async(
|
575
|
+
hook_ctx=HookContext(
|
576
|
+
operation_id="delete_collection_collections__collection__delete",
|
577
|
+
oauth2_scopes=[],
|
578
|
+
security_source=None,
|
579
|
+
),
|
580
|
+
request=req,
|
581
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
582
|
+
retry_config=retry_config,
|
583
|
+
)
|
584
|
+
|
585
|
+
data: Any = None
|
586
|
+
if utils.match_response(http_res, "200", "application/json"):
|
587
|
+
return utils.unmarshal_json(http_res.text, Any)
|
588
|
+
if utils.match_response(
|
589
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
590
|
+
):
|
591
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
592
|
+
raise models.ErrorResponse(data=data)
|
593
|
+
if utils.match_response(http_res, "422", "application/json"):
|
594
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
595
|
+
raise models.HTTPValidationError(data=data)
|
596
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
597
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
598
|
+
raise models.APIError(
|
599
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
600
|
+
)
|
601
|
+
|
602
|
+
content_type = http_res.headers.get("Content-Type")
|
603
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
604
|
+
raise models.APIError(
|
605
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
606
|
+
http_res.status_code,
|
607
|
+
http_res_text,
|
608
|
+
http_res,
|
609
|
+
)
|
610
|
+
|
611
|
+
def update(
|
612
|
+
self,
|
613
|
+
*,
|
614
|
+
collection: str,
|
615
|
+
collection_name: str,
|
616
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
617
|
+
metadata: OptionalNullable[
|
618
|
+
Union[
|
619
|
+
models.CreateCollectionRequestMetadata,
|
620
|
+
models.CreateCollectionRequestMetadataTypedDict,
|
621
|
+
]
|
622
|
+
] = UNSET,
|
623
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
624
|
+
server_url: Optional[str] = None,
|
625
|
+
timeout_ms: Optional[int] = None,
|
626
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
627
|
+
) -> models.CollectionModel:
|
628
|
+
r"""Update Collection
|
629
|
+
|
630
|
+
Update a collection using either its name or ID
|
631
|
+
|
632
|
+
:param collection: Either the collection name or collection ID
|
633
|
+
:param collection_name: Name for the collection
|
634
|
+
: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.
|
635
|
+
:param metadata: Optional metadata for the collection
|
636
|
+
:param retries: Override the default retry configuration for this method
|
637
|
+
:param server_url: Override the default server URL for this method
|
638
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
639
|
+
:param http_headers: Additional headers to set or replace on requests.
|
640
|
+
"""
|
641
|
+
base_url = None
|
642
|
+
url_variables = None
|
643
|
+
if timeout_ms is None:
|
644
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
645
|
+
|
646
|
+
if server_url is not None:
|
647
|
+
base_url = server_url
|
648
|
+
|
649
|
+
request = models.UpdateCollectionCollectionsCollectionPutRequest(
|
650
|
+
collection=collection,
|
651
|
+
x_namespace=x_namespace,
|
652
|
+
create_collection_request=models.CreateCollectionRequest(
|
653
|
+
collection_name=collection_name,
|
654
|
+
metadata=utils.get_pydantic_model(
|
655
|
+
metadata, OptionalNullable[models.CreateCollectionRequestMetadata]
|
656
|
+
),
|
657
|
+
),
|
658
|
+
)
|
659
|
+
|
660
|
+
req = self.build_request(
|
661
|
+
method="PUT",
|
662
|
+
path="/collections/{collection}",
|
663
|
+
base_url=base_url,
|
664
|
+
url_variables=url_variables,
|
665
|
+
request=request,
|
666
|
+
request_body_required=True,
|
667
|
+
request_has_path_params=True,
|
668
|
+
request_has_query_params=False,
|
669
|
+
user_agent_header="user-agent",
|
670
|
+
accept_header_value="application/json",
|
671
|
+
http_headers=http_headers,
|
672
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
673
|
+
request.create_collection_request,
|
674
|
+
False,
|
675
|
+
False,
|
676
|
+
"json",
|
677
|
+
models.CreateCollectionRequest,
|
678
|
+
),
|
679
|
+
timeout_ms=timeout_ms,
|
680
|
+
)
|
681
|
+
|
682
|
+
if retries == UNSET:
|
683
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
684
|
+
retries = self.sdk_configuration.retry_config
|
685
|
+
|
686
|
+
retry_config = None
|
687
|
+
if isinstance(retries, utils.RetryConfig):
|
688
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
689
|
+
|
690
|
+
http_res = self.do_request(
|
691
|
+
hook_ctx=HookContext(
|
692
|
+
operation_id="update_collection_collections__collection__put",
|
693
|
+
oauth2_scopes=[],
|
694
|
+
security_source=None,
|
695
|
+
),
|
696
|
+
request=req,
|
697
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
698
|
+
retry_config=retry_config,
|
699
|
+
)
|
700
|
+
|
701
|
+
data: Any = None
|
702
|
+
if utils.match_response(http_res, "200", "application/json"):
|
703
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
704
|
+
if utils.match_response(
|
705
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
706
|
+
):
|
707
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
708
|
+
raise models.ErrorResponse(data=data)
|
709
|
+
if utils.match_response(http_res, "422", "application/json"):
|
710
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
711
|
+
raise models.HTTPValidationError(data=data)
|
712
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
713
|
+
http_res_text = utils.stream_to_text(http_res)
|
714
|
+
raise models.APIError(
|
715
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
716
|
+
)
|
717
|
+
|
718
|
+
content_type = http_res.headers.get("Content-Type")
|
719
|
+
http_res_text = utils.stream_to_text(http_res)
|
720
|
+
raise models.APIError(
|
721
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
722
|
+
http_res.status_code,
|
723
|
+
http_res_text,
|
724
|
+
http_res,
|
725
|
+
)
|
726
|
+
|
727
|
+
async def update_async(
|
728
|
+
self,
|
729
|
+
*,
|
730
|
+
collection: str,
|
731
|
+
collection_name: str,
|
732
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
733
|
+
metadata: OptionalNullable[
|
734
|
+
Union[
|
735
|
+
models.CreateCollectionRequestMetadata,
|
736
|
+
models.CreateCollectionRequestMetadataTypedDict,
|
737
|
+
]
|
738
|
+
] = UNSET,
|
739
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
740
|
+
server_url: Optional[str] = None,
|
741
|
+
timeout_ms: Optional[int] = None,
|
742
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
743
|
+
) -> models.CollectionModel:
|
744
|
+
r"""Update Collection
|
745
|
+
|
746
|
+
Update a collection using either its name or ID
|
747
|
+
|
748
|
+
:param collection: Either the collection name or collection ID
|
749
|
+
:param collection_name: Name for the collection
|
750
|
+
: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.
|
751
|
+
:param metadata: Optional metadata for the collection
|
752
|
+
:param retries: Override the default retry configuration for this method
|
753
|
+
:param server_url: Override the default server URL for this method
|
754
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
755
|
+
:param http_headers: Additional headers to set or replace on requests.
|
756
|
+
"""
|
757
|
+
base_url = None
|
758
|
+
url_variables = None
|
759
|
+
if timeout_ms is None:
|
760
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
761
|
+
|
762
|
+
if server_url is not None:
|
763
|
+
base_url = server_url
|
764
|
+
|
765
|
+
request = models.UpdateCollectionCollectionsCollectionPutRequest(
|
766
|
+
collection=collection,
|
767
|
+
x_namespace=x_namespace,
|
768
|
+
create_collection_request=models.CreateCollectionRequest(
|
769
|
+
collection_name=collection_name,
|
770
|
+
metadata=utils.get_pydantic_model(
|
771
|
+
metadata, OptionalNullable[models.CreateCollectionRequestMetadata]
|
772
|
+
),
|
773
|
+
),
|
774
|
+
)
|
775
|
+
|
776
|
+
req = self.build_request_async(
|
777
|
+
method="PUT",
|
778
|
+
path="/collections/{collection}",
|
779
|
+
base_url=base_url,
|
780
|
+
url_variables=url_variables,
|
781
|
+
request=request,
|
782
|
+
request_body_required=True,
|
783
|
+
request_has_path_params=True,
|
784
|
+
request_has_query_params=False,
|
785
|
+
user_agent_header="user-agent",
|
786
|
+
accept_header_value="application/json",
|
787
|
+
http_headers=http_headers,
|
788
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
789
|
+
request.create_collection_request,
|
790
|
+
False,
|
791
|
+
False,
|
792
|
+
"json",
|
793
|
+
models.CreateCollectionRequest,
|
794
|
+
),
|
795
|
+
timeout_ms=timeout_ms,
|
796
|
+
)
|
797
|
+
|
798
|
+
if retries == UNSET:
|
799
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
800
|
+
retries = self.sdk_configuration.retry_config
|
801
|
+
|
802
|
+
retry_config = None
|
803
|
+
if isinstance(retries, utils.RetryConfig):
|
804
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
805
|
+
|
806
|
+
http_res = await self.do_request_async(
|
807
|
+
hook_ctx=HookContext(
|
808
|
+
operation_id="update_collection_collections__collection__put",
|
809
|
+
oauth2_scopes=[],
|
810
|
+
security_source=None,
|
811
|
+
),
|
812
|
+
request=req,
|
813
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
814
|
+
retry_config=retry_config,
|
815
|
+
)
|
816
|
+
|
817
|
+
data: Any = None
|
818
|
+
if utils.match_response(http_res, "200", "application/json"):
|
819
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
820
|
+
if utils.match_response(
|
821
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
822
|
+
):
|
823
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
824
|
+
raise models.ErrorResponse(data=data)
|
825
|
+
if utils.match_response(http_res, "422", "application/json"):
|
826
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
827
|
+
raise models.HTTPValidationError(data=data)
|
828
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
829
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
830
|
+
raise models.APIError(
|
831
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
832
|
+
)
|
833
|
+
|
834
|
+
content_type = http_res.headers.get("Content-Type")
|
835
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
836
|
+
raise models.APIError(
|
837
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
838
|
+
http_res.status_code,
|
839
|
+
http_res_text,
|
840
|
+
http_res,
|
841
|
+
)
|
842
|
+
|
843
|
+
def get(
|
844
|
+
self,
|
845
|
+
*,
|
846
|
+
collection: str,
|
847
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
848
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
849
|
+
server_url: Optional[str] = None,
|
850
|
+
timeout_ms: Optional[int] = None,
|
851
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
852
|
+
) -> models.CollectionModel:
|
853
|
+
r"""Get Collection
|
854
|
+
|
855
|
+
Get a collection using either its name or ID
|
856
|
+
|
857
|
+
:param collection: Either the collection name or collection ID
|
858
|
+
: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.
|
859
|
+
:param retries: Override the default retry configuration for this method
|
860
|
+
:param server_url: Override the default server URL for this method
|
861
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
862
|
+
:param http_headers: Additional headers to set or replace on requests.
|
863
|
+
"""
|
864
|
+
base_url = None
|
865
|
+
url_variables = None
|
866
|
+
if timeout_ms is None:
|
867
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
868
|
+
|
869
|
+
if server_url is not None:
|
870
|
+
base_url = server_url
|
871
|
+
|
872
|
+
request = models.GetCollectionCollectionsCollectionGetRequest(
|
873
|
+
collection=collection,
|
874
|
+
x_namespace=x_namespace,
|
875
|
+
)
|
876
|
+
|
877
|
+
req = self.build_request(
|
878
|
+
method="GET",
|
879
|
+
path="/collections/{collection}",
|
880
|
+
base_url=base_url,
|
881
|
+
url_variables=url_variables,
|
882
|
+
request=request,
|
883
|
+
request_body_required=False,
|
884
|
+
request_has_path_params=True,
|
885
|
+
request_has_query_params=False,
|
886
|
+
user_agent_header="user-agent",
|
887
|
+
accept_header_value="application/json",
|
888
|
+
http_headers=http_headers,
|
889
|
+
timeout_ms=timeout_ms,
|
890
|
+
)
|
891
|
+
|
892
|
+
if retries == UNSET:
|
893
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
894
|
+
retries = self.sdk_configuration.retry_config
|
895
|
+
|
896
|
+
retry_config = None
|
897
|
+
if isinstance(retries, utils.RetryConfig):
|
898
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
899
|
+
|
900
|
+
http_res = self.do_request(
|
901
|
+
hook_ctx=HookContext(
|
902
|
+
operation_id="get_collection_collections__collection__get",
|
903
|
+
oauth2_scopes=[],
|
904
|
+
security_source=None,
|
905
|
+
),
|
906
|
+
request=req,
|
907
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
908
|
+
retry_config=retry_config,
|
909
|
+
)
|
910
|
+
|
911
|
+
data: Any = None
|
912
|
+
if utils.match_response(http_res, "200", "application/json"):
|
913
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
914
|
+
if utils.match_response(
|
915
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
916
|
+
):
|
917
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
918
|
+
raise models.ErrorResponse(data=data)
|
919
|
+
if utils.match_response(http_res, "422", "application/json"):
|
920
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
921
|
+
raise models.HTTPValidationError(data=data)
|
922
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
923
|
+
http_res_text = utils.stream_to_text(http_res)
|
924
|
+
raise models.APIError(
|
925
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
926
|
+
)
|
927
|
+
|
928
|
+
content_type = http_res.headers.get("Content-Type")
|
929
|
+
http_res_text = utils.stream_to_text(http_res)
|
930
|
+
raise models.APIError(
|
931
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
932
|
+
http_res.status_code,
|
933
|
+
http_res_text,
|
934
|
+
http_res,
|
935
|
+
)
|
936
|
+
|
937
|
+
async def get_async(
|
938
|
+
self,
|
939
|
+
*,
|
940
|
+
collection: str,
|
941
|
+
x_namespace: OptionalNullable[str] = UNSET,
|
942
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
943
|
+
server_url: Optional[str] = None,
|
944
|
+
timeout_ms: Optional[int] = None,
|
945
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
946
|
+
) -> models.CollectionModel:
|
947
|
+
r"""Get Collection
|
948
|
+
|
949
|
+
Get a collection using either its name or ID
|
950
|
+
|
951
|
+
:param collection: Either the collection name or collection ID
|
952
|
+
: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.
|
953
|
+
:param retries: Override the default retry configuration for this method
|
954
|
+
:param server_url: Override the default server URL for this method
|
955
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
956
|
+
:param http_headers: Additional headers to set or replace on requests.
|
957
|
+
"""
|
958
|
+
base_url = None
|
959
|
+
url_variables = None
|
960
|
+
if timeout_ms is None:
|
961
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
962
|
+
|
963
|
+
if server_url is not None:
|
964
|
+
base_url = server_url
|
965
|
+
|
966
|
+
request = models.GetCollectionCollectionsCollectionGetRequest(
|
967
|
+
collection=collection,
|
968
|
+
x_namespace=x_namespace,
|
969
|
+
)
|
970
|
+
|
971
|
+
req = self.build_request_async(
|
972
|
+
method="GET",
|
973
|
+
path="/collections/{collection}",
|
974
|
+
base_url=base_url,
|
975
|
+
url_variables=url_variables,
|
976
|
+
request=request,
|
977
|
+
request_body_required=False,
|
978
|
+
request_has_path_params=True,
|
979
|
+
request_has_query_params=False,
|
980
|
+
user_agent_header="user-agent",
|
981
|
+
accept_header_value="application/json",
|
982
|
+
http_headers=http_headers,
|
983
|
+
timeout_ms=timeout_ms,
|
984
|
+
)
|
985
|
+
|
986
|
+
if retries == UNSET:
|
987
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
988
|
+
retries = self.sdk_configuration.retry_config
|
989
|
+
|
990
|
+
retry_config = None
|
991
|
+
if isinstance(retries, utils.RetryConfig):
|
992
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
993
|
+
|
994
|
+
http_res = await self.do_request_async(
|
995
|
+
hook_ctx=HookContext(
|
996
|
+
operation_id="get_collection_collections__collection__get",
|
997
|
+
oauth2_scopes=[],
|
998
|
+
security_source=None,
|
999
|
+
),
|
1000
|
+
request=req,
|
1001
|
+
error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
|
1002
|
+
retry_config=retry_config,
|
1003
|
+
)
|
1004
|
+
|
1005
|
+
data: Any = None
|
1006
|
+
if utils.match_response(http_res, "200", "application/json"):
|
1007
|
+
return utils.unmarshal_json(http_res.text, models.CollectionModel)
|
1008
|
+
if utils.match_response(
|
1009
|
+
http_res, ["400", "401", "403", "404", "500"], "application/json"
|
1010
|
+
):
|
1011
|
+
data = utils.unmarshal_json(http_res.text, models.ErrorResponseData)
|
1012
|
+
raise models.ErrorResponse(data=data)
|
1013
|
+
if utils.match_response(http_res, "422", "application/json"):
|
1014
|
+
data = utils.unmarshal_json(http_res.text, models.HTTPValidationErrorData)
|
1015
|
+
raise models.HTTPValidationError(data=data)
|
1016
|
+
if utils.match_response(http_res, ["4XX", "5XX"], "*"):
|
1017
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1018
|
+
raise models.APIError(
|
1019
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
1020
|
+
)
|
1021
|
+
|
1022
|
+
content_type = http_res.headers.get("Content-Type")
|
1023
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
1024
|
+
raise models.APIError(
|
1025
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
1026
|
+
http_res.status_code,
|
1027
|
+
http_res_text,
|
1028
|
+
http_res,
|
1029
|
+
)
|