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