label-studio-sdk 0.0.34__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. label_studio_sdk/__init__.py +206 -9
  2. label_studio_sdk/_extensions/label_studio_tools/__init__.py +0 -0
  3. label_studio_sdk/_extensions/label_studio_tools/core/__init__.py +0 -0
  4. label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +163 -0
  5. label_studio_sdk/_extensions/label_studio_tools/core/utils/__init__.py +0 -0
  6. label_studio_sdk/_extensions/label_studio_tools/core/utils/exceptions.py +2 -0
  7. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +228 -0
  8. label_studio_sdk/_extensions/label_studio_tools/core/utils/params.py +45 -0
  9. label_studio_sdk/_extensions/label_studio_tools/etl/__init__.py +1 -0
  10. label_studio_sdk/_extensions/label_studio_tools/etl/beam.py +34 -0
  11. label_studio_sdk/_extensions/label_studio_tools/etl/example.py +17 -0
  12. label_studio_sdk/_extensions/label_studio_tools/etl/registry.py +67 -0
  13. label_studio_sdk/_extensions/label_studio_tools/postprocessing/__init__.py +0 -0
  14. label_studio_sdk/_extensions/label_studio_tools/postprocessing/video.py +97 -0
  15. label_studio_sdk/_legacy/__init__.py +11 -0
  16. label_studio_sdk/_legacy/client.py +471 -0
  17. label_studio_sdk/_legacy/label_interface/data_examples.json +96 -0
  18. label_studio_sdk/{label_interface → _legacy/label_interface}/interface.py +9 -6
  19. label_studio_sdk/{project.py → _legacy/project.py} +2 -2
  20. label_studio_sdk/actions/__init__.py +2 -0
  21. label_studio_sdk/actions/client.py +150 -0
  22. label_studio_sdk/annotations/__init__.py +2 -0
  23. label_studio_sdk/annotations/client.py +750 -0
  24. label_studio_sdk/client.py +162 -450
  25. label_studio_sdk/converter/__init__.py +7 -0
  26. label_studio_sdk/converter/audio.py +56 -0
  27. label_studio_sdk/converter/brush.py +452 -0
  28. label_studio_sdk/converter/converter.py +1175 -0
  29. label_studio_sdk/converter/exports/__init__.py +0 -0
  30. label_studio_sdk/converter/exports/csv.py +82 -0
  31. label_studio_sdk/converter/exports/csv2.py +103 -0
  32. label_studio_sdk/converter/funsd.py +85 -0
  33. label_studio_sdk/converter/imports/__init__.py +0 -0
  34. label_studio_sdk/converter/imports/coco.py +314 -0
  35. label_studio_sdk/converter/imports/colors.py +198 -0
  36. label_studio_sdk/converter/imports/label_config.py +45 -0
  37. label_studio_sdk/converter/imports/pathtrack.py +269 -0
  38. label_studio_sdk/converter/imports/yolo.py +236 -0
  39. label_studio_sdk/converter/main.py +202 -0
  40. label_studio_sdk/converter/utils.py +473 -0
  41. label_studio_sdk/core/__init__.py +33 -0
  42. label_studio_sdk/core/api_error.py +15 -0
  43. label_studio_sdk/core/client_wrapper.py +55 -0
  44. label_studio_sdk/core/datetime_utils.py +28 -0
  45. label_studio_sdk/core/file.py +38 -0
  46. label_studio_sdk/core/http_client.py +443 -0
  47. label_studio_sdk/core/jsonable_encoder.py +99 -0
  48. label_studio_sdk/core/pagination.py +87 -0
  49. label_studio_sdk/core/pydantic_utilities.py +28 -0
  50. label_studio_sdk/core/query_encoder.py +33 -0
  51. label_studio_sdk/core/remove_none_from_dict.py +11 -0
  52. label_studio_sdk/core/request_options.py +32 -0
  53. label_studio_sdk/environment.py +7 -0
  54. label_studio_sdk/errors/__init__.py +6 -0
  55. label_studio_sdk/errors/bad_request_error.py +8 -0
  56. label_studio_sdk/errors/internal_server_error.py +8 -0
  57. label_studio_sdk/export_storage/__init__.py +28 -0
  58. label_studio_sdk/export_storage/azure/__init__.py +5 -0
  59. label_studio_sdk/export_storage/azure/client.py +722 -0
  60. label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
  61. label_studio_sdk/export_storage/azure/types/azure_create_response.py +52 -0
  62. label_studio_sdk/export_storage/azure/types/azure_update_response.py +52 -0
  63. label_studio_sdk/export_storage/client.py +107 -0
  64. label_studio_sdk/export_storage/gcs/__init__.py +5 -0
  65. label_studio_sdk/export_storage/gcs/client.py +722 -0
  66. label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
  67. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +52 -0
  68. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +52 -0
  69. label_studio_sdk/export_storage/local/__init__.py +5 -0
  70. label_studio_sdk/export_storage/local/client.py +688 -0
  71. label_studio_sdk/export_storage/local/types/__init__.py +6 -0
  72. label_studio_sdk/export_storage/local/types/local_create_response.py +47 -0
  73. label_studio_sdk/export_storage/local/types/local_update_response.py +47 -0
  74. label_studio_sdk/export_storage/redis/__init__.py +5 -0
  75. label_studio_sdk/export_storage/redis/client.py +714 -0
  76. label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
  77. label_studio_sdk/export_storage/redis/types/redis_create_response.py +57 -0
  78. label_studio_sdk/export_storage/redis/types/redis_update_response.py +57 -0
  79. label_studio_sdk/export_storage/s3/__init__.py +5 -0
  80. label_studio_sdk/export_storage/s3/client.py +820 -0
  81. label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
  82. label_studio_sdk/export_storage/s3/types/s3create_response.py +74 -0
  83. label_studio_sdk/export_storage/s3/types/s3update_response.py +74 -0
  84. label_studio_sdk/export_storage/types/__init__.py +5 -0
  85. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
  86. label_studio_sdk/files/__init__.py +2 -0
  87. label_studio_sdk/files/client.py +556 -0
  88. label_studio_sdk/import_storage/__init__.py +28 -0
  89. label_studio_sdk/import_storage/azure/__init__.py +5 -0
  90. label_studio_sdk/import_storage/azure/client.py +812 -0
  91. label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
  92. label_studio_sdk/import_storage/azure/types/azure_create_response.py +72 -0
  93. label_studio_sdk/import_storage/azure/types/azure_update_response.py +72 -0
  94. label_studio_sdk/import_storage/client.py +107 -0
  95. label_studio_sdk/import_storage/gcs/__init__.py +5 -0
  96. label_studio_sdk/import_storage/gcs/client.py +812 -0
  97. label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
  98. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +72 -0
  99. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +72 -0
  100. label_studio_sdk/import_storage/local/__init__.py +5 -0
  101. label_studio_sdk/import_storage/local/client.py +690 -0
  102. label_studio_sdk/import_storage/local/types/__init__.py +6 -0
  103. label_studio_sdk/import_storage/local/types/local_create_response.py +47 -0
  104. label_studio_sdk/import_storage/local/types/local_update_response.py +47 -0
  105. label_studio_sdk/import_storage/redis/__init__.py +5 -0
  106. label_studio_sdk/import_storage/redis/client.py +768 -0
  107. label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
  108. label_studio_sdk/import_storage/redis/types/redis_create_response.py +62 -0
  109. label_studio_sdk/import_storage/redis/types/redis_update_response.py +62 -0
  110. label_studio_sdk/import_storage/s3/__init__.py +5 -0
  111. label_studio_sdk/import_storage/s3/client.py +912 -0
  112. label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
  113. label_studio_sdk/import_storage/s3/types/s3create_response.py +99 -0
  114. label_studio_sdk/import_storage/s3/types/s3update_response.py +99 -0
  115. label_studio_sdk/import_storage/types/__init__.py +5 -0
  116. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
  117. label_studio_sdk/ml/__init__.py +19 -0
  118. label_studio_sdk/ml/client.py +981 -0
  119. label_studio_sdk/ml/types/__init__.py +17 -0
  120. label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
  121. label_studio_sdk/ml/types/ml_create_response.py +78 -0
  122. label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
  123. label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
  124. label_studio_sdk/ml/types/ml_update_response.py +78 -0
  125. label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
  126. label_studio_sdk/predictions/__init__.py +2 -0
  127. label_studio_sdk/predictions/client.py +638 -0
  128. label_studio_sdk/projects/__init__.py +6 -0
  129. label_studio_sdk/projects/client.py +1053 -0
  130. label_studio_sdk/projects/exports/__init__.py +2 -0
  131. label_studio_sdk/projects/exports/client.py +930 -0
  132. label_studio_sdk/projects/types/__init__.py +7 -0
  133. label_studio_sdk/projects/types/projects_create_response.py +96 -0
  134. label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
  135. label_studio_sdk/projects/types/projects_list_response.py +33 -0
  136. label_studio_sdk/py.typed +0 -0
  137. label_studio_sdk/tasks/__init__.py +5 -0
  138. label_studio_sdk/tasks/client.py +811 -0
  139. label_studio_sdk/tasks/types/__init__.py +6 -0
  140. label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
  141. label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
  142. label_studio_sdk/types/__init__.py +115 -0
  143. label_studio_sdk/types/annotation.py +116 -0
  144. label_studio_sdk/types/annotation_filter_options.py +42 -0
  145. label_studio_sdk/types/annotation_last_action.py +19 -0
  146. label_studio_sdk/types/azure_blob_export_storage.py +112 -0
  147. label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
  148. label_studio_sdk/types/azure_blob_import_storage.py +113 -0
  149. label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
  150. label_studio_sdk/types/base_task.py +113 -0
  151. label_studio_sdk/types/base_user.py +42 -0
  152. label_studio_sdk/types/converted_format.py +36 -0
  153. label_studio_sdk/types/converted_format_status.py +5 -0
  154. label_studio_sdk/types/export.py +48 -0
  155. label_studio_sdk/types/export_convert.py +32 -0
  156. label_studio_sdk/types/export_create.py +54 -0
  157. label_studio_sdk/types/export_create_status.py +5 -0
  158. label_studio_sdk/types/export_status.py +5 -0
  159. label_studio_sdk/types/file_upload.py +30 -0
  160. label_studio_sdk/types/filter.py +53 -0
  161. label_studio_sdk/types/filter_group.py +35 -0
  162. label_studio_sdk/types/gcs_export_storage.py +112 -0
  163. label_studio_sdk/types/gcs_export_storage_status.py +7 -0
  164. label_studio_sdk/types/gcs_import_storage.py +113 -0
  165. label_studio_sdk/types/gcs_import_storage_status.py +7 -0
  166. label_studio_sdk/types/local_files_export_storage.py +97 -0
  167. label_studio_sdk/types/local_files_export_storage_status.py +7 -0
  168. label_studio_sdk/types/local_files_import_storage.py +92 -0
  169. label_studio_sdk/types/local_files_import_storage_status.py +7 -0
  170. label_studio_sdk/types/ml_backend.py +89 -0
  171. label_studio_sdk/types/ml_backend_auth_method.py +5 -0
  172. label_studio_sdk/types/ml_backend_state.py +5 -0
  173. label_studio_sdk/types/prediction.py +78 -0
  174. label_studio_sdk/types/project.py +198 -0
  175. label_studio_sdk/types/project_import.py +63 -0
  176. label_studio_sdk/types/project_import_status.py +5 -0
  177. label_studio_sdk/types/project_label_config.py +32 -0
  178. label_studio_sdk/types/project_sampling.py +7 -0
  179. label_studio_sdk/types/project_skip_queue.py +5 -0
  180. label_studio_sdk/types/redis_export_storage.py +117 -0
  181. label_studio_sdk/types/redis_export_storage_status.py +7 -0
  182. label_studio_sdk/types/redis_import_storage.py +112 -0
  183. label_studio_sdk/types/redis_import_storage_status.py +7 -0
  184. label_studio_sdk/types/s3export_storage.py +134 -0
  185. label_studio_sdk/types/s3export_storage_status.py +7 -0
  186. label_studio_sdk/types/s3import_storage.py +140 -0
  187. label_studio_sdk/types/s3import_storage_status.py +7 -0
  188. label_studio_sdk/types/serialization_option.py +36 -0
  189. label_studio_sdk/types/serialization_options.py +45 -0
  190. label_studio_sdk/types/task.py +157 -0
  191. label_studio_sdk/types/task_filter_options.py +49 -0
  192. label_studio_sdk/types/user_simple.py +37 -0
  193. label_studio_sdk/types/view.py +55 -0
  194. label_studio_sdk/types/webhook.py +67 -0
  195. label_studio_sdk/types/webhook_actions_item.py +21 -0
  196. label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
  197. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
  198. label_studio_sdk/users/__init__.py +5 -0
  199. label_studio_sdk/users/client.py +830 -0
  200. label_studio_sdk/users/types/__init__.py +6 -0
  201. label_studio_sdk/users/types/users_get_token_response.py +36 -0
  202. label_studio_sdk/users/types/users_reset_token_response.py +36 -0
  203. label_studio_sdk/version.py +4 -0
  204. label_studio_sdk/views/__init__.py +31 -0
  205. label_studio_sdk/views/client.py +564 -0
  206. label_studio_sdk/views/types/__init__.py +29 -0
  207. label_studio_sdk/views/types/views_create_request_data.py +43 -0
  208. label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
  209. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
  210. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +47 -0
  211. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +38 -0
  212. label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +5 -0
  213. label_studio_sdk/views/types/views_update_request_data.py +43 -0
  214. label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
  215. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
  216. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +47 -0
  217. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +38 -0
  218. label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +5 -0
  219. label_studio_sdk/webhooks/__init__.py +5 -0
  220. label_studio_sdk/webhooks/client.py +636 -0
  221. label_studio_sdk/webhooks/types/__init__.py +5 -0
  222. label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
  223. label_studio_sdk-1.0.0.dist-info/METADATA +307 -0
  224. label_studio_sdk-1.0.0.dist-info/RECORD +239 -0
  225. {label_studio_sdk-0.0.34.dist-info → label_studio_sdk-1.0.0.dist-info}/WHEEL +1 -2
  226. label_studio_sdk-0.0.34.dist-info/LICENSE +0 -201
  227. label_studio_sdk-0.0.34.dist-info/METADATA +0 -24
  228. label_studio_sdk-0.0.34.dist-info/RECORD +0 -37
  229. label_studio_sdk-0.0.34.dist-info/top_level.txt +0 -2
  230. tests/test_client.py +0 -37
  231. tests/test_export.py +0 -105
  232. tests/test_interface/__init__.py +0 -1
  233. tests/test_interface/configs.py +0 -137
  234. tests/test_interface/mockups.py +0 -22
  235. tests/test_interface/test_compat.py +0 -64
  236. tests/test_interface/test_control_tags.py +0 -55
  237. tests/test_interface/test_data_generation.py +0 -45
  238. tests/test_interface/test_lpi.py +0 -15
  239. tests/test_interface/test_main.py +0 -196
  240. tests/test_interface/test_object_tags.py +0 -36
  241. tests/test_interface/test_region.py +0 -36
  242. tests/test_interface/test_validate_summary.py +0 -35
  243. tests/test_interface/test_validation.py +0 -59
  244. {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
  245. /label_studio_sdk/{exceptions.py → _legacy/exceptions.py} +0 -0
  246. /label_studio_sdk/{label_interface → _legacy/label_interface}/__init__.py +0 -0
  247. /label_studio_sdk/{label_interface → _legacy/label_interface}/base.py +0 -0
  248. /label_studio_sdk/{label_interface → _legacy/label_interface}/control_tags.py +0 -0
  249. /label_studio_sdk/{label_interface → _legacy/label_interface}/label_tags.py +0 -0
  250. /label_studio_sdk/{label_interface → _legacy/label_interface}/object_tags.py +0 -0
  251. /label_studio_sdk/{label_interface → _legacy/label_interface}/region.py +0 -0
  252. /label_studio_sdk/{objects.py → _legacy/objects.py} +0 -0
  253. /label_studio_sdk/{schema → _legacy/schema}/label_config_schema.json +0 -0
  254. /label_studio_sdk/{users.py → _legacy/users.py} +0 -0
  255. /label_studio_sdk/{utils.py → _legacy/utils.py} +0 -0
  256. /label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +0 -0
@@ -0,0 +1,812 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ...core.api_error import ApiError
7
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ...core.jsonable_encoder import jsonable_encoder
9
+ from ...core.pydantic_utilities import pydantic_v1
10
+ from ...core.request_options import RequestOptions
11
+ from ...types.gcs_import_storage import GcsImportStorage
12
+ from .types.gcs_create_response import GcsCreateResponse
13
+ from .types.gcs_update_response import GcsUpdateResponse
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class GcsClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def list(
24
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
25
+ ) -> typing.List[GcsImportStorage]:
26
+ """
27
+ You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
28
+
29
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
30
+
31
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
32
+
33
+ Parameters
34
+ ----------
35
+ project : typing.Optional[int]
36
+ Project ID
37
+
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ typing.List[GcsImportStorage]
44
+
45
+
46
+ Examples
47
+ --------
48
+ from label_studio_sdk.client import LabelStudio
49
+
50
+ client = LabelStudio(
51
+ api_key="YOUR_API_KEY",
52
+ )
53
+ client.import_storage.gcs.list()
54
+ """
55
+ _response = self._client_wrapper.httpx_client.request(
56
+ "api/storages/gcs/", method="GET", params={"project": project}, request_options=request_options
57
+ )
58
+ if 200 <= _response.status_code < 300:
59
+ return pydantic_v1.parse_obj_as(typing.List[GcsImportStorage], _response.json()) # type: ignore
60
+ try:
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(status_code=_response.status_code, body=_response.text)
64
+ raise ApiError(status_code=_response.status_code, body=_response_json)
65
+
66
+ def create(
67
+ self,
68
+ *,
69
+ project: typing.Optional[int] = OMIT,
70
+ bucket: typing.Optional[str] = OMIT,
71
+ prefix: typing.Optional[str] = OMIT,
72
+ regex_filter: typing.Optional[str] = OMIT,
73
+ use_blob_urls: typing.Optional[bool] = OMIT,
74
+ google_application_credentials: typing.Optional[str] = OMIT,
75
+ google_project_id: typing.Optional[str] = OMIT,
76
+ presign: typing.Optional[bool] = OMIT,
77
+ presign_ttl: typing.Optional[int] = OMIT,
78
+ request_options: typing.Optional[RequestOptions] = None,
79
+ ) -> GcsCreateResponse:
80
+ """
81
+ Create a new source storage connection to a Google Cloud Storage bucket.
82
+
83
+ For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
84
+
85
+ <Info>Ensure you configure CORS before adding cloud storage. This ensures you will be able to see the content of the data rather than just a link.</Info>
86
+
87
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be imported until you [sync your connection](sync).</Tip>
88
+
89
+ Parameters
90
+ ----------
91
+ project : typing.Optional[int]
92
+ Project ID
93
+
94
+ bucket : typing.Optional[str]
95
+ GCS bucket name
96
+
97
+ prefix : typing.Optional[str]
98
+ GCS bucket prefix
99
+
100
+ regex_filter : typing.Optional[str]
101
+ Cloud storage regex for filtering objects
102
+
103
+ use_blob_urls : typing.Optional[bool]
104
+ Interpret objects as BLOBs and generate URLs
105
+
106
+ google_application_credentials : typing.Optional[str]
107
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
108
+
109
+ google_project_id : typing.Optional[str]
110
+ Google project ID
111
+
112
+ presign : typing.Optional[bool]
113
+ Presign URLs for direct download
114
+
115
+ presign_ttl : typing.Optional[int]
116
+ Presign TTL in minutes
117
+
118
+ request_options : typing.Optional[RequestOptions]
119
+ Request-specific configuration.
120
+
121
+ Returns
122
+ -------
123
+ GcsCreateResponse
124
+
125
+
126
+ Examples
127
+ --------
128
+ from label_studio_sdk.client import LabelStudio
129
+
130
+ client = LabelStudio(
131
+ api_key="YOUR_API_KEY",
132
+ )
133
+ client.import_storage.gcs.create()
134
+ """
135
+ _response = self._client_wrapper.httpx_client.request(
136
+ "api/storages/gcs/",
137
+ method="POST",
138
+ json={
139
+ "project": project,
140
+ "bucket": bucket,
141
+ "prefix": prefix,
142
+ "regex_filter": regex_filter,
143
+ "use_blob_urls": use_blob_urls,
144
+ "google_application_credentials": google_application_credentials,
145
+ "google_project_id": google_project_id,
146
+ "presign": presign,
147
+ "presign_ttl": presign_ttl,
148
+ },
149
+ request_options=request_options,
150
+ omit=OMIT,
151
+ )
152
+ if 200 <= _response.status_code < 300:
153
+ return pydantic_v1.parse_obj_as(GcsCreateResponse, _response.json()) # type: ignore
154
+ try:
155
+ _response_json = _response.json()
156
+ except JSONDecodeError:
157
+ raise ApiError(status_code=_response.status_code, body=_response.text)
158
+ raise ApiError(status_code=_response.status_code, body=_response_json)
159
+
160
+ def validate(self, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
161
+ """
162
+ Validate a specific GCS import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
163
+
164
+ Parameters
165
+ ----------
166
+ request_options : typing.Optional[RequestOptions]
167
+ Request-specific configuration.
168
+
169
+ Returns
170
+ -------
171
+ GcsImportStorage
172
+
173
+
174
+ Examples
175
+ --------
176
+ from label_studio_sdk.client import LabelStudio
177
+
178
+ client = LabelStudio(
179
+ api_key="YOUR_API_KEY",
180
+ )
181
+ client.import_storage.gcs.validate()
182
+ """
183
+ _response = self._client_wrapper.httpx_client.request(
184
+ "api/storages/gcs/validate", method="POST", request_options=request_options
185
+ )
186
+ if 200 <= _response.status_code < 300:
187
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
188
+ try:
189
+ _response_json = _response.json()
190
+ except JSONDecodeError:
191
+ raise ApiError(status_code=_response.status_code, body=_response.text)
192
+ raise ApiError(status_code=_response.status_code, body=_response_json)
193
+
194
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
195
+ """
196
+ Get a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
197
+
198
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
199
+
200
+ Parameters
201
+ ----------
202
+ id : int
203
+ A unique integer value identifying this gcs import storage.
204
+
205
+ request_options : typing.Optional[RequestOptions]
206
+ Request-specific configuration.
207
+
208
+ Returns
209
+ -------
210
+ GcsImportStorage
211
+
212
+
213
+ Examples
214
+ --------
215
+ from label_studio_sdk.client import LabelStudio
216
+
217
+ client = LabelStudio(
218
+ api_key="YOUR_API_KEY",
219
+ )
220
+ client.import_storage.gcs.get(
221
+ id=1,
222
+ )
223
+ """
224
+ _response = self._client_wrapper.httpx_client.request(
225
+ f"api/storages/gcs/{jsonable_encoder(id)}", method="GET", request_options=request_options
226
+ )
227
+ if 200 <= _response.status_code < 300:
228
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
229
+ try:
230
+ _response_json = _response.json()
231
+ except JSONDecodeError:
232
+ raise ApiError(status_code=_response.status_code, body=_response.text)
233
+ raise ApiError(status_code=_response.status_code, body=_response_json)
234
+
235
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
236
+ """
237
+ Delete a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
238
+
239
+ Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
240
+
241
+ If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
242
+
243
+ Parameters
244
+ ----------
245
+ id : int
246
+ A unique integer value identifying this gcs import storage.
247
+
248
+ request_options : typing.Optional[RequestOptions]
249
+ Request-specific configuration.
250
+
251
+ Returns
252
+ -------
253
+ None
254
+
255
+ Examples
256
+ --------
257
+ from label_studio_sdk.client import LabelStudio
258
+
259
+ client = LabelStudio(
260
+ api_key="YOUR_API_KEY",
261
+ )
262
+ client.import_storage.gcs.delete(
263
+ id=1,
264
+ )
265
+ """
266
+ _response = self._client_wrapper.httpx_client.request(
267
+ f"api/storages/gcs/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
268
+ )
269
+ if 200 <= _response.status_code < 300:
270
+ return
271
+ try:
272
+ _response_json = _response.json()
273
+ except JSONDecodeError:
274
+ raise ApiError(status_code=_response.status_code, body=_response.text)
275
+ raise ApiError(status_code=_response.status_code, body=_response_json)
276
+
277
+ def update(
278
+ self,
279
+ id: int,
280
+ *,
281
+ project: typing.Optional[int] = OMIT,
282
+ bucket: typing.Optional[str] = OMIT,
283
+ prefix: typing.Optional[str] = OMIT,
284
+ regex_filter: typing.Optional[str] = OMIT,
285
+ use_blob_urls: typing.Optional[bool] = OMIT,
286
+ google_application_credentials: typing.Optional[str] = OMIT,
287
+ google_project_id: typing.Optional[str] = OMIT,
288
+ presign: typing.Optional[bool] = OMIT,
289
+ presign_ttl: typing.Optional[int] = OMIT,
290
+ request_options: typing.Optional[RequestOptions] = None,
291
+ ) -> GcsUpdateResponse:
292
+ """
293
+ Update a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
294
+
295
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
296
+
297
+ Parameters
298
+ ----------
299
+ id : int
300
+ A unique integer value identifying this gcs import storage.
301
+
302
+ project : typing.Optional[int]
303
+ Project ID
304
+
305
+ bucket : typing.Optional[str]
306
+ GCS bucket name
307
+
308
+ prefix : typing.Optional[str]
309
+ GCS bucket prefix
310
+
311
+ regex_filter : typing.Optional[str]
312
+ Cloud storage regex for filtering objects
313
+
314
+ use_blob_urls : typing.Optional[bool]
315
+ Interpret objects as BLOBs and generate URLs
316
+
317
+ google_application_credentials : typing.Optional[str]
318
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
319
+
320
+ google_project_id : typing.Optional[str]
321
+ Google project ID
322
+
323
+ presign : typing.Optional[bool]
324
+ Presign URLs for direct download
325
+
326
+ presign_ttl : typing.Optional[int]
327
+ Presign TTL in minutes
328
+
329
+ request_options : typing.Optional[RequestOptions]
330
+ Request-specific configuration.
331
+
332
+ Returns
333
+ -------
334
+ GcsUpdateResponse
335
+
336
+
337
+ Examples
338
+ --------
339
+ from label_studio_sdk.client import LabelStudio
340
+
341
+ client = LabelStudio(
342
+ api_key="YOUR_API_KEY",
343
+ )
344
+ client.import_storage.gcs.update(
345
+ id=1,
346
+ )
347
+ """
348
+ _response = self._client_wrapper.httpx_client.request(
349
+ f"api/storages/gcs/{jsonable_encoder(id)}",
350
+ method="PATCH",
351
+ json={
352
+ "project": project,
353
+ "bucket": bucket,
354
+ "prefix": prefix,
355
+ "regex_filter": regex_filter,
356
+ "use_blob_urls": use_blob_urls,
357
+ "google_application_credentials": google_application_credentials,
358
+ "google_project_id": google_project_id,
359
+ "presign": presign,
360
+ "presign_ttl": presign_ttl,
361
+ },
362
+ request_options=request_options,
363
+ omit=OMIT,
364
+ )
365
+ if 200 <= _response.status_code < 300:
366
+ return pydantic_v1.parse_obj_as(GcsUpdateResponse, _response.json()) # type: ignore
367
+ try:
368
+ _response_json = _response.json()
369
+ except JSONDecodeError:
370
+ raise ApiError(status_code=_response.status_code, body=_response.text)
371
+ raise ApiError(status_code=_response.status_code, body=_response_json)
372
+
373
+ def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
374
+ """
375
+ Sync tasks from a GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
376
+
377
+ Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
378
+
379
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
380
+
381
+ Parameters
382
+ ----------
383
+ id : int
384
+ Storage ID
385
+
386
+ request_options : typing.Optional[RequestOptions]
387
+ Request-specific configuration.
388
+
389
+ Returns
390
+ -------
391
+ GcsImportStorage
392
+
393
+
394
+ Examples
395
+ --------
396
+ from label_studio_sdk.client import LabelStudio
397
+
398
+ client = LabelStudio(
399
+ api_key="YOUR_API_KEY",
400
+ )
401
+ client.import_storage.gcs.sync(
402
+ id=1,
403
+ )
404
+ """
405
+ _response = self._client_wrapper.httpx_client.request(
406
+ f"api/storages/gcs/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
407
+ )
408
+ if 200 <= _response.status_code < 300:
409
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
410
+ try:
411
+ _response_json = _response.json()
412
+ except JSONDecodeError:
413
+ raise ApiError(status_code=_response.status_code, body=_response.text)
414
+ raise ApiError(status_code=_response.status_code, body=_response_json)
415
+
416
+
417
+ class AsyncGcsClient:
418
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
419
+ self._client_wrapper = client_wrapper
420
+
421
+ async def list(
422
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
423
+ ) -> typing.List[GcsImportStorage]:
424
+ """
425
+ You can connect your Google Cloud Storage bucket to Label Studio as a source storage or target storage. Use this API request to get a list of all Google import (source) storage connections for a specific project.
426
+
427
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
428
+
429
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
430
+
431
+ Parameters
432
+ ----------
433
+ project : typing.Optional[int]
434
+ Project ID
435
+
436
+ request_options : typing.Optional[RequestOptions]
437
+ Request-specific configuration.
438
+
439
+ Returns
440
+ -------
441
+ typing.List[GcsImportStorage]
442
+
443
+
444
+ Examples
445
+ --------
446
+ from label_studio_sdk.client import AsyncLabelStudio
447
+
448
+ client = AsyncLabelStudio(
449
+ api_key="YOUR_API_KEY",
450
+ )
451
+ await client.import_storage.gcs.list()
452
+ """
453
+ _response = await self._client_wrapper.httpx_client.request(
454
+ "api/storages/gcs/", method="GET", params={"project": project}, request_options=request_options
455
+ )
456
+ if 200 <= _response.status_code < 300:
457
+ return pydantic_v1.parse_obj_as(typing.List[GcsImportStorage], _response.json()) # type: ignore
458
+ try:
459
+ _response_json = _response.json()
460
+ except JSONDecodeError:
461
+ raise ApiError(status_code=_response.status_code, body=_response.text)
462
+ raise ApiError(status_code=_response.status_code, body=_response_json)
463
+
464
+ async def create(
465
+ self,
466
+ *,
467
+ project: typing.Optional[int] = OMIT,
468
+ bucket: typing.Optional[str] = OMIT,
469
+ prefix: typing.Optional[str] = OMIT,
470
+ regex_filter: typing.Optional[str] = OMIT,
471
+ use_blob_urls: typing.Optional[bool] = OMIT,
472
+ google_application_credentials: typing.Optional[str] = OMIT,
473
+ google_project_id: typing.Optional[str] = OMIT,
474
+ presign: typing.Optional[bool] = OMIT,
475
+ presign_ttl: typing.Optional[int] = OMIT,
476
+ request_options: typing.Optional[RequestOptions] = None,
477
+ ) -> GcsCreateResponse:
478
+ """
479
+ Create a new source storage connection to a Google Cloud Storage bucket.
480
+
481
+ For information about the required fields and prerequisites, see [Google Cloud Storage](https://labelstud.io/guide/storage#Google-Cloud-Storage) in the Label Studio documentation.
482
+
483
+ <Info>Ensure you configure CORS before adding cloud storage. This ensures you will be able to see the content of the data rather than just a link.</Info>
484
+
485
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be imported until you [sync your connection](sync).</Tip>
486
+
487
+ Parameters
488
+ ----------
489
+ project : typing.Optional[int]
490
+ Project ID
491
+
492
+ bucket : typing.Optional[str]
493
+ GCS bucket name
494
+
495
+ prefix : typing.Optional[str]
496
+ GCS bucket prefix
497
+
498
+ regex_filter : typing.Optional[str]
499
+ Cloud storage regex for filtering objects
500
+
501
+ use_blob_urls : typing.Optional[bool]
502
+ Interpret objects as BLOBs and generate URLs
503
+
504
+ google_application_credentials : typing.Optional[str]
505
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
506
+
507
+ google_project_id : typing.Optional[str]
508
+ Google project ID
509
+
510
+ presign : typing.Optional[bool]
511
+ Presign URLs for direct download
512
+
513
+ presign_ttl : typing.Optional[int]
514
+ Presign TTL in minutes
515
+
516
+ request_options : typing.Optional[RequestOptions]
517
+ Request-specific configuration.
518
+
519
+ Returns
520
+ -------
521
+ GcsCreateResponse
522
+
523
+
524
+ Examples
525
+ --------
526
+ from label_studio_sdk.client import AsyncLabelStudio
527
+
528
+ client = AsyncLabelStudio(
529
+ api_key="YOUR_API_KEY",
530
+ )
531
+ await client.import_storage.gcs.create()
532
+ """
533
+ _response = await self._client_wrapper.httpx_client.request(
534
+ "api/storages/gcs/",
535
+ method="POST",
536
+ json={
537
+ "project": project,
538
+ "bucket": bucket,
539
+ "prefix": prefix,
540
+ "regex_filter": regex_filter,
541
+ "use_blob_urls": use_blob_urls,
542
+ "google_application_credentials": google_application_credentials,
543
+ "google_project_id": google_project_id,
544
+ "presign": presign,
545
+ "presign_ttl": presign_ttl,
546
+ },
547
+ request_options=request_options,
548
+ omit=OMIT,
549
+ )
550
+ if 200 <= _response.status_code < 300:
551
+ return pydantic_v1.parse_obj_as(GcsCreateResponse, _response.json()) # type: ignore
552
+ try:
553
+ _response_json = _response.json()
554
+ except JSONDecodeError:
555
+ raise ApiError(status_code=_response.status_code, body=_response.text)
556
+ raise ApiError(status_code=_response.status_code, body=_response_json)
557
+
558
+ async def validate(self, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
559
+ """
560
+ Validate a specific GCS import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
561
+
562
+ Parameters
563
+ ----------
564
+ request_options : typing.Optional[RequestOptions]
565
+ Request-specific configuration.
566
+
567
+ Returns
568
+ -------
569
+ GcsImportStorage
570
+
571
+
572
+ Examples
573
+ --------
574
+ from label_studio_sdk.client import AsyncLabelStudio
575
+
576
+ client = AsyncLabelStudio(
577
+ api_key="YOUR_API_KEY",
578
+ )
579
+ await client.import_storage.gcs.validate()
580
+ """
581
+ _response = await self._client_wrapper.httpx_client.request(
582
+ "api/storages/gcs/validate", method="POST", request_options=request_options
583
+ )
584
+ if 200 <= _response.status_code < 300:
585
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
586
+ try:
587
+ _response_json = _response.json()
588
+ except JSONDecodeError:
589
+ raise ApiError(status_code=_response.status_code, body=_response.text)
590
+ raise ApiError(status_code=_response.status_code, body=_response_json)
591
+
592
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
593
+ """
594
+ Get a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
595
+
596
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
597
+
598
+ Parameters
599
+ ----------
600
+ id : int
601
+ A unique integer value identifying this gcs import storage.
602
+
603
+ request_options : typing.Optional[RequestOptions]
604
+ Request-specific configuration.
605
+
606
+ Returns
607
+ -------
608
+ GcsImportStorage
609
+
610
+
611
+ Examples
612
+ --------
613
+ from label_studio_sdk.client import AsyncLabelStudio
614
+
615
+ client = AsyncLabelStudio(
616
+ api_key="YOUR_API_KEY",
617
+ )
618
+ await client.import_storage.gcs.get(
619
+ id=1,
620
+ )
621
+ """
622
+ _response = await self._client_wrapper.httpx_client.request(
623
+ f"api/storages/gcs/{jsonable_encoder(id)}", method="GET", request_options=request_options
624
+ )
625
+ if 200 <= _response.status_code < 300:
626
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
627
+ try:
628
+ _response_json = _response.json()
629
+ except JSONDecodeError:
630
+ raise ApiError(status_code=_response.status_code, body=_response.text)
631
+ raise ApiError(status_code=_response.status_code, body=_response_json)
632
+
633
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
634
+ """
635
+ Delete a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
636
+
637
+ Deleting a source storage connection does not affect tasks with synced data in Label Studio. The sync process is designed to import new or updated tasks from the connected storage into the project, but it does not track deletions of files from the storage. Therefore, if you remove the external storage connection, the tasks that were created from that storage will remain in the project.
638
+
639
+ If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
640
+
641
+ Parameters
642
+ ----------
643
+ id : int
644
+ A unique integer value identifying this gcs import storage.
645
+
646
+ request_options : typing.Optional[RequestOptions]
647
+ Request-specific configuration.
648
+
649
+ Returns
650
+ -------
651
+ None
652
+
653
+ Examples
654
+ --------
655
+ from label_studio_sdk.client import AsyncLabelStudio
656
+
657
+ client = AsyncLabelStudio(
658
+ api_key="YOUR_API_KEY",
659
+ )
660
+ await client.import_storage.gcs.delete(
661
+ id=1,
662
+ )
663
+ """
664
+ _response = await self._client_wrapper.httpx_client.request(
665
+ f"api/storages/gcs/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
666
+ )
667
+ if 200 <= _response.status_code < 300:
668
+ return
669
+ try:
670
+ _response_json = _response.json()
671
+ except JSONDecodeError:
672
+ raise ApiError(status_code=_response.status_code, body=_response.text)
673
+ raise ApiError(status_code=_response.status_code, body=_response_json)
674
+
675
+ async def update(
676
+ self,
677
+ id: int,
678
+ *,
679
+ project: typing.Optional[int] = OMIT,
680
+ bucket: typing.Optional[str] = OMIT,
681
+ prefix: typing.Optional[str] = OMIT,
682
+ regex_filter: typing.Optional[str] = OMIT,
683
+ use_blob_urls: typing.Optional[bool] = OMIT,
684
+ google_application_credentials: typing.Optional[str] = OMIT,
685
+ google_project_id: typing.Optional[str] = OMIT,
686
+ presign: typing.Optional[bool] = OMIT,
687
+ presign_ttl: typing.Optional[int] = OMIT,
688
+ request_options: typing.Optional[RequestOptions] = None,
689
+ ) -> GcsUpdateResponse:
690
+ """
691
+ Update a specific GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
692
+
693
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
694
+
695
+ Parameters
696
+ ----------
697
+ id : int
698
+ A unique integer value identifying this gcs import storage.
699
+
700
+ project : typing.Optional[int]
701
+ Project ID
702
+
703
+ bucket : typing.Optional[str]
704
+ GCS bucket name
705
+
706
+ prefix : typing.Optional[str]
707
+ GCS bucket prefix
708
+
709
+ regex_filter : typing.Optional[str]
710
+ Cloud storage regex for filtering objects
711
+
712
+ use_blob_urls : typing.Optional[bool]
713
+ Interpret objects as BLOBs and generate URLs
714
+
715
+ google_application_credentials : typing.Optional[str]
716
+ The content of GOOGLE_APPLICATION_CREDENTIALS json file
717
+
718
+ google_project_id : typing.Optional[str]
719
+ Google project ID
720
+
721
+ presign : typing.Optional[bool]
722
+ Presign URLs for direct download
723
+
724
+ presign_ttl : typing.Optional[int]
725
+ Presign TTL in minutes
726
+
727
+ request_options : typing.Optional[RequestOptions]
728
+ Request-specific configuration.
729
+
730
+ Returns
731
+ -------
732
+ GcsUpdateResponse
733
+
734
+
735
+ Examples
736
+ --------
737
+ from label_studio_sdk.client import AsyncLabelStudio
738
+
739
+ client = AsyncLabelStudio(
740
+ api_key="YOUR_API_KEY",
741
+ )
742
+ await client.import_storage.gcs.update(
743
+ id=1,
744
+ )
745
+ """
746
+ _response = await self._client_wrapper.httpx_client.request(
747
+ f"api/storages/gcs/{jsonable_encoder(id)}",
748
+ method="PATCH",
749
+ json={
750
+ "project": project,
751
+ "bucket": bucket,
752
+ "prefix": prefix,
753
+ "regex_filter": regex_filter,
754
+ "use_blob_urls": use_blob_urls,
755
+ "google_application_credentials": google_application_credentials,
756
+ "google_project_id": google_project_id,
757
+ "presign": presign,
758
+ "presign_ttl": presign_ttl,
759
+ },
760
+ request_options=request_options,
761
+ omit=OMIT,
762
+ )
763
+ if 200 <= _response.status_code < 300:
764
+ return pydantic_v1.parse_obj_as(GcsUpdateResponse, _response.json()) # type: ignore
765
+ try:
766
+ _response_json = _response.json()
767
+ except JSONDecodeError:
768
+ raise ApiError(status_code=_response.status_code, body=_response.text)
769
+ raise ApiError(status_code=_response.status_code, body=_response_json)
770
+
771
+ async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
772
+ """
773
+ Sync tasks from a GCS import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
774
+
775
+ Sync operations with external buckets only go one way. They either create tasks from objects in the bucket (source/import storage) or push annotations to the output bucket (export/target storage). Changing something on the bucket side doesn’t guarantee consistency in results.
776
+
777
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
778
+
779
+ Parameters
780
+ ----------
781
+ id : int
782
+ Storage ID
783
+
784
+ request_options : typing.Optional[RequestOptions]
785
+ Request-specific configuration.
786
+
787
+ Returns
788
+ -------
789
+ GcsImportStorage
790
+
791
+
792
+ Examples
793
+ --------
794
+ from label_studio_sdk.client import AsyncLabelStudio
795
+
796
+ client = AsyncLabelStudio(
797
+ api_key="YOUR_API_KEY",
798
+ )
799
+ await client.import_storage.gcs.sync(
800
+ id=1,
801
+ )
802
+ """
803
+ _response = await self._client_wrapper.httpx_client.request(
804
+ f"api/storages/gcs/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
805
+ )
806
+ if 200 <= _response.status_code < 300:
807
+ return pydantic_v1.parse_obj_as(GcsImportStorage, _response.json()) # type: ignore
808
+ try:
809
+ _response_json = _response.json()
810
+ except JSONDecodeError:
811
+ raise ApiError(status_code=_response.status_code, body=_response.text)
812
+ raise ApiError(status_code=_response.status_code, body=_response_json)