label-studio-sdk 2.0.5__py3-none-any.whl → 2.0.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.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

Files changed (72) hide show
  1. label_studio_sdk/__init__.py +52 -0
  2. label_studio_sdk/annotation_history/__init__.py +5 -0
  3. label_studio_sdk/annotation_history/client.py +415 -0
  4. label_studio_sdk/annotation_history/types/__init__.py +5 -0
  5. label_studio_sdk/annotation_history/types/annotation_history_delete_response.py +22 -0
  6. label_studio_sdk/annotation_reviews/__init__.py +2 -0
  7. label_studio_sdk/annotation_reviews/client.py +713 -0
  8. label_studio_sdk/base_client.py +16 -0
  9. label_studio_sdk/blueprints/__init__.py +2 -0
  10. label_studio_sdk/blueprints/client.py +272 -0
  11. label_studio_sdk/core/client_wrapper.py +2 -1
  12. label_studio_sdk/export_storage/__init__.py +2 -2
  13. label_studio_sdk/export_storage/azure_spi/__init__.py +2 -0
  14. label_studio_sdk/export_storage/azure_spi/client.py +1354 -0
  15. label_studio_sdk/export_storage/client.py +8 -0
  16. label_studio_sdk/export_storage/gcswif/__init__.py +2 -0
  17. label_studio_sdk/export_storage/gcswif/client.py +1376 -0
  18. label_studio_sdk/import_storage/__init__.py +2 -2
  19. label_studio_sdk/import_storage/azure_spi/__init__.py +2 -0
  20. label_studio_sdk/import_storage/azure_spi/client.py +1378 -0
  21. label_studio_sdk/import_storage/client.py +8 -0
  22. label_studio_sdk/import_storage/gcswif/__init__.py +2 -0
  23. label_studio_sdk/import_storage/gcswif/client.py +1400 -0
  24. label_studio_sdk/jwt_settings/client.py +10 -8
  25. label_studio_sdk/projects/client.py +8 -0
  26. label_studio_sdk/projects/members/__init__.py +2 -2
  27. label_studio_sdk/projects/members/bulk/client.py +46 -2
  28. label_studio_sdk/projects/members/client.py +4 -0
  29. label_studio_sdk/projects/members/paginated/__init__.py +2 -0
  30. label_studio_sdk/projects/members/paginated/client.py +248 -0
  31. label_studio_sdk/session_policy/__init__.py +2 -0
  32. label_studio_sdk/session_policy/client.py +247 -0
  33. label_studio_sdk/tasks/client.py +371 -0
  34. label_studio_sdk/types/__init__.py +42 -0
  35. label_studio_sdk/types/action_enum.py +19 -0
  36. label_studio_sdk/types/all_roles_project_list.py +1 -1
  37. label_studio_sdk/types/annotation.py +7 -0
  38. label_studio_sdk/types/annotation_history.py +81 -0
  39. label_studio_sdk/types/annotation_history_action.py +7 -0
  40. label_studio_sdk/types/annotation_request.py +7 -0
  41. label_studio_sdk/types/annotation_review.py +61 -0
  42. label_studio_sdk/types/annotation_review_request.py +41 -0
  43. label_studio_sdk/types/azure_service_principal_export_storage.py +114 -0
  44. label_studio_sdk/types/azure_service_principal_export_storage_request.py +107 -0
  45. label_studio_sdk/types/azure_service_principal_import_storage.py +115 -0
  46. label_studio_sdk/types/azure_service_principal_import_storage_request.py +108 -0
  47. label_studio_sdk/types/blueprint.py +41 -0
  48. label_studio_sdk/types/gcswif_export_storage.py +119 -0
  49. label_studio_sdk/types/gcswif_export_storage_request.py +112 -0
  50. label_studio_sdk/types/gcswif_import_storage.py +120 -0
  51. label_studio_sdk/types/gcswif_import_storage_request.py +113 -0
  52. label_studio_sdk/types/lse_project_update.py +1 -0
  53. label_studio_sdk/types/lse_task.py +1 -0
  54. label_studio_sdk/types/lse_task_serializer_for_reviewers.py +1 -0
  55. label_studio_sdk/types/lsejwt_settings.py +1 -5
  56. label_studio_sdk/types/paginated_annotation_history_list.py +23 -0
  57. label_studio_sdk/types/paginated_lse_user_list.py +23 -0
  58. label_studio_sdk/types/paginated_paginated_project_member_list.py +23 -0
  59. label_studio_sdk/types/paginated_project_member.py +50 -0
  60. label_studio_sdk/types/project_member_bulk_assign_roles_request.py +21 -0
  61. label_studio_sdk/types/review_settings.py +5 -0
  62. label_studio_sdk/types/review_settings_request.py +5 -0
  63. label_studio_sdk/types/session_timeout_policy.py +31 -0
  64. label_studio_sdk/types/task_event.py +61 -0
  65. label_studio_sdk/workspaces/members/__init__.py +2 -2
  66. label_studio_sdk/workspaces/members/client.py +4 -0
  67. label_studio_sdk/workspaces/members/paginated/__init__.py +2 -0
  68. label_studio_sdk/workspaces/members/paginated/client.py +212 -0
  69. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/METADATA +2 -2
  70. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/RECORD +72 -29
  71. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/LICENSE +0 -0
  72. {label_studio_sdk-2.0.5.dist-info → label_studio_sdk-2.0.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1376 @@
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.gcswif_export_storage import GcswifExportStorage
7
+ from ...core.unchecked_base_model import construct_type
8
+ from json.decoder import JSONDecodeError
9
+ from ...core.api_error import ApiError
10
+ import datetime as dt
11
+ from ...types.status_c5a_enum import StatusC5AEnum
12
+ from ...core.jsonable_encoder import jsonable_encoder
13
+ from ...core.client_wrapper import AsyncClientWrapper
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class GcswifClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def list(
24
+ self,
25
+ *,
26
+ ordering: typing.Optional[str] = None,
27
+ project: typing.Optional[int] = None,
28
+ request_options: typing.Optional[RequestOptions] = None,
29
+ ) -> typing.List[GcswifExportStorage]:
30
+ """
31
+ Get a list of all GCS export storage connections that were set up with WIF authentication.
32
+
33
+ Parameters
34
+ ----------
35
+ ordering : typing.Optional[str]
36
+ Which field to use when ordering the results.
37
+
38
+ project : typing.Optional[int]
39
+ Project ID
40
+
41
+ request_options : typing.Optional[RequestOptions]
42
+ Request-specific configuration.
43
+
44
+ Returns
45
+ -------
46
+ typing.List[GcswifExportStorage]
47
+
48
+
49
+ Examples
50
+ --------
51
+ from label_studio_sdk import LabelStudio
52
+
53
+ client = LabelStudio(
54
+ api_key="YOUR_API_KEY",
55
+ )
56
+ client.export_storage.gcswif.list()
57
+ """
58
+ _response = self._client_wrapper.httpx_client.request(
59
+ "api/storages/export/gcswif",
60
+ method="GET",
61
+ params={
62
+ "ordering": ordering,
63
+ "project": project,
64
+ },
65
+ request_options=request_options,
66
+ )
67
+ try:
68
+ if 200 <= _response.status_code < 300:
69
+ return typing.cast(
70
+ typing.List[GcswifExportStorage],
71
+ construct_type(
72
+ type_=typing.List[GcswifExportStorage], # type: ignore
73
+ object_=_response.json(),
74
+ ),
75
+ )
76
+ _response_json = _response.json()
77
+ except JSONDecodeError:
78
+ raise ApiError(status_code=_response.status_code, body=_response.text)
79
+ raise ApiError(status_code=_response.status_code, body=_response_json)
80
+
81
+ def create(
82
+ self,
83
+ *,
84
+ project: int,
85
+ bucket: typing.Optional[str] = OMIT,
86
+ can_delete_objects: typing.Optional[bool] = OMIT,
87
+ description: typing.Optional[str] = OMIT,
88
+ google_application_credentials: typing.Optional[str] = OMIT,
89
+ google_project_id: typing.Optional[str] = OMIT,
90
+ google_project_number: typing.Optional[str] = OMIT,
91
+ google_service_account_email: typing.Optional[str] = OMIT,
92
+ google_wif_pool_id: typing.Optional[str] = OMIT,
93
+ google_wif_provider_id: typing.Optional[str] = OMIT,
94
+ last_sync: typing.Optional[dt.datetime] = OMIT,
95
+ last_sync_count: typing.Optional[int] = OMIT,
96
+ last_sync_job: typing.Optional[str] = OMIT,
97
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
98
+ prefix: typing.Optional[str] = OMIT,
99
+ regex_filter: typing.Optional[str] = OMIT,
100
+ status: typing.Optional[StatusC5AEnum] = OMIT,
101
+ synchronizable: typing.Optional[bool] = OMIT,
102
+ title: typing.Optional[str] = OMIT,
103
+ traceback: typing.Optional[str] = OMIT,
104
+ use_blob_urls: typing.Optional[bool] = OMIT,
105
+ request_options: typing.Optional[RequestOptions] = None,
106
+ ) -> GcswifExportStorage:
107
+ """
108
+ Create an GCS export storage connection with WIF authentication to store annotations.
109
+
110
+ Parameters
111
+ ----------
112
+ project : int
113
+ A unique integer value identifying this project.
114
+
115
+ bucket : typing.Optional[str]
116
+ GCS bucket name
117
+
118
+ can_delete_objects : typing.Optional[bool]
119
+ Deletion from storage enabled
120
+
121
+ description : typing.Optional[str]
122
+ Cloud storage description
123
+
124
+ google_application_credentials : typing.Optional[str]
125
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
126
+
127
+ google_project_id : typing.Optional[str]
128
+ Google project ID
129
+
130
+ google_project_number : typing.Optional[str]
131
+ Google project number
132
+
133
+ google_service_account_email : typing.Optional[str]
134
+ Google service account email
135
+
136
+ google_wif_pool_id : typing.Optional[str]
137
+ Google WIF pool ID
138
+
139
+ google_wif_provider_id : typing.Optional[str]
140
+ Google WIF provider ID
141
+
142
+ last_sync : typing.Optional[dt.datetime]
143
+ Last sync finished time
144
+
145
+ last_sync_count : typing.Optional[int]
146
+ Count of tasks synced last time
147
+
148
+ last_sync_job : typing.Optional[str]
149
+ Last sync job ID
150
+
151
+ meta : typing.Optional[typing.Optional[typing.Any]]
152
+
153
+ prefix : typing.Optional[str]
154
+ GCS bucket prefix
155
+
156
+ regex_filter : typing.Optional[str]
157
+ Cloud storage regex for filtering objects
158
+
159
+ status : typing.Optional[StatusC5AEnum]
160
+
161
+ synchronizable : typing.Optional[bool]
162
+
163
+ title : typing.Optional[str]
164
+ Cloud storage title
165
+
166
+ traceback : typing.Optional[str]
167
+ Traceback report for the last failed sync
168
+
169
+ use_blob_urls : typing.Optional[bool]
170
+ Interpret objects as BLOBs and generate URLs
171
+
172
+ request_options : typing.Optional[RequestOptions]
173
+ Request-specific configuration.
174
+
175
+ Returns
176
+ -------
177
+ GcswifExportStorage
178
+
179
+
180
+ Examples
181
+ --------
182
+ from label_studio_sdk import LabelStudio
183
+
184
+ client = LabelStudio(
185
+ api_key="YOUR_API_KEY",
186
+ )
187
+ client.export_storage.gcswif.create(
188
+ project=1,
189
+ )
190
+ """
191
+ _response = self._client_wrapper.httpx_client.request(
192
+ "api/storages/export/gcswif",
193
+ method="POST",
194
+ json={
195
+ "bucket": bucket,
196
+ "can_delete_objects": can_delete_objects,
197
+ "description": description,
198
+ "google_application_credentials": google_application_credentials,
199
+ "google_project_id": google_project_id,
200
+ "google_project_number": google_project_number,
201
+ "google_service_account_email": google_service_account_email,
202
+ "google_wif_pool_id": google_wif_pool_id,
203
+ "google_wif_provider_id": google_wif_provider_id,
204
+ "last_sync": last_sync,
205
+ "last_sync_count": last_sync_count,
206
+ "last_sync_job": last_sync_job,
207
+ "meta": meta,
208
+ "prefix": prefix,
209
+ "project": project,
210
+ "regex_filter": regex_filter,
211
+ "status": status,
212
+ "synchronizable": synchronizable,
213
+ "title": title,
214
+ "traceback": traceback,
215
+ "use_blob_urls": use_blob_urls,
216
+ },
217
+ request_options=request_options,
218
+ omit=OMIT,
219
+ )
220
+ try:
221
+ if 200 <= _response.status_code < 300:
222
+ return typing.cast(
223
+ GcswifExportStorage,
224
+ construct_type(
225
+ type_=GcswifExportStorage, # type: ignore
226
+ object_=_response.json(),
227
+ ),
228
+ )
229
+ _response_json = _response.json()
230
+ except JSONDecodeError:
231
+ raise ApiError(status_code=_response.status_code, body=_response.text)
232
+ raise ApiError(status_code=_response.status_code, body=_response_json)
233
+
234
+ def validate(
235
+ self,
236
+ *,
237
+ project: int,
238
+ bucket: typing.Optional[str] = OMIT,
239
+ can_delete_objects: typing.Optional[bool] = OMIT,
240
+ description: typing.Optional[str] = OMIT,
241
+ google_application_credentials: typing.Optional[str] = OMIT,
242
+ google_project_id: typing.Optional[str] = OMIT,
243
+ google_project_number: typing.Optional[str] = OMIT,
244
+ google_service_account_email: typing.Optional[str] = OMIT,
245
+ google_wif_pool_id: typing.Optional[str] = OMIT,
246
+ google_wif_provider_id: typing.Optional[str] = OMIT,
247
+ last_sync: typing.Optional[dt.datetime] = OMIT,
248
+ last_sync_count: typing.Optional[int] = OMIT,
249
+ last_sync_job: typing.Optional[str] = OMIT,
250
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
251
+ prefix: typing.Optional[str] = OMIT,
252
+ regex_filter: typing.Optional[str] = OMIT,
253
+ status: typing.Optional[StatusC5AEnum] = OMIT,
254
+ synchronizable: typing.Optional[bool] = OMIT,
255
+ title: typing.Optional[str] = OMIT,
256
+ traceback: typing.Optional[str] = OMIT,
257
+ use_blob_urls: typing.Optional[bool] = OMIT,
258
+ request_options: typing.Optional[RequestOptions] = None,
259
+ ) -> None:
260
+ """
261
+ Validate a specific GCS export storage connection that was set up with WIF authentication.
262
+
263
+ Parameters
264
+ ----------
265
+ project : int
266
+ A unique integer value identifying this project.
267
+
268
+ bucket : typing.Optional[str]
269
+ GCS bucket name
270
+
271
+ can_delete_objects : typing.Optional[bool]
272
+ Deletion from storage enabled
273
+
274
+ description : typing.Optional[str]
275
+ Cloud storage description
276
+
277
+ google_application_credentials : typing.Optional[str]
278
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
279
+
280
+ google_project_id : typing.Optional[str]
281
+ Google project ID
282
+
283
+ google_project_number : typing.Optional[str]
284
+ Google project number
285
+
286
+ google_service_account_email : typing.Optional[str]
287
+ Google service account email
288
+
289
+ google_wif_pool_id : typing.Optional[str]
290
+ Google WIF pool ID
291
+
292
+ google_wif_provider_id : typing.Optional[str]
293
+ Google WIF provider ID
294
+
295
+ last_sync : typing.Optional[dt.datetime]
296
+ Last sync finished time
297
+
298
+ last_sync_count : typing.Optional[int]
299
+ Count of tasks synced last time
300
+
301
+ last_sync_job : typing.Optional[str]
302
+ Last sync job ID
303
+
304
+ meta : typing.Optional[typing.Optional[typing.Any]]
305
+
306
+ prefix : typing.Optional[str]
307
+ GCS bucket prefix
308
+
309
+ regex_filter : typing.Optional[str]
310
+ Cloud storage regex for filtering objects
311
+
312
+ status : typing.Optional[StatusC5AEnum]
313
+
314
+ synchronizable : typing.Optional[bool]
315
+
316
+ title : typing.Optional[str]
317
+ Cloud storage title
318
+
319
+ traceback : typing.Optional[str]
320
+ Traceback report for the last failed sync
321
+
322
+ use_blob_urls : typing.Optional[bool]
323
+ Interpret objects as BLOBs and generate URLs
324
+
325
+ request_options : typing.Optional[RequestOptions]
326
+ Request-specific configuration.
327
+
328
+ Returns
329
+ -------
330
+ None
331
+
332
+ Examples
333
+ --------
334
+ from label_studio_sdk import LabelStudio
335
+
336
+ client = LabelStudio(
337
+ api_key="YOUR_API_KEY",
338
+ )
339
+ client.export_storage.gcswif.validate(
340
+ project=1,
341
+ )
342
+ """
343
+ _response = self._client_wrapper.httpx_client.request(
344
+ "api/storages/export/gcswif/validate",
345
+ method="POST",
346
+ json={
347
+ "bucket": bucket,
348
+ "can_delete_objects": can_delete_objects,
349
+ "description": description,
350
+ "google_application_credentials": google_application_credentials,
351
+ "google_project_id": google_project_id,
352
+ "google_project_number": google_project_number,
353
+ "google_service_account_email": google_service_account_email,
354
+ "google_wif_pool_id": google_wif_pool_id,
355
+ "google_wif_provider_id": google_wif_provider_id,
356
+ "last_sync": last_sync,
357
+ "last_sync_count": last_sync_count,
358
+ "last_sync_job": last_sync_job,
359
+ "meta": meta,
360
+ "prefix": prefix,
361
+ "project": project,
362
+ "regex_filter": regex_filter,
363
+ "status": status,
364
+ "synchronizable": synchronizable,
365
+ "title": title,
366
+ "traceback": traceback,
367
+ "use_blob_urls": use_blob_urls,
368
+ },
369
+ request_options=request_options,
370
+ omit=OMIT,
371
+ )
372
+ try:
373
+ if 200 <= _response.status_code < 300:
374
+ return
375
+ _response_json = _response.json()
376
+ except JSONDecodeError:
377
+ raise ApiError(status_code=_response.status_code, body=_response.text)
378
+ raise ApiError(status_code=_response.status_code, body=_response_json)
379
+
380
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcswifExportStorage:
381
+ """
382
+ Get a specific GCS export storage connection that was set up with WIF authentication.
383
+
384
+ Parameters
385
+ ----------
386
+ id : int
387
+
388
+ request_options : typing.Optional[RequestOptions]
389
+ Request-specific configuration.
390
+
391
+ Returns
392
+ -------
393
+ GcswifExportStorage
394
+
395
+
396
+ Examples
397
+ --------
398
+ from label_studio_sdk import LabelStudio
399
+
400
+ client = LabelStudio(
401
+ api_key="YOUR_API_KEY",
402
+ )
403
+ client.export_storage.gcswif.get(
404
+ id=1,
405
+ )
406
+ """
407
+ _response = self._client_wrapper.httpx_client.request(
408
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
409
+ method="GET",
410
+ request_options=request_options,
411
+ )
412
+ try:
413
+ if 200 <= _response.status_code < 300:
414
+ return typing.cast(
415
+ GcswifExportStorage,
416
+ construct_type(
417
+ type_=GcswifExportStorage, # type: ignore
418
+ object_=_response.json(),
419
+ ),
420
+ )
421
+ _response_json = _response.json()
422
+ except JSONDecodeError:
423
+ raise ApiError(status_code=_response.status_code, body=_response.text)
424
+ raise ApiError(status_code=_response.status_code, body=_response_json)
425
+
426
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
427
+ """
428
+ Delete a specific GCS export storage connection that was set up with WIF authentication.
429
+
430
+ Parameters
431
+ ----------
432
+ id : int
433
+
434
+ request_options : typing.Optional[RequestOptions]
435
+ Request-specific configuration.
436
+
437
+ Returns
438
+ -------
439
+ None
440
+
441
+ Examples
442
+ --------
443
+ from label_studio_sdk import LabelStudio
444
+
445
+ client = LabelStudio(
446
+ api_key="YOUR_API_KEY",
447
+ )
448
+ client.export_storage.gcswif.delete(
449
+ id=1,
450
+ )
451
+ """
452
+ _response = self._client_wrapper.httpx_client.request(
453
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
454
+ method="DELETE",
455
+ request_options=request_options,
456
+ )
457
+ try:
458
+ if 200 <= _response.status_code < 300:
459
+ return
460
+ _response_json = _response.json()
461
+ except JSONDecodeError:
462
+ raise ApiError(status_code=_response.status_code, body=_response.text)
463
+ raise ApiError(status_code=_response.status_code, body=_response_json)
464
+
465
+ def update(
466
+ self,
467
+ id: int,
468
+ *,
469
+ bucket: typing.Optional[str] = OMIT,
470
+ can_delete_objects: typing.Optional[bool] = OMIT,
471
+ description: typing.Optional[str] = OMIT,
472
+ google_application_credentials: typing.Optional[str] = OMIT,
473
+ google_project_id: typing.Optional[str] = OMIT,
474
+ google_project_number: typing.Optional[str] = OMIT,
475
+ google_service_account_email: typing.Optional[str] = OMIT,
476
+ google_wif_pool_id: typing.Optional[str] = OMIT,
477
+ google_wif_provider_id: typing.Optional[str] = OMIT,
478
+ last_sync: typing.Optional[dt.datetime] = OMIT,
479
+ last_sync_count: typing.Optional[int] = OMIT,
480
+ last_sync_job: typing.Optional[str] = OMIT,
481
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
482
+ prefix: typing.Optional[str] = OMIT,
483
+ project: typing.Optional[int] = OMIT,
484
+ regex_filter: typing.Optional[str] = OMIT,
485
+ status: typing.Optional[StatusC5AEnum] = OMIT,
486
+ synchronizable: typing.Optional[bool] = OMIT,
487
+ title: typing.Optional[str] = OMIT,
488
+ traceback: typing.Optional[str] = OMIT,
489
+ use_blob_urls: typing.Optional[bool] = OMIT,
490
+ request_options: typing.Optional[RequestOptions] = None,
491
+ ) -> GcswifExportStorage:
492
+ """
493
+ Update a specific GCS export storage connection that was set up with WIF authentication.
494
+
495
+ Parameters
496
+ ----------
497
+ id : int
498
+
499
+ bucket : typing.Optional[str]
500
+ GCS bucket name
501
+
502
+ can_delete_objects : typing.Optional[bool]
503
+ Deletion from storage enabled
504
+
505
+ description : typing.Optional[str]
506
+ Cloud storage description
507
+
508
+ google_application_credentials : typing.Optional[str]
509
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
510
+
511
+ google_project_id : typing.Optional[str]
512
+ Google project ID
513
+
514
+ google_project_number : typing.Optional[str]
515
+ Google project number
516
+
517
+ google_service_account_email : typing.Optional[str]
518
+ Google service account email
519
+
520
+ google_wif_pool_id : typing.Optional[str]
521
+ Google WIF pool ID
522
+
523
+ google_wif_provider_id : typing.Optional[str]
524
+ Google WIF provider ID
525
+
526
+ last_sync : typing.Optional[dt.datetime]
527
+ Last sync finished time
528
+
529
+ last_sync_count : typing.Optional[int]
530
+ Count of tasks synced last time
531
+
532
+ last_sync_job : typing.Optional[str]
533
+ Last sync job ID
534
+
535
+ meta : typing.Optional[typing.Optional[typing.Any]]
536
+
537
+ prefix : typing.Optional[str]
538
+ GCS bucket prefix
539
+
540
+ project : typing.Optional[int]
541
+ A unique integer value identifying this project.
542
+
543
+ regex_filter : typing.Optional[str]
544
+ Cloud storage regex for filtering objects
545
+
546
+ status : typing.Optional[StatusC5AEnum]
547
+
548
+ synchronizable : typing.Optional[bool]
549
+
550
+ title : typing.Optional[str]
551
+ Cloud storage title
552
+
553
+ traceback : typing.Optional[str]
554
+ Traceback report for the last failed sync
555
+
556
+ use_blob_urls : typing.Optional[bool]
557
+ Interpret objects as BLOBs and generate URLs
558
+
559
+ request_options : typing.Optional[RequestOptions]
560
+ Request-specific configuration.
561
+
562
+ Returns
563
+ -------
564
+ GcswifExportStorage
565
+
566
+
567
+ Examples
568
+ --------
569
+ from label_studio_sdk import LabelStudio
570
+
571
+ client = LabelStudio(
572
+ api_key="YOUR_API_KEY",
573
+ )
574
+ client.export_storage.gcswif.update(
575
+ id=1,
576
+ )
577
+ """
578
+ _response = self._client_wrapper.httpx_client.request(
579
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
580
+ method="PATCH",
581
+ json={
582
+ "bucket": bucket,
583
+ "can_delete_objects": can_delete_objects,
584
+ "description": description,
585
+ "google_application_credentials": google_application_credentials,
586
+ "google_project_id": google_project_id,
587
+ "google_project_number": google_project_number,
588
+ "google_service_account_email": google_service_account_email,
589
+ "google_wif_pool_id": google_wif_pool_id,
590
+ "google_wif_provider_id": google_wif_provider_id,
591
+ "last_sync": last_sync,
592
+ "last_sync_count": last_sync_count,
593
+ "last_sync_job": last_sync_job,
594
+ "meta": meta,
595
+ "prefix": prefix,
596
+ "project": project,
597
+ "regex_filter": regex_filter,
598
+ "status": status,
599
+ "synchronizable": synchronizable,
600
+ "title": title,
601
+ "traceback": traceback,
602
+ "use_blob_urls": use_blob_urls,
603
+ },
604
+ headers={
605
+ "content-type": "application/json",
606
+ },
607
+ request_options=request_options,
608
+ omit=OMIT,
609
+ )
610
+ try:
611
+ if 200 <= _response.status_code < 300:
612
+ return typing.cast(
613
+ GcswifExportStorage,
614
+ construct_type(
615
+ type_=GcswifExportStorage, # type: ignore
616
+ object_=_response.json(),
617
+ ),
618
+ )
619
+ _response_json = _response.json()
620
+ except JSONDecodeError:
621
+ raise ApiError(status_code=_response.status_code, body=_response.text)
622
+ raise ApiError(status_code=_response.status_code, body=_response_json)
623
+
624
+ def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcswifExportStorage:
625
+ """
626
+ Sync tasks from an GCS WIF export storage.
627
+
628
+ Parameters
629
+ ----------
630
+ id : int
631
+
632
+ request_options : typing.Optional[RequestOptions]
633
+ Request-specific configuration.
634
+
635
+ Returns
636
+ -------
637
+ GcswifExportStorage
638
+
639
+
640
+ Examples
641
+ --------
642
+ from label_studio_sdk import LabelStudio
643
+
644
+ client = LabelStudio(
645
+ api_key="YOUR_API_KEY",
646
+ )
647
+ client.export_storage.gcswif.sync(
648
+ id=1,
649
+ )
650
+ """
651
+ _response = self._client_wrapper.httpx_client.request(
652
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}/sync",
653
+ method="POST",
654
+ request_options=request_options,
655
+ )
656
+ try:
657
+ if 200 <= _response.status_code < 300:
658
+ return typing.cast(
659
+ GcswifExportStorage,
660
+ construct_type(
661
+ type_=GcswifExportStorage, # type: ignore
662
+ object_=_response.json(),
663
+ ),
664
+ )
665
+ _response_json = _response.json()
666
+ except JSONDecodeError:
667
+ raise ApiError(status_code=_response.status_code, body=_response.text)
668
+ raise ApiError(status_code=_response.status_code, body=_response_json)
669
+
670
+
671
+ class AsyncGcswifClient:
672
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
673
+ self._client_wrapper = client_wrapper
674
+
675
+ async def list(
676
+ self,
677
+ *,
678
+ ordering: typing.Optional[str] = None,
679
+ project: typing.Optional[int] = None,
680
+ request_options: typing.Optional[RequestOptions] = None,
681
+ ) -> typing.List[GcswifExportStorage]:
682
+ """
683
+ Get a list of all GCS export storage connections that were set up with WIF authentication.
684
+
685
+ Parameters
686
+ ----------
687
+ ordering : typing.Optional[str]
688
+ Which field to use when ordering the results.
689
+
690
+ project : typing.Optional[int]
691
+ Project ID
692
+
693
+ request_options : typing.Optional[RequestOptions]
694
+ Request-specific configuration.
695
+
696
+ Returns
697
+ -------
698
+ typing.List[GcswifExportStorage]
699
+
700
+
701
+ Examples
702
+ --------
703
+ import asyncio
704
+
705
+ from label_studio_sdk import AsyncLabelStudio
706
+
707
+ client = AsyncLabelStudio(
708
+ api_key="YOUR_API_KEY",
709
+ )
710
+
711
+
712
+ async def main() -> None:
713
+ await client.export_storage.gcswif.list()
714
+
715
+
716
+ asyncio.run(main())
717
+ """
718
+ _response = await self._client_wrapper.httpx_client.request(
719
+ "api/storages/export/gcswif",
720
+ method="GET",
721
+ params={
722
+ "ordering": ordering,
723
+ "project": project,
724
+ },
725
+ request_options=request_options,
726
+ )
727
+ try:
728
+ if 200 <= _response.status_code < 300:
729
+ return typing.cast(
730
+ typing.List[GcswifExportStorage],
731
+ construct_type(
732
+ type_=typing.List[GcswifExportStorage], # type: ignore
733
+ object_=_response.json(),
734
+ ),
735
+ )
736
+ _response_json = _response.json()
737
+ except JSONDecodeError:
738
+ raise ApiError(status_code=_response.status_code, body=_response.text)
739
+ raise ApiError(status_code=_response.status_code, body=_response_json)
740
+
741
+ async def create(
742
+ self,
743
+ *,
744
+ project: int,
745
+ bucket: typing.Optional[str] = OMIT,
746
+ can_delete_objects: typing.Optional[bool] = OMIT,
747
+ description: typing.Optional[str] = OMIT,
748
+ google_application_credentials: typing.Optional[str] = OMIT,
749
+ google_project_id: typing.Optional[str] = OMIT,
750
+ google_project_number: typing.Optional[str] = OMIT,
751
+ google_service_account_email: typing.Optional[str] = OMIT,
752
+ google_wif_pool_id: typing.Optional[str] = OMIT,
753
+ google_wif_provider_id: typing.Optional[str] = OMIT,
754
+ last_sync: typing.Optional[dt.datetime] = OMIT,
755
+ last_sync_count: typing.Optional[int] = OMIT,
756
+ last_sync_job: typing.Optional[str] = OMIT,
757
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
758
+ prefix: typing.Optional[str] = OMIT,
759
+ regex_filter: typing.Optional[str] = OMIT,
760
+ status: typing.Optional[StatusC5AEnum] = OMIT,
761
+ synchronizable: typing.Optional[bool] = OMIT,
762
+ title: typing.Optional[str] = OMIT,
763
+ traceback: typing.Optional[str] = OMIT,
764
+ use_blob_urls: typing.Optional[bool] = OMIT,
765
+ request_options: typing.Optional[RequestOptions] = None,
766
+ ) -> GcswifExportStorage:
767
+ """
768
+ Create an GCS export storage connection with WIF authentication to store annotations.
769
+
770
+ Parameters
771
+ ----------
772
+ project : int
773
+ A unique integer value identifying this project.
774
+
775
+ bucket : typing.Optional[str]
776
+ GCS bucket name
777
+
778
+ can_delete_objects : typing.Optional[bool]
779
+ Deletion from storage enabled
780
+
781
+ description : typing.Optional[str]
782
+ Cloud storage description
783
+
784
+ google_application_credentials : typing.Optional[str]
785
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
786
+
787
+ google_project_id : typing.Optional[str]
788
+ Google project ID
789
+
790
+ google_project_number : typing.Optional[str]
791
+ Google project number
792
+
793
+ google_service_account_email : typing.Optional[str]
794
+ Google service account email
795
+
796
+ google_wif_pool_id : typing.Optional[str]
797
+ Google WIF pool ID
798
+
799
+ google_wif_provider_id : typing.Optional[str]
800
+ Google WIF provider ID
801
+
802
+ last_sync : typing.Optional[dt.datetime]
803
+ Last sync finished time
804
+
805
+ last_sync_count : typing.Optional[int]
806
+ Count of tasks synced last time
807
+
808
+ last_sync_job : typing.Optional[str]
809
+ Last sync job ID
810
+
811
+ meta : typing.Optional[typing.Optional[typing.Any]]
812
+
813
+ prefix : typing.Optional[str]
814
+ GCS bucket prefix
815
+
816
+ regex_filter : typing.Optional[str]
817
+ Cloud storage regex for filtering objects
818
+
819
+ status : typing.Optional[StatusC5AEnum]
820
+
821
+ synchronizable : typing.Optional[bool]
822
+
823
+ title : typing.Optional[str]
824
+ Cloud storage title
825
+
826
+ traceback : typing.Optional[str]
827
+ Traceback report for the last failed sync
828
+
829
+ use_blob_urls : typing.Optional[bool]
830
+ Interpret objects as BLOBs and generate URLs
831
+
832
+ request_options : typing.Optional[RequestOptions]
833
+ Request-specific configuration.
834
+
835
+ Returns
836
+ -------
837
+ GcswifExportStorage
838
+
839
+
840
+ Examples
841
+ --------
842
+ import asyncio
843
+
844
+ from label_studio_sdk import AsyncLabelStudio
845
+
846
+ client = AsyncLabelStudio(
847
+ api_key="YOUR_API_KEY",
848
+ )
849
+
850
+
851
+ async def main() -> None:
852
+ await client.export_storage.gcswif.create(
853
+ project=1,
854
+ )
855
+
856
+
857
+ asyncio.run(main())
858
+ """
859
+ _response = await self._client_wrapper.httpx_client.request(
860
+ "api/storages/export/gcswif",
861
+ method="POST",
862
+ json={
863
+ "bucket": bucket,
864
+ "can_delete_objects": can_delete_objects,
865
+ "description": description,
866
+ "google_application_credentials": google_application_credentials,
867
+ "google_project_id": google_project_id,
868
+ "google_project_number": google_project_number,
869
+ "google_service_account_email": google_service_account_email,
870
+ "google_wif_pool_id": google_wif_pool_id,
871
+ "google_wif_provider_id": google_wif_provider_id,
872
+ "last_sync": last_sync,
873
+ "last_sync_count": last_sync_count,
874
+ "last_sync_job": last_sync_job,
875
+ "meta": meta,
876
+ "prefix": prefix,
877
+ "project": project,
878
+ "regex_filter": regex_filter,
879
+ "status": status,
880
+ "synchronizable": synchronizable,
881
+ "title": title,
882
+ "traceback": traceback,
883
+ "use_blob_urls": use_blob_urls,
884
+ },
885
+ request_options=request_options,
886
+ omit=OMIT,
887
+ )
888
+ try:
889
+ if 200 <= _response.status_code < 300:
890
+ return typing.cast(
891
+ GcswifExportStorage,
892
+ construct_type(
893
+ type_=GcswifExportStorage, # type: ignore
894
+ object_=_response.json(),
895
+ ),
896
+ )
897
+ _response_json = _response.json()
898
+ except JSONDecodeError:
899
+ raise ApiError(status_code=_response.status_code, body=_response.text)
900
+ raise ApiError(status_code=_response.status_code, body=_response_json)
901
+
902
+ async def validate(
903
+ self,
904
+ *,
905
+ project: int,
906
+ bucket: typing.Optional[str] = OMIT,
907
+ can_delete_objects: typing.Optional[bool] = OMIT,
908
+ description: typing.Optional[str] = OMIT,
909
+ google_application_credentials: typing.Optional[str] = OMIT,
910
+ google_project_id: typing.Optional[str] = OMIT,
911
+ google_project_number: typing.Optional[str] = OMIT,
912
+ google_service_account_email: typing.Optional[str] = OMIT,
913
+ google_wif_pool_id: typing.Optional[str] = OMIT,
914
+ google_wif_provider_id: typing.Optional[str] = OMIT,
915
+ last_sync: typing.Optional[dt.datetime] = OMIT,
916
+ last_sync_count: typing.Optional[int] = OMIT,
917
+ last_sync_job: typing.Optional[str] = OMIT,
918
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
919
+ prefix: typing.Optional[str] = OMIT,
920
+ regex_filter: typing.Optional[str] = OMIT,
921
+ status: typing.Optional[StatusC5AEnum] = OMIT,
922
+ synchronizable: typing.Optional[bool] = OMIT,
923
+ title: typing.Optional[str] = OMIT,
924
+ traceback: typing.Optional[str] = OMIT,
925
+ use_blob_urls: typing.Optional[bool] = OMIT,
926
+ request_options: typing.Optional[RequestOptions] = None,
927
+ ) -> None:
928
+ """
929
+ Validate a specific GCS export storage connection that was set up with WIF authentication.
930
+
931
+ Parameters
932
+ ----------
933
+ project : int
934
+ A unique integer value identifying this project.
935
+
936
+ bucket : typing.Optional[str]
937
+ GCS bucket name
938
+
939
+ can_delete_objects : typing.Optional[bool]
940
+ Deletion from storage enabled
941
+
942
+ description : typing.Optional[str]
943
+ Cloud storage description
944
+
945
+ google_application_credentials : typing.Optional[str]
946
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
947
+
948
+ google_project_id : typing.Optional[str]
949
+ Google project ID
950
+
951
+ google_project_number : typing.Optional[str]
952
+ Google project number
953
+
954
+ google_service_account_email : typing.Optional[str]
955
+ Google service account email
956
+
957
+ google_wif_pool_id : typing.Optional[str]
958
+ Google WIF pool ID
959
+
960
+ google_wif_provider_id : typing.Optional[str]
961
+ Google WIF provider ID
962
+
963
+ last_sync : typing.Optional[dt.datetime]
964
+ Last sync finished time
965
+
966
+ last_sync_count : typing.Optional[int]
967
+ Count of tasks synced last time
968
+
969
+ last_sync_job : typing.Optional[str]
970
+ Last sync job ID
971
+
972
+ meta : typing.Optional[typing.Optional[typing.Any]]
973
+
974
+ prefix : typing.Optional[str]
975
+ GCS bucket prefix
976
+
977
+ regex_filter : typing.Optional[str]
978
+ Cloud storage regex for filtering objects
979
+
980
+ status : typing.Optional[StatusC5AEnum]
981
+
982
+ synchronizable : typing.Optional[bool]
983
+
984
+ title : typing.Optional[str]
985
+ Cloud storage title
986
+
987
+ traceback : typing.Optional[str]
988
+ Traceback report for the last failed sync
989
+
990
+ use_blob_urls : typing.Optional[bool]
991
+ Interpret objects as BLOBs and generate URLs
992
+
993
+ request_options : typing.Optional[RequestOptions]
994
+ Request-specific configuration.
995
+
996
+ Returns
997
+ -------
998
+ None
999
+
1000
+ Examples
1001
+ --------
1002
+ import asyncio
1003
+
1004
+ from label_studio_sdk import AsyncLabelStudio
1005
+
1006
+ client = AsyncLabelStudio(
1007
+ api_key="YOUR_API_KEY",
1008
+ )
1009
+
1010
+
1011
+ async def main() -> None:
1012
+ await client.export_storage.gcswif.validate(
1013
+ project=1,
1014
+ )
1015
+
1016
+
1017
+ asyncio.run(main())
1018
+ """
1019
+ _response = await self._client_wrapper.httpx_client.request(
1020
+ "api/storages/export/gcswif/validate",
1021
+ method="POST",
1022
+ json={
1023
+ "bucket": bucket,
1024
+ "can_delete_objects": can_delete_objects,
1025
+ "description": description,
1026
+ "google_application_credentials": google_application_credentials,
1027
+ "google_project_id": google_project_id,
1028
+ "google_project_number": google_project_number,
1029
+ "google_service_account_email": google_service_account_email,
1030
+ "google_wif_pool_id": google_wif_pool_id,
1031
+ "google_wif_provider_id": google_wif_provider_id,
1032
+ "last_sync": last_sync,
1033
+ "last_sync_count": last_sync_count,
1034
+ "last_sync_job": last_sync_job,
1035
+ "meta": meta,
1036
+ "prefix": prefix,
1037
+ "project": project,
1038
+ "regex_filter": regex_filter,
1039
+ "status": status,
1040
+ "synchronizable": synchronizable,
1041
+ "title": title,
1042
+ "traceback": traceback,
1043
+ "use_blob_urls": use_blob_urls,
1044
+ },
1045
+ request_options=request_options,
1046
+ omit=OMIT,
1047
+ )
1048
+ try:
1049
+ if 200 <= _response.status_code < 300:
1050
+ return
1051
+ _response_json = _response.json()
1052
+ except JSONDecodeError:
1053
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1054
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1055
+
1056
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcswifExportStorage:
1057
+ """
1058
+ Get a specific GCS export storage connection that was set up with WIF authentication.
1059
+
1060
+ Parameters
1061
+ ----------
1062
+ id : int
1063
+
1064
+ request_options : typing.Optional[RequestOptions]
1065
+ Request-specific configuration.
1066
+
1067
+ Returns
1068
+ -------
1069
+ GcswifExportStorage
1070
+
1071
+
1072
+ Examples
1073
+ --------
1074
+ import asyncio
1075
+
1076
+ from label_studio_sdk import AsyncLabelStudio
1077
+
1078
+ client = AsyncLabelStudio(
1079
+ api_key="YOUR_API_KEY",
1080
+ )
1081
+
1082
+
1083
+ async def main() -> None:
1084
+ await client.export_storage.gcswif.get(
1085
+ id=1,
1086
+ )
1087
+
1088
+
1089
+ asyncio.run(main())
1090
+ """
1091
+ _response = await self._client_wrapper.httpx_client.request(
1092
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
1093
+ method="GET",
1094
+ request_options=request_options,
1095
+ )
1096
+ try:
1097
+ if 200 <= _response.status_code < 300:
1098
+ return typing.cast(
1099
+ GcswifExportStorage,
1100
+ construct_type(
1101
+ type_=GcswifExportStorage, # type: ignore
1102
+ object_=_response.json(),
1103
+ ),
1104
+ )
1105
+ _response_json = _response.json()
1106
+ except JSONDecodeError:
1107
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1108
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1109
+
1110
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
1111
+ """
1112
+ Delete a specific GCS export storage connection that was set up with WIF authentication.
1113
+
1114
+ Parameters
1115
+ ----------
1116
+ id : int
1117
+
1118
+ request_options : typing.Optional[RequestOptions]
1119
+ Request-specific configuration.
1120
+
1121
+ Returns
1122
+ -------
1123
+ None
1124
+
1125
+ Examples
1126
+ --------
1127
+ import asyncio
1128
+
1129
+ from label_studio_sdk import AsyncLabelStudio
1130
+
1131
+ client = AsyncLabelStudio(
1132
+ api_key="YOUR_API_KEY",
1133
+ )
1134
+
1135
+
1136
+ async def main() -> None:
1137
+ await client.export_storage.gcswif.delete(
1138
+ id=1,
1139
+ )
1140
+
1141
+
1142
+ asyncio.run(main())
1143
+ """
1144
+ _response = await self._client_wrapper.httpx_client.request(
1145
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
1146
+ method="DELETE",
1147
+ request_options=request_options,
1148
+ )
1149
+ try:
1150
+ if 200 <= _response.status_code < 300:
1151
+ return
1152
+ _response_json = _response.json()
1153
+ except JSONDecodeError:
1154
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1155
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1156
+
1157
+ async def update(
1158
+ self,
1159
+ id: int,
1160
+ *,
1161
+ bucket: typing.Optional[str] = OMIT,
1162
+ can_delete_objects: typing.Optional[bool] = OMIT,
1163
+ description: typing.Optional[str] = OMIT,
1164
+ google_application_credentials: typing.Optional[str] = OMIT,
1165
+ google_project_id: typing.Optional[str] = OMIT,
1166
+ google_project_number: typing.Optional[str] = OMIT,
1167
+ google_service_account_email: typing.Optional[str] = OMIT,
1168
+ google_wif_pool_id: typing.Optional[str] = OMIT,
1169
+ google_wif_provider_id: typing.Optional[str] = OMIT,
1170
+ last_sync: typing.Optional[dt.datetime] = OMIT,
1171
+ last_sync_count: typing.Optional[int] = OMIT,
1172
+ last_sync_job: typing.Optional[str] = OMIT,
1173
+ meta: typing.Optional[typing.Optional[typing.Any]] = OMIT,
1174
+ prefix: typing.Optional[str] = OMIT,
1175
+ project: typing.Optional[int] = OMIT,
1176
+ regex_filter: typing.Optional[str] = OMIT,
1177
+ status: typing.Optional[StatusC5AEnum] = OMIT,
1178
+ synchronizable: typing.Optional[bool] = OMIT,
1179
+ title: typing.Optional[str] = OMIT,
1180
+ traceback: typing.Optional[str] = OMIT,
1181
+ use_blob_urls: typing.Optional[bool] = OMIT,
1182
+ request_options: typing.Optional[RequestOptions] = None,
1183
+ ) -> GcswifExportStorage:
1184
+ """
1185
+ Update a specific GCS export storage connection that was set up with WIF authentication.
1186
+
1187
+ Parameters
1188
+ ----------
1189
+ id : int
1190
+
1191
+ bucket : typing.Optional[str]
1192
+ GCS bucket name
1193
+
1194
+ can_delete_objects : typing.Optional[bool]
1195
+ Deletion from storage enabled
1196
+
1197
+ description : typing.Optional[str]
1198
+ Cloud storage description
1199
+
1200
+ google_application_credentials : typing.Optional[str]
1201
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
1202
+
1203
+ google_project_id : typing.Optional[str]
1204
+ Google project ID
1205
+
1206
+ google_project_number : typing.Optional[str]
1207
+ Google project number
1208
+
1209
+ google_service_account_email : typing.Optional[str]
1210
+ Google service account email
1211
+
1212
+ google_wif_pool_id : typing.Optional[str]
1213
+ Google WIF pool ID
1214
+
1215
+ google_wif_provider_id : typing.Optional[str]
1216
+ Google WIF provider ID
1217
+
1218
+ last_sync : typing.Optional[dt.datetime]
1219
+ Last sync finished time
1220
+
1221
+ last_sync_count : typing.Optional[int]
1222
+ Count of tasks synced last time
1223
+
1224
+ last_sync_job : typing.Optional[str]
1225
+ Last sync job ID
1226
+
1227
+ meta : typing.Optional[typing.Optional[typing.Any]]
1228
+
1229
+ prefix : typing.Optional[str]
1230
+ GCS bucket prefix
1231
+
1232
+ project : typing.Optional[int]
1233
+ A unique integer value identifying this project.
1234
+
1235
+ regex_filter : typing.Optional[str]
1236
+ Cloud storage regex for filtering objects
1237
+
1238
+ status : typing.Optional[StatusC5AEnum]
1239
+
1240
+ synchronizable : typing.Optional[bool]
1241
+
1242
+ title : typing.Optional[str]
1243
+ Cloud storage title
1244
+
1245
+ traceback : typing.Optional[str]
1246
+ Traceback report for the last failed sync
1247
+
1248
+ use_blob_urls : typing.Optional[bool]
1249
+ Interpret objects as BLOBs and generate URLs
1250
+
1251
+ request_options : typing.Optional[RequestOptions]
1252
+ Request-specific configuration.
1253
+
1254
+ Returns
1255
+ -------
1256
+ GcswifExportStorage
1257
+
1258
+
1259
+ Examples
1260
+ --------
1261
+ import asyncio
1262
+
1263
+ from label_studio_sdk import AsyncLabelStudio
1264
+
1265
+ client = AsyncLabelStudio(
1266
+ api_key="YOUR_API_KEY",
1267
+ )
1268
+
1269
+
1270
+ async def main() -> None:
1271
+ await client.export_storage.gcswif.update(
1272
+ id=1,
1273
+ )
1274
+
1275
+
1276
+ asyncio.run(main())
1277
+ """
1278
+ _response = await self._client_wrapper.httpx_client.request(
1279
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}",
1280
+ method="PATCH",
1281
+ json={
1282
+ "bucket": bucket,
1283
+ "can_delete_objects": can_delete_objects,
1284
+ "description": description,
1285
+ "google_application_credentials": google_application_credentials,
1286
+ "google_project_id": google_project_id,
1287
+ "google_project_number": google_project_number,
1288
+ "google_service_account_email": google_service_account_email,
1289
+ "google_wif_pool_id": google_wif_pool_id,
1290
+ "google_wif_provider_id": google_wif_provider_id,
1291
+ "last_sync": last_sync,
1292
+ "last_sync_count": last_sync_count,
1293
+ "last_sync_job": last_sync_job,
1294
+ "meta": meta,
1295
+ "prefix": prefix,
1296
+ "project": project,
1297
+ "regex_filter": regex_filter,
1298
+ "status": status,
1299
+ "synchronizable": synchronizable,
1300
+ "title": title,
1301
+ "traceback": traceback,
1302
+ "use_blob_urls": use_blob_urls,
1303
+ },
1304
+ headers={
1305
+ "content-type": "application/json",
1306
+ },
1307
+ request_options=request_options,
1308
+ omit=OMIT,
1309
+ )
1310
+ try:
1311
+ if 200 <= _response.status_code < 300:
1312
+ return typing.cast(
1313
+ GcswifExportStorage,
1314
+ construct_type(
1315
+ type_=GcswifExportStorage, # type: ignore
1316
+ object_=_response.json(),
1317
+ ),
1318
+ )
1319
+ _response_json = _response.json()
1320
+ except JSONDecodeError:
1321
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1322
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1323
+
1324
+ async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcswifExportStorage:
1325
+ """
1326
+ Sync tasks from an GCS WIF export storage.
1327
+
1328
+ Parameters
1329
+ ----------
1330
+ id : int
1331
+
1332
+ request_options : typing.Optional[RequestOptions]
1333
+ Request-specific configuration.
1334
+
1335
+ Returns
1336
+ -------
1337
+ GcswifExportStorage
1338
+
1339
+
1340
+ Examples
1341
+ --------
1342
+ import asyncio
1343
+
1344
+ from label_studio_sdk import AsyncLabelStudio
1345
+
1346
+ client = AsyncLabelStudio(
1347
+ api_key="YOUR_API_KEY",
1348
+ )
1349
+
1350
+
1351
+ async def main() -> None:
1352
+ await client.export_storage.gcswif.sync(
1353
+ id=1,
1354
+ )
1355
+
1356
+
1357
+ asyncio.run(main())
1358
+ """
1359
+ _response = await self._client_wrapper.httpx_client.request(
1360
+ f"api/storages/export/gcswif/{jsonable_encoder(id)}/sync",
1361
+ method="POST",
1362
+ request_options=request_options,
1363
+ )
1364
+ try:
1365
+ if 200 <= _response.status_code < 300:
1366
+ return typing.cast(
1367
+ GcswifExportStorage,
1368
+ construct_type(
1369
+ type_=GcswifExportStorage, # type: ignore
1370
+ object_=_response.json(),
1371
+ ),
1372
+ )
1373
+ _response_json = _response.json()
1374
+ except JSONDecodeError:
1375
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1376
+ raise ApiError(status_code=_response.status_code, body=_response_json)