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.
Files changed (80) hide show
  1. groundx/__init__.py +107 -0
  2. groundx/buckets/__init__.py +2 -0
  3. groundx/buckets/client.py +761 -0
  4. groundx/client.py +160 -0
  5. groundx/core/__init__.py +47 -0
  6. groundx/core/api_error.py +15 -0
  7. groundx/core/client_wrapper.py +54 -0
  8. groundx/core/datetime_utils.py +28 -0
  9. groundx/core/file.py +67 -0
  10. groundx/core/http_client.py +499 -0
  11. groundx/core/jsonable_encoder.py +101 -0
  12. groundx/core/pydantic_utilities.py +296 -0
  13. groundx/core/query_encoder.py +58 -0
  14. groundx/core/remove_none_from_dict.py +11 -0
  15. groundx/core/request_options.py +35 -0
  16. groundx/core/serialization.py +272 -0
  17. groundx/customer/__init__.py +2 -0
  18. groundx/customer/client.py +112 -0
  19. groundx/documents/__init__.py +5 -0
  20. groundx/documents/client.py +1544 -0
  21. groundx/documents/types/__init__.py +6 -0
  22. groundx/documents/types/document_remote_ingest_request_documents_item.py +45 -0
  23. groundx/documents/types/website_crawl_request_websites_item.py +46 -0
  24. groundx/environment.py +7 -0
  25. groundx/errors/__init__.py +6 -0
  26. groundx/errors/bad_request_error.py +9 -0
  27. groundx/errors/unauthorized_error.py +9 -0
  28. groundx/groups/__init__.py +2 -0
  29. groundx/groups/client.py +1098 -0
  30. groundx/health/__init__.py +2 -0
  31. groundx/health/client.py +236 -0
  32. groundx/py.typed +0 -0
  33. groundx/search/__init__.py +5 -0
  34. groundx/search/client.py +489 -0
  35. groundx/search/types/__init__.py +5 -0
  36. groundx/search/types/search_content_request_id.py +5 -0
  37. groundx/types/__init__.py +83 -0
  38. groundx/types/bounding_box_detail.py +54 -0
  39. groundx/types/bucket_detail.py +46 -0
  40. groundx/types/bucket_list_response.py +20 -0
  41. groundx/types/bucket_response.py +20 -0
  42. groundx/types/bucket_update_detail.py +22 -0
  43. groundx/types/bucket_update_response.py +20 -0
  44. groundx/types/customer_detail.py +39 -0
  45. groundx/types/customer_response.py +20 -0
  46. groundx/types/document_detail.py +62 -0
  47. groundx/types/document_list_response.py +23 -0
  48. groundx/types/document_lookup_response.py +32 -0
  49. groundx/types/document_response.py +20 -0
  50. groundx/types/document_type.py +7 -0
  51. groundx/types/group_detail.py +52 -0
  52. groundx/types/group_list_response.py +20 -0
  53. groundx/types/group_response.py +20 -0
  54. groundx/types/health_response.py +20 -0
  55. groundx/types/health_response_health.py +20 -0
  56. groundx/types/health_service.py +36 -0
  57. groundx/types/health_service_status.py +5 -0
  58. groundx/types/ingest_response.py +20 -0
  59. groundx/types/ingest_response_ingest.py +23 -0
  60. groundx/types/message_response.py +19 -0
  61. groundx/types/meter_detail.py +40 -0
  62. groundx/types/process_status_response.py +20 -0
  63. groundx/types/process_status_response_ingest.py +26 -0
  64. groundx/types/process_status_response_ingest_progress.py +26 -0
  65. groundx/types/process_status_response_ingest_progress_cancelled.py +21 -0
  66. groundx/types/process_status_response_ingest_progress_complete.py +21 -0
  67. groundx/types/process_status_response_ingest_progress_errors.py +21 -0
  68. groundx/types/process_status_response_ingest_progress_processing.py +21 -0
  69. groundx/types/processing_status.py +5 -0
  70. groundx/types/search_response.py +20 -0
  71. groundx/types/search_response_search.py +59 -0
  72. groundx/types/search_result_item.py +96 -0
  73. groundx/types/sort.py +5 -0
  74. groundx/types/sort_order.py +5 -0
  75. groundx/types/subscription_detail.py +24 -0
  76. groundx/types/subscription_detail_meters.py +23 -0
  77. groundx/version.py +3 -0
  78. groundx-2.0.11.dist-info/METADATA +177 -0
  79. groundx-2.0.11.dist-info/RECORD +80 -0
  80. groundx-2.0.11.dist-info/WHEEL +4 -0
