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