mixpeek 0.20.20__py3-none-any.whl → 0.21.6__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 (228) hide show
  1. mixpeek/_version.py +3 -3
  2. mixpeek/{assets.py → bucketobjects.py} +309 -793
  3. mixpeek/buckets.py +1292 -0
  4. mixpeek/clusters.py +306 -0
  5. mixpeek/collectioncache.py +820 -0
  6. mixpeek/{taxonomyentities.py → collectiondocuments.py} +305 -559
  7. mixpeek/collections.py +120 -994
  8. mixpeek/features.py +45 -991
  9. mixpeek/models/__init__.py +625 -570
  10. mixpeek/models/aggregationtype.py +13 -0
  11. mixpeek/models/apikeyupdate.py +1 -1
  12. mixpeek/models/attributebasedconfig.py +21 -0
  13. mixpeek/models/automaticnaming.py +29 -0
  14. mixpeek/models/basicfeatureextractor.py +35 -0
  15. mixpeek/models/{classify_features_v1_entities_taxonomies_taxonomy_classify_postop.py → batch_delete_documents_v1_collections_collection_identifier_documents_batch_deleteop.py} +17 -15
  16. mixpeek/models/{update_collection_v1_collections_collection_putop.py → batch_update_documents_v1_collections_collection_identifier_documents_batch_putop.py} +29 -19
  17. mixpeek/models/blobdetails.py +72 -0
  18. mixpeek/models/blobmodel.py +107 -0
  19. mixpeek/models/bucketcreaterequest.py +75 -0
  20. mixpeek/models/bucketresponse.py +90 -0
  21. mixpeek/models/bucketschema_input.py +37 -0
  22. mixpeek/models/bucketschema_output.py +37 -0
  23. mixpeek/models/{featureresponse.py → bucketschemafield_input.py} +45 -18
  24. mixpeek/models/bucketschemafield_output.py +101 -0
  25. mixpeek/models/bucketschemafieldtype.py +29 -0
  26. mixpeek/models/bucketupdaterequest.py +68 -0
  27. mixpeek/models/cachestats.py +40 -0
  28. mixpeek/models/{list_collections_v1_collections_getop.py → cleanup_cache_v1_collections_cache_cleanup_postop.py} +23 -12
  29. mixpeek/models/{inputtype.py → clusteringmethod.py} +3 -5
  30. mixpeek/models/clustertype.py +9 -0
  31. mixpeek/models/collectioncacheconfig_input.py +92 -0
  32. mixpeek/models/collectioncacheconfig_output.py +92 -0
  33. mixpeek/models/collectionconfig.py +32 -0
  34. mixpeek/models/collectionmodel.py +79 -8
  35. mixpeek/models/{create_taxonomy_v1_entities_taxonomies_postop.py → create_bucket_v1_buckets_create_postop.py} +7 -7
  36. mixpeek/models/{search_assets_v1_assets_search_postop.py → create_cluster_v1_clusters_postop.py} +7 -7
  37. mixpeek/models/{create_collection_v1_collections_postop.py → create_collection_v1_collections_create_postop.py} +3 -3
  38. mixpeek/models/{ingest_video_url_v1_ingest_videos_url_postop.py → create_interaction_v1_retrievers_interactions_postop.py} +7 -7
  39. mixpeek/models/{partial_asset_update_v1_assets_asset_id_patchop.py → create_object_v1_buckets_bucket_identifier_objects_create_postop.py} +11 -9
  40. mixpeek/models/{ingest_text_v1_ingest_text_postop.py → create_retriever_v1_retrievers_retrievers_postop.py} +10 -7
  41. mixpeek/models/{ingest_image_url_v1_ingest_images_url_postop.py → create_taxonomy_v1_taxonomies_postop.py} +7 -7
  42. mixpeek/models/createblobrequest.py +80 -0
  43. mixpeek/models/createclusterrequest.py +74 -0
  44. mixpeek/models/createcollectionrequest.py +72 -3
  45. mixpeek/models/createnamespacerequest.py +14 -8
  46. mixpeek/models/createobjectrequest.py +75 -0
  47. mixpeek/models/createretrieverrequest.py +90 -0
  48. mixpeek/models/{taxonomyupdate.py → createtaxonomyrequest.py} +15 -13
  49. mixpeek/models/{delete_asset_v1_assets_asset_id_deleteop.py → delete_bucket_v1_buckets_bucket_identifier_deleteop.py} +5 -5
  50. mixpeek/models/{delete_classifications_v1_entities_taxonomies_taxonomy_classifications_classification_id_deleteop.py → delete_document_v1_collections_collection_identifier_documents_document_id_deleteop.py} +11 -11
  51. mixpeek/models/{get_taxonomy_v1_entities_taxonomies_taxonomy_getop.py → delete_interaction_v1_retrievers_interactions_interaction_id_deleteop.py} +7 -7
  52. mixpeek/models/delete_object_v1_buckets_bucket_identifier_objects_object_identifier_deleteop.py +70 -0
  53. mixpeek/models/{featureextractionembeddingrequest.py → documenthandlingconfig.py} +12 -15
  54. mixpeek/models/documentinputhandling.py +11 -0
  55. mixpeek/models/{jsontextoutputsettings.py → documentlistresponse.py} +15 -14
  56. mixpeek/models/documentoutputhandling.py +10 -0
  57. mixpeek/models/documentoutputtype.py +11 -0
  58. mixpeek/models/documentresponse.py +87 -0
  59. mixpeek/models/{nodeupdate.py → documentupdate.py} +22 -13
  60. mixpeek/models/enrichmentfield.py +25 -0
  61. mixpeek/models/errordetail.py +1 -1
  62. mixpeek/models/{update_node_v1_entities_taxonomies_nodes_node_patchop.py → execute_retriever_v1_retrievers_retrievers_retriever_id_execute_postop.py} +11 -11
  63. mixpeek/models/featureextractorconfig.py +116 -0
  64. mixpeek/models/featureextractordefinition.py +192 -0
  65. mixpeek/models/filtercondition.py +25 -25
  66. mixpeek/models/filteroperator.py +24 -0
  67. mixpeek/models/generativemodels.py +10 -0
  68. mixpeek/models/{delete_feature_v1_features_feature_id_deleteop.py → get_bucket_v1_buckets_bucket_identifier_getop.py} +5 -5
  69. mixpeek/models/{list_taxonomies_v1_entities_taxonomies_getop.py → get_cache_stats_v1_collections_cache_stats_getop.py} +16 -14
  70. mixpeek/models/get_collection_v1_collections_collection_id_getop.py +59 -0
  71. mixpeek/models/get_document_v1_collections_collection_identifier_documents_document_id_getop.py +70 -0
  72. mixpeek/models/get_feature_extractor_v1_features_extractors_feature_id_getop.py +16 -0
  73. mixpeek/models/get_interaction_v1_retrievers_interactions_interaction_id_getop.py +57 -0
  74. mixpeek/models/{delete_collection_v1_collections_collection_deleteop.py → get_object_v1_buckets_bucket_identifier_objects_object_identifier_getop.py} +16 -7
  75. mixpeek/models/get_research_v1_research_getop.py +52 -0
  76. mixpeek/models/get_retriever_stages_v1_retrievers_stages_getop.py +52 -0
  77. mixpeek/models/{delete_taxonomy_v1_entities_taxonomies_taxonomy_deleteop.py → get_retriever_v1_retrievers_retrievers_retriever_id_getop.py} +5 -7
  78. mixpeek/models/get_task_v1_tasks_task_id_getop.py +1 -1
  79. mixpeek/models/getusagerequestmodel.py +91 -0
  80. mixpeek/models/hdbscanparameters.py +26 -0
  81. mixpeek/models/interactionresponse.py +86 -0
  82. mixpeek/models/interactiontype.py +22 -0
  83. mixpeek/models/{search_features_v1_features_search_postop.py → invalidate_cache_v1_collections_cache_invalidate_postop.py} +60 -34
  84. mixpeek/models/invalidationevent.py +67 -0
  85. mixpeek/models/invalidationstrategy.py +12 -0
  86. mixpeek/models/kill_task_v1_tasks_task_id_deleteop.py +1 -1
  87. mixpeek/models/list_active_tasks_v1_tasks_getop.py +1 -1
  88. mixpeek/models/{list_assets_v1_assets_postop.py → list_buckets_v1_buckets_postop.py} +18 -18
  89. mixpeek/models/{list_features_v1_features_postop.py → list_documents_v1_collections_collection_identifier_documents_getop.py} +54 -19
  90. mixpeek/models/list_interactions_v1_retrievers_interactions_getop.py +96 -0
  91. mixpeek/models/{list_classifications_v1_entities_taxonomies_taxonomy_classifications_postop.py → list_objects_v1_buckets_bucket_identifier_objects_postop.py} +22 -29
  92. mixpeek/models/{groupbyoptionsasset.py → listbucketsrequest.py} +19 -28
  93. mixpeek/models/listbucketsresponse.py +23 -0
  94. mixpeek/models/{groupbyoptions.py → listobjectsrequest.py} +19 -28
  95. mixpeek/models/listobjectsresponse.py +25 -0
  96. mixpeek/models/listtasksresponse.py +3 -6
  97. mixpeek/models/{logicaloperator.py → logicaloperator_input.py} +42 -24
  98. mixpeek/models/logicaloperator_output.py +121 -0
  99. mixpeek/models/multivectorindex.py +25 -0
  100. mixpeek/models/namespaceresponse.py +1 -1
  101. mixpeek/models/namespaceusage.py +45 -0
  102. mixpeek/models/namingmethod.py +8 -0
  103. mixpeek/models/objectresponse.py +124 -0
  104. mixpeek/models/{db_model_paginationresponse.py → paginationresponse.py} +3 -3
  105. mixpeek/models/payloadindexconfig.py +1 -1
  106. mixpeek/models/plan.py +82 -0
  107. mixpeek/models/recomputestrategy.py +12 -0
  108. mixpeek/models/resourcetotals.py +39 -0
  109. mixpeek/models/{jsonvideooutputsettings.py → retrieverbinding.py} +19 -11
  110. mixpeek/models/{logodetectsettings.py → retrievercacheconfig.py} +20 -11
  111. mixpeek/models/retrievermodel.py +95 -0
  112. mixpeek/models/retrieverqueryrequest.py +114 -0
  113. mixpeek/models/retrieverresponse.py +24 -0
  114. mixpeek/models/searchinteraction.py +81 -0
  115. mixpeek/models/singlelineageentry.py +99 -0
  116. mixpeek/models/sortdirection.py +11 -0
  117. mixpeek/models/sortoption.py +20 -12
  118. mixpeek/models/sourceconfig_input.py +72 -0
  119. mixpeek/models/sourceconfig_output.py +75 -0
  120. mixpeek/models/sourcetype.py +11 -0
  121. mixpeek/models/stageconfig_input.py +111 -0
  122. mixpeek/models/stageconfig_output.py +114 -0
  123. mixpeek/models/stagedefinition.py +110 -0
  124. mixpeek/models/{jsonimageoutputsettings.py → stageresponse.py} +21 -11
  125. mixpeek/models/taskresponse.py +1 -1
  126. mixpeek/models/taskstatus.py +1 -0
  127. mixpeek/models/{assetfeatures.py → taxonomyapplicationconfig.py} +23 -15
  128. mixpeek/models/taxonomyconfig.py +19 -0
  129. mixpeek/models/timeseriesdatapoint.py +25 -0
  130. mixpeek/models/timeseriesusage.py +36 -0
  131. mixpeek/models/{full_asset_update_v1_assets_asset_id_putop.py → update_bucket_v1_buckets_bucket_identifier_putop.py} +9 -9
  132. mixpeek/models/{update_taxonomy_v1_entities_taxonomies_taxonomy_patchop.py → update_document_v1_collections_collection_identifier_documents_document_id_putop.py} +25 -13
  133. mixpeek/models/{full_feature_update_v1_features_feature_id_putop.py → update_object_v1_buckets_bucket_identifier_objects_object_identifier_putop.py} +20 -9
  134. mixpeek/models/updatenamespacerequest.py +1 -1
  135. mixpeek/models/updateobjectrequest.py +75 -0
  136. mixpeek/models/usageresponse.py +86 -0
  137. mixpeek/models/usagesummary.py +39 -0
  138. mixpeek/models/usagetimerange.py +16 -0
  139. mixpeek/models/usermodel_input.py +3 -0
  140. mixpeek/models/usermodel_output.py +3 -0
  141. mixpeek/models/vectorbasedconfig.py +60 -0
  142. mixpeek/models/{collectionresult.py → vectorindex.py} +20 -15
  143. mixpeek/models/vectorindexdefinition.py +43 -0
  144. mixpeek/models/vectortype.py +4 -1
  145. mixpeek/namespaces.py +26 -480
  146. mixpeek/organizationnotifications.py +214 -0
  147. mixpeek/organizations.py +6 -210
  148. mixpeek/{featureextractors.py → organizationsusage.py} +31 -39
  149. mixpeek/research.py +228 -0
  150. mixpeek/retrieverinteractions.py +1036 -0
  151. mixpeek/{ingestassets.py → retrievers.py} +209 -271
  152. mixpeek/retrieverstages.py +232 -0
  153. mixpeek/sdk.py +40 -23
  154. mixpeek/taxonomies.py +43 -513
  155. mixpeek/types/basemodel.py +3 -3
  156. mixpeek/utils/enums.py +67 -27
  157. {mixpeek-0.20.20.dist-info → mixpeek-0.21.6.dist-info}/METADATA +68 -50
  158. mixpeek-0.21.6.dist-info/RECORD +216 -0
  159. {mixpeek-0.20.20.dist-info → mixpeek-0.21.6.dist-info}/WHEEL +1 -1
  160. mixpeek/models/actionusage.py +0 -16
  161. mixpeek/models/assetresponse.py +0 -166
  162. mixpeek/models/assets_model_searchquery.py +0 -21
  163. mixpeek/models/assetupdate.py +0 -28
  164. mixpeek/models/assignmentconfig.py +0 -67
  165. mixpeek/models/assignmentmode.py +0 -11
  166. mixpeek/models/availablemodels.py +0 -16
  167. mixpeek/models/availablemodelsresponse.py +0 -27
  168. mixpeek/models/classificationmatch.py +0 -77
  169. mixpeek/models/classificationwithfeature.py +0 -73
  170. mixpeek/models/collectiondetailsresponse.py +0 -83
  171. mixpeek/models/dateusage.py +0 -22
  172. mixpeek/models/denseembedding.py +0 -16
  173. mixpeek/models/discoverrequest.py +0 -64
  174. mixpeek/models/embeddingconfig.py +0 -33
  175. mixpeek/models/embeddingrequest.py +0 -92
  176. mixpeek/models/embeddingresponse.py +0 -64
  177. mixpeek/models/entitysettings.py +0 -50
  178. mixpeek/models/featureoptions.py +0 -25
  179. mixpeek/models/features_model_paginationresponse.py +0 -59
  180. mixpeek/models/featureupdaterequest.py +0 -21
  181. mixpeek/models/get_asset_v1_assets_asset_id_getop.py +0 -73
  182. mixpeek/models/get_asset_with_features_v1_assets_asset_id_features_getop.py +0 -73
  183. mixpeek/models/get_collection_details_v1_collections_collection_details_getop.py +0 -59
  184. mixpeek/models/get_collection_details_v1_collections_collection_getop.py +0 -59
  185. mixpeek/models/get_feature_v1_features_feature_id_getop.py +0 -70
  186. mixpeek/models/get_taxonomy_node_v1_entities_taxonomies_nodes_node_getop.py +0 -59
  187. mixpeek/models/groupedassetdata.py +0 -18
  188. mixpeek/models/imagedescribesettings.py +0 -82
  189. mixpeek/models/imagedetectsettings.py +0 -47
  190. mixpeek/models/imagereadsettings.py +0 -71
  191. mixpeek/models/imagesettings.py +0 -92
  192. mixpeek/models/listassetsrequest.py +0 -75
  193. mixpeek/models/listassetsresponse.py +0 -22
  194. mixpeek/models/listclassificationsrequest.py +0 -69
  195. mixpeek/models/listclassificationsresponse.py +0 -31
  196. mixpeek/models/listcollectionsresponse.py +0 -22
  197. mixpeek/models/listfeaturesrequest.py +0 -77
  198. mixpeek/models/listfeaturesresponse.py +0 -22
  199. mixpeek/models/listtaxonomiesresponse.py +0 -24
  200. mixpeek/models/modality.py +0 -13
  201. mixpeek/models/modeldetails.py +0 -61
  202. mixpeek/models/nodeoptions.py +0 -16
  203. mixpeek/models/patch_namespace_v1_namespaces_namespace_patchop.py +0 -28
  204. mixpeek/models/payloadindextype.py +0 -17
  205. mixpeek/models/processimageurlinput.py +0 -87
  206. mixpeek/models/processtextinput.py +0 -82
  207. mixpeek/models/processvideourlinput.py +0 -87
  208. mixpeek/models/querysettings.py +0 -56
  209. mixpeek/models/rerankingoptions.py +0 -47
  210. mixpeek/models/search_model_searchquery.py +0 -76
  211. mixpeek/models/searchassetsrequest.py +0 -78
  212. mixpeek/models/searchrequestfeatures.py +0 -153
  213. mixpeek/models/sparseembedding.py +0 -21
  214. mixpeek/models/taxonomycreate.py +0 -20
  215. mixpeek/models/taxonomyextractionconfig.py +0 -26
  216. mixpeek/models/taxonomymodel.py +0 -27
  217. mixpeek/models/taxonomynode.py +0 -101
  218. mixpeek/models/taxonomynodecreate.py +0 -63
  219. mixpeek/models/textsettings.py +0 -67
  220. mixpeek/models/updateassetrequest.py +0 -60
  221. mixpeek/models/usage.py +0 -18
  222. mixpeek/models/vectormodel.py +0 -15
  223. mixpeek/models/videodescribesettings.py +0 -82
  224. mixpeek/models/videodetectsettings.py +0 -47
  225. mixpeek/models/videoreadsettings.py +0 -71
  226. mixpeek/models/videosettings.py +0 -115
  227. mixpeek/models/videotranscriptionsettings.py +0 -69
  228. mixpeek-0.20.20.dist-info/RECORD +0 -201