@@ -0,0 +1,1098 @@
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.group_list_response import GroupListResponse
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.group_response import GroupResponse
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.message_response import MessageResponse
15
+ from ..core.client_wrapper import AsyncClientWrapper
16
+
17
+ # this is used as the default value for optional parameters
18
+ OMIT = typing.cast(typing.Any, ...)
19
+
20
+
21
+ class GroupsClient:
22
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
23
+ self._client_wrapper = client_wrapper
24
+
25
+ def list(
26
+ self,
27
+ *,
28
+ n: typing.Optional[int] = None,
29
+ next_token: typing.Optional[str] = None,
30
+ request_options: typing.Optional[RequestOptions] = None,
31
+ ) -> GroupListResponse:
32
+ """
33
+ list all groups within your GroundX account.
34
+
35
+ 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.
36
+
37
+ Parameters
38
+ ----------
39
+ n : typing.Optional[int]
40
+ The maximum number of returned groups. Accepts 1-100 with a default of 20.
41
+
42
+ next_token : typing.Optional[str]
43
+ 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.
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ GroupListResponse
51
+ Successful retrieval of groups
52
+
53
+ Examples
54
+ --------
55
+ from groundx import GroundX
56
+
57
+ client = GroundX(
58
+ api_key="YOUR_API_KEY",
59
+ )
60
+ client.groups.list()
61
+ """
62
+ _response = self._client_wrapper.httpx_client.request(
63
+ "v1/group",
64
+ method="GET",
65
+ params={
66
+ "n": n,
67
+ "nextToken": next_token,
68
+ },
69
+ request_options=request_options,
70
+ )
71
+ try:
72
+ if 200 <= _response.status_code < 300:
73
+ return typing.cast(
74
+ GroupListResponse,
75
+ parse_obj_as(
76
+ type_=GroupListResponse, # type: ignore
77
+ object_=_response.json(),
78
+ ),
79
+ )
80
+ _response_json = _response.json()
81
+ except JSONDecodeError:
82
+ raise ApiError(status_code=_response.status_code, body=_response.text)
83
+ raise ApiError(status_code=_response.status_code, body=_response_json)
84
+
85
+ def create(
86
+ self,
87
+ *,
88
+ name: str,
89
+ bucket_name: typing.Optional[str] = OMIT,
90
+ request_options: typing.Optional[RequestOptions] = None,
91
+ ) -> GroupResponse:
92
+ """
93
+ create a new group, a group being a collection of buckets which can be searched.
94
+
95
+ 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.
96
+
97
+ Parameters
98
+ ----------
99
+ name : str
100
+ The name of the group being created.
101
+
102
+ bucket_name : typing.Optional[str]
103
+ Specify bucketName to automatically create a bucket, by the name specified, and add it to the created group.
104
+
105
+ request_options : typing.Optional[RequestOptions]
106
+ Request-specific configuration.
107
+
108
+ Returns
109
+ -------
110
+ GroupResponse
111
+ Group successfully created
112
+
113
+ Examples
114
+ --------
115
+ from groundx import GroundX
116
+
117
+ client = GroundX(
118
+ api_key="YOUR_API_KEY",
119
+ )
120
+ client.groups.create(
121
+ name="your_group_name",
122
+ )
123
+ """
124
+ _response = self._client_wrapper.httpx_client.request(
125
+ "v1/group",
126
+ method="POST",
127
+ json={
128
+ "name": name,
129
+ "bucketName": bucket_name,
130
+ },
131
+ headers={
132
+ "content-type": "application/json",
133
+ },
134
+ request_options=request_options,
135
+ omit=OMIT,
136
+ )
137
+ try:
138
+ if 200 <= _response.status_code < 300:
139
+ return typing.cast(
140
+ GroupResponse,
141
+ parse_obj_as(
142
+ type_=GroupResponse, # type: ignore
143
+ object_=_response.json(),
144
+ ),
145
+ )
146
+ if _response.status_code == 400:
147
+ raise BadRequestError(
148
+ typing.cast(
149
+ typing.Optional[typing.Any],
150
+ parse_obj_as(
151
+ type_=typing.Optional[typing.Any], # type: ignore
152
+ object_=_response.json(),
153
+ ),
154
+ )
155
+ )
156
+ _response_json = _response.json()
157
+ except JSONDecodeError:
158
+ raise ApiError(status_code=_response.status_code, body=_response.text)
159
+ raise ApiError(status_code=_response.status_code, body=_response_json)
160
+
161
+ def get(self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GroupResponse:
162
+ """
163
+ look up a specific group by its groupId.
164
+
165
+ 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.
166
+
167
+ Parameters
168
+ ----------
169
+ group_id : int
170
+ The groupId of the group to look up.
171
+
172
+ request_options : typing.Optional[RequestOptions]
173
+ Request-specific configuration.
174
+
175
+ Returns
176
+ -------
177
+ GroupResponse
178
+ Successful retrieval of group
179
+
180
+ Examples
181
+ --------
182
+ from groundx import GroundX
183
+
184
+ client = GroundX(
185
+ api_key="YOUR_API_KEY",
186
+ )
187
+ client.groups.get(
188
+ group_id=1,
189
+ )
190
+ """
191
+ _response = self._client_wrapper.httpx_client.request(
192
+ f"v1/group/{jsonable_encoder(group_id)}",
193
+ method="GET",
194
+ request_options=request_options,
195
+ )
196
+ try:
197
+ if 200 <= _response.status_code < 300:
198
+ return typing.cast(
199
+ GroupResponse,
200
+ parse_obj_as(
201
+ type_=GroupResponse, # type: ignore
202
+ object_=_response.json(),
203
+ ),
204
+ )
205
+ if _response.status_code == 400:
206
+ raise BadRequestError(
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
+ if _response.status_code == 401:
216
+ raise UnauthorizedError(
217
+ typing.cast(
218
+ typing.Optional[typing.Any],
219
+ parse_obj_as(
220
+ type_=typing.Optional[typing.Any], # type: ignore
221
+ object_=_response.json(),
222
+ ),
223
+ )
224
+ )
225
+ _response_json = _response.json()
226
+ except JSONDecodeError:
227
+ raise ApiError(status_code=_response.status_code, body=_response.text)
228
+ raise ApiError(status_code=_response.status_code, body=_response_json)
229
+
230
+ def update(
231
+ self, group_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
232
+ ) -> GroupResponse:
233
+ """
234
+ Rename a group
235
+
236
+ 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.
237
+
238
+ Parameters
239
+ ----------
240
+ group_id : int
241
+ The groupId of the group to update.
242
+
243
+ new_name : str
244
+ The new name of the group being renamed.
245
+
246
+ request_options : typing.Optional[RequestOptions]
247
+ Request-specific configuration.
248
+
249
+ Returns
250
+ -------
251
+ GroupResponse
252
+ Successful update of group
253
+
254
+ Examples
255
+ --------
256
+ from groundx import GroundX
257
+
258
+ client = GroundX(
259
+ api_key="YOUR_API_KEY",
260
+ )
261
+ client.groups.update(
262
+ group_id=1,
263
+ new_name="your_group_name",
264
+ )
265
+ """
266
+ _response = self._client_wrapper.httpx_client.request(
267
+ f"v1/group/{jsonable_encoder(group_id)}",
268
+ method="PUT",
269
+ json={
270
+ "newName": new_name,
271
+ },
272
+ headers={
273
+ "content-type": "application/json",
274
+ },
275
+ request_options=request_options,
276
+ omit=OMIT,
277
+ )
278
+ try:
279
+ if 200 <= _response.status_code < 300:
280
+ return typing.cast(
281
+ GroupResponse,
282
+ parse_obj_as(
283
+ type_=GroupResponse, # type: ignore
284
+ object_=_response.json(),
285
+ ),
286
+ )
287
+ if _response.status_code == 400:
288
+ raise BadRequestError(
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
+ if _response.status_code == 401:
298
+ raise UnauthorizedError(
299
+ typing.cast(
300
+ typing.Optional[typing.Any],
301
+ parse_obj_as(
302
+ type_=typing.Optional[typing.Any], # type: ignore
303
+ object_=_response.json(),
304
+ ),
305
+ )
306
+ )
307
+ _response_json = _response.json()
308
+ except JSONDecodeError:
309
+ raise ApiError(status_code=_response.status_code, body=_response.text)
310
+ raise ApiError(status_code=_response.status_code, body=_response_json)
311
+
312
+ def delete(self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> MessageResponse:
313
+ """
314
+ Delete a group.
315
+
316
+ 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.
317
+
318
+ Parameters
319
+ ----------
320
+ group_id : int
321
+ The groupId of the group to be deleted.
322
+
323
+ request_options : typing.Optional[RequestOptions]
324
+ Request-specific configuration.
325
+
326
+ Returns
327
+ -------
328
+ MessageResponse
329
+ Group successfully deleted
330
+
331
+ Examples
332
+ --------
333
+ from groundx import GroundX
334
+
335
+ client = GroundX(
336
+ api_key="YOUR_API_KEY",
337
+ )
338
+ client.groups.delete(
339
+ group_id=1,
340
+ )
341
+ """
342
+ _response = self._client_wrapper.httpx_client.request(
343
+ f"v1/group/{jsonable_encoder(group_id)}",
344
+ method="DELETE",
345
+ request_options=request_options,
346
+ )
347
+ try:
348
+ if 200 <= _response.status_code < 300:
349
+ return typing.cast(
350
+ MessageResponse,
351
+ parse_obj_as(
352
+ type_=MessageResponse, # type: ignore
353
+ object_=_response.json(),
354
+ ),
355
+ )
356
+ if _response.status_code == 400:
357
+ raise BadRequestError(
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
+ if _response.status_code == 401:
367
+ raise UnauthorizedError(
368
+ typing.cast(
369
+ typing.Optional[typing.Any],
370
+ parse_obj_as(
371
+ type_=typing.Optional[typing.Any], # type: ignore
372
+ object_=_response.json(),
373
+ ),
374
+ )
375
+ )
376
+ _response_json = _response.json()
377
+ except JSONDecodeError:
378
+ raise ApiError(status_code=_response.status_code, body=_response.text)
379
+ raise ApiError(status_code=_response.status_code, body=_response_json)
380
+
381
+ def add_bucket(
382
+ self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
383
+ ) -> MessageResponse:
384
+ """
385
+ Add an existing bucket to an existing group. Buckets and groups can be associated many to many.
386
+
387
+ 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.
388
+
389
+ Parameters
390
+ ----------
391
+ group_id : int
392
+ The groupId of the group which the bucket will be added to.
393
+
394
+ bucket_id : int
395
+ The bucketId of the bucket being added to the group.
396
+
397
+ request_options : typing.Optional[RequestOptions]
398
+ Request-specific configuration.
399
+
400
+ Returns
401
+ -------
402
+ MessageResponse
403
+ Successful update of group
404
+
405
+ Examples
406
+ --------
407
+ from groundx import GroundX
408
+
409
+ client = GroundX(
410
+ api_key="YOUR_API_KEY",
411
+ )
412
+ client.groups.add_bucket(
413
+ group_id=1,
414
+ bucket_id=1,
415
+ )
416
+ """
417
+ _response = self._client_wrapper.httpx_client.request(
418
+ f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
419
+ method="POST",
420
+ request_options=request_options,
421
+ )
422
+ try:
423
+ if 200 <= _response.status_code < 300:
424
+ return typing.cast(
425
+ MessageResponse,
426
+ parse_obj_as(
427
+ type_=MessageResponse, # type: ignore
428
+ object_=_response.json(),
429
+ ),
430
+ )
431
+ if _response.status_code == 400:
432
+ raise BadRequestError(
433
+ typing.cast(
434
+ typing.Optional[typing.Any],
435
+ parse_obj_as(
436
+ type_=typing.Optional[typing.Any], # type: ignore
437
+ object_=_response.json(),
438
+ ),
439
+ )
440
+ )
441
+ if _response.status_code == 401:
442
+ raise UnauthorizedError(
443
+ typing.cast(
444
+ typing.Optional[typing.Any],
445
+ parse_obj_as(
446
+ type_=typing.Optional[typing.Any], # type: ignore
447
+ object_=_response.json(),
448
+ ),
449
+ )
450
+ )
451
+ _response_json = _response.json()
452
+ except JSONDecodeError:
453
+ raise ApiError(status_code=_response.status_code, body=_response.text)
454
+ raise ApiError(status_code=_response.status_code, body=_response_json)
455
+
456
+ def remove_bucket(
457
+ self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
458
+ ) -> MessageResponse:
459
+ """
460
+ 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.
461
+
462
+ 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.
463
+
464
+ Parameters
465
+ ----------
466
+ group_id : int
467
+ The groupId of the group which the bucket will be removed from.
468
+
469
+ bucket_id : int
470
+ The bucketId of the bucket which will be removed from the group.
471
+
472
+ request_options : typing.Optional[RequestOptions]
473
+ Request-specific configuration.
474
+
475
+ Returns
476
+ -------
477
+ MessageResponse
478
+ Successful update of group
479
+
480
+ Examples
481
+ --------
482
+ from groundx import GroundX
483
+
484
+ client = GroundX(
485
+ api_key="YOUR_API_KEY",
486
+ )
487
+ client.groups.remove_bucket(
488
+ group_id=1,
489
+ bucket_id=1,
490
+ )
491
+ """
492
+ _response = self._client_wrapper.httpx_client.request(
493
+ f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
494
+ method="DELETE",
495
+ request_options=request_options,
496
+ )
497
+ try:
498
+ if 200 <= _response.status_code < 300:
499
+ return typing.cast(
500
+ MessageResponse,
501
+ parse_obj_as(
502
+ type_=MessageResponse, # type: ignore
503
+ object_=_response.json(),
504
+ ),
505
+ )
506
+ if _response.status_code == 400:
507
+ raise BadRequestError(
508
+ typing.cast(
509
+ typing.Optional[typing.Any],
510
+ parse_obj_as(
511
+ type_=typing.Optional[typing.Any], # type: ignore
512
+ object_=_response.json(),
513
+ ),
514
+ )
515
+ )
516
+ if _response.status_code == 401:
517
+ raise UnauthorizedError(
518
+ typing.cast(
519
+ typing.Optional[typing.Any],
520
+ parse_obj_as(
521
+ type_=typing.Optional[typing.Any], # type: ignore
522
+ object_=_response.json(),
523
+ ),
524
+ )
525
+ )
526
+ _response_json = _response.json()
527
+ except JSONDecodeError:
528
+ raise ApiError(status_code=_response.status_code, body=_response.text)
529
+ raise ApiError(status_code=_response.status_code, body=_response_json)
530
+
531
+
532
+ class AsyncGroupsClient:
533
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
534
+ self._client_wrapper = client_wrapper
535
+
536
+ async def list(
537
+ self,
538
+ *,
539
+ n: typing.Optional[int] = None,
540
+ next_token: typing.Optional[str] = None,
541
+ request_options: typing.Optional[RequestOptions] = None,
542
+ ) -> GroupListResponse:
543
+ """
544
+ list all groups within your GroundX account.
545
+
546
+ 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.
547
+
548
+ Parameters
549
+ ----------
550
+ n : typing.Optional[int]
551
+ The maximum number of returned groups. Accepts 1-100 with a default of 20.
552
+
553
+ next_token : typing.Optional[str]
554
+ 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.
555
+
556
+ request_options : typing.Optional[RequestOptions]
557
+ Request-specific configuration.
558
+
559
+ Returns
560
+ -------
561
+ GroupListResponse
562
+ Successful retrieval of groups
563
+
564
+ Examples
565
+ --------
566
+ import asyncio
567
+
568
+ from groundx import AsyncGroundX
569
+
570
+ client = AsyncGroundX(
571
+ api_key="YOUR_API_KEY",
572
+ )
573
+
574
+
575
+ async def main() -> None:
576
+ await client.groups.list()
577
+
578
+
579
+ asyncio.run(main())
580
+ """
581
+ _response = await self._client_wrapper.httpx_client.request(
582
+ "v1/group",
583
+ method="GET",
584
+ params={
585
+ "n": n,
586
+ "nextToken": next_token,
587
+ },
588
+ request_options=request_options,
589
+ )
590
+ try:
591
+ if 200 <= _response.status_code < 300:
592
+ return typing.cast(
593
+ GroupListResponse,
594
+ parse_obj_as(
595
+ type_=GroupListResponse, # type: ignore
596
+ object_=_response.json(),
597
+ ),
598
+ )
599
+ _response_json = _response.json()
600
+ except JSONDecodeError:
601
+ raise ApiError(status_code=_response.status_code, body=_response.text)
602
+ raise ApiError(status_code=_response.status_code, body=_response_json)
603
+
604
+ async def create(
605
+ self,
606
+ *,
607
+ name: str,
608
+ bucket_name: typing.Optional[str] = OMIT,
609
+ request_options: typing.Optional[RequestOptions] = None,
610
+ ) -> GroupResponse:
611
+ """
612
+ create a new group, a group being a collection of buckets which can be searched.
613
+
614
+ 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.
615
+
616
+ Parameters
617
+ ----------
618
+ name : str
619
+ The name of the group being created.
620
+
621
+ bucket_name : typing.Optional[str]
622
+ Specify bucketName to automatically create a bucket, by the name specified, and add it to the created group.
623
+
624
+ request_options : typing.Optional[RequestOptions]
625
+ Request-specific configuration.
626
+
627
+ Returns
628
+ -------
629
+ GroupResponse
630
+ Group successfully created
631
+
632
+ Examples
633
+ --------
634
+ import asyncio
635
+
636
+ from groundx import AsyncGroundX
637
+
638
+ client = AsyncGroundX(
639
+ api_key="YOUR_API_KEY",
640
+ )
641
+
642
+
643
+ async def main() -> None:
644
+ await client.groups.create(
645
+ name="your_group_name",
646
+ )
647
+
648
+
649
+ asyncio.run(main())
650
+ """
651
+ _response = await self._client_wrapper.httpx_client.request(
652
+ "v1/group",
653
+ method="POST",
654
+ json={
655
+ "name": name,
656
+ "bucketName": bucket_name,
657
+ },
658
+ headers={
659
+ "content-type": "application/json",
660
+ },
661
+ request_options=request_options,
662
+ omit=OMIT,
663
+ )
664
+ try:
665
+ if 200 <= _response.status_code < 300:
666
+ return typing.cast(
667
+ GroupResponse,
668
+ parse_obj_as(
669
+ type_=GroupResponse, # type: ignore
670
+ object_=_response.json(),
671
+ ),
672
+ )
673
+ if _response.status_code == 400:
674
+ raise BadRequestError(
675
+ typing.cast(
676
+ typing.Optional[typing.Any],
677
+ parse_obj_as(
678
+ type_=typing.Optional[typing.Any], # type: ignore
679
+ object_=_response.json(),
680
+ ),
681
+ )
682
+ )
683
+ _response_json = _response.json()
684
+ except JSONDecodeError:
685
+ raise ApiError(status_code=_response.status_code, body=_response.text)
686
+ raise ApiError(status_code=_response.status_code, body=_response_json)
687
+
688
+ async def get(self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GroupResponse:
689
+ """
690
+ look up a specific group by its groupId.
691
+
692
+ 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.
693
+
694
+ Parameters
695
+ ----------
696
+ group_id : int
697
+ The groupId of the group to look up.
698
+
699
+ request_options : typing.Optional[RequestOptions]
700
+ Request-specific configuration.
701
+
702
+ Returns
703
+ -------
704
+ GroupResponse
705
+ Successful retrieval of group
706
+
707
+ Examples
708
+ --------
709
+ import asyncio
710
+
711
+ from groundx import AsyncGroundX
712
+
713
+ client = AsyncGroundX(
714
+ api_key="YOUR_API_KEY",
715
+ )
716
+
717
+
718
+ async def main() -> None:
719
+ await client.groups.get(
720
+ group_id=1,
721
+ )
722
+
723
+
724
+ asyncio.run(main())
725
+ """
726
+ _response = await self._client_wrapper.httpx_client.request(
727
+ f"v1/group/{jsonable_encoder(group_id)}",
728
+ method="GET",
729
+ request_options=request_options,
730
+ )
731
+ try:
732
+ if 200 <= _response.status_code < 300:
733
+ return typing.cast(
734
+ GroupResponse,
735
+ parse_obj_as(
736
+ type_=GroupResponse, # type: ignore
737
+ object_=_response.json(),
738
+ ),
739
+ )
740
+ if _response.status_code == 400:
741
+ raise BadRequestError(
742
+ typing.cast(
743
+ typing.Optional[typing.Any],
744
+ parse_obj_as(
745
+ type_=typing.Optional[typing.Any], # type: ignore
746
+ object_=_response.json(),
747
+ ),
748
+ )
749
+ )
750
+ if _response.status_code == 401:
751
+ raise UnauthorizedError(
752
+ typing.cast(
753
+ typing.Optional[typing.Any],
754
+ parse_obj_as(
755
+ type_=typing.Optional[typing.Any], # type: ignore
756
+ object_=_response.json(),
757
+ ),
758
+ )
759
+ )
760
+ _response_json = _response.json()
761
+ except JSONDecodeError:
762
+ raise ApiError(status_code=_response.status_code, body=_response.text)
763
+ raise ApiError(status_code=_response.status_code, body=_response_json)
764
+
765
+ async def update(
766
+ self, group_id: int, *, new_name: str, request_options: typing.Optional[RequestOptions] = None
767
+ ) -> GroupResponse:
768
+ """
769
+ Rename a group
770
+
771
+ 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.
772
+
773
+ Parameters
774
+ ----------
775
+ group_id : int
776
+ The groupId of the group to update.
777
+
778
+ new_name : str
779
+ The new name of the group being renamed.
780
+
781
+ request_options : typing.Optional[RequestOptions]
782
+ Request-specific configuration.
783
+
784
+ Returns
785
+ -------
786
+ GroupResponse
787
+ Successful update of group
788
+
789
+ Examples
790
+ --------
791
+ import asyncio
792
+
793
+ from groundx import AsyncGroundX
794
+
795
+ client = AsyncGroundX(
796
+ api_key="YOUR_API_KEY",
797
+ )
798
+
799
+
800
+ async def main() -> None:
801
+ await client.groups.update(
802
+ group_id=1,
803
+ new_name="your_group_name",
804
+ )
805
+
806
+
807
+ asyncio.run(main())
808
+ """
809
+ _response = await self._client_wrapper.httpx_client.request(
810
+ f"v1/group/{jsonable_encoder(group_id)}",
811
+ method="PUT",
812
+ json={
813
+ "newName": new_name,
814
+ },
815
+ headers={
816
+ "content-type": "application/json",
817
+ },
818
+ request_options=request_options,
819
+ omit=OMIT,
820
+ )
821
+ try:
822
+ if 200 <= _response.status_code < 300:
823
+ return typing.cast(
824
+ GroupResponse,
825
+ parse_obj_as(
826
+ type_=GroupResponse, # type: ignore
827
+ object_=_response.json(),
828
+ ),
829
+ )
830
+ if _response.status_code == 400:
831
+ raise BadRequestError(
832
+ typing.cast(
833
+ typing.Optional[typing.Any],
834
+ parse_obj_as(
835
+ type_=typing.Optional[typing.Any], # type: ignore
836
+ object_=_response.json(),
837
+ ),
838
+ )
839
+ )
840
+ if _response.status_code == 401:
841
+ raise UnauthorizedError(
842
+ typing.cast(
843
+ typing.Optional[typing.Any],
844
+ parse_obj_as(
845
+ type_=typing.Optional[typing.Any], # type: ignore
846
+ object_=_response.json(),
847
+ ),
848
+ )
849
+ )
850
+ _response_json = _response.json()
851
+ except JSONDecodeError:
852
+ raise ApiError(status_code=_response.status_code, body=_response.text)
853
+ raise ApiError(status_code=_response.status_code, body=_response_json)
854
+
855
+ async def delete(
856
+ self, group_id: int, *, request_options: typing.Optional[RequestOptions] = None
857
+ ) -> MessageResponse:
858
+ """
859
+ Delete a group.
860
+
861
+ 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.
862
+
863
+ Parameters
864
+ ----------
865
+ group_id : int
866
+ The groupId of the group to be deleted.
867
+
868
+ request_options : typing.Optional[RequestOptions]
869
+ Request-specific configuration.
870
+
871
+ Returns
872
+ -------
873
+ MessageResponse
874
+ Group successfully deleted
875
+
876
+ Examples
877
+ --------
878
+ import asyncio
879
+
880
+ from groundx import AsyncGroundX
881
+
882
+ client = AsyncGroundX(
883
+ api_key="YOUR_API_KEY",
884
+ )
885
+
886
+
887
+ async def main() -> None:
888
+ await client.groups.delete(
889
+ group_id=1,
890
+ )
891
+
892
+
893
+ asyncio.run(main())
894
+ """
895
+ _response = await self._client_wrapper.httpx_client.request(
896
+ f"v1/group/{jsonable_encoder(group_id)}",
897
+ method="DELETE",
898
+ request_options=request_options,
899
+ )
900
+ try:
901
+ if 200 <= _response.status_code < 300:
902
+ return typing.cast(
903
+ MessageResponse,
904
+ parse_obj_as(
905
+ type_=MessageResponse, # type: ignore
906
+ object_=_response.json(),
907
+ ),
908
+ )
909
+ if _response.status_code == 400:
910
+ raise BadRequestError(
911
+ typing.cast(
912
+ typing.Optional[typing.Any],
913
+ parse_obj_as(
914
+ type_=typing.Optional[typing.Any], # type: ignore
915
+ object_=_response.json(),
916
+ ),
917
+ )
918
+ )
919
+ if _response.status_code == 401:
920
+ raise UnauthorizedError(
921
+ typing.cast(
922
+ typing.Optional[typing.Any],
923
+ parse_obj_as(
924
+ type_=typing.Optional[typing.Any], # type: ignore
925
+ object_=_response.json(),
926
+ ),
927
+ )
928
+ )
929
+ _response_json = _response.json()
930
+ except JSONDecodeError:
931
+ raise ApiError(status_code=_response.status_code, body=_response.text)
932
+ raise ApiError(status_code=_response.status_code, body=_response_json)
933
+
934
+ async def add_bucket(
935
+ self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
936
+ ) -> MessageResponse:
937
+ """
938
+ Add an existing bucket to an existing group. Buckets and groups can be associated many to many.
939
+
940
+ 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.
941
+
942
+ Parameters
943
+ ----------
944
+ group_id : int
945
+ The groupId of the group which the bucket will be added to.
946
+
947
+ bucket_id : int
948
+ The bucketId of the bucket being added to the group.
949
+
950
+ request_options : typing.Optional[RequestOptions]
951
+ Request-specific configuration.
952
+
953
+ Returns
954
+ -------
955
+ MessageResponse
956
+ Successful update of group
957
+
958
+ Examples
959
+ --------
960
+ import asyncio
961
+
962
+ from groundx import AsyncGroundX
963
+
964
+ client = AsyncGroundX(
965
+ api_key="YOUR_API_KEY",
966
+ )
967
+
968
+
969
+ async def main() -> None:
970
+ await client.groups.add_bucket(
971
+ group_id=1,
972
+ bucket_id=1,
973
+ )
974
+
975
+
976
+ asyncio.run(main())
977
+ """
978
+ _response = await self._client_wrapper.httpx_client.request(
979
+ f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
980
+ method="POST",
981
+ request_options=request_options,
982
+ )
983
+ try:
984
+ if 200 <= _response.status_code < 300:
985
+ return typing.cast(
986
+ MessageResponse,
987
+ parse_obj_as(
988
+ type_=MessageResponse, # type: ignore
989
+ object_=_response.json(),
990
+ ),
991
+ )
992
+ if _response.status_code == 400:
993
+ raise BadRequestError(
994
+ typing.cast(
995
+ typing.Optional[typing.Any],
996
+ parse_obj_as(
997
+ type_=typing.Optional[typing.Any], # type: ignore
998
+ object_=_response.json(),
999
+ ),
1000
+ )
1001
+ )
1002
+ if _response.status_code == 401:
1003
+ raise UnauthorizedError(
1004
+ typing.cast(
1005
+ typing.Optional[typing.Any],
1006
+ parse_obj_as(
1007
+ type_=typing.Optional[typing.Any], # type: ignore
1008
+ object_=_response.json(),
1009
+ ),
1010
+ )
1011
+ )
1012
+ _response_json = _response.json()
1013
+ except JSONDecodeError:
1014
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1015
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1016
+
1017
+ async def remove_bucket(
1018
+ self, group_id: int, bucket_id: int, *, request_options: typing.Optional[RequestOptions] = None
1019
+ ) -> MessageResponse:
1020
+ """
1021
+ 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.
1022
+
1023
+ 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.
1024
+
1025
+ Parameters
1026
+ ----------
1027
+ group_id : int
1028
+ The groupId of the group which the bucket will be removed from.
1029
+
1030
+ bucket_id : int
1031
+ The bucketId of the bucket which will be removed from the group.
1032
+
1033
+ request_options : typing.Optional[RequestOptions]
1034
+ Request-specific configuration.
1035
+
1036
+ Returns
1037
+ -------
1038
+ MessageResponse
1039
+ Successful update of group
1040
+
1041
+ Examples
1042
+ --------
1043
+ import asyncio
1044
+
1045
+ from groundx import AsyncGroundX
1046
+
1047
+ client = AsyncGroundX(
1048
+ api_key="YOUR_API_KEY",
1049
+ )
1050
+
1051
+
1052
+ async def main() -> None:
1053
+ await client.groups.remove_bucket(
1054
+ group_id=1,
1055
+ bucket_id=1,
1056
+ )
1057
+
1058
+
1059
+ asyncio.run(main())
1060
+ """
1061
+ _response = await self._client_wrapper.httpx_client.request(
1062
+ f"v1/group/{jsonable_encoder(group_id)}/bucket/{jsonable_encoder(bucket_id)}",
1063
+ method="DELETE",
1064
+ request_options=request_options,
1065
+ )
1066
+ try:
1067
+ if 200 <= _response.status_code < 300:
1068
+ return typing.cast(
1069
+ MessageResponse,
1070
+ parse_obj_as(
1071
+ type_=MessageResponse, # type: ignore
1072
+ object_=_response.json(),
1073
+ ),
1074
+ )
1075
+ if _response.status_code == 400:
1076
+ raise BadRequestError(
1077
+ typing.cast(
1078
+ typing.Optional[typing.Any],
1079
+ parse_obj_as(
1080
+ type_=typing.Optional[typing.Any], # type: ignore
1081
+ object_=_response.json(),
1082
+ ),
1083
+ )
1084
+ )
1085
+ if _response.status_code == 401:
1086
+ raise UnauthorizedError(
1087
+ typing.cast(
1088
+ typing.Optional[typing.Any],
1089
+ parse_obj_as(
1090
+ type_=typing.Optional[typing.Any], # type: ignore
1091
+ object_=_response.json(),
1092
+ ),
1093
+ )
1094
+ )
1095
+ _response_json = _response.json()
1096
+ except JSONDecodeError:
1097
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1098
+ raise ApiError(status_code=_response.status_code, body=_response_json)