groundx 2.0.15__py3-none-any.whl → 2.7.7__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.
- groundx/__init__.py +73 -21
- groundx/buckets/__init__.py +2 -0
- groundx/buckets/client.py +55 -388
- groundx/buckets/raw_client.py +628 -0
- groundx/client.py +22 -21
- groundx/core/__init__.py +5 -0
- groundx/core/api_error.py +13 -5
- groundx/core/client_wrapper.py +4 -3
- groundx/core/force_multipart.py +16 -0
- groundx/core/http_client.py +76 -32
- groundx/core/http_response.py +55 -0
- groundx/core/jsonable_encoder.py +0 -1
- groundx/core/pydantic_utilities.py +71 -112
- groundx/core/serialization.py +7 -3
- groundx/csv_splitter.py +64 -0
- groundx/customer/__init__.py +2 -0
- groundx/customer/client.py +31 -43
- groundx/customer/raw_client.py +91 -0
- groundx/documents/__init__.py +1 -2
- groundx/documents/client.py +455 -953
- groundx/documents/raw_client.py +1450 -0
- groundx/errors/__init__.py +2 -0
- groundx/errors/bad_request_error.py +4 -3
- groundx/errors/unauthorized_error.py +4 -3
- groundx/extract/__init__.py +48 -0
- groundx/extract/agents/__init__.py +7 -0
- groundx/extract/agents/agent.py +202 -0
- groundx/extract/classes/__init__.py +24 -0
- groundx/extract/classes/agent.py +23 -0
- groundx/extract/classes/api.py +15 -0
- groundx/extract/classes/document.py +338 -0
- groundx/extract/classes/field.py +88 -0
- groundx/extract/classes/groundx.py +147 -0
- groundx/extract/classes/prompt.py +36 -0
- groundx/extract/classes/test_document.py +109 -0
- groundx/extract/classes/test_field.py +43 -0
- groundx/extract/classes/test_groundx.py +223 -0
- groundx/extract/classes/test_prompt.py +68 -0
- groundx/extract/post_process/__init__.py +7 -0
- groundx/extract/post_process/post_process.py +33 -0
- groundx/extract/services/.DS_Store +0 -0
- groundx/extract/services/__init__.py +14 -0
- groundx/extract/services/csv.py +76 -0
- groundx/extract/services/logger.py +126 -0
- groundx/extract/services/logging_cfg.py +53 -0
- groundx/extract/services/ratelimit.py +104 -0
- groundx/extract/services/sheets_client.py +160 -0
- groundx/extract/services/status.py +197 -0
- groundx/extract/services/upload.py +68 -0
- groundx/extract/services/upload_minio.py +122 -0
- groundx/extract/services/upload_s3.py +91 -0
- groundx/extract/services/utility.py +52 -0
- groundx/extract/settings/__init__.py +15 -0
- groundx/extract/settings/settings.py +212 -0
- groundx/extract/settings/test_settings.py +512 -0
- groundx/extract/tasks/__init__.py +6 -0
- groundx/extract/tasks/utility.py +27 -0
- groundx/extract/utility/__init__.py +15 -0
- groundx/extract/utility/classes.py +193 -0
- groundx/extract/utility/test_utility.py +81 -0
- groundx/groups/__init__.py +2 -0
- groundx/groups/client.py +63 -550
- groundx/groups/raw_client.py +901 -0
- groundx/health/__init__.py +2 -0
- groundx/health/client.py +35 -101
- groundx/health/raw_client.py +193 -0
- groundx/ingest.py +771 -0
- groundx/search/__init__.py +2 -0
- groundx/search/client.py +94 -227
- groundx/search/raw_client.py +442 -0
- groundx/search/types/__init__.py +2 -0
- groundx/types/__init__.py +68 -16
- groundx/types/bounding_box_detail.py +4 -4
- groundx/types/bucket_detail.py +5 -5
- groundx/types/bucket_list_response.py +17 -3
- groundx/types/bucket_response.py +3 -3
- groundx/types/bucket_update_detail.py +4 -4
- groundx/types/bucket_update_response.py +3 -3
- groundx/types/customer_detail.py +2 -2
- groundx/types/customer_response.py +3 -3
- groundx/types/document.py +54 -0
- groundx/types/document_detail.py +16 -4
- groundx/types/document_list_response.py +4 -4
- groundx/types/document_local_ingest_request.py +7 -0
- groundx/types/document_lookup_response.py +8 -3
- groundx/types/document_response.py +3 -3
- groundx/types/document_type.py +21 -1
- groundx/types/group_detail.py +4 -4
- groundx/types/group_list_response.py +17 -3
- groundx/types/group_response.py +3 -3
- groundx/types/health_response.py +3 -3
- groundx/types/health_response_health.py +3 -3
- groundx/types/health_service.py +5 -5
- groundx/types/ingest_local_document.py +25 -0
- groundx/types/ingest_local_document_metadata.py +51 -0
- groundx/types/ingest_remote_document.py +15 -6
- groundx/types/ingest_response.py +4 -4
- groundx/types/{process_status_response_ingest.py → ingest_status.py} +8 -7
- groundx/types/{ingest_response_ingest.py → ingest_status_light.py} +7 -5
- groundx/types/ingest_status_progress.py +26 -0
- groundx/types/{process_status_response_ingest_progress_errors.py → ingest_status_progress_cancelled.py} +4 -4
- groundx/types/{process_status_response_ingest_progress_complete.py → ingest_status_progress_complete.py} +4 -4
- groundx/types/{process_status_response_ingest_progress_cancelled.py → ingest_status_progress_errors.py} +4 -4
- groundx/types/{process_status_response_ingest_progress_processing.py → ingest_status_progress_processing.py} +4 -4
- groundx/types/message_response.py +2 -2
- groundx/types/meter_detail.py +2 -2
- groundx/types/process_level.py +5 -0
- groundx/types/{process_status_response.py → processes_status_response.py} +8 -5
- groundx/types/processing_status.py +3 -1
- groundx/types/search_response.py +3 -3
- groundx/types/search_response_search.py +3 -3
- groundx/types/search_result_item.py +7 -5
- groundx/types/search_result_item_pages_item.py +41 -0
- groundx/types/subscription_detail.py +3 -3
- groundx/types/subscription_detail_meters.py +5 -5
- groundx/{documents/types/website_crawl_request_websites_item.py → types/website_source.py} +7 -7
- groundx/types/workflow_apply_request.py +24 -0
- groundx/types/workflow_detail.py +59 -0
- groundx/types/workflow_detail_chunk_strategy.py +5 -0
- groundx/types/workflow_detail_relationships.py +36 -0
- groundx/types/workflow_engine.py +58 -0
- groundx/types/workflow_engine_reasoning_effort.py +5 -0
- groundx/types/workflow_engine_service.py +7 -0
- groundx/types/workflow_prompt.py +37 -0
- groundx/types/workflow_prompt_group.py +25 -0
- groundx/types/workflow_prompt_role.py +5 -0
- groundx/types/workflow_request.py +31 -0
- groundx/types/workflow_request_chunk_strategy.py +5 -0
- groundx/types/workflow_response.py +20 -0
- groundx/types/workflow_step.py +33 -0
- groundx/types/workflow_step_config.py +33 -0
- groundx/types/workflow_step_config_field.py +8 -0
- groundx/types/workflow_steps.py +38 -0
- groundx/types/workflows_response.py +20 -0
- groundx/workflows/__init__.py +7 -0
- groundx/workflows/client.py +736 -0
- groundx/workflows/raw_client.py +841 -0
- groundx/workflows/types/__init__.py +7 -0
- groundx/workflows/types/workflows_get_request_id.py +5 -0
- {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/LICENSE +1 -1
- {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/METADATA +39 -22
- groundx-2.7.7.dist-info/RECORD +155 -0
- groundx/documents/types/__init__.py +0 -6
- groundx/documents/types/documents_ingest_local_request_files_item.py +0 -43
- groundx/types/process_status_response_ingest_progress.py +0 -26
- groundx-2.0.15.dist-info/RECORD +0 -82
- {groundx-2.0.15.dist-info → groundx-2.7.7.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
11
|
+
from ..core.request_options import RequestOptions
|
|
12
|
+
from ..errors.bad_request_error import BadRequestError
|
|
13
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
14
|
+
from ..types.bucket_list_response import BucketListResponse
|
|
15
|
+
from ..types.bucket_response import BucketResponse
|
|
16
|
+
from ..types.bucket_update_response import BucketUpdateResponse
|
|
17
|
+
from ..types.message_response import MessageResponse
|
|
18
|
+
|
|
19
|
+
# this is used as the default value for optional parameters
|
|
20
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class RawBucketsClient:
|
|
24
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
|
+
self._client_wrapper = client_wrapper
|
|
26
|
+
|
|
27
|
+
def list(
|
|
28
|
+
self,
|
|
29
|
+
*,
|
|
30
|
+
n: typing.Optional[int] = None,
|
|
31
|
+
next_token: typing.Optional[str] = None,
|
|
32
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
33
|
+
) -> HttpResponse[BucketListResponse]:
|
|
34
|
+
"""
|
|
35
|
+
List all buckets within your GroundX account
|
|
36
|
+
|
|
37
|
+
Parameters
|
|
38
|
+
----------
|
|
39
|
+
n : typing.Optional[int]
|
|
40
|
+
The maximum number of returned buckets. Accepts 1-100 with a default of 20.
|
|
41
|
+
|
|
42
|
+
next_token : typing.Optional[str]
|
|
43
|
+
A token for pagination. If the number of buckets for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n buckets.
|
|
44
|
+
|
|
45
|
+
request_options : typing.Optional[RequestOptions]
|
|
46
|
+
Request-specific configuration.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
HttpResponse[BucketListResponse]
|
|
51
|
+
Look up success
|
|
52
|
+
"""
|
|
53
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
+
"v1/bucket",
|
|
55
|
+
method="GET",
|
|
56
|
+
params={
|
|
57
|
+
"n": n,
|
|
58
|
+
"nextToken": next_token,
|
|
59
|
+
},
|
|
60
|
+
request_options=request_options,
|
|
61
|
+
)
|
|
62
|
+
try:
|
|
63
|
+
if 200 <= _response.status_code < 300:
|
|
64
|
+
_data = typing.cast(
|
|
65
|
+
BucketListResponse,
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=BucketListResponse, # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
return HttpResponse(response=_response, data=_data)
|
|
72
|
+
_response_json = _response.json()
|
|
73
|
+
except JSONDecodeError:
|
|
74
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
76
|
+
|
|
77
|
+
def create(
|
|
78
|
+
self, *, name: str, request_options: typing.Optional[RequestOptions] = None
|
|
79
|
+
) -> HttpResponse[BucketResponse]:
|
|
80
|
+
"""
|
|
81
|
+
Create a new bucket.
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
name : str
|
|
86
|
+
|
|
87
|
+
request_options : typing.Optional[RequestOptions]
|
|
88
|
+
Request-specific configuration.
|
|
89
|
+
|
|
90
|
+
Returns
|
|
91
|
+
-------
|
|
92
|
+
HttpResponse[BucketResponse]
|
|
93
|
+
Bucket successfully created
|
|
94
|
+
"""
|
|
95
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
96
|
+
"v1/bucket",
|
|
97
|
+
method="POST",
|
|
98
|
+
json={
|
|
99
|
+
"name": name,
|
|
100
|
+
},
|
|
101
|
+
headers={
|
|
102
|
+
"content-type": "application/json",
|
|
103
|
+
},
|
|
104
|
+
request_options=request_options,
|
|
105
|
+
omit=OMIT,
|
|
106
|
+
)
|
|
107
|
+
try:
|
|
108
|
+
if 200 <= _response.status_code < 300:
|
|
109
|
+
_data = typing.cast(
|
|
110
|
+
BucketResponse,
|
|
111
|
+
parse_obj_as(
|
|
112
|
+
type_=BucketResponse, # type: ignore
|
|
113
|
+
object_=_response.json(),
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
return HttpResponse(response=_response, data=_data)
|
|
117
|
+
if _response.status_code == 400:
|
|
118
|
+
raise BadRequestError(
|
|
119
|
+
headers=dict(_response.headers),
|
|
120
|
+
body=typing.cast(
|
|
121
|
+
typing.Optional[typing.Any],
|
|
122
|
+
parse_obj_as(
|
|
123
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
124
|
+
object_=_response.json(),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
_response_json = _response.json()
|
|
129
|
+
except JSONDecodeError:
|
|
130
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
131
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
132
|
+
|
|
133
|
+
def get(
|
|
134
|
+
self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
135
|
+
) -> HttpResponse[BucketResponse]:
|
|
136
|
+
"""
|
|
137
|
+
Look up a specific bucket by its bucketId.
|
|
138
|
+
|
|
139
|
+
Parameters
|
|
140
|
+
----------
|
|
141
|
+
bucket_id : int
|
|
142
|
+
The bucketId of the bucket to look up.
|
|
143
|
+
|
|
144
|
+
request_options : typing.Optional[RequestOptions]
|
|
145
|
+
Request-specific configuration.
|
|
146
|
+
|
|
147
|
+
Returns
|
|
148
|
+
-------
|
|
149
|
+
HttpResponse[BucketResponse]
|
|
150
|
+
Look up success
|
|
151
|
+
"""
|
|
152
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
153
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
154
|
+
method="GET",
|
|
155
|
+
request_options=request_options,
|
|
156
|
+
)
|
|
157
|
+
try:
|
|
158
|
+
if 200 <= _response.status_code < 300:
|
|
159
|
+
_data = typing.cast(
|
|
160
|
+
BucketResponse,
|
|
161
|
+
parse_obj_as(
|
|
162
|
+
type_=BucketResponse, # type: ignore
|
|
163
|
+
object_=_response.json(),
|
|
164
|
+
),
|
|
165
|
+
)
|
|
166
|
+
return HttpResponse(response=_response, data=_data)
|
|
167
|
+
if _response.status_code == 400:
|
|
168
|
+
raise BadRequestError(
|
|
169
|
+
headers=dict(_response.headers),
|
|
170
|
+
body=typing.cast(
|
|
171
|
+
typing.Optional[typing.Any],
|
|
172
|
+
parse_obj_as(
|
|
173
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
),
|
|
177
|
+
)
|
|
178
|
+
if _response.status_code == 401:
|
|
179
|
+
raise UnauthorizedError(
|
|
180
|
+
headers=dict(_response.headers),
|
|
181
|
+
body=typing.cast(
|
|
182
|
+
typing.Optional[typing.Any],
|
|
183
|
+
parse_obj_as(
|
|
184
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
185
|
+
object_=_response.json(),
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
)
|
|
189
|
+
_response_json = _response.json()
|
|
190
|
+
except JSONDecodeError:
|
|
191
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
192
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
193
|
+
|
|
194
|
+
def update(
|
|
195
|
+
self, bucket_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
|
196
|
+
) -> HttpResponse[BucketUpdateResponse]:
|
|
197
|
+
"""
|
|
198
|
+
Rename a bucket.
|
|
199
|
+
|
|
200
|
+
Parameters
|
|
201
|
+
----------
|
|
202
|
+
bucket_id : int
|
|
203
|
+
The bucketId of the bucket being updated.
|
|
204
|
+
|
|
205
|
+
new_name : str
|
|
206
|
+
The new name of the bucket being renamed.
|
|
207
|
+
|
|
208
|
+
request_options : typing.Optional[RequestOptions]
|
|
209
|
+
Request-specific configuration.
|
|
210
|
+
|
|
211
|
+
Returns
|
|
212
|
+
-------
|
|
213
|
+
HttpResponse[BucketUpdateResponse]
|
|
214
|
+
Bucket successfully updated
|
|
215
|
+
"""
|
|
216
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
217
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
218
|
+
method="PUT",
|
|
219
|
+
json={
|
|
220
|
+
"newName": new_name,
|
|
221
|
+
},
|
|
222
|
+
headers={
|
|
223
|
+
"content-type": "application/json",
|
|
224
|
+
},
|
|
225
|
+
request_options=request_options,
|
|
226
|
+
omit=OMIT,
|
|
227
|
+
)
|
|
228
|
+
try:
|
|
229
|
+
if 200 <= _response.status_code < 300:
|
|
230
|
+
_data = typing.cast(
|
|
231
|
+
BucketUpdateResponse,
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=BucketUpdateResponse, # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
)
|
|
237
|
+
return HttpResponse(response=_response, data=_data)
|
|
238
|
+
if _response.status_code == 400:
|
|
239
|
+
raise BadRequestError(
|
|
240
|
+
headers=dict(_response.headers),
|
|
241
|
+
body=typing.cast(
|
|
242
|
+
typing.Optional[typing.Any],
|
|
243
|
+
parse_obj_as(
|
|
244
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
245
|
+
object_=_response.json(),
|
|
246
|
+
),
|
|
247
|
+
),
|
|
248
|
+
)
|
|
249
|
+
if _response.status_code == 401:
|
|
250
|
+
raise UnauthorizedError(
|
|
251
|
+
headers=dict(_response.headers),
|
|
252
|
+
body=typing.cast(
|
|
253
|
+
typing.Optional[typing.Any],
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
256
|
+
object_=_response.json(),
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
)
|
|
260
|
+
_response_json = _response.json()
|
|
261
|
+
except JSONDecodeError:
|
|
262
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
263
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
264
|
+
|
|
265
|
+
def delete(
|
|
266
|
+
self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
267
|
+
) -> HttpResponse[MessageResponse]:
|
|
268
|
+
"""
|
|
269
|
+
Delete a bucket.
|
|
270
|
+
|
|
271
|
+
Parameters
|
|
272
|
+
----------
|
|
273
|
+
bucket_id : int
|
|
274
|
+
The bucketId of the bucket being deleted.
|
|
275
|
+
|
|
276
|
+
request_options : typing.Optional[RequestOptions]
|
|
277
|
+
Request-specific configuration.
|
|
278
|
+
|
|
279
|
+
Returns
|
|
280
|
+
-------
|
|
281
|
+
HttpResponse[MessageResponse]
|
|
282
|
+
Bucket successfully deleted
|
|
283
|
+
"""
|
|
284
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
285
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
286
|
+
method="DELETE",
|
|
287
|
+
request_options=request_options,
|
|
288
|
+
)
|
|
289
|
+
try:
|
|
290
|
+
if 200 <= _response.status_code < 300:
|
|
291
|
+
_data = typing.cast(
|
|
292
|
+
MessageResponse,
|
|
293
|
+
parse_obj_as(
|
|
294
|
+
type_=MessageResponse, # type: ignore
|
|
295
|
+
object_=_response.json(),
|
|
296
|
+
),
|
|
297
|
+
)
|
|
298
|
+
return HttpResponse(response=_response, data=_data)
|
|
299
|
+
if _response.status_code == 400:
|
|
300
|
+
raise BadRequestError(
|
|
301
|
+
headers=dict(_response.headers),
|
|
302
|
+
body=typing.cast(
|
|
303
|
+
typing.Optional[typing.Any],
|
|
304
|
+
parse_obj_as(
|
|
305
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
306
|
+
object_=_response.json(),
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
)
|
|
310
|
+
if _response.status_code == 401:
|
|
311
|
+
raise UnauthorizedError(
|
|
312
|
+
headers=dict(_response.headers),
|
|
313
|
+
body=typing.cast(
|
|
314
|
+
typing.Optional[typing.Any],
|
|
315
|
+
parse_obj_as(
|
|
316
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
317
|
+
object_=_response.json(),
|
|
318
|
+
),
|
|
319
|
+
),
|
|
320
|
+
)
|
|
321
|
+
_response_json = _response.json()
|
|
322
|
+
except JSONDecodeError:
|
|
323
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
324
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class AsyncRawBucketsClient:
|
|
328
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
329
|
+
self._client_wrapper = client_wrapper
|
|
330
|
+
|
|
331
|
+
async def list(
|
|
332
|
+
self,
|
|
333
|
+
*,
|
|
334
|
+
n: typing.Optional[int] = None,
|
|
335
|
+
next_token: typing.Optional[str] = None,
|
|
336
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
337
|
+
) -> AsyncHttpResponse[BucketListResponse]:
|
|
338
|
+
"""
|
|
339
|
+
List all buckets within your GroundX account
|
|
340
|
+
|
|
341
|
+
Parameters
|
|
342
|
+
----------
|
|
343
|
+
n : typing.Optional[int]
|
|
344
|
+
The maximum number of returned buckets. Accepts 1-100 with a default of 20.
|
|
345
|
+
|
|
346
|
+
next_token : typing.Optional[str]
|
|
347
|
+
A token for pagination. If the number of buckets for a given query is larger than n, the response will include a "nextToken" value. That token can be included in this field to retrieve the next batch of n buckets.
|
|
348
|
+
|
|
349
|
+
request_options : typing.Optional[RequestOptions]
|
|
350
|
+
Request-specific configuration.
|
|
351
|
+
|
|
352
|
+
Returns
|
|
353
|
+
-------
|
|
354
|
+
AsyncHttpResponse[BucketListResponse]
|
|
355
|
+
Look up success
|
|
356
|
+
"""
|
|
357
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
358
|
+
"v1/bucket",
|
|
359
|
+
method="GET",
|
|
360
|
+
params={
|
|
361
|
+
"n": n,
|
|
362
|
+
"nextToken": next_token,
|
|
363
|
+
},
|
|
364
|
+
request_options=request_options,
|
|
365
|
+
)
|
|
366
|
+
try:
|
|
367
|
+
if 200 <= _response.status_code < 300:
|
|
368
|
+
_data = typing.cast(
|
|
369
|
+
BucketListResponse,
|
|
370
|
+
parse_obj_as(
|
|
371
|
+
type_=BucketListResponse, # type: ignore
|
|
372
|
+
object_=_response.json(),
|
|
373
|
+
),
|
|
374
|
+
)
|
|
375
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
376
|
+
_response_json = _response.json()
|
|
377
|
+
except JSONDecodeError:
|
|
378
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
379
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
380
|
+
|
|
381
|
+
async def create(
|
|
382
|
+
self, *, name: str, request_options: typing.Optional[RequestOptions] = None
|
|
383
|
+
) -> AsyncHttpResponse[BucketResponse]:
|
|
384
|
+
"""
|
|
385
|
+
Create a new bucket.
|
|
386
|
+
|
|
387
|
+
Parameters
|
|
388
|
+
----------
|
|
389
|
+
name : str
|
|
390
|
+
|
|
391
|
+
request_options : typing.Optional[RequestOptions]
|
|
392
|
+
Request-specific configuration.
|
|
393
|
+
|
|
394
|
+
Returns
|
|
395
|
+
-------
|
|
396
|
+
AsyncHttpResponse[BucketResponse]
|
|
397
|
+
Bucket successfully created
|
|
398
|
+
"""
|
|
399
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
400
|
+
"v1/bucket",
|
|
401
|
+
method="POST",
|
|
402
|
+
json={
|
|
403
|
+
"name": name,
|
|
404
|
+
},
|
|
405
|
+
headers={
|
|
406
|
+
"content-type": "application/json",
|
|
407
|
+
},
|
|
408
|
+
request_options=request_options,
|
|
409
|
+
omit=OMIT,
|
|
410
|
+
)
|
|
411
|
+
try:
|
|
412
|
+
if 200 <= _response.status_code < 300:
|
|
413
|
+
_data = typing.cast(
|
|
414
|
+
BucketResponse,
|
|
415
|
+
parse_obj_as(
|
|
416
|
+
type_=BucketResponse, # type: ignore
|
|
417
|
+
object_=_response.json(),
|
|
418
|
+
),
|
|
419
|
+
)
|
|
420
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
421
|
+
if _response.status_code == 400:
|
|
422
|
+
raise BadRequestError(
|
|
423
|
+
headers=dict(_response.headers),
|
|
424
|
+
body=typing.cast(
|
|
425
|
+
typing.Optional[typing.Any],
|
|
426
|
+
parse_obj_as(
|
|
427
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
428
|
+
object_=_response.json(),
|
|
429
|
+
),
|
|
430
|
+
),
|
|
431
|
+
)
|
|
432
|
+
_response_json = _response.json()
|
|
433
|
+
except JSONDecodeError:
|
|
434
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
435
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
436
|
+
|
|
437
|
+
async def get(
|
|
438
|
+
self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
439
|
+
) -> AsyncHttpResponse[BucketResponse]:
|
|
440
|
+
"""
|
|
441
|
+
Look up a specific bucket by its bucketId.
|
|
442
|
+
|
|
443
|
+
Parameters
|
|
444
|
+
----------
|
|
445
|
+
bucket_id : int
|
|
446
|
+
The bucketId of the bucket to look up.
|
|
447
|
+
|
|
448
|
+
request_options : typing.Optional[RequestOptions]
|
|
449
|
+
Request-specific configuration.
|
|
450
|
+
|
|
451
|
+
Returns
|
|
452
|
+
-------
|
|
453
|
+
AsyncHttpResponse[BucketResponse]
|
|
454
|
+
Look up success
|
|
455
|
+
"""
|
|
456
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
457
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
458
|
+
method="GET",
|
|
459
|
+
request_options=request_options,
|
|
460
|
+
)
|
|
461
|
+
try:
|
|
462
|
+
if 200 <= _response.status_code < 300:
|
|
463
|
+
_data = typing.cast(
|
|
464
|
+
BucketResponse,
|
|
465
|
+
parse_obj_as(
|
|
466
|
+
type_=BucketResponse, # type: ignore
|
|
467
|
+
object_=_response.json(),
|
|
468
|
+
),
|
|
469
|
+
)
|
|
470
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
471
|
+
if _response.status_code == 400:
|
|
472
|
+
raise BadRequestError(
|
|
473
|
+
headers=dict(_response.headers),
|
|
474
|
+
body=typing.cast(
|
|
475
|
+
typing.Optional[typing.Any],
|
|
476
|
+
parse_obj_as(
|
|
477
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
478
|
+
object_=_response.json(),
|
|
479
|
+
),
|
|
480
|
+
),
|
|
481
|
+
)
|
|
482
|
+
if _response.status_code == 401:
|
|
483
|
+
raise UnauthorizedError(
|
|
484
|
+
headers=dict(_response.headers),
|
|
485
|
+
body=typing.cast(
|
|
486
|
+
typing.Optional[typing.Any],
|
|
487
|
+
parse_obj_as(
|
|
488
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
489
|
+
object_=_response.json(),
|
|
490
|
+
),
|
|
491
|
+
),
|
|
492
|
+
)
|
|
493
|
+
_response_json = _response.json()
|
|
494
|
+
except JSONDecodeError:
|
|
495
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
496
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
497
|
+
|
|
498
|
+
async def update(
|
|
499
|
+
self, bucket_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
|
500
|
+
) -> AsyncHttpResponse[BucketUpdateResponse]:
|
|
501
|
+
"""
|
|
502
|
+
Rename a bucket.
|
|
503
|
+
|
|
504
|
+
Parameters
|
|
505
|
+
----------
|
|
506
|
+
bucket_id : int
|
|
507
|
+
The bucketId of the bucket being updated.
|
|
508
|
+
|
|
509
|
+
new_name : str
|
|
510
|
+
The new name of the bucket being renamed.
|
|
511
|
+
|
|
512
|
+
request_options : typing.Optional[RequestOptions]
|
|
513
|
+
Request-specific configuration.
|
|
514
|
+
|
|
515
|
+
Returns
|
|
516
|
+
-------
|
|
517
|
+
AsyncHttpResponse[BucketUpdateResponse]
|
|
518
|
+
Bucket successfully updated
|
|
519
|
+
"""
|
|
520
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
521
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
522
|
+
method="PUT",
|
|
523
|
+
json={
|
|
524
|
+
"newName": new_name,
|
|
525
|
+
},
|
|
526
|
+
headers={
|
|
527
|
+
"content-type": "application/json",
|
|
528
|
+
},
|
|
529
|
+
request_options=request_options,
|
|
530
|
+
omit=OMIT,
|
|
531
|
+
)
|
|
532
|
+
try:
|
|
533
|
+
if 200 <= _response.status_code < 300:
|
|
534
|
+
_data = typing.cast(
|
|
535
|
+
BucketUpdateResponse,
|
|
536
|
+
parse_obj_as(
|
|
537
|
+
type_=BucketUpdateResponse, # type: ignore
|
|
538
|
+
object_=_response.json(),
|
|
539
|
+
),
|
|
540
|
+
)
|
|
541
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
542
|
+
if _response.status_code == 400:
|
|
543
|
+
raise BadRequestError(
|
|
544
|
+
headers=dict(_response.headers),
|
|
545
|
+
body=typing.cast(
|
|
546
|
+
typing.Optional[typing.Any],
|
|
547
|
+
parse_obj_as(
|
|
548
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
549
|
+
object_=_response.json(),
|
|
550
|
+
),
|
|
551
|
+
),
|
|
552
|
+
)
|
|
553
|
+
if _response.status_code == 401:
|
|
554
|
+
raise UnauthorizedError(
|
|
555
|
+
headers=dict(_response.headers),
|
|
556
|
+
body=typing.cast(
|
|
557
|
+
typing.Optional[typing.Any],
|
|
558
|
+
parse_obj_as(
|
|
559
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
560
|
+
object_=_response.json(),
|
|
561
|
+
),
|
|
562
|
+
),
|
|
563
|
+
)
|
|
564
|
+
_response_json = _response.json()
|
|
565
|
+
except JSONDecodeError:
|
|
566
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
567
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
568
|
+
|
|
569
|
+
async def delete(
|
|
570
|
+
self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
|
571
|
+
) -> AsyncHttpResponse[MessageResponse]:
|
|
572
|
+
"""
|
|
573
|
+
Delete a bucket.
|
|
574
|
+
|
|
575
|
+
Parameters
|
|
576
|
+
----------
|
|
577
|
+
bucket_id : int
|
|
578
|
+
The bucketId of the bucket being deleted.
|
|
579
|
+
|
|
580
|
+
request_options : typing.Optional[RequestOptions]
|
|
581
|
+
Request-specific configuration.
|
|
582
|
+
|
|
583
|
+
Returns
|
|
584
|
+
-------
|
|
585
|
+
AsyncHttpResponse[MessageResponse]
|
|
586
|
+
Bucket successfully deleted
|
|
587
|
+
"""
|
|
588
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
589
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
|
590
|
+
method="DELETE",
|
|
591
|
+
request_options=request_options,
|
|
592
|
+
)
|
|
593
|
+
try:
|
|
594
|
+
if 200 <= _response.status_code < 300:
|
|
595
|
+
_data = typing.cast(
|
|
596
|
+
MessageResponse,
|
|
597
|
+
parse_obj_as(
|
|
598
|
+
type_=MessageResponse, # type: ignore
|
|
599
|
+
object_=_response.json(),
|
|
600
|
+
),
|
|
601
|
+
)
|
|
602
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
603
|
+
if _response.status_code == 400:
|
|
604
|
+
raise BadRequestError(
|
|
605
|
+
headers=dict(_response.headers),
|
|
606
|
+
body=typing.cast(
|
|
607
|
+
typing.Optional[typing.Any],
|
|
608
|
+
parse_obj_as(
|
|
609
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
610
|
+
object_=_response.json(),
|
|
611
|
+
),
|
|
612
|
+
),
|
|
613
|
+
)
|
|
614
|
+
if _response.status_code == 401:
|
|
615
|
+
raise UnauthorizedError(
|
|
616
|
+
headers=dict(_response.headers),
|
|
617
|
+
body=typing.cast(
|
|
618
|
+
typing.Optional[typing.Any],
|
|
619
|
+
parse_obj_as(
|
|
620
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
621
|
+
object_=_response.json(),
|
|
622
|
+
),
|
|
623
|
+
),
|
|
624
|
+
)
|
|
625
|
+
_response_json = _response.json()
|
|
626
|
+
except JSONDecodeError:
|
|
627
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
628
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|