mixpeek/buckets.py ADDED
@@ -0,0 +1,1292 @@
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 mixpeek.utils import get_security_from_env
8
+ from typing import Any, Mapping, Optional, Union
9
+
10
+
11
+ class Buckets(BaseSDK):
12
+ def create(
13
+ self,
14
+ *,
15
+ bucket_name: str,
16
+ bucket_schema: Union[
17
+ models.BucketSchemaInput, models.BucketSchemaInputTypedDict
18
+ ],
19
+ x_namespace: OptionalNullable[str] = UNSET,
20
+ description: OptionalNullable[str] = UNSET,
21
+ metadata: Optional[
22
+ Union[
23
+ models.BucketCreateRequestMetadata,
24
+ models.BucketCreateRequestMetadataTypedDict,
25
+ ]
26
+ ] = None,
27
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
28
+ server_url: Optional[str] = None,
29
+ timeout_ms: Optional[int] = None,
30
+ http_headers: Optional[Mapping[str, str]] = None,
31
+ ) -> models.BucketResponse:
32
+ r"""Create Bucket
33
+
34
+ This endpoint allows you to create a new bucket with a defined schema.
35
+ A bucket is a collection of objects that conform to the schema.
36
+ The schema defines the structure and validation rules for objects in the bucket.
37
+
38
+ :param bucket_name: Human-readable name for the bucket
39
+ :param bucket_schema: Schema definition for bucket objects
40
+ :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.
41
+ :param description: Description of the bucket
42
+ :param metadata: Additional metadata for the bucket
43
+ :param retries: Override the default retry configuration for this method
44
+ :param server_url: Override the default server URL for this method
45
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
46
+ :param http_headers: Additional headers to set or replace on requests.
47
+ """
48
+ base_url = None
49
+ url_variables = None
50
+ if timeout_ms is None:
51
+ timeout_ms = self.sdk_configuration.timeout_ms
52
+
53
+ if server_url is not None:
54
+ base_url = server_url
55
+ else:
56
+ base_url = self._get_url(base_url, url_variables)
57
+
58
+ request = models.CreateBucketV1BucketsCreatePostRequest(
59
+ x_namespace=x_namespace,
60
+ bucket_create_request=models.BucketCreateRequest(
61
+ bucket_name=bucket_name,
62
+ description=description,
63
+ bucket_schema=utils.get_pydantic_model(
64
+ bucket_schema, models.BucketSchemaInput
65
+ ),
66
+ metadata=utils.get_pydantic_model(
67
+ metadata, Optional[models.BucketCreateRequestMetadata]
68
+ ),
69
+ ),
70
+ )
71
+
72
+ req = self._build_request(
73
+ method="POST",
74
+ path="/v1/buckets/create",
75
+ base_url=base_url,
76
+ url_variables=url_variables,
77
+ request=request,
78
+ request_body_required=True,
79
+ request_has_path_params=False,
80
+ request_has_query_params=True,
81
+ user_agent_header="user-agent",
82
+ accept_header_value="application/json",
83
+ http_headers=http_headers,
84
+ security=self.sdk_configuration.security,
85
+ get_serialized_body=lambda: utils.serialize_request_body(
86
+ request.bucket_create_request,
87
+ False,
88
+ False,
89
+ "json",
90
+ models.BucketCreateRequest,
91
+ ),
92
+ timeout_ms=timeout_ms,
93
+ )
94
+
95
+ if retries == UNSET:
96
+ if self.sdk_configuration.retry_config is not UNSET:
97
+ retries = self.sdk_configuration.retry_config
98
+
99
+ retry_config = None
100
+ if isinstance(retries, utils.RetryConfig):
101
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
102
+
103
+ http_res = self.do_request(
104
+ hook_ctx=HookContext(
105
+ base_url=base_url or "",
106
+ operation_id="create_bucket_v1_buckets_create_post",
107
+ oauth2_scopes=[],
108
+ security_source=get_security_from_env(
109
+ self.sdk_configuration.security, models.Security
110
+ ),
111
+ ),
112
+ request=req,
113
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
114
+ retry_config=retry_config,
115
+ )
116
+
117
+ response_data: Any = None
118
+ if utils.match_response(http_res, "200", "application/json"):
119
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
120
+ if utils.match_response(
121
+ http_res, ["400", "401", "403", "404"], "application/json"
122
+ ):
123
+ response_data = utils.unmarshal_json(
124
+ http_res.text, models.ErrorResponseData
125
+ )
126
+ raise models.ErrorResponse(data=response_data)
127
+ if utils.match_response(http_res, "422", "application/json"):
128
+ response_data = utils.unmarshal_json(
129
+ http_res.text, models.HTTPValidationErrorData
130
+ )
131
+ raise models.HTTPValidationError(data=response_data)
132
+ if utils.match_response(http_res, "500", "application/json"):
133
+ response_data = utils.unmarshal_json(
134
+ http_res.text, models.ErrorResponseData
135
+ )
136
+ raise models.ErrorResponse(data=response_data)
137
+ if utils.match_response(http_res, "4XX", "*"):
138
+ http_res_text = utils.stream_to_text(http_res)
139
+ raise models.APIError(
140
+ "API error occurred", http_res.status_code, http_res_text, http_res
141
+ )
142
+ if utils.match_response(http_res, "5XX", "*"):
143
+ http_res_text = utils.stream_to_text(http_res)
144
+ raise models.APIError(
145
+ "API error occurred", http_res.status_code, http_res_text, http_res
146
+ )
147
+
148
+ content_type = http_res.headers.get("Content-Type")
149
+ http_res_text = utils.stream_to_text(http_res)
150
+ raise models.APIError(
151
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
152
+ http_res.status_code,
153
+ http_res_text,
154
+ http_res,
155
+ )
156
+
157
+ async def create_async(
158
+ self,
159
+ *,
160
+ bucket_name: str,
161
+ bucket_schema: Union[
162
+ models.BucketSchemaInput, models.BucketSchemaInputTypedDict
163
+ ],
164
+ x_namespace: OptionalNullable[str] = UNSET,
165
+ description: OptionalNullable[str] = UNSET,
166
+ metadata: Optional[
167
+ Union[
168
+ models.BucketCreateRequestMetadata,
169
+ models.BucketCreateRequestMetadataTypedDict,
170
+ ]
171
+ ] = None,
172
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
173
+ server_url: Optional[str] = None,
174
+ timeout_ms: Optional[int] = None,
175
+ http_headers: Optional[Mapping[str, str]] = None,
176
+ ) -> models.BucketResponse:
177
+ r"""Create Bucket
178
+
179
+ This endpoint allows you to create a new bucket with a defined schema.
180
+ A bucket is a collection of objects that conform to the schema.
181
+ The schema defines the structure and validation rules for objects in the bucket.
182
+
183
+ :param bucket_name: Human-readable name for the bucket
184
+ :param bucket_schema: Schema definition for bucket objects
185
+ :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.
186
+ :param description: Description of the bucket
187
+ :param metadata: Additional metadata for the bucket
188
+ :param retries: Override the default retry configuration for this method
189
+ :param server_url: Override the default server URL for this method
190
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
191
+ :param http_headers: Additional headers to set or replace on requests.
192
+ """
193
+ base_url = None
194
+ url_variables = None
195
+ if timeout_ms is None:
196
+ timeout_ms = self.sdk_configuration.timeout_ms
197
+
198
+ if server_url is not None:
199
+ base_url = server_url
200
+ else:
201
+ base_url = self._get_url(base_url, url_variables)
202
+
203
+ request = models.CreateBucketV1BucketsCreatePostRequest(
204
+ x_namespace=x_namespace,
205
+ bucket_create_request=models.BucketCreateRequest(
206
+ bucket_name=bucket_name,
207
+ description=description,
208
+ bucket_schema=utils.get_pydantic_model(
209
+ bucket_schema, models.BucketSchemaInput
210
+ ),
211
+ metadata=utils.get_pydantic_model(
212
+ metadata, Optional[models.BucketCreateRequestMetadata]
213
+ ),
214
+ ),
215
+ )
216
+
217
+ req = self._build_request_async(
218
+ method="POST",
219
+ path="/v1/buckets/create",
220
+ base_url=base_url,
221
+ url_variables=url_variables,
222
+ request=request,
223
+ request_body_required=True,
224
+ request_has_path_params=False,
225
+ request_has_query_params=True,
226
+ user_agent_header="user-agent",
227
+ accept_header_value="application/json",
228
+ http_headers=http_headers,
229
+ security=self.sdk_configuration.security,
230
+ get_serialized_body=lambda: utils.serialize_request_body(
231
+ request.bucket_create_request,
232
+ False,
233
+ False,
234
+ "json",
235
+ models.BucketCreateRequest,
236
+ ),
237
+ timeout_ms=timeout_ms,
238
+ )
239
+
240
+ if retries == UNSET:
241
+ if self.sdk_configuration.retry_config is not UNSET:
242
+ retries = self.sdk_configuration.retry_config
243
+
244
+ retry_config = None
245
+ if isinstance(retries, utils.RetryConfig):
246
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
247
+
248
+ http_res = await self.do_request_async(
249
+ hook_ctx=HookContext(
250
+ base_url=base_url or "",
251
+ operation_id="create_bucket_v1_buckets_create_post",
252
+ oauth2_scopes=[],
253
+ security_source=get_security_from_env(
254
+ self.sdk_configuration.security, models.Security
255
+ ),
256
+ ),
257
+ request=req,
258
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
259
+ retry_config=retry_config,
260
+ )
261
+
262
+ response_data: Any = None
263
+ if utils.match_response(http_res, "200", "application/json"):
264
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
265
+ if utils.match_response(
266
+ http_res, ["400", "401", "403", "404"], "application/json"
267
+ ):
268
+ response_data = utils.unmarshal_json(
269
+ http_res.text, models.ErrorResponseData
270
+ )
271
+ raise models.ErrorResponse(data=response_data)
272
+ if utils.match_response(http_res, "422", "application/json"):
273
+ response_data = utils.unmarshal_json(
274
+ http_res.text, models.HTTPValidationErrorData
275
+ )
276
+ raise models.HTTPValidationError(data=response_data)
277
+ if utils.match_response(http_res, "500", "application/json"):
278
+ response_data = utils.unmarshal_json(
279
+ http_res.text, models.ErrorResponseData
280
+ )
281
+ raise models.ErrorResponse(data=response_data)
282
+ if utils.match_response(http_res, "4XX", "*"):
283
+ http_res_text = await utils.stream_to_text_async(http_res)
284
+ raise models.APIError(
285
+ "API error occurred", http_res.status_code, http_res_text, http_res
286
+ )
287
+ if utils.match_response(http_res, "5XX", "*"):
288
+ http_res_text = await utils.stream_to_text_async(http_res)
289
+ raise models.APIError(
290
+ "API error occurred", http_res.status_code, http_res_text, http_res
291
+ )
292
+
293
+ content_type = http_res.headers.get("Content-Type")
294
+ http_res_text = await utils.stream_to_text_async(http_res)
295
+ raise models.APIError(
296
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
297
+ http_res.status_code,
298
+ http_res_text,
299
+ http_res,
300
+ )
301
+
302
+ def get(
303
+ self,
304
+ *,
305
+ bucket_identifier: str,
306
+ x_namespace: OptionalNullable[str] = UNSET,
307
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
308
+ server_url: Optional[str] = None,
309
+ timeout_ms: Optional[int] = None,
310
+ http_headers: Optional[Mapping[str, str]] = None,
311
+ ) -> models.BucketResponse:
312
+ r"""Get Bucket
313
+
314
+ This endpoint retrieves a bucket by its ID.
315
+
316
+ :param bucket_identifier:
317
+ :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.
318
+ :param retries: Override the default retry configuration for this method
319
+ :param server_url: Override the default server URL for this method
320
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
321
+ :param http_headers: Additional headers to set or replace on requests.
322
+ """
323
+ base_url = None
324
+ url_variables = None
325
+ if timeout_ms is None:
326
+ timeout_ms = self.sdk_configuration.timeout_ms
327
+
328
+ if server_url is not None:
329
+ base_url = server_url
330
+ else:
331
+ base_url = self._get_url(base_url, url_variables)
332
+
333
+ request = models.GetBucketV1BucketsBucketIdentifierGetRequest(
334
+ bucket_identifier=bucket_identifier,
335
+ x_namespace=x_namespace,
336
+ )
337
+
338
+ req = self._build_request(
339
+ method="GET",
340
+ path="/v1/buckets/{bucket_identifier}",
341
+ base_url=base_url,
342
+ url_variables=url_variables,
343
+ request=request,
344
+ request_body_required=False,
345
+ request_has_path_params=True,
346
+ request_has_query_params=True,
347
+ user_agent_header="user-agent",
348
+ accept_header_value="application/json",
349
+ http_headers=http_headers,
350
+ security=self.sdk_configuration.security,
351
+ timeout_ms=timeout_ms,
352
+ )
353
+
354
+ if retries == UNSET:
355
+ if self.sdk_configuration.retry_config is not UNSET:
356
+ retries = self.sdk_configuration.retry_config
357
+
358
+ retry_config = None
359
+ if isinstance(retries, utils.RetryConfig):
360
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
361
+
362
+ http_res = self.do_request(
363
+ hook_ctx=HookContext(
364
+ base_url=base_url or "",
365
+ operation_id="get_bucket_v1_buckets__bucket_identifier__get",
366
+ oauth2_scopes=[],
367
+ security_source=get_security_from_env(
368
+ self.sdk_configuration.security, models.Security
369
+ ),
370
+ ),
371
+ request=req,
372
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
373
+ retry_config=retry_config,
374
+ )
375
+
376
+ response_data: Any = None
377
+ if utils.match_response(http_res, "200", "application/json"):
378
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
379
+ if utils.match_response(
380
+ http_res, ["400", "401", "403", "404"], "application/json"
381
+ ):
382
+ response_data = utils.unmarshal_json(
383
+ http_res.text, models.ErrorResponseData
384
+ )
385
+ raise models.ErrorResponse(data=response_data)
386
+ if utils.match_response(http_res, "422", "application/json"):
387
+ response_data = utils.unmarshal_json(
388
+ http_res.text, models.HTTPValidationErrorData
389
+ )
390
+ raise models.HTTPValidationError(data=response_data)
391
+ if utils.match_response(http_res, "500", "application/json"):
392
+ response_data = utils.unmarshal_json(
393
+ http_res.text, models.ErrorResponseData
394
+ )
395
+ raise models.ErrorResponse(data=response_data)
396
+ if utils.match_response(http_res, "4XX", "*"):
397
+ http_res_text = utils.stream_to_text(http_res)
398
+ raise models.APIError(
399
+ "API error occurred", http_res.status_code, http_res_text, http_res
400
+ )
401
+ if utils.match_response(http_res, "5XX", "*"):
402
+ http_res_text = utils.stream_to_text(http_res)
403
+ raise models.APIError(
404
+ "API error occurred", http_res.status_code, http_res_text, http_res
405
+ )
406
+
407
+ content_type = http_res.headers.get("Content-Type")
408
+ http_res_text = utils.stream_to_text(http_res)
409
+ raise models.APIError(
410
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
411
+ http_res.status_code,
412
+ http_res_text,
413
+ http_res,
414
+ )
415
+
416
+ async def get_async(
417
+ self,
418
+ *,
419
+ bucket_identifier: str,
420
+ x_namespace: OptionalNullable[str] = UNSET,
421
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
422
+ server_url: Optional[str] = None,
423
+ timeout_ms: Optional[int] = None,
424
+ http_headers: Optional[Mapping[str, str]] = None,
425
+ ) -> models.BucketResponse:
426
+ r"""Get Bucket
427
+
428
+ This endpoint retrieves a bucket by its ID.
429
+
430
+ :param bucket_identifier:
431
+ :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.
432
+ :param retries: Override the default retry configuration for this method
433
+ :param server_url: Override the default server URL for this method
434
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
435
+ :param http_headers: Additional headers to set or replace on requests.
436
+ """
437
+ base_url = None
438
+ url_variables = None
439
+ if timeout_ms is None:
440
+ timeout_ms = self.sdk_configuration.timeout_ms
441
+
442
+ if server_url is not None:
443
+ base_url = server_url
444
+ else:
445
+ base_url = self._get_url(base_url, url_variables)
446
+
447
+ request = models.GetBucketV1BucketsBucketIdentifierGetRequest(
448
+ bucket_identifier=bucket_identifier,
449
+ x_namespace=x_namespace,
450
+ )
451
+
452
+ req = self._build_request_async(
453
+ method="GET",
454
+ path="/v1/buckets/{bucket_identifier}",
455
+ base_url=base_url,
456
+ url_variables=url_variables,
457
+ request=request,
458
+ request_body_required=False,
459
+ request_has_path_params=True,
460
+ request_has_query_params=True,
461
+ user_agent_header="user-agent",
462
+ accept_header_value="application/json",
463
+ http_headers=http_headers,
464
+ security=self.sdk_configuration.security,
465
+ timeout_ms=timeout_ms,
466
+ )
467
+
468
+ if retries == UNSET:
469
+ if self.sdk_configuration.retry_config is not UNSET:
470
+ retries = self.sdk_configuration.retry_config
471
+
472
+ retry_config = None
473
+ if isinstance(retries, utils.RetryConfig):
474
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
475
+
476
+ http_res = await self.do_request_async(
477
+ hook_ctx=HookContext(
478
+ base_url=base_url or "",
479
+ operation_id="get_bucket_v1_buckets__bucket_identifier__get",
480
+ oauth2_scopes=[],
481
+ security_source=get_security_from_env(
482
+ self.sdk_configuration.security, models.Security
483
+ ),
484
+ ),
485
+ request=req,
486
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
487
+ retry_config=retry_config,
488
+ )
489
+
490
+ response_data: Any = None
491
+ if utils.match_response(http_res, "200", "application/json"):
492
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
493
+ if utils.match_response(
494
+ http_res, ["400", "401", "403", "404"], "application/json"
495
+ ):
496
+ response_data = utils.unmarshal_json(
497
+ http_res.text, models.ErrorResponseData
498
+ )
499
+ raise models.ErrorResponse(data=response_data)
500
+ if utils.match_response(http_res, "422", "application/json"):
501
+ response_data = utils.unmarshal_json(
502
+ http_res.text, models.HTTPValidationErrorData
503
+ )
504
+ raise models.HTTPValidationError(data=response_data)
505
+ if utils.match_response(http_res, "500", "application/json"):
506
+ response_data = utils.unmarshal_json(
507
+ http_res.text, models.ErrorResponseData
508
+ )
509
+ raise models.ErrorResponse(data=response_data)
510
+ if utils.match_response(http_res, "4XX", "*"):
511
+ http_res_text = await utils.stream_to_text_async(http_res)
512
+ raise models.APIError(
513
+ "API error occurred", http_res.status_code, http_res_text, http_res
514
+ )
515
+ if utils.match_response(http_res, "5XX", "*"):
516
+ http_res_text = await utils.stream_to_text_async(http_res)
517
+ raise models.APIError(
518
+ "API error occurred", http_res.status_code, http_res_text, http_res
519
+ )
520
+
521
+ content_type = http_res.headers.get("Content-Type")
522
+ http_res_text = await utils.stream_to_text_async(http_res)
523
+ raise models.APIError(
524
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
525
+ http_res.status_code,
526
+ http_res_text,
527
+ http_res,
528
+ )
529
+
530
+ def update(
531
+ self,
532
+ *,
533
+ bucket_identifier: str,
534
+ x_namespace: OptionalNullable[str] = UNSET,
535
+ bucket_name: OptionalNullable[str] = UNSET,
536
+ description: OptionalNullable[str] = UNSET,
537
+ metadata: OptionalNullable[
538
+ Union[models.Metadata, models.MetadataTypedDict]
539
+ ] = UNSET,
540
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
541
+ server_url: Optional[str] = None,
542
+ timeout_ms: Optional[int] = None,
543
+ http_headers: Optional[Mapping[str, str]] = None,
544
+ ) -> models.BucketResponse:
545
+ r"""Update Bucket
546
+
547
+ This endpoint allows you to update an existing bucket.
548
+ You can update the bucket's name, description, and metadata.
549
+
550
+ :param bucket_identifier:
551
+ :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.
552
+ :param bucket_name: Human-readable name for the bucket
553
+ :param description: Description of the bucket
554
+ :param metadata: Additional metadata for the bucket
555
+ :param retries: Override the default retry configuration for this method
556
+ :param server_url: Override the default server URL for this method
557
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
558
+ :param http_headers: Additional headers to set or replace on requests.
559
+ """
560
+ base_url = None
561
+ url_variables = None
562
+ if timeout_ms is None:
563
+ timeout_ms = self.sdk_configuration.timeout_ms
564
+
565
+ if server_url is not None:
566
+ base_url = server_url
567
+ else:
568
+ base_url = self._get_url(base_url, url_variables)
569
+
570
+ request = models.UpdateBucketV1BucketsBucketIdentifierPutRequest(
571
+ bucket_identifier=bucket_identifier,
572
+ x_namespace=x_namespace,
573
+ bucket_update_request=models.BucketUpdateRequest(
574
+ bucket_name=bucket_name,
575
+ description=description,
576
+ metadata=utils.get_pydantic_model(
577
+ metadata, OptionalNullable[models.Metadata]
578
+ ),
579
+ ),
580
+ )
581
+
582
+ req = self._build_request(
583
+ method="PUT",
584
+ path="/v1/buckets/{bucket_identifier}",
585
+ base_url=base_url,
586
+ url_variables=url_variables,
587
+ request=request,
588
+ request_body_required=True,
589
+ request_has_path_params=True,
590
+ request_has_query_params=True,
591
+ user_agent_header="user-agent",
592
+ accept_header_value="application/json",
593
+ http_headers=http_headers,
594
+ security=self.sdk_configuration.security,
595
+ get_serialized_body=lambda: utils.serialize_request_body(
596
+ request.bucket_update_request,
597
+ False,
598
+ False,
599
+ "json",
600
+ models.BucketUpdateRequest,
601
+ ),
602
+ timeout_ms=timeout_ms,
603
+ )
604
+
605
+ if retries == UNSET:
606
+ if self.sdk_configuration.retry_config is not UNSET:
607
+ retries = self.sdk_configuration.retry_config
608
+
609
+ retry_config = None
610
+ if isinstance(retries, utils.RetryConfig):
611
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
612
+
613
+ http_res = self.do_request(
614
+ hook_ctx=HookContext(
615
+ base_url=base_url or "",
616
+ operation_id="update_bucket_v1_buckets__bucket_identifier__put",
617
+ oauth2_scopes=[],
618
+ security_source=get_security_from_env(
619
+ self.sdk_configuration.security, models.Security
620
+ ),
621
+ ),
622
+ request=req,
623
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
624
+ retry_config=retry_config,
625
+ )
626
+
627
+ response_data: Any = None
628
+ if utils.match_response(http_res, "200", "application/json"):
629
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
630
+ if utils.match_response(
631
+ http_res, ["400", "401", "403", "404"], "application/json"
632
+ ):
633
+ response_data = utils.unmarshal_json(
634
+ http_res.text, models.ErrorResponseData
635
+ )
636
+ raise models.ErrorResponse(data=response_data)
637
+ if utils.match_response(http_res, "422", "application/json"):
638
+ response_data = utils.unmarshal_json(
639
+ http_res.text, models.HTTPValidationErrorData
640
+ )
641
+ raise models.HTTPValidationError(data=response_data)
642
+ if utils.match_response(http_res, "500", "application/json"):
643
+ response_data = utils.unmarshal_json(
644
+ http_res.text, models.ErrorResponseData
645
+ )
646
+ raise models.ErrorResponse(data=response_data)
647
+ if utils.match_response(http_res, "4XX", "*"):
648
+ http_res_text = utils.stream_to_text(http_res)
649
+ raise models.APIError(
650
+ "API error occurred", http_res.status_code, http_res_text, http_res
651
+ )
652
+ if utils.match_response(http_res, "5XX", "*"):
653
+ http_res_text = utils.stream_to_text(http_res)
654
+ raise models.APIError(
655
+ "API error occurred", http_res.status_code, http_res_text, http_res
656
+ )
657
+
658
+ content_type = http_res.headers.get("Content-Type")
659
+ http_res_text = utils.stream_to_text(http_res)
660
+ raise models.APIError(
661
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
662
+ http_res.status_code,
663
+ http_res_text,
664
+ http_res,
665
+ )
666
+
667
+ async def update_async(
668
+ self,
669
+ *,
670
+ bucket_identifier: str,
671
+ x_namespace: OptionalNullable[str] = UNSET,
672
+ bucket_name: OptionalNullable[str] = UNSET,
673
+ description: OptionalNullable[str] = UNSET,
674
+ metadata: OptionalNullable[
675
+ Union[models.Metadata, models.MetadataTypedDict]
676
+ ] = UNSET,
677
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
678
+ server_url: Optional[str] = None,
679
+ timeout_ms: Optional[int] = None,
680
+ http_headers: Optional[Mapping[str, str]] = None,
681
+ ) -> models.BucketResponse:
682
+ r"""Update Bucket
683
+
684
+ This endpoint allows you to update an existing bucket.
685
+ You can update the bucket's name, description, and metadata.
686
+
687
+ :param bucket_identifier:
688
+ :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.
689
+ :param bucket_name: Human-readable name for the bucket
690
+ :param description: Description of the bucket
691
+ :param metadata: Additional metadata for the bucket
692
+ :param retries: Override the default retry configuration for this method
693
+ :param server_url: Override the default server URL for this method
694
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
695
+ :param http_headers: Additional headers to set or replace on requests.
696
+ """
697
+ base_url = None
698
+ url_variables = None
699
+ if timeout_ms is None:
700
+ timeout_ms = self.sdk_configuration.timeout_ms
701
+
702
+ if server_url is not None:
703
+ base_url = server_url
704
+ else:
705
+ base_url = self._get_url(base_url, url_variables)
706
+
707
+ request = models.UpdateBucketV1BucketsBucketIdentifierPutRequest(
708
+ bucket_identifier=bucket_identifier,
709
+ x_namespace=x_namespace,
710
+ bucket_update_request=models.BucketUpdateRequest(
711
+ bucket_name=bucket_name,
712
+ description=description,
713
+ metadata=utils.get_pydantic_model(
714
+ metadata, OptionalNullable[models.Metadata]
715
+ ),
716
+ ),
717
+ )
718
+
719
+ req = self._build_request_async(
720
+ method="PUT",
721
+ path="/v1/buckets/{bucket_identifier}",
722
+ base_url=base_url,
723
+ url_variables=url_variables,
724
+ request=request,
725
+ request_body_required=True,
726
+ request_has_path_params=True,
727
+ request_has_query_params=True,
728
+ user_agent_header="user-agent",
729
+ accept_header_value="application/json",
730
+ http_headers=http_headers,
731
+ security=self.sdk_configuration.security,
732
+ get_serialized_body=lambda: utils.serialize_request_body(
733
+ request.bucket_update_request,
734
+ False,
735
+ False,
736
+ "json",
737
+ models.BucketUpdateRequest,
738
+ ),
739
+ timeout_ms=timeout_ms,
740
+ )
741
+
742
+ if retries == UNSET:
743
+ if self.sdk_configuration.retry_config is not UNSET:
744
+ retries = self.sdk_configuration.retry_config
745
+
746
+ retry_config = None
747
+ if isinstance(retries, utils.RetryConfig):
748
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
749
+
750
+ http_res = await self.do_request_async(
751
+ hook_ctx=HookContext(
752
+ base_url=base_url or "",
753
+ operation_id="update_bucket_v1_buckets__bucket_identifier__put",
754
+ oauth2_scopes=[],
755
+ security_source=get_security_from_env(
756
+ self.sdk_configuration.security, models.Security
757
+ ),
758
+ ),
759
+ request=req,
760
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
761
+ retry_config=retry_config,
762
+ )
763
+
764
+ response_data: Any = None
765
+ if utils.match_response(http_res, "200", "application/json"):
766
+ return utils.unmarshal_json(http_res.text, models.BucketResponse)
767
+ if utils.match_response(
768
+ http_res, ["400", "401", "403", "404"], "application/json"
769
+ ):
770
+ response_data = utils.unmarshal_json(
771
+ http_res.text, models.ErrorResponseData
772
+ )
773
+ raise models.ErrorResponse(data=response_data)
774
+ if utils.match_response(http_res, "422", "application/json"):
775
+ response_data = utils.unmarshal_json(
776
+ http_res.text, models.HTTPValidationErrorData
777
+ )
778
+ raise models.HTTPValidationError(data=response_data)
779
+ if utils.match_response(http_res, "500", "application/json"):
780
+ response_data = utils.unmarshal_json(
781
+ http_res.text, models.ErrorResponseData
782
+ )
783
+ raise models.ErrorResponse(data=response_data)
784
+ if utils.match_response(http_res, "4XX", "*"):
785
+ http_res_text = await utils.stream_to_text_async(http_res)
786
+ raise models.APIError(
787
+ "API error occurred", http_res.status_code, http_res_text, http_res
788
+ )
789
+ if utils.match_response(http_res, "5XX", "*"):
790
+ http_res_text = await utils.stream_to_text_async(http_res)
791
+ raise models.APIError(
792
+ "API error occurred", http_res.status_code, http_res_text, http_res
793
+ )
794
+
795
+ content_type = http_res.headers.get("Content-Type")
796
+ http_res_text = await utils.stream_to_text_async(http_res)
797
+ raise models.APIError(
798
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
799
+ http_res.status_code,
800
+ http_res_text,
801
+ http_res,
802
+ )
803
+
804
+ def delete(
805
+ self,
806
+ *,
807
+ bucket_identifier: str,
808
+ x_namespace: OptionalNullable[str] = UNSET,
809
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
810
+ server_url: Optional[str] = None,
811
+ timeout_ms: Optional[int] = None,
812
+ http_headers: Optional[Mapping[str, str]] = None,
813
+ ) -> models.TaskResponse:
814
+ r"""Delete Bucket
815
+
816
+ This endpoint deletes a bucket and all its objects.
817
+
818
+ :param bucket_identifier:
819
+ :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.
820
+ :param retries: Override the default retry configuration for this method
821
+ :param server_url: Override the default server URL for this method
822
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
823
+ :param http_headers: Additional headers to set or replace on requests.
824
+ """
825
+ base_url = None
826
+ url_variables = None
827
+ if timeout_ms is None:
828
+ timeout_ms = self.sdk_configuration.timeout_ms
829
+
830
+ if server_url is not None:
831
+ base_url = server_url
832
+ else:
833
+ base_url = self._get_url(base_url, url_variables)
834
+
835
+ request = models.DeleteBucketV1BucketsBucketIdentifierDeleteRequest(
836
+ bucket_identifier=bucket_identifier,
837
+ x_namespace=x_namespace,
838
+ )
839
+
840
+ req = self._build_request(
841
+ method="DELETE",
842
+ path="/v1/buckets/{bucket_identifier}",
843
+ base_url=base_url,
844
+ url_variables=url_variables,
845
+ request=request,
846
+ request_body_required=False,
847
+ request_has_path_params=True,
848
+ request_has_query_params=True,
849
+ user_agent_header="user-agent",
850
+ accept_header_value="application/json",
851
+ http_headers=http_headers,
852
+ security=self.sdk_configuration.security,
853
+ timeout_ms=timeout_ms,
854
+ )
855
+
856
+ if retries == UNSET:
857
+ if self.sdk_configuration.retry_config is not UNSET:
858
+ retries = self.sdk_configuration.retry_config
859
+
860
+ retry_config = None
861
+ if isinstance(retries, utils.RetryConfig):
862
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
863
+
864
+ http_res = self.do_request(
865
+ hook_ctx=HookContext(
866
+ base_url=base_url or "",
867
+ operation_id="delete_bucket_v1_buckets__bucket_identifier__delete",
868
+ oauth2_scopes=[],
869
+ security_source=get_security_from_env(
870
+ self.sdk_configuration.security, models.Security
871
+ ),
872
+ ),
873
+ request=req,
874
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
875
+ retry_config=retry_config,
876
+ )
877
+
878
+ response_data: Any = None
879
+ if utils.match_response(http_res, "200", "application/json"):
880
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
881
+ if utils.match_response(
882
+ http_res, ["400", "401", "403", "404"], "application/json"
883
+ ):
884
+ response_data = utils.unmarshal_json(
885
+ http_res.text, models.ErrorResponseData
886
+ )
887
+ raise models.ErrorResponse(data=response_data)
888
+ if utils.match_response(http_res, "422", "application/json"):
889
+ response_data = utils.unmarshal_json(
890
+ http_res.text, models.HTTPValidationErrorData
891
+ )
892
+ raise models.HTTPValidationError(data=response_data)
893
+ if utils.match_response(http_res, "500", "application/json"):
894
+ response_data = utils.unmarshal_json(
895
+ http_res.text, models.ErrorResponseData
896
+ )
897
+ raise models.ErrorResponse(data=response_data)
898
+ if utils.match_response(http_res, "4XX", "*"):
899
+ http_res_text = utils.stream_to_text(http_res)
900
+ raise models.APIError(
901
+ "API error occurred", http_res.status_code, http_res_text, http_res
902
+ )
903
+ if utils.match_response(http_res, "5XX", "*"):
904
+ http_res_text = utils.stream_to_text(http_res)
905
+ raise models.APIError(
906
+ "API error occurred", http_res.status_code, http_res_text, http_res
907
+ )
908
+
909
+ content_type = http_res.headers.get("Content-Type")
910
+ http_res_text = utils.stream_to_text(http_res)
911
+ raise models.APIError(
912
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
913
+ http_res.status_code,
914
+ http_res_text,
915
+ http_res,
916
+ )
917
+
918
+ async def delete_async(
919
+ self,
920
+ *,
921
+ bucket_identifier: str,
922
+ x_namespace: OptionalNullable[str] = UNSET,
923
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
924
+ server_url: Optional[str] = None,
925
+ timeout_ms: Optional[int] = None,
926
+ http_headers: Optional[Mapping[str, str]] = None,
927
+ ) -> models.TaskResponse:
928
+ r"""Delete Bucket
929
+
930
+ This endpoint deletes a bucket and all its objects.
931
+
932
+ :param bucket_identifier:
933
+ :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.
934
+ :param retries: Override the default retry configuration for this method
935
+ :param server_url: Override the default server URL for this method
936
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
937
+ :param http_headers: Additional headers to set or replace on requests.
938
+ """
939
+ base_url = None
940
+ url_variables = None
941
+ if timeout_ms is None:
942
+ timeout_ms = self.sdk_configuration.timeout_ms
943
+
944
+ if server_url is not None:
945
+ base_url = server_url
946
+ else:
947
+ base_url = self._get_url(base_url, url_variables)
948
+
949
+ request = models.DeleteBucketV1BucketsBucketIdentifierDeleteRequest(
950
+ bucket_identifier=bucket_identifier,
951
+ x_namespace=x_namespace,
952
+ )
953
+
954
+ req = self._build_request_async(
955
+ method="DELETE",
956
+ path="/v1/buckets/{bucket_identifier}",
957
+ base_url=base_url,
958
+ url_variables=url_variables,
959
+ request=request,
960
+ request_body_required=False,
961
+ request_has_path_params=True,
962
+ request_has_query_params=True,
963
+ user_agent_header="user-agent",
964
+ accept_header_value="application/json",
965
+ http_headers=http_headers,
966
+ security=self.sdk_configuration.security,
967
+ timeout_ms=timeout_ms,
968
+ )
969
+
970
+ if retries == UNSET:
971
+ if self.sdk_configuration.retry_config is not UNSET:
972
+ retries = self.sdk_configuration.retry_config
973
+
974
+ retry_config = None
975
+ if isinstance(retries, utils.RetryConfig):
976
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
977
+
978
+ http_res = await self.do_request_async(
979
+ hook_ctx=HookContext(
980
+ base_url=base_url or "",
981
+ operation_id="delete_bucket_v1_buckets__bucket_identifier__delete",
982
+ oauth2_scopes=[],
983
+ security_source=get_security_from_env(
984
+ self.sdk_configuration.security, models.Security
985
+ ),
986
+ ),
987
+ request=req,
988
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
989
+ retry_config=retry_config,
990
+ )
991
+
992
+ response_data: Any = None
993
+ if utils.match_response(http_res, "200", "application/json"):
994
+ return utils.unmarshal_json(http_res.text, models.TaskResponse)
995
+ if utils.match_response(
996
+ http_res, ["400", "401", "403", "404"], "application/json"
997
+ ):
998
+ response_data = utils.unmarshal_json(
999
+ http_res.text, models.ErrorResponseData
1000
+ )
1001
+ raise models.ErrorResponse(data=response_data)
1002
+ if utils.match_response(http_res, "422", "application/json"):
1003
+ response_data = utils.unmarshal_json(
1004
+ http_res.text, models.HTTPValidationErrorData
1005
+ )
1006
+ raise models.HTTPValidationError(data=response_data)
1007
+ if utils.match_response(http_res, "500", "application/json"):
1008
+ response_data = utils.unmarshal_json(
1009
+ http_res.text, models.ErrorResponseData
1010
+ )
1011
+ raise models.ErrorResponse(data=response_data)
1012
+ if utils.match_response(http_res, "4XX", "*"):
1013
+ http_res_text = await utils.stream_to_text_async(http_res)
1014
+ raise models.APIError(
1015
+ "API error occurred", http_res.status_code, http_res_text, http_res
1016
+ )
1017
+ if utils.match_response(http_res, "5XX", "*"):
1018
+ http_res_text = await utils.stream_to_text_async(http_res)
1019
+ raise models.APIError(
1020
+ "API error occurred", http_res.status_code, http_res_text, http_res
1021
+ )
1022
+
1023
+ content_type = http_res.headers.get("Content-Type")
1024
+ http_res_text = await utils.stream_to_text_async(http_res)
1025
+ raise models.APIError(
1026
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1027
+ http_res.status_code,
1028
+ http_res_text,
1029
+ http_res,
1030
+ )
1031
+
1032
+ def list(
1033
+ self,
1034
+ *,
1035
+ limit: OptionalNullable[int] = UNSET,
1036
+ offset: OptionalNullable[int] = UNSET,
1037
+ x_namespace: OptionalNullable[str] = UNSET,
1038
+ list_buckets_request: Optional[
1039
+ Union[models.ListBucketsRequest, models.ListBucketsRequestTypedDict]
1040
+ ] = None,
1041
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1042
+ server_url: Optional[str] = None,
1043
+ timeout_ms: Optional[int] = None,
1044
+ http_headers: Optional[Mapping[str, str]] = None,
1045
+ ) -> models.ListBucketsResponse:
1046
+ r"""List Buckets
1047
+
1048
+ This endpoint lists buckets with pagination, sorting, and filtering options.
1049
+
1050
+ :param limit:
1051
+ :param offset:
1052
+ :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.
1053
+ :param list_buckets_request:
1054
+ :param retries: Override the default retry configuration for this method
1055
+ :param server_url: Override the default server URL for this method
1056
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1057
+ :param http_headers: Additional headers to set or replace on requests.
1058
+ """
1059
+ base_url = None
1060
+ url_variables = None
1061
+ if timeout_ms is None:
1062
+ timeout_ms = self.sdk_configuration.timeout_ms
1063
+
1064
+ if server_url is not None:
1065
+ base_url = server_url
1066
+ else:
1067
+ base_url = self._get_url(base_url, url_variables)
1068
+
1069
+ request = models.ListBucketsV1BucketsPostRequest(
1070
+ limit=limit,
1071
+ offset=offset,
1072
+ x_namespace=x_namespace,
1073
+ list_buckets_request=utils.get_pydantic_model(
1074
+ list_buckets_request, Optional[models.ListBucketsRequest]
1075
+ ),
1076
+ )
1077
+
1078
+ req = self._build_request(
1079
+ method="POST",
1080
+ path="/v1/buckets",
1081
+ base_url=base_url,
1082
+ url_variables=url_variables,
1083
+ request=request,
1084
+ request_body_required=False,
1085
+ request_has_path_params=False,
1086
+ request_has_query_params=True,
1087
+ user_agent_header="user-agent",
1088
+ accept_header_value="application/json",
1089
+ http_headers=http_headers,
1090
+ security=self.sdk_configuration.security,
1091
+ get_serialized_body=lambda: utils.serialize_request_body(
1092
+ request.list_buckets_request,
1093
+ False,
1094
+ True,
1095
+ "json",
1096
+ Optional[models.ListBucketsRequest],
1097
+ ),
1098
+ timeout_ms=timeout_ms,
1099
+ )
1100
+
1101
+ if retries == UNSET:
1102
+ if self.sdk_configuration.retry_config is not UNSET:
1103
+ retries = self.sdk_configuration.retry_config
1104
+
1105
+ retry_config = None
1106
+ if isinstance(retries, utils.RetryConfig):
1107
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1108
+
1109
+ http_res = self.do_request(
1110
+ hook_ctx=HookContext(
1111
+ base_url=base_url or "",
1112
+ operation_id="list_buckets_v1_buckets_post",
1113
+ oauth2_scopes=[],
1114
+ security_source=get_security_from_env(
1115
+ self.sdk_configuration.security, models.Security
1116
+ ),
1117
+ ),
1118
+ request=req,
1119
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1120
+ retry_config=retry_config,
1121
+ )
1122
+
1123
+ response_data: Any = None
1124
+ if utils.match_response(http_res, "200", "application/json"):
1125
+ return utils.unmarshal_json(http_res.text, models.ListBucketsResponse)
1126
+ if utils.match_response(
1127
+ http_res, ["400", "401", "403", "404"], "application/json"
1128
+ ):
1129
+ response_data = utils.unmarshal_json(
1130
+ http_res.text, models.ErrorResponseData
1131
+ )
1132
+ raise models.ErrorResponse(data=response_data)
1133
+ if utils.match_response(http_res, "422", "application/json"):
1134
+ response_data = utils.unmarshal_json(
1135
+ http_res.text, models.HTTPValidationErrorData
1136
+ )
1137
+ raise models.HTTPValidationError(data=response_data)
1138
+ if utils.match_response(http_res, "500", "application/json"):
1139
+ response_data = utils.unmarshal_json(
1140
+ http_res.text, models.ErrorResponseData
1141
+ )
1142
+ raise models.ErrorResponse(data=response_data)
1143
+ if utils.match_response(http_res, "4XX", "*"):
1144
+ http_res_text = utils.stream_to_text(http_res)
1145
+ raise models.APIError(
1146
+ "API error occurred", http_res.status_code, http_res_text, http_res
1147
+ )
1148
+ if utils.match_response(http_res, "5XX", "*"):
1149
+ http_res_text = utils.stream_to_text(http_res)
1150
+ raise models.APIError(
1151
+ "API error occurred", http_res.status_code, http_res_text, http_res
1152
+ )
1153
+
1154
+ content_type = http_res.headers.get("Content-Type")
1155
+ http_res_text = utils.stream_to_text(http_res)
1156
+ raise models.APIError(
1157
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1158
+ http_res.status_code,
1159
+ http_res_text,
1160
+ http_res,
1161
+ )
1162
+
1163
+ async def list_async(
1164
+ self,
1165
+ *,
1166
+ limit: OptionalNullable[int] = UNSET,
1167
+ offset: OptionalNullable[int] = UNSET,
1168
+ x_namespace: OptionalNullable[str] = UNSET,
1169
+ list_buckets_request: Optional[
1170
+ Union[models.ListBucketsRequest, models.ListBucketsRequestTypedDict]
1171
+ ] = None,
1172
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1173
+ server_url: Optional[str] = None,
1174
+ timeout_ms: Optional[int] = None,
1175
+ http_headers: Optional[Mapping[str, str]] = None,
1176
+ ) -> models.ListBucketsResponse:
1177
+ r"""List Buckets
1178
+
1179
+ This endpoint lists buckets with pagination, sorting, and filtering options.
1180
+
1181
+ :param limit:
1182
+ :param offset:
1183
+ :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.
1184
+ :param list_buckets_request:
1185
+ :param retries: Override the default retry configuration for this method
1186
+ :param server_url: Override the default server URL for this method
1187
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1188
+ :param http_headers: Additional headers to set or replace on requests.
1189
+ """
1190
+ base_url = None
1191
+ url_variables = None
1192
+ if timeout_ms is None:
1193
+ timeout_ms = self.sdk_configuration.timeout_ms
1194
+
1195
+ if server_url is not None:
1196
+ base_url = server_url
1197
+ else:
1198
+ base_url = self._get_url(base_url, url_variables)
1199
+
1200
+ request = models.ListBucketsV1BucketsPostRequest(
1201
+ limit=limit,
1202
+ offset=offset,
1203
+ x_namespace=x_namespace,
1204
+ list_buckets_request=utils.get_pydantic_model(
1205
+ list_buckets_request, Optional[models.ListBucketsRequest]
1206
+ ),
1207
+ )
1208
+
1209
+ req = self._build_request_async(
1210
+ method="POST",
1211
+ path="/v1/buckets",
1212
+ base_url=base_url,
1213
+ url_variables=url_variables,
1214
+ request=request,
1215
+ request_body_required=False,
1216
+ request_has_path_params=False,
1217
+ request_has_query_params=True,
1218
+ user_agent_header="user-agent",
1219
+ accept_header_value="application/json",
1220
+ http_headers=http_headers,
1221
+ security=self.sdk_configuration.security,
1222
+ get_serialized_body=lambda: utils.serialize_request_body(
1223
+ request.list_buckets_request,
1224
+ False,
1225
+ True,
1226
+ "json",
1227
+ Optional[models.ListBucketsRequest],
1228
+ ),
1229
+ timeout_ms=timeout_ms,
1230
+ )
1231
+
1232
+ if retries == UNSET:
1233
+ if self.sdk_configuration.retry_config is not UNSET:
1234
+ retries = self.sdk_configuration.retry_config
1235
+
1236
+ retry_config = None
1237
+ if isinstance(retries, utils.RetryConfig):
1238
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1239
+
1240
+ http_res = await self.do_request_async(
1241
+ hook_ctx=HookContext(
1242
+ base_url=base_url or "",
1243
+ operation_id="list_buckets_v1_buckets_post",
1244
+ oauth2_scopes=[],
1245
+ security_source=get_security_from_env(
1246
+ self.sdk_configuration.security, models.Security
1247
+ ),
1248
+ ),
1249
+ request=req,
1250
+ error_status_codes=["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
1251
+ retry_config=retry_config,
1252
+ )
1253
+
1254
+ response_data: Any = None
1255
+ if utils.match_response(http_res, "200", "application/json"):
1256
+ return utils.unmarshal_json(http_res.text, models.ListBucketsResponse)
1257
+ if utils.match_response(
1258
+ http_res, ["400", "401", "403", "404"], "application/json"
1259
+ ):
1260
+ response_data = utils.unmarshal_json(
1261
+ http_res.text, models.ErrorResponseData
1262
+ )
1263
+ raise models.ErrorResponse(data=response_data)
1264
+ if utils.match_response(http_res, "422", "application/json"):
1265
+ response_data = utils.unmarshal_json(
1266
+ http_res.text, models.HTTPValidationErrorData
1267
+ )
1268
+ raise models.HTTPValidationError(data=response_data)
1269
+ if utils.match_response(http_res, "500", "application/json"):
1270
+ response_data = utils.unmarshal_json(
1271
+ http_res.text, models.ErrorResponseData
1272
+ )
1273
+ raise models.ErrorResponse(data=response_data)
1274
+ if utils.match_response(http_res, "4XX", "*"):
1275
+ http_res_text = await utils.stream_to_text_async(http_res)
1276
+ raise models.APIError(
1277
+ "API error occurred", http_res.status_code, http_res_text, http_res
1278
+ )
1279
+ if utils.match_response(http_res, "5XX", "*"):
1280
+ http_res_text = await utils.stream_to_text_async(http_res)
1281
+ raise models.APIError(
1282
+ "API error occurred", http_res.status_code, http_res_text, http_res
1283
+ )
1284
+
1285
+ content_type = http_res.headers.get("Content-Type")
1286
+ http_res_text = await utils.stream_to_text_async(http_res)
1287
+ raise models.APIError(
1288
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1289
+ http_res.status_code,
1290
+ http_res_text,
1291
+ http_res,
1292
+ )