groundx 2.3.3__py3-none-any.whl → 2.3.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.
- groundx/__init__.py +4 -0
- groundx/buckets/__init__.py +2 -0
- groundx/buckets/client.py +47 -366
- groundx/buckets/raw_client.py +628 -0
- groundx/client.py +15 -17
- 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 +70 -26
- groundx/core/http_response.py +55 -0
- groundx/core/jsonable_encoder.py +0 -1
- groundx/core/pydantic_utilities.py +69 -110
- groundx/core/serialization.py +7 -3
- groundx/customer/__init__.py +2 -0
- groundx/customer/client.py +31 -43
- groundx/customer/raw_client.py +91 -0
- groundx/documents/__init__.py +2 -0
- groundx/documents/client.py +100 -780
- groundx/documents/raw_client.py +1404 -0
- groundx/errors/__init__.py +2 -0
- groundx/errors/bad_request_error.py +4 -3
- groundx/errors/unauthorized_error.py +4 -3
- groundx/groups/__init__.py +2 -0
- groundx/groups/client.py +55 -520
- 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/search/__init__.py +2 -0
- groundx/search/client.py +64 -213
- groundx/search/raw_client.py +442 -0
- groundx/search/types/__init__.py +2 -0
- groundx/types/__init__.py +4 -0
- groundx/types/bounding_box_detail.py +4 -4
- groundx/types/bucket_detail.py +5 -5
- groundx/types/bucket_list_response.py +3 -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 +9 -4
- groundx/types/document_detail.py +4 -4
- groundx/types/document_list_response.py +4 -4
- groundx/types/document_local_ingest_request.py +1 -0
- groundx/types/document_lookup_response.py +3 -3
- groundx/types/document_response.py +3 -3
- groundx/types/group_detail.py +4 -4
- groundx/types/group_list_response.py +3 -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 +3 -3
- groundx/types/ingest_local_document_metadata.py +4 -4
- groundx/types/ingest_remote_document.py +4 -4
- groundx/types/ingest_response.py +3 -3
- groundx/types/ingest_status.py +3 -3
- groundx/types/ingest_status_light.py +3 -3
- groundx/types/ingest_status_progress.py +3 -3
- groundx/types/ingest_status_progress_cancelled.py +3 -3
- groundx/types/ingest_status_progress_complete.py +3 -3
- groundx/types/ingest_status_progress_errors.py +3 -3
- groundx/types/ingest_status_progress_processing.py +3 -3
- groundx/types/message_response.py +2 -2
- groundx/types/meter_detail.py +2 -2
- groundx/types/processes_status_response.py +3 -3
- 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/types/website_source.py +4 -4
- {groundx-2.3.3.dist-info → groundx-2.3.6.dist-info}/METADATA +1 -1
- groundx-2.3.6.dist-info/RECORD +96 -0
- groundx-2.3.3.dist-info/RECORD +0 -87
- {groundx-2.3.3.dist-info → groundx-2.3.6.dist-info}/LICENSE +0 -0
- {groundx-2.3.3.dist-info → groundx-2.3.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,901 @@
|
|
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.group_list_response import GroupListResponse
|
15
|
+
from ..types.group_response import GroupResponse
|
16
|
+
from ..types.message_response import MessageResponse
|
17
|
+
|
18
|
+
# this is used as the default value for optional parameters
|
19
|
+
OMIT = typing.cast(typing.Any, ...)
|
20
|
+
|
21
|
+
|
22
|
+
class RawGroupsClient:
|
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
|
+
) -> HttpResponse[GroupListResponse]:
|
33
|
+
"""
|
34
|
+
list all groups within your GroundX account.
|
35
|
+
|
36
|
+
Parameters
|
37
|
+
----------
|
38
|
+
n : typing.Optional[int]
|
39
|
+
The maximum number of returned groups. Accepts 1-100 with a default of 20.
|
40
|
+
|
41
|
+
next_token : typing.Optional[str]
|
42
|
+
A token for pagination. If the number of groups 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 groups.
|
43
|
+
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
45
|
+
Request-specific configuration.
|
46
|
+
|
47
|
+
Returns
|
48
|
+
-------
|
49
|
+
HttpResponse[GroupListResponse]
|
50
|
+
Successful retrieval of groups
|
51
|
+
"""
|
52
|
+
_response = self._client_wrapper.httpx_client.request(
|
53
|
+
"v1/group",
|
54
|
+
method="GET",
|
55
|
+
params={
|
56
|
+
"n": n,
|
57
|
+
"nextToken": next_token,
|
58
|
+
},
|
59
|
+
request_options=request_options,
|
60
|
+
)
|
61
|
+
try:
|
62
|
+
if 200 <= _response.status_code < 300:
|
63
|
+
_data = typing.cast(
|
64
|
+
GroupListResponse,
|
65
|
+
parse_obj_as(
|
66
|
+
type_=GroupListResponse, # type: ignore
|
67
|
+
object_=_response.json(),
|
68
|
+
),
|
69
|
+
)
|
70
|
+
return HttpResponse(response=_response, data=_data)
|
71
|
+
_response_json = _response.json()
|
72
|
+
except JSONDecodeError:
|
73
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
74
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
75
|
+
|
76
|
+
def create(
|
77
|
+
self,
|
78
|
+
*,
|
79
|
+
name: str,
|
80
|
+
bucket_name: typing.Optional[str] = OMIT,
|
81
|
+
request_options: typing.Optional[RequestOptions] = None,
|
82
|
+
) -> HttpResponse[GroupResponse]:
|
83
|
+
"""
|
84
|
+
create a new group, a group being a collection of buckets which can be searched.
|
85
|
+
|
86
|
+
Parameters
|
87
|
+
----------
|
88
|
+
name : str
|
89
|
+
The name of the group being created.
|
90
|
+
|
91
|
+
bucket_name : typing.Optional[str]
|
92
|
+
Specify bucketName to automatically create a bucket, by the name specified, and add it to the created group.
|
93
|
+
|
94
|
+
request_options : typing.Optional[RequestOptions]
|
95
|
+
Request-specific configuration.
|
96
|
+
|
97
|
+
Returns
|
98
|
+
-------
|
99
|
+
HttpResponse[GroupResponse]
|
100
|
+
Group successfully created
|
101
|
+
"""
|
102
|
+
_response = self._client_wrapper.httpx_client.request(
|
103
|
+
"v1/group",
|
104
|
+
method="POST",
|
105
|
+
json={
|
106
|
+
"name": name,
|
107
|
+
"bucketName": bucket_name,
|
108
|
+
},
|
109
|
+
headers={
|
110
|
+
"content-type": "application/json",
|
111
|
+
},
|
112
|
+
request_options=request_options,
|
113
|
+
omit=OMIT,
|
114
|
+
)
|
115
|
+
try:
|
116
|
+
if 200 <= _response.status_code < 300:
|
117
|
+
_data = typing.cast(
|
118
|
+
GroupResponse,
|
119
|
+
parse_obj_as(
|
120
|
+
type_=GroupResponse, # type: ignore
|
121
|
+
object_=_response.json(),
|
122
|
+
),
|
123
|
+
)
|
124
|
+
return HttpResponse(response=_response, data=_data)
|
125
|
+
if _response.status_code == 400:
|
126
|
+
raise BadRequestError(
|
127
|
+
headers=dict(_response.headers),
|
128
|
+
body=typing.cast(
|
129
|
+
typing.Optional[typing.Any],
|
130
|
+
parse_obj_as(
|
131
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
132
|
+
object_=_response.json(),
|
133
|
+
),
|
134
|
+
),
|
135
|
+
)
|
136
|
+
_response_json = _response.json()
|
137
|
+
except JSONDecodeError:
|
138
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
139
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
140
|
+
|
141
|
+
def get(
|
142
|
+
self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
143
|
+
) -> HttpResponse[GroupResponse]:
|
144
|
+
"""
|
145
|
+
look up a specific group by its groupId.
|
146
|
+
|
147
|
+
Parameters
|
148
|
+
----------
|
149
|
+
group_id : int
|
150
|
+
The groupId of the group to look up.
|
151
|
+
|
152
|
+
request_options : typing.Optional[RequestOptions]
|
153
|
+
Request-specific configuration.
|
154
|
+
|
155
|
+
Returns
|
156
|
+
-------
|
157
|
+
HttpResponse[GroupResponse]
|
158
|
+
Successful retrieval of group
|
159
|
+
"""
|
160
|
+
_response = self._client_wrapper.httpx_client.request(
|
161
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
162
|
+
method="GET",
|
163
|
+
request_options=request_options,
|
164
|
+
)
|
165
|
+
try:
|
166
|
+
if 200 <= _response.status_code < 300:
|
167
|
+
_data = typing.cast(
|
168
|
+
GroupResponse,
|
169
|
+
parse_obj_as(
|
170
|
+
type_=GroupResponse, # type: ignore
|
171
|
+
object_=_response.json(),
|
172
|
+
),
|
173
|
+
)
|
174
|
+
return HttpResponse(response=_response, data=_data)
|
175
|
+
if _response.status_code == 400:
|
176
|
+
raise BadRequestError(
|
177
|
+
headers=dict(_response.headers),
|
178
|
+
body=typing.cast(
|
179
|
+
typing.Optional[typing.Any],
|
180
|
+
parse_obj_as(
|
181
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
182
|
+
object_=_response.json(),
|
183
|
+
),
|
184
|
+
),
|
185
|
+
)
|
186
|
+
if _response.status_code == 401:
|
187
|
+
raise UnauthorizedError(
|
188
|
+
headers=dict(_response.headers),
|
189
|
+
body=typing.cast(
|
190
|
+
typing.Optional[typing.Any],
|
191
|
+
parse_obj_as(
|
192
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
193
|
+
object_=_response.json(),
|
194
|
+
),
|
195
|
+
),
|
196
|
+
)
|
197
|
+
_response_json = _response.json()
|
198
|
+
except JSONDecodeError:
|
199
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
200
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
201
|
+
|
202
|
+
def update(
|
203
|
+
self, group_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
204
|
+
) -> HttpResponse[GroupResponse]:
|
205
|
+
"""
|
206
|
+
Rename a group
|
207
|
+
|
208
|
+
Parameters
|
209
|
+
----------
|
210
|
+
group_id : int
|
211
|
+
The groupId of the group to update.
|
212
|
+
|
213
|
+
new_name : str
|
214
|
+
The new name of the group being renamed.
|
215
|
+
|
216
|
+
request_options : typing.Optional[RequestOptions]
|
217
|
+
Request-specific configuration.
|
218
|
+
|
219
|
+
Returns
|
220
|
+
-------
|
221
|
+
HttpResponse[GroupResponse]
|
222
|
+
Successful update of group
|
223
|
+
"""
|
224
|
+
_response = self._client_wrapper.httpx_client.request(
|
225
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
226
|
+
method="PUT",
|
227
|
+
json={
|
228
|
+
"newName": new_name,
|
229
|
+
},
|
230
|
+
headers={
|
231
|
+
"content-type": "application/json",
|
232
|
+
},
|
233
|
+
request_options=request_options,
|
234
|
+
omit=OMIT,
|
235
|
+
)
|
236
|
+
try:
|
237
|
+
if 200 <= _response.status_code < 300:
|
238
|
+
_data = typing.cast(
|
239
|
+
GroupResponse,
|
240
|
+
parse_obj_as(
|
241
|
+
type_=GroupResponse, # type: ignore
|
242
|
+
object_=_response.json(),
|
243
|
+
),
|
244
|
+
)
|
245
|
+
return HttpResponse(response=_response, data=_data)
|
246
|
+
if _response.status_code == 400:
|
247
|
+
raise BadRequestError(
|
248
|
+
headers=dict(_response.headers),
|
249
|
+
body=typing.cast(
|
250
|
+
typing.Optional[typing.Any],
|
251
|
+
parse_obj_as(
|
252
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
253
|
+
object_=_response.json(),
|
254
|
+
),
|
255
|
+
),
|
256
|
+
)
|
257
|
+
if _response.status_code == 401:
|
258
|
+
raise UnauthorizedError(
|
259
|
+
headers=dict(_response.headers),
|
260
|
+
body=typing.cast(
|
261
|
+
typing.Optional[typing.Any],
|
262
|
+
parse_obj_as(
|
263
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
264
|
+
object_=_response.json(),
|
265
|
+
),
|
266
|
+
),
|
267
|
+
)
|
268
|
+
_response_json = _response.json()
|
269
|
+
except JSONDecodeError:
|
270
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
271
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
272
|
+
|
273
|
+
def delete(
|
274
|
+
self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
275
|
+
) -> HttpResponse[MessageResponse]:
|
276
|
+
"""
|
277
|
+
Delete a group.
|
278
|
+
|
279
|
+
Parameters
|
280
|
+
----------
|
281
|
+
group_id : int
|
282
|
+
The groupId of the group to be deleted.
|
283
|
+
|
284
|
+
request_options : typing.Optional[RequestOptions]
|
285
|
+
Request-specific configuration.
|
286
|
+
|
287
|
+
Returns
|
288
|
+
-------
|
289
|
+
HttpResponse[MessageResponse]
|
290
|
+
Group successfully deleted
|
291
|
+
"""
|
292
|
+
_response = self._client_wrapper.httpx_client.request(
|
293
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
294
|
+
method="DELETE",
|
295
|
+
request_options=request_options,
|
296
|
+
)
|
297
|
+
try:
|
298
|
+
if 200 <= _response.status_code < 300:
|
299
|
+
_data = typing.cast(
|
300
|
+
MessageResponse,
|
301
|
+
parse_obj_as(
|
302
|
+
type_=MessageResponse, # type: ignore
|
303
|
+
object_=_response.json(),
|
304
|
+
),
|
305
|
+
)
|
306
|
+
return HttpResponse(response=_response, data=_data)
|
307
|
+
if _response.status_code == 400:
|
308
|
+
raise BadRequestError(
|
309
|
+
headers=dict(_response.headers),
|
310
|
+
body=typing.cast(
|
311
|
+
typing.Optional[typing.Any],
|
312
|
+
parse_obj_as(
|
313
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
314
|
+
object_=_response.json(),
|
315
|
+
),
|
316
|
+
),
|
317
|
+
)
|
318
|
+
if _response.status_code == 401:
|
319
|
+
raise UnauthorizedError(
|
320
|
+
headers=dict(_response.headers),
|
321
|
+
body=typing.cast(
|
322
|
+
typing.Optional[typing.Any],
|
323
|
+
parse_obj_as(
|
324
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
325
|
+
object_=_response.json(),
|
326
|
+
),
|
327
|
+
),
|
328
|
+
)
|
329
|
+
_response_json = _response.json()
|
330
|
+
except JSONDecodeError:
|
331
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
332
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
333
|
+
|
334
|
+
def add_bucket(
|
335
|
+
self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
336
|
+
) -> HttpResponse[MessageResponse]:
|
337
|
+
"""
|
338
|
+
Add an existing bucket to an existing group. Buckets and groups can be associated many to many.
|
339
|
+
|
340
|
+
Parameters
|
341
|
+
----------
|
342
|
+
group_id : int
|
343
|
+
The groupId of the group which the bucket will be added to.
|
344
|
+
|
345
|
+
bucket_id : int
|
346
|
+
The bucketId of the bucket being added to the group.
|
347
|
+
|
348
|
+
request_options : typing.Optional[RequestOptions]
|
349
|
+
Request-specific configuration.
|
350
|
+
|
351
|
+
Returns
|
352
|
+
-------
|
353
|
+
HttpResponse[MessageResponse]
|
354
|
+
Successful update of group
|
355
|
+
"""
|
356
|
+
_response = self._client_wrapper.httpx_client.request(
|
357
|
+
f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
|
358
|
+
method="POST",
|
359
|
+
request_options=request_options,
|
360
|
+
)
|
361
|
+
try:
|
362
|
+
if 200 <= _response.status_code < 300:
|
363
|
+
_data = typing.cast(
|
364
|
+
MessageResponse,
|
365
|
+
parse_obj_as(
|
366
|
+
type_=MessageResponse, # type: ignore
|
367
|
+
object_=_response.json(),
|
368
|
+
),
|
369
|
+
)
|
370
|
+
return HttpResponse(response=_response, data=_data)
|
371
|
+
if _response.status_code == 400:
|
372
|
+
raise BadRequestError(
|
373
|
+
headers=dict(_response.headers),
|
374
|
+
body=typing.cast(
|
375
|
+
typing.Optional[typing.Any],
|
376
|
+
parse_obj_as(
|
377
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
378
|
+
object_=_response.json(),
|
379
|
+
),
|
380
|
+
),
|
381
|
+
)
|
382
|
+
if _response.status_code == 401:
|
383
|
+
raise UnauthorizedError(
|
384
|
+
headers=dict(_response.headers),
|
385
|
+
body=typing.cast(
|
386
|
+
typing.Optional[typing.Any],
|
387
|
+
parse_obj_as(
|
388
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
389
|
+
object_=_response.json(),
|
390
|
+
),
|
391
|
+
),
|
392
|
+
)
|
393
|
+
_response_json = _response.json()
|
394
|
+
except JSONDecodeError:
|
395
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
396
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
397
|
+
|
398
|
+
def remove_bucket(
|
399
|
+
self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
400
|
+
) -> HttpResponse[MessageResponse]:
|
401
|
+
"""
|
402
|
+
remove a bucket from a group. Buckets and groups can be associated many to many, this removes one bucket to group association without disturbing others.
|
403
|
+
|
404
|
+
Parameters
|
405
|
+
----------
|
406
|
+
group_id : int
|
407
|
+
The groupId of the group which the bucket will be removed from.
|
408
|
+
|
409
|
+
bucket_id : int
|
410
|
+
The bucketId of the bucket which will be removed from the group.
|
411
|
+
|
412
|
+
request_options : typing.Optional[RequestOptions]
|
413
|
+
Request-specific configuration.
|
414
|
+
|
415
|
+
Returns
|
416
|
+
-------
|
417
|
+
HttpResponse[MessageResponse]
|
418
|
+
Successful update of group
|
419
|
+
"""
|
420
|
+
_response = self._client_wrapper.httpx_client.request(
|
421
|
+
f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
|
422
|
+
method="DELETE",
|
423
|
+
request_options=request_options,
|
424
|
+
)
|
425
|
+
try:
|
426
|
+
if 200 <= _response.status_code < 300:
|
427
|
+
_data = typing.cast(
|
428
|
+
MessageResponse,
|
429
|
+
parse_obj_as(
|
430
|
+
type_=MessageResponse, # type: ignore
|
431
|
+
object_=_response.json(),
|
432
|
+
),
|
433
|
+
)
|
434
|
+
return HttpResponse(response=_response, data=_data)
|
435
|
+
if _response.status_code == 400:
|
436
|
+
raise BadRequestError(
|
437
|
+
headers=dict(_response.headers),
|
438
|
+
body=typing.cast(
|
439
|
+
typing.Optional[typing.Any],
|
440
|
+
parse_obj_as(
|
441
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
442
|
+
object_=_response.json(),
|
443
|
+
),
|
444
|
+
),
|
445
|
+
)
|
446
|
+
if _response.status_code == 401:
|
447
|
+
raise UnauthorizedError(
|
448
|
+
headers=dict(_response.headers),
|
449
|
+
body=typing.cast(
|
450
|
+
typing.Optional[typing.Any],
|
451
|
+
parse_obj_as(
|
452
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
453
|
+
object_=_response.json(),
|
454
|
+
),
|
455
|
+
),
|
456
|
+
)
|
457
|
+
_response_json = _response.json()
|
458
|
+
except JSONDecodeError:
|
459
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
460
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
461
|
+
|
462
|
+
|
463
|
+
class AsyncRawGroupsClient:
|
464
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
465
|
+
self._client_wrapper = client_wrapper
|
466
|
+
|
467
|
+
async def list(
|
468
|
+
self,
|
469
|
+
*,
|
470
|
+
n: typing.Optional[int] = None,
|
471
|
+
next_token: typing.Optional[str] = None,
|
472
|
+
request_options: typing.Optional[RequestOptions] = None,
|
473
|
+
) -> AsyncHttpResponse[GroupListResponse]:
|
474
|
+
"""
|
475
|
+
list all groups within your GroundX account.
|
476
|
+
|
477
|
+
Parameters
|
478
|
+
----------
|
479
|
+
n : typing.Optional[int]
|
480
|
+
The maximum number of returned groups. Accepts 1-100 with a default of 20.
|
481
|
+
|
482
|
+
next_token : typing.Optional[str]
|
483
|
+
A token for pagination. If the number of groups 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 groups.
|
484
|
+
|
485
|
+
request_options : typing.Optional[RequestOptions]
|
486
|
+
Request-specific configuration.
|
487
|
+
|
488
|
+
Returns
|
489
|
+
-------
|
490
|
+
AsyncHttpResponse[GroupListResponse]
|
491
|
+
Successful retrieval of groups
|
492
|
+
"""
|
493
|
+
_response = await self._client_wrapper.httpx_client.request(
|
494
|
+
"v1/group",
|
495
|
+
method="GET",
|
496
|
+
params={
|
497
|
+
"n": n,
|
498
|
+
"nextToken": next_token,
|
499
|
+
},
|
500
|
+
request_options=request_options,
|
501
|
+
)
|
502
|
+
try:
|
503
|
+
if 200 <= _response.status_code < 300:
|
504
|
+
_data = typing.cast(
|
505
|
+
GroupListResponse,
|
506
|
+
parse_obj_as(
|
507
|
+
type_=GroupListResponse, # type: ignore
|
508
|
+
object_=_response.json(),
|
509
|
+
),
|
510
|
+
)
|
511
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
512
|
+
_response_json = _response.json()
|
513
|
+
except JSONDecodeError:
|
514
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
515
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
516
|
+
|
517
|
+
async def create(
|
518
|
+
self,
|
519
|
+
*,
|
520
|
+
name: str,
|
521
|
+
bucket_name: typing.Optional[str] = OMIT,
|
522
|
+
request_options: typing.Optional[RequestOptions] = None,
|
523
|
+
) -> AsyncHttpResponse[GroupResponse]:
|
524
|
+
"""
|
525
|
+
create a new group, a group being a collection of buckets which can be searched.
|
526
|
+
|
527
|
+
Parameters
|
528
|
+
----------
|
529
|
+
name : str
|
530
|
+
The name of the group being created.
|
531
|
+
|
532
|
+
bucket_name : typing.Optional[str]
|
533
|
+
Specify bucketName to automatically create a bucket, by the name specified, and add it to the created group.
|
534
|
+
|
535
|
+
request_options : typing.Optional[RequestOptions]
|
536
|
+
Request-specific configuration.
|
537
|
+
|
538
|
+
Returns
|
539
|
+
-------
|
540
|
+
AsyncHttpResponse[GroupResponse]
|
541
|
+
Group successfully created
|
542
|
+
"""
|
543
|
+
_response = await self._client_wrapper.httpx_client.request(
|
544
|
+
"v1/group",
|
545
|
+
method="POST",
|
546
|
+
json={
|
547
|
+
"name": name,
|
548
|
+
"bucketName": bucket_name,
|
549
|
+
},
|
550
|
+
headers={
|
551
|
+
"content-type": "application/json",
|
552
|
+
},
|
553
|
+
request_options=request_options,
|
554
|
+
omit=OMIT,
|
555
|
+
)
|
556
|
+
try:
|
557
|
+
if 200 <= _response.status_code < 300:
|
558
|
+
_data = typing.cast(
|
559
|
+
GroupResponse,
|
560
|
+
parse_obj_as(
|
561
|
+
type_=GroupResponse, # type: ignore
|
562
|
+
object_=_response.json(),
|
563
|
+
),
|
564
|
+
)
|
565
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
566
|
+
if _response.status_code == 400:
|
567
|
+
raise BadRequestError(
|
568
|
+
headers=dict(_response.headers),
|
569
|
+
body=typing.cast(
|
570
|
+
typing.Optional[typing.Any],
|
571
|
+
parse_obj_as(
|
572
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
573
|
+
object_=_response.json(),
|
574
|
+
),
|
575
|
+
),
|
576
|
+
)
|
577
|
+
_response_json = _response.json()
|
578
|
+
except JSONDecodeError:
|
579
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
580
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
581
|
+
|
582
|
+
async def get(
|
583
|
+
self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
584
|
+
) -> AsyncHttpResponse[GroupResponse]:
|
585
|
+
"""
|
586
|
+
look up a specific group by its groupId.
|
587
|
+
|
588
|
+
Parameters
|
589
|
+
----------
|
590
|
+
group_id : int
|
591
|
+
The groupId of the group to look up.
|
592
|
+
|
593
|
+
request_options : typing.Optional[RequestOptions]
|
594
|
+
Request-specific configuration.
|
595
|
+
|
596
|
+
Returns
|
597
|
+
-------
|
598
|
+
AsyncHttpResponse[GroupResponse]
|
599
|
+
Successful retrieval of group
|
600
|
+
"""
|
601
|
+
_response = await self._client_wrapper.httpx_client.request(
|
602
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
603
|
+
method="GET",
|
604
|
+
request_options=request_options,
|
605
|
+
)
|
606
|
+
try:
|
607
|
+
if 200 <= _response.status_code < 300:
|
608
|
+
_data = typing.cast(
|
609
|
+
GroupResponse,
|
610
|
+
parse_obj_as(
|
611
|
+
type_=GroupResponse, # type: ignore
|
612
|
+
object_=_response.json(),
|
613
|
+
),
|
614
|
+
)
|
615
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
616
|
+
if _response.status_code == 400:
|
617
|
+
raise BadRequestError(
|
618
|
+
headers=dict(_response.headers),
|
619
|
+
body=typing.cast(
|
620
|
+
typing.Optional[typing.Any],
|
621
|
+
parse_obj_as(
|
622
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
623
|
+
object_=_response.json(),
|
624
|
+
),
|
625
|
+
),
|
626
|
+
)
|
627
|
+
if _response.status_code == 401:
|
628
|
+
raise UnauthorizedError(
|
629
|
+
headers=dict(_response.headers),
|
630
|
+
body=typing.cast(
|
631
|
+
typing.Optional[typing.Any],
|
632
|
+
parse_obj_as(
|
633
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
634
|
+
object_=_response.json(),
|
635
|
+
),
|
636
|
+
),
|
637
|
+
)
|
638
|
+
_response_json = _response.json()
|
639
|
+
except JSONDecodeError:
|
640
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
641
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
642
|
+
|
643
|
+
async def update(
|
644
|
+
self, group_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
|
645
|
+
) -> AsyncHttpResponse[GroupResponse]:
|
646
|
+
"""
|
647
|
+
Rename a group
|
648
|
+
|
649
|
+
Parameters
|
650
|
+
----------
|
651
|
+
group_id : int
|
652
|
+
The groupId of the group to update.
|
653
|
+
|
654
|
+
new_name : str
|
655
|
+
The new name of the group being renamed.
|
656
|
+
|
657
|
+
request_options : typing.Optional[RequestOptions]
|
658
|
+
Request-specific configuration.
|
659
|
+
|
660
|
+
Returns
|
661
|
+
-------
|
662
|
+
AsyncHttpResponse[GroupResponse]
|
663
|
+
Successful update of group
|
664
|
+
"""
|
665
|
+
_response = await self._client_wrapper.httpx_client.request(
|
666
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
667
|
+
method="PUT",
|
668
|
+
json={
|
669
|
+
"newName": new_name,
|
670
|
+
},
|
671
|
+
headers={
|
672
|
+
"content-type": "application/json",
|
673
|
+
},
|
674
|
+
request_options=request_options,
|
675
|
+
omit=OMIT,
|
676
|
+
)
|
677
|
+
try:
|
678
|
+
if 200 <= _response.status_code < 300:
|
679
|
+
_data = typing.cast(
|
680
|
+
GroupResponse,
|
681
|
+
parse_obj_as(
|
682
|
+
type_=GroupResponse, # type: ignore
|
683
|
+
object_=_response.json(),
|
684
|
+
),
|
685
|
+
)
|
686
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
687
|
+
if _response.status_code == 400:
|
688
|
+
raise BadRequestError(
|
689
|
+
headers=dict(_response.headers),
|
690
|
+
body=typing.cast(
|
691
|
+
typing.Optional[typing.Any],
|
692
|
+
parse_obj_as(
|
693
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
694
|
+
object_=_response.json(),
|
695
|
+
),
|
696
|
+
),
|
697
|
+
)
|
698
|
+
if _response.status_code == 401:
|
699
|
+
raise UnauthorizedError(
|
700
|
+
headers=dict(_response.headers),
|
701
|
+
body=typing.cast(
|
702
|
+
typing.Optional[typing.Any],
|
703
|
+
parse_obj_as(
|
704
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
705
|
+
object_=_response.json(),
|
706
|
+
),
|
707
|
+
),
|
708
|
+
)
|
709
|
+
_response_json = _response.json()
|
710
|
+
except JSONDecodeError:
|
711
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
712
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
713
|
+
|
714
|
+
async def delete(
|
715
|
+
self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
716
|
+
) -> AsyncHttpResponse[MessageResponse]:
|
717
|
+
"""
|
718
|
+
Delete a group.
|
719
|
+
|
720
|
+
Parameters
|
721
|
+
----------
|
722
|
+
group_id : int
|
723
|
+
The groupId of the group to be deleted.
|
724
|
+
|
725
|
+
request_options : typing.Optional[RequestOptions]
|
726
|
+
Request-specific configuration.
|
727
|
+
|
728
|
+
Returns
|
729
|
+
-------
|
730
|
+
AsyncHttpResponse[MessageResponse]
|
731
|
+
Group successfully deleted
|
732
|
+
"""
|
733
|
+
_response = await self._client_wrapper.httpx_client.request(
|
734
|
+
f"v1/group/{jsonable_encoder(group_id)}",
|
735
|
+
method="DELETE",
|
736
|
+
request_options=request_options,
|
737
|
+
)
|
738
|
+
try:
|
739
|
+
if 200 <= _response.status_code < 300:
|
740
|
+
_data = typing.cast(
|
741
|
+
MessageResponse,
|
742
|
+
parse_obj_as(
|
743
|
+
type_=MessageResponse, # type: ignore
|
744
|
+
object_=_response.json(),
|
745
|
+
),
|
746
|
+
)
|
747
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
748
|
+
if _response.status_code == 400:
|
749
|
+
raise BadRequestError(
|
750
|
+
headers=dict(_response.headers),
|
751
|
+
body=typing.cast(
|
752
|
+
typing.Optional[typing.Any],
|
753
|
+
parse_obj_as(
|
754
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
755
|
+
object_=_response.json(),
|
756
|
+
),
|
757
|
+
),
|
758
|
+
)
|
759
|
+
if _response.status_code == 401:
|
760
|
+
raise UnauthorizedError(
|
761
|
+
headers=dict(_response.headers),
|
762
|
+
body=typing.cast(
|
763
|
+
typing.Optional[typing.Any],
|
764
|
+
parse_obj_as(
|
765
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
766
|
+
object_=_response.json(),
|
767
|
+
),
|
768
|
+
),
|
769
|
+
)
|
770
|
+
_response_json = _response.json()
|
771
|
+
except JSONDecodeError:
|
772
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
773
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
774
|
+
|
775
|
+
async def add_bucket(
|
776
|
+
self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
777
|
+
) -> AsyncHttpResponse[MessageResponse]:
|
778
|
+
"""
|
779
|
+
Add an existing bucket to an existing group. Buckets and groups can be associated many to many.
|
780
|
+
|
781
|
+
Parameters
|
782
|
+
----------
|
783
|
+
group_id : int
|
784
|
+
The groupId of the group which the bucket will be added to.
|
785
|
+
|
786
|
+
bucket_id : int
|
787
|
+
The bucketId of the bucket being added to the group.
|
788
|
+
|
789
|
+
request_options : typing.Optional[RequestOptions]
|
790
|
+
Request-specific configuration.
|
791
|
+
|
792
|
+
Returns
|
793
|
+
-------
|
794
|
+
AsyncHttpResponse[MessageResponse]
|
795
|
+
Successful update of group
|
796
|
+
"""
|
797
|
+
_response = await self._client_wrapper.httpx_client.request(
|
798
|
+
f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
|
799
|
+
method="POST",
|
800
|
+
request_options=request_options,
|
801
|
+
)
|
802
|
+
try:
|
803
|
+
if 200 <= _response.status_code < 300:
|
804
|
+
_data = typing.cast(
|
805
|
+
MessageResponse,
|
806
|
+
parse_obj_as(
|
807
|
+
type_=MessageResponse, # type: ignore
|
808
|
+
object_=_response.json(),
|
809
|
+
),
|
810
|
+
)
|
811
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
812
|
+
if _response.status_code == 400:
|
813
|
+
raise BadRequestError(
|
814
|
+
headers=dict(_response.headers),
|
815
|
+
body=typing.cast(
|
816
|
+
typing.Optional[typing.Any],
|
817
|
+
parse_obj_as(
|
818
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
819
|
+
object_=_response.json(),
|
820
|
+
),
|
821
|
+
),
|
822
|
+
)
|
823
|
+
if _response.status_code == 401:
|
824
|
+
raise UnauthorizedError(
|
825
|
+
headers=dict(_response.headers),
|
826
|
+
body=typing.cast(
|
827
|
+
typing.Optional[typing.Any],
|
828
|
+
parse_obj_as(
|
829
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
830
|
+
object_=_response.json(),
|
831
|
+
),
|
832
|
+
),
|
833
|
+
)
|
834
|
+
_response_json = _response.json()
|
835
|
+
except JSONDecodeError:
|
836
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
837
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
838
|
+
|
839
|
+
async def remove_bucket(
|
840
|
+
self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
|
841
|
+
) -> AsyncHttpResponse[MessageResponse]:
|
842
|
+
"""
|
843
|
+
remove a bucket from a group. Buckets and groups can be associated many to many, this removes one bucket to group association without disturbing others.
|
844
|
+
|
845
|
+
Parameters
|
846
|
+
----------
|
847
|
+
group_id : int
|
848
|
+
The groupId of the group which the bucket will be removed from.
|
849
|
+
|
850
|
+
bucket_id : int
|
851
|
+
The bucketId of the bucket which will be removed from the group.
|
852
|
+
|
853
|
+
request_options : typing.Optional[RequestOptions]
|
854
|
+
Request-specific configuration.
|
855
|
+
|
856
|
+
Returns
|
857
|
+
-------
|
858
|
+
AsyncHttpResponse[MessageResponse]
|
859
|
+
Successful update of group
|
860
|
+
"""
|
861
|
+
_response = await self._client_wrapper.httpx_client.request(
|
862
|
+
f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
|
863
|
+
method="DELETE",
|
864
|
+
request_options=request_options,
|
865
|
+
)
|
866
|
+
try:
|
867
|
+
if 200 <= _response.status_code < 300:
|
868
|
+
_data = typing.cast(
|
869
|
+
MessageResponse,
|
870
|
+
parse_obj_as(
|
871
|
+
type_=MessageResponse, # type: ignore
|
872
|
+
object_=_response.json(),
|
873
|
+
),
|
874
|
+
)
|
875
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
876
|
+
if _response.status_code == 400:
|
877
|
+
raise BadRequestError(
|
878
|
+
headers=dict(_response.headers),
|
879
|
+
body=typing.cast(
|
880
|
+
typing.Optional[typing.Any],
|
881
|
+
parse_obj_as(
|
882
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
883
|
+
object_=_response.json(),
|
884
|
+
),
|
885
|
+
),
|
886
|
+
)
|
887
|
+
if _response.status_code == 401:
|
888
|
+
raise UnauthorizedError(
|
889
|
+
headers=dict(_response.headers),
|
890
|
+
body=typing.cast(
|
891
|
+
typing.Optional[typing.Any],
|
892
|
+
parse_obj_as(
|
893
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
894
|
+
object_=_response.json(),
|
895
|
+
),
|
896
|
+
),
|
897
|
+
)
|
898
|
+
_response_json = _response.json()
|
899
|
+
except JSONDecodeError:
|
900
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
901
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|