groundx 2.0.11__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 +107 -0
- groundx/buckets/__init__.py +2 -0
- groundx/buckets/client.py +761 -0
- groundx/client.py +160 -0
- groundx/core/__init__.py +47 -0
- groundx/core/api_error.py +15 -0
- groundx/core/client_wrapper.py +54 -0
- groundx/core/datetime_utils.py +28 -0
- groundx/core/file.py +67 -0
- groundx/core/http_client.py +499 -0
- groundx/core/jsonable_encoder.py +101 -0
- groundx/core/pydantic_utilities.py +296 -0
- groundx/core/query_encoder.py +58 -0
- groundx/core/remove_none_from_dict.py +11 -0
- groundx/core/request_options.py +35 -0
- groundx/core/serialization.py +272 -0
- groundx/customer/__init__.py +2 -0
- groundx/customer/client.py +112 -0
- groundx/documents/__init__.py +5 -0
- groundx/documents/client.py +1544 -0
- groundx/documents/types/__init__.py +6 -0
- groundx/documents/types/document_remote_ingest_request_documents_item.py +45 -0
- groundx/documents/types/website_crawl_request_websites_item.py +46 -0
- groundx/environment.py +7 -0
- groundx/errors/__init__.py +6 -0
- groundx/errors/bad_request_error.py +9 -0
- groundx/errors/unauthorized_error.py +9 -0
- groundx/groups/__init__.py +2 -0
- groundx/groups/client.py +1098 -0
- groundx/health/__init__.py +2 -0
- groundx/health/client.py +236 -0
- groundx/py.typed +0 -0
- groundx/search/__init__.py +5 -0
- groundx/search/client.py +489 -0
- groundx/search/types/__init__.py +5 -0
- groundx/search/types/search_content_request_id.py +5 -0
- groundx/types/__init__.py +83 -0
- groundx/types/bounding_box_detail.py +54 -0
- groundx/types/bucket_detail.py +46 -0
- groundx/types/bucket_list_response.py +20 -0
- groundx/types/bucket_response.py +20 -0
- groundx/types/bucket_update_detail.py +22 -0
- groundx/types/bucket_update_response.py +20 -0
- groundx/types/customer_detail.py +39 -0
- groundx/types/customer_response.py +20 -0
- groundx/types/document_detail.py +62 -0
- groundx/types/document_list_response.py +23 -0
- groundx/types/document_lookup_response.py +32 -0
- groundx/types/document_response.py +20 -0
- groundx/types/document_type.py +7 -0
- groundx/types/group_detail.py +52 -0
- groundx/types/group_list_response.py +20 -0
- groundx/types/group_response.py +20 -0
- groundx/types/health_response.py +20 -0
- groundx/types/health_response_health.py +20 -0
- groundx/types/health_service.py +36 -0
- groundx/types/health_service_status.py +5 -0
- groundx/types/ingest_response.py +20 -0
- groundx/types/ingest_response_ingest.py +23 -0
- groundx/types/message_response.py +19 -0
- groundx/types/meter_detail.py +40 -0
- groundx/types/process_status_response.py +20 -0
- groundx/types/process_status_response_ingest.py +26 -0
- groundx/types/process_status_response_ingest_progress.py +26 -0
- groundx/types/process_status_response_ingest_progress_cancelled.py +21 -0
- groundx/types/process_status_response_ingest_progress_complete.py +21 -0
- groundx/types/process_status_response_ingest_progress_errors.py +21 -0
- groundx/types/process_status_response_ingest_progress_processing.py +21 -0
- groundx/types/processing_status.py +5 -0
- groundx/types/search_response.py +20 -0
- groundx/types/search_response_search.py +59 -0
- groundx/types/search_result_item.py +96 -0
- groundx/types/sort.py +5 -0
- groundx/types/sort_order.py +5 -0
- groundx/types/subscription_detail.py +24 -0
- groundx/types/subscription_detail_meters.py +23 -0
- groundx/version.py +3 -0
- groundx-2.0.11.dist-info/METADATA +177 -0
- groundx-2.0.11.dist-info/RECORD +80 -0
- groundx-2.0.11.dist-info/WHEEL +4 -0
@@ -0,0 +1,761 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
5
|
+
from ..core.request_options import RequestOptions
|
6
|
+
from ..types.bucket_list_response import BucketListResponse
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
8
|
+
from json.decoder import JSONDecodeError
|
9
|
+
from ..core.api_error import ApiError
|
10
|
+
from ..types.bucket_response import BucketResponse
|
11
|
+
from ..errors.bad_request_error import BadRequestError
|
12
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
13
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
14
|
+
from ..types.bucket_update_response import BucketUpdateResponse
|
15
|
+
from ..types.message_response import MessageResponse
|
16
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
17
|
+
|
18
|
+
# this is used as the default value for optional parameters
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
20
|
+
|
21
|
+
|
22
|
+
class BucketsClient:
|
23
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
24
|
+
self._client_wrapper = client_wrapper
|
25
|
+
|
26
|
+
def list(
|
27
|
+
self,
|
28
|
+
*,
|
29
|
+
n: typing.Optional[int] = None,
|
30
|
+
next_token: typing.Optional[str] = None,
|
31
|
+
request_options: typing.Optional[RequestOptions] = None,
|
32
|
+
) -> BucketListResponse:
|
33
|
+
"""
|
34
|
+
List all buckets within your GroundX account
|
35
|
+
|
36
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
37
|
+
|
38
|
+
Parameters
|
39
|
+
----------
|
40
|
+
n : typing.Optional[int]
|
41
|
+
The maximum number of returned buckets. Accepts 1-100 with a default of 20.
|
42
|
+
|
43
|
+
next_token : typing.Optional[str]
|
44
|
+
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.
|
45
|
+
|
46
|
+
request_options : typing.Optional[RequestOptions]
|
47
|
+
Request-specific configuration.
|
48
|
+
|
49
|
+
Returns
|
50
|
+
-------
|
51
|
+
BucketListResponse
|
52
|
+
Look up success
|
53
|
+
|
54
|
+
Examples
|
55
|
+
--------
|
56
|
+
from groundx import GroundX
|
57
|
+
|
58
|
+
client = GroundX(
|
59
|
+
api_key="YOUR_API_KEY",
|
60
|
+
)
|
61
|
+
client.buckets.list()
|
62
|
+
"""
|
63
|
+
_response = self._client_wrapper.httpx_client.request(
|
64
|
+
"v1/bucket",
|
65
|
+
method="GET",
|
66
|
+
params={
|
67
|
+
"n": n,
|
68
|
+
"nextToken": next_token,
|
69
|
+
},
|
70
|
+
request_options=request_options,
|
71
|
+
)
|
72
|
+
try:
|
73
|
+
if 200 <= _response.status_code < 300:
|
74
|
+
return typing.cast(
|
75
|
+
BucketListResponse,
|
76
|
+
parse_obj_as(
|
77
|
+
type_=BucketListResponse, # type: ignore
|
78
|
+
object_=_response.json(),
|
79
|
+
),
|
80
|
+
)
|
81
|
+
_response_json = _response.json()
|
82
|
+
except JSONDecodeError:
|
83
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
84
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
85
|
+
|
86
|
+
def create(self, *, name: str, request_options: typing.Optional[RequestOptions] = None) -> BucketResponse:
|
87
|
+
"""
|
88
|
+
Create a new bucket.
|
89
|
+
|
90
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
91
|
+
|
92
|
+
Parameters
|
93
|
+
----------
|
94
|
+
name : str
|
95
|
+
|
96
|
+
request_options : typing.Optional[RequestOptions]
|
97
|
+
Request-specific configuration.
|
98
|
+
|
99
|
+
Returns
|
100
|
+
-------
|
101
|
+
BucketResponse
|
102
|
+
Bucket successfully created
|
103
|
+
|
104
|
+
Examples
|
105
|
+
--------
|
106
|
+
from groundx import GroundX
|
107
|
+
|
108
|
+
client = GroundX(
|
109
|
+
api_key="YOUR_API_KEY",
|
110
|
+
)
|
111
|
+
client.buckets.create(
|
112
|
+
name="your_bucket_name",
|
113
|
+
)
|
114
|
+
"""
|
115
|
+
_response = self._client_wrapper.httpx_client.request(
|
116
|
+
"v1/bucket",
|
117
|
+
method="POST",
|
118
|
+
json={
|
119
|
+
"name": name,
|
120
|
+
},
|
121
|
+
headers={
|
122
|
+
"content-type": "application/json",
|
123
|
+
},
|
124
|
+
request_options=request_options,
|
125
|
+
omit=OMIT,
|
126
|
+
)
|
127
|
+
try:
|
128
|
+
if 200 <= _response.status_code < 300:
|
129
|
+
return typing.cast(
|
130
|
+
BucketResponse,
|
131
|
+
parse_obj_as(
|
132
|
+
type_=BucketResponse, # type: ignore
|
133
|
+
object_=_response.json(),
|
134
|
+
),
|
135
|
+
)
|
136
|
+
if _response.status_code == 400:
|
137
|
+
raise BadRequestError(
|
138
|
+
typing.cast(
|
139
|
+
typing.Optional[typing.Any],
|
140
|
+
parse_obj_as(
|
141
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
142
|
+
object_=_response.json(),
|
143
|
+
),
|
144
|
+
)
|
145
|
+
)
|
146
|
+
_response_json = _response.json()
|
147
|
+
except JSONDecodeError:
|
148
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
149
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
150
|
+
|
151
|
+
def get(self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> BucketResponse:
|
152
|
+
"""
|
153
|
+
Look up a specific bucket by its bucketId.
|
154
|
+
|
155
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
156
|
+
|
157
|
+
Parameters
|
158
|
+
----------
|
159
|
+
bucket_id : int
|
160
|
+
The bucketId of the bucket to look up.
|
161
|
+
|
162
|
+
request_options : typing.Optional[RequestOptions]
|
163
|
+
Request-specific configuration.
|
164
|
+
|
165
|
+
Returns
|
166
|
+
-------
|
167
|
+
BucketResponse
|
168
|
+
Look up success
|
169
|
+
|
170
|
+
Examples
|
171
|
+
--------
|
172
|
+
from groundx import GroundX
|
173
|
+
|
174
|
+
client = GroundX(
|
175
|
+
api_key="YOUR_API_KEY",
|
176
|
+
)
|
177
|
+
client.buckets.get(
|
178
|
+
bucket_id=1,
|
179
|
+
)
|
180
|
+
"""
|
181
|
+
_response = self._client_wrapper.httpx_client.request(
|
182
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
183
|
+
method="GET",
|
184
|
+
request_options=request_options,
|
185
|
+
)
|
186
|
+
try:
|
187
|
+
if 200 <= _response.status_code < 300:
|
188
|
+
return typing.cast(
|
189
|
+
BucketResponse,
|
190
|
+
parse_obj_as(
|
191
|
+
type_=BucketResponse, # type: ignore
|
192
|
+
object_=_response.json(),
|
193
|
+
),
|
194
|
+
)
|
195
|
+
if _response.status_code == 400:
|
196
|
+
raise BadRequestError(
|
197
|
+
typing.cast(
|
198
|
+
typing.Optional[typing.Any],
|
199
|
+
parse_obj_as(
|
200
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
201
|
+
object_=_response.json(),
|
202
|
+
),
|
203
|
+
)
|
204
|
+
)
|
205
|
+
if _response.status_code == 401:
|
206
|
+
raise UnauthorizedError(
|
207
|
+
typing.cast(
|
208
|
+
typing.Optional[typing.Any],
|
209
|
+
parse_obj_as(
|
210
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
211
|
+
object_=_response.json(),
|
212
|
+
),
|
213
|
+
)
|
214
|
+
)
|
215
|
+
_response_json = _response.json()
|
216
|
+
except JSONDecodeError:
|
217
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
218
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
219
|
+
|
220
|
+
def update(
|
221
|
+
self, bucket_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
222
|
+
) -> BucketUpdateResponse:
|
223
|
+
"""
|
224
|
+
Rename a bucket.
|
225
|
+
|
226
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
227
|
+
|
228
|
+
Parameters
|
229
|
+
----------
|
230
|
+
bucket_id : int
|
231
|
+
The bucketId of the bucket being updated.
|
232
|
+
|
233
|
+
new_name : str
|
234
|
+
The new name of the bucket being renamed.
|
235
|
+
|
236
|
+
request_options : typing.Optional[RequestOptions]
|
237
|
+
Request-specific configuration.
|
238
|
+
|
239
|
+
Returns
|
240
|
+
-------
|
241
|
+
BucketUpdateResponse
|
242
|
+
Bucket successfully updated
|
243
|
+
|
244
|
+
Examples
|
245
|
+
--------
|
246
|
+
from groundx import GroundX
|
247
|
+
|
248
|
+
client = GroundX(
|
249
|
+
api_key="YOUR_API_KEY",
|
250
|
+
)
|
251
|
+
client.buckets.update(
|
252
|
+
bucket_id=1,
|
253
|
+
new_name="your_bucket_name",
|
254
|
+
)
|
255
|
+
"""
|
256
|
+
_response = self._client_wrapper.httpx_client.request(
|
257
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
258
|
+
method="PUT",
|
259
|
+
json={
|
260
|
+
"newName": new_name,
|
261
|
+
},
|
262
|
+
headers={
|
263
|
+
"content-type": "application/json",
|
264
|
+
},
|
265
|
+
request_options=request_options,
|
266
|
+
omit=OMIT,
|
267
|
+
)
|
268
|
+
try:
|
269
|
+
if 200 <= _response.status_code < 300:
|
270
|
+
return typing.cast(
|
271
|
+
BucketUpdateResponse,
|
272
|
+
parse_obj_as(
|
273
|
+
type_=BucketUpdateResponse, # type: ignore
|
274
|
+
object_=_response.json(),
|
275
|
+
),
|
276
|
+
)
|
277
|
+
if _response.status_code == 400:
|
278
|
+
raise BadRequestError(
|
279
|
+
typing.cast(
|
280
|
+
typing.Optional[typing.Any],
|
281
|
+
parse_obj_as(
|
282
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
283
|
+
object_=_response.json(),
|
284
|
+
),
|
285
|
+
)
|
286
|
+
)
|
287
|
+
if _response.status_code == 401:
|
288
|
+
raise UnauthorizedError(
|
289
|
+
typing.cast(
|
290
|
+
typing.Optional[typing.Any],
|
291
|
+
parse_obj_as(
|
292
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
293
|
+
object_=_response.json(),
|
294
|
+
),
|
295
|
+
)
|
296
|
+
)
|
297
|
+
_response_json = _response.json()
|
298
|
+
except JSONDecodeError:
|
299
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
300
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
301
|
+
|
302
|
+
def delete(self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MessageResponse:
|
303
|
+
"""
|
304
|
+
Delete a bucket.
|
305
|
+
|
306
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
307
|
+
|
308
|
+
Parameters
|
309
|
+
----------
|
310
|
+
bucket_id : int
|
311
|
+
The bucketId of the bucket being deleted.
|
312
|
+
|
313
|
+
request_options : typing.Optional[RequestOptions]
|
314
|
+
Request-specific configuration.
|
315
|
+
|
316
|
+
Returns
|
317
|
+
-------
|
318
|
+
MessageResponse
|
319
|
+
Bucket successfully deleted
|
320
|
+
|
321
|
+
Examples
|
322
|
+
--------
|
323
|
+
from groundx import GroundX
|
324
|
+
|
325
|
+
client = GroundX(
|
326
|
+
api_key="YOUR_API_KEY",
|
327
|
+
)
|
328
|
+
client.buckets.delete(
|
329
|
+
bucket_id=1,
|
330
|
+
)
|
331
|
+
"""
|
332
|
+
_response = self._client_wrapper.httpx_client.request(
|
333
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
334
|
+
method="DELETE",
|
335
|
+
request_options=request_options,
|
336
|
+
)
|
337
|
+
try:
|
338
|
+
if 200 <= _response.status_code < 300:
|
339
|
+
return typing.cast(
|
340
|
+
MessageResponse,
|
341
|
+
parse_obj_as(
|
342
|
+
type_=MessageResponse, # type: ignore
|
343
|
+
object_=_response.json(),
|
344
|
+
),
|
345
|
+
)
|
346
|
+
if _response.status_code == 400:
|
347
|
+
raise BadRequestError(
|
348
|
+
typing.cast(
|
349
|
+
typing.Optional[typing.Any],
|
350
|
+
parse_obj_as(
|
351
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
352
|
+
object_=_response.json(),
|
353
|
+
),
|
354
|
+
)
|
355
|
+
)
|
356
|
+
if _response.status_code == 401:
|
357
|
+
raise UnauthorizedError(
|
358
|
+
typing.cast(
|
359
|
+
typing.Optional[typing.Any],
|
360
|
+
parse_obj_as(
|
361
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
362
|
+
object_=_response.json(),
|
363
|
+
),
|
364
|
+
)
|
365
|
+
)
|
366
|
+
_response_json = _response.json()
|
367
|
+
except JSONDecodeError:
|
368
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
369
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
370
|
+
|
371
|
+
|
372
|
+
class AsyncBucketsClient:
|
373
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
374
|
+
self._client_wrapper = client_wrapper
|
375
|
+
|
376
|
+
async def list(
|
377
|
+
self,
|
378
|
+
*,
|
379
|
+
n: typing.Optional[int] = None,
|
380
|
+
next_token: typing.Optional[str] = None,
|
381
|
+
request_options: typing.Optional[RequestOptions] = None,
|
382
|
+
) -> BucketListResponse:
|
383
|
+
"""
|
384
|
+
List all buckets within your GroundX account
|
385
|
+
|
386
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
387
|
+
|
388
|
+
Parameters
|
389
|
+
----------
|
390
|
+
n : typing.Optional[int]
|
391
|
+
The maximum number of returned buckets. Accepts 1-100 with a default of 20.
|
392
|
+
|
393
|
+
next_token : typing.Optional[str]
|
394
|
+
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.
|
395
|
+
|
396
|
+
request_options : typing.Optional[RequestOptions]
|
397
|
+
Request-specific configuration.
|
398
|
+
|
399
|
+
Returns
|
400
|
+
-------
|
401
|
+
BucketListResponse
|
402
|
+
Look up success
|
403
|
+
|
404
|
+
Examples
|
405
|
+
--------
|
406
|
+
import asyncio
|
407
|
+
|
408
|
+
from groundx import AsyncGroundX
|
409
|
+
|
410
|
+
client = AsyncGroundX(
|
411
|
+
api_key="YOUR_API_KEY",
|
412
|
+
)
|
413
|
+
|
414
|
+
|
415
|
+
async def main() -> None:
|
416
|
+
await client.buckets.list()
|
417
|
+
|
418
|
+
|
419
|
+
asyncio.run(main())
|
420
|
+
"""
|
421
|
+
_response = await self._client_wrapper.httpx_client.request(
|
422
|
+
"v1/bucket",
|
423
|
+
method="GET",
|
424
|
+
params={
|
425
|
+
"n": n,
|
426
|
+
"nextToken": next_token,
|
427
|
+
},
|
428
|
+
request_options=request_options,
|
429
|
+
)
|
430
|
+
try:
|
431
|
+
if 200 <= _response.status_code < 300:
|
432
|
+
return typing.cast(
|
433
|
+
BucketListResponse,
|
434
|
+
parse_obj_as(
|
435
|
+
type_=BucketListResponse, # type: ignore
|
436
|
+
object_=_response.json(),
|
437
|
+
),
|
438
|
+
)
|
439
|
+
_response_json = _response.json()
|
440
|
+
except JSONDecodeError:
|
441
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
442
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
443
|
+
|
444
|
+
async def create(self, *, name: str, request_options: typing.Optional[RequestOptions] = None) -> BucketResponse:
|
445
|
+
"""
|
446
|
+
Create a new bucket.
|
447
|
+
|
448
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
449
|
+
|
450
|
+
Parameters
|
451
|
+
----------
|
452
|
+
name : str
|
453
|
+
|
454
|
+
request_options : typing.Optional[RequestOptions]
|
455
|
+
Request-specific configuration.
|
456
|
+
|
457
|
+
Returns
|
458
|
+
-------
|
459
|
+
BucketResponse
|
460
|
+
Bucket successfully created
|
461
|
+
|
462
|
+
Examples
|
463
|
+
--------
|
464
|
+
import asyncio
|
465
|
+
|
466
|
+
from groundx import AsyncGroundX
|
467
|
+
|
468
|
+
client = AsyncGroundX(
|
469
|
+
api_key="YOUR_API_KEY",
|
470
|
+
)
|
471
|
+
|
472
|
+
|
473
|
+
async def main() -> None:
|
474
|
+
await client.buckets.create(
|
475
|
+
name="your_bucket_name",
|
476
|
+
)
|
477
|
+
|
478
|
+
|
479
|
+
asyncio.run(main())
|
480
|
+
"""
|
481
|
+
_response = await self._client_wrapper.httpx_client.request(
|
482
|
+
"v1/bucket",
|
483
|
+
method="POST",
|
484
|
+
json={
|
485
|
+
"name": name,
|
486
|
+
},
|
487
|
+
headers={
|
488
|
+
"content-type": "application/json",
|
489
|
+
},
|
490
|
+
request_options=request_options,
|
491
|
+
omit=OMIT,
|
492
|
+
)
|
493
|
+
try:
|
494
|
+
if 200 <= _response.status_code < 300:
|
495
|
+
return typing.cast(
|
496
|
+
BucketResponse,
|
497
|
+
parse_obj_as(
|
498
|
+
type_=BucketResponse, # type: ignore
|
499
|
+
object_=_response.json(),
|
500
|
+
),
|
501
|
+
)
|
502
|
+
if _response.status_code == 400:
|
503
|
+
raise BadRequestError(
|
504
|
+
typing.cast(
|
505
|
+
typing.Optional[typing.Any],
|
506
|
+
parse_obj_as(
|
507
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
508
|
+
object_=_response.json(),
|
509
|
+
),
|
510
|
+
)
|
511
|
+
)
|
512
|
+
_response_json = _response.json()
|
513
|
+
except JSONDecodeError:
|
514
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
515
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
516
|
+
|
517
|
+
async def get(self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> BucketResponse:
|
518
|
+
"""
|
519
|
+
Look up a specific bucket by its bucketId.
|
520
|
+
|
521
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
522
|
+
|
523
|
+
Parameters
|
524
|
+
----------
|
525
|
+
bucket_id : int
|
526
|
+
The bucketId of the bucket to look up.
|
527
|
+
|
528
|
+
request_options : typing.Optional[RequestOptions]
|
529
|
+
Request-specific configuration.
|
530
|
+
|
531
|
+
Returns
|
532
|
+
-------
|
533
|
+
BucketResponse
|
534
|
+
Look up success
|
535
|
+
|
536
|
+
Examples
|
537
|
+
--------
|
538
|
+
import asyncio
|
539
|
+
|
540
|
+
from groundx import AsyncGroundX
|
541
|
+
|
542
|
+
client = AsyncGroundX(
|
543
|
+
api_key="YOUR_API_KEY",
|
544
|
+
)
|
545
|
+
|
546
|
+
|
547
|
+
async def main() -> None:
|
548
|
+
await client.buckets.get(
|
549
|
+
bucket_id=1,
|
550
|
+
)
|
551
|
+
|
552
|
+
|
553
|
+
asyncio.run(main())
|
554
|
+
"""
|
555
|
+
_response = await self._client_wrapper.httpx_client.request(
|
556
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
557
|
+
method="GET",
|
558
|
+
request_options=request_options,
|
559
|
+
)
|
560
|
+
try:
|
561
|
+
if 200 <= _response.status_code < 300:
|
562
|
+
return typing.cast(
|
563
|
+
BucketResponse,
|
564
|
+
parse_obj_as(
|
565
|
+
type_=BucketResponse, # type: ignore
|
566
|
+
object_=_response.json(),
|
567
|
+
),
|
568
|
+
)
|
569
|
+
if _response.status_code == 400:
|
570
|
+
raise BadRequestError(
|
571
|
+
typing.cast(
|
572
|
+
typing.Optional[typing.Any],
|
573
|
+
parse_obj_as(
|
574
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
575
|
+
object_=_response.json(),
|
576
|
+
),
|
577
|
+
)
|
578
|
+
)
|
579
|
+
if _response.status_code == 401:
|
580
|
+
raise UnauthorizedError(
|
581
|
+
typing.cast(
|
582
|
+
typing.Optional[typing.Any],
|
583
|
+
parse_obj_as(
|
584
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
585
|
+
object_=_response.json(),
|
586
|
+
),
|
587
|
+
)
|
588
|
+
)
|
589
|
+
_response_json = _response.json()
|
590
|
+
except JSONDecodeError:
|
591
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
592
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
593
|
+
|
594
|
+
async def update(
|
595
|
+
self, bucket_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
596
|
+
) -> BucketUpdateResponse:
|
597
|
+
"""
|
598
|
+
Rename a bucket.
|
599
|
+
|
600
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
601
|
+
|
602
|
+
Parameters
|
603
|
+
----------
|
604
|
+
bucket_id : int
|
605
|
+
The bucketId of the bucket being updated.
|
606
|
+
|
607
|
+
new_name : str
|
608
|
+
The new name of the bucket being renamed.
|
609
|
+
|
610
|
+
request_options : typing.Optional[RequestOptions]
|
611
|
+
Request-specific configuration.
|
612
|
+
|
613
|
+
Returns
|
614
|
+
-------
|
615
|
+
BucketUpdateResponse
|
616
|
+
Bucket successfully updated
|
617
|
+
|
618
|
+
Examples
|
619
|
+
--------
|
620
|
+
import asyncio
|
621
|
+
|
622
|
+
from groundx import AsyncGroundX
|
623
|
+
|
624
|
+
client = AsyncGroundX(
|
625
|
+
api_key="YOUR_API_KEY",
|
626
|
+
)
|
627
|
+
|
628
|
+
|
629
|
+
async def main() -> None:
|
630
|
+
await client.buckets.update(
|
631
|
+
bucket_id=1,
|
632
|
+
new_name="your_bucket_name",
|
633
|
+
)
|
634
|
+
|
635
|
+
|
636
|
+
asyncio.run(main())
|
637
|
+
"""
|
638
|
+
_response = await self._client_wrapper.httpx_client.request(
|
639
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
640
|
+
method="PUT",
|
641
|
+
json={
|
642
|
+
"newName": new_name,
|
643
|
+
},
|
644
|
+
headers={
|
645
|
+
"content-type": "application/json",
|
646
|
+
},
|
647
|
+
request_options=request_options,
|
648
|
+
omit=OMIT,
|
649
|
+
)
|
650
|
+
try:
|
651
|
+
if 200 <= _response.status_code < 300:
|
652
|
+
return typing.cast(
|
653
|
+
BucketUpdateResponse,
|
654
|
+
parse_obj_as(
|
655
|
+
type_=BucketUpdateResponse, # type: ignore
|
656
|
+
object_=_response.json(),
|
657
|
+
),
|
658
|
+
)
|
659
|
+
if _response.status_code == 400:
|
660
|
+
raise BadRequestError(
|
661
|
+
typing.cast(
|
662
|
+
typing.Optional[typing.Any],
|
663
|
+
parse_obj_as(
|
664
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
665
|
+
object_=_response.json(),
|
666
|
+
),
|
667
|
+
)
|
668
|
+
)
|
669
|
+
if _response.status_code == 401:
|
670
|
+
raise UnauthorizedError(
|
671
|
+
typing.cast(
|
672
|
+
typing.Optional[typing.Any],
|
673
|
+
parse_obj_as(
|
674
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
675
|
+
object_=_response.json(),
|
676
|
+
),
|
677
|
+
)
|
678
|
+
)
|
679
|
+
_response_json = _response.json()
|
680
|
+
except JSONDecodeError:
|
681
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
682
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
683
|
+
|
684
|
+
async def delete(
|
685
|
+
self, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
686
|
+
) -> MessageResponse:
|
687
|
+
"""
|
688
|
+
Delete a bucket.
|
689
|
+
|
690
|
+
Interact with the "Request Body" below to explore the arguments of this function. Enter your GroundX API key to send a request directly from this web page. Select your language of choice to structure a code snippet based on your specified arguments.
|
691
|
+
|
692
|
+
Parameters
|
693
|
+
----------
|
694
|
+
bucket_id : int
|
695
|
+
The bucketId of the bucket being deleted.
|
696
|
+
|
697
|
+
request_options : typing.Optional[RequestOptions]
|
698
|
+
Request-specific configuration.
|
699
|
+
|
700
|
+
Returns
|
701
|
+
-------
|
702
|
+
MessageResponse
|
703
|
+
Bucket successfully deleted
|
704
|
+
|
705
|
+
Examples
|
706
|
+
--------
|
707
|
+
import asyncio
|
708
|
+
|
709
|
+
from groundx import AsyncGroundX
|
710
|
+
|
711
|
+
client = AsyncGroundX(
|
712
|
+
api_key="YOUR_API_KEY",
|
713
|
+
)
|
714
|
+
|
715
|
+
|
716
|
+
async def main() -> None:
|
717
|
+
await client.buckets.delete(
|
718
|
+
bucket_id=1,
|
719
|
+
)
|
720
|
+
|
721
|
+
|
722
|
+
asyncio.run(main())
|
723
|
+
"""
|
724
|
+
_response = await self._client_wrapper.httpx_client.request(
|
725
|
+
f"v1/bucket/{jsonable_encoder(bucket_id)}",
|
726
|
+
method="DELETE",
|
727
|
+
request_options=request_options,
|
728
|
+
)
|
729
|
+
try:
|
730
|
+
if 200 <= _response.status_code < 300:
|
731
|
+
return typing.cast(
|
732
|
+
MessageResponse,
|
733
|
+
parse_obj_as(
|
734
|
+
type_=MessageResponse, # type: ignore
|
735
|
+
object_=_response.json(),
|
736
|
+
),
|
737
|
+
)
|
738
|
+
if _response.status_code == 400:
|
739
|
+
raise BadRequestError(
|
740
|
+
typing.cast(
|
741
|
+
typing.Optional[typing.Any],
|
742
|
+
parse_obj_as(
|
743
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
744
|
+
object_=_response.json(),
|
745
|
+
),
|
746
|
+
)
|
747
|
+
)
|
748
|
+
if _response.status_code == 401:
|
749
|
+
raise UnauthorizedError(
|
750
|
+
typing.cast(
|
751
|
+
typing.Optional[typing.Any],
|
752
|
+
parse_obj_as(
|
753
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
754
|
+
object_=_response.json(),
|
755
|
+
),
|
756
|
+
)
|
757
|
+
)
|
758
|
+
_response_json = _response.json()
|
759
|
+
except JSONDecodeError:
|
760
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
761
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|