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

Potentially problematic release.


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

Files changed (410) hide show
  1. label_studio_sdk/__init__.py +325 -180
  2. label_studio_sdk/actions/__init__.py +4 -0
  3. label_studio_sdk/actions/client.py +46 -10
  4. label_studio_sdk/actions/types/__init__.py +4 -0
  5. label_studio_sdk/actions/types/actions_create_request_filters.py +2 -2
  6. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +2 -2
  7. label_studio_sdk/actions/types/actions_create_request_id.py +7 -7
  8. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +2 -2
  9. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +2 -2
  10. label_studio_sdk/actions/types/actions_list_response_item.py +25 -0
  11. label_studio_sdk/actions/types/actions_list_response_item_dialog.py +22 -0
  12. label_studio_sdk/annotations/__init__.py +2 -2
  13. label_studio_sdk/annotations/client.py +379 -243
  14. label_studio_sdk/annotations/types/__init__.py +4 -2
  15. label_studio_sdk/annotations/types/annotation_bulk_serializer_with_selected_items_request_last_action.py +7 -0
  16. label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +8 -5
  17. label_studio_sdk/base_client.py +28 -24
  18. label_studio_sdk/comments/client.py +378 -140
  19. label_studio_sdk/converter/README.md +207 -0
  20. label_studio_sdk/converter/imports/coco.py +132 -23
  21. label_studio_sdk/core/__init__.py +4 -0
  22. label_studio_sdk/core/unchecked_base_model.py +305 -0
  23. label_studio_sdk/environment.py +1 -1
  24. label_studio_sdk/errors/__init__.py +10 -1
  25. label_studio_sdk/errors/forbidden_error.py +9 -0
  26. label_studio_sdk/errors/method_not_allowed_error.py +9 -0
  27. label_studio_sdk/export_storage/__init__.py +1 -24
  28. label_studio_sdk/export_storage/azure/__init__.py +0 -3
  29. label_studio_sdk/export_storage/azure/client.py +231 -273
  30. label_studio_sdk/export_storage/client.py +5 -5
  31. label_studio_sdk/export_storage/gcs/__init__.py +0 -3
  32. label_studio_sdk/export_storage/gcs/client.py +231 -273
  33. label_studio_sdk/export_storage/local/__init__.py +0 -3
  34. label_studio_sdk/export_storage/local/client.py +211 -253
  35. label_studio_sdk/export_storage/redis/__init__.py +0 -3
  36. label_studio_sdk/export_storage/redis/client.py +239 -281
  37. label_studio_sdk/export_storage/s3/__init__.py +0 -3
  38. label_studio_sdk/export_storage/s3/client.py +254 -296
  39. label_studio_sdk/export_storage/s3s/client.py +694 -210
  40. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +2 -2
  41. label_studio_sdk/files/client.py +52 -71
  42. label_studio_sdk/import_storage/__init__.py +1 -24
  43. label_studio_sdk/import_storage/azure/__init__.py +0 -3
  44. label_studio_sdk/import_storage/azure/client.py +249 -299
  45. label_studio_sdk/import_storage/client.py +5 -5
  46. label_studio_sdk/import_storage/gcs/__init__.py +0 -3
  47. label_studio_sdk/import_storage/gcs/client.py +249 -299
  48. label_studio_sdk/import_storage/local/__init__.py +0 -3
  49. label_studio_sdk/import_storage/local/client.py +211 -257
  50. label_studio_sdk/import_storage/redis/__init__.py +0 -3
  51. label_studio_sdk/import_storage/redis/client.py +239 -285
  52. label_studio_sdk/import_storage/s3/__init__.py +0 -3
  53. label_studio_sdk/import_storage/s3/client.py +274 -324
  54. label_studio_sdk/import_storage/s3s/client.py +728 -434
  55. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +2 -2
  56. label_studio_sdk/jwt_settings/client.py +56 -58
  57. label_studio_sdk/label_interface/control_tags.py +48 -8
  58. label_studio_sdk/label_interface/interface.py +261 -56
  59. label_studio_sdk/ml/__init__.py +2 -16
  60. label_studio_sdk/ml/client.py +196 -179
  61. label_studio_sdk/ml/types/__init__.py +2 -12
  62. label_studio_sdk/ml/types/ml_list_model_versions_response.py +20 -0
  63. label_studio_sdk/model_providers/__init__.py +3 -0
  64. label_studio_sdk/model_providers/client.py +280 -228
  65. label_studio_sdk/model_providers/types/__init__.py +5 -0
  66. label_studio_sdk/{prompts/types/prompts_batch_predictions_response.py → model_providers/types/model_providers_list_model_provider_choices_response.py} +3 -3
  67. label_studio_sdk/organizations/__init__.py +5 -0
  68. label_studio_sdk/organizations/client.py +331 -0
  69. label_studio_sdk/organizations/members/__init__.py +2 -0
  70. label_studio_sdk/organizations/members/client.py +290 -0
  71. label_studio_sdk/predictions/client.py +29 -77
  72. label_studio_sdk/projects/__init__.py +18 -9
  73. label_studio_sdk/projects/client.py +905 -414
  74. label_studio_sdk/projects/exports/__init__.py +2 -2
  75. label_studio_sdk/projects/exports/client.py +336 -396
  76. label_studio_sdk/projects/exports/client_ext.py +30 -30
  77. label_studio_sdk/projects/exports/types/__init__.py +1 -2
  78. label_studio_sdk/projects/exports/types/exports_convert_response.py +5 -9
  79. label_studio_sdk/projects/pauses/client.py +114 -105
  80. label_studio_sdk/projects/stats/__init__.py +5 -0
  81. label_studio_sdk/projects/stats/client.py +175 -0
  82. label_studio_sdk/projects/stats/types/__init__.py +8 -0
  83. label_studio_sdk/projects/stats/types/stats_iaa_response.py +44 -0
  84. label_studio_sdk/projects/stats/types/stats_iaa_response_common_tasks.py +7 -0
  85. label_studio_sdk/projects/stats/types/stats_iaa_response_iaa.py +5 -0
  86. label_studio_sdk/{types/base_task_file_upload.py → projects/stats/types/stats_iaa_response_std.py} +1 -1
  87. label_studio_sdk/projects/types/__init__.py +10 -6
  88. label_studio_sdk/projects/types/lse_project_create_request_sampling.py +7 -0
  89. label_studio_sdk/projects/types/lse_project_create_request_skip_queue.py +7 -0
  90. label_studio_sdk/projects/types/patched_lse_project_update_request_sampling.py +7 -0
  91. label_studio_sdk/projects/types/patched_lse_project_update_request_skip_queue.py +7 -0
  92. label_studio_sdk/{prompts/types/prompts_batch_failed_predictions_response.py → projects/types/projects_duplicate_response.py} +8 -5
  93. label_studio_sdk/projects/types/projects_import_tasks_response.py +2 -2
  94. label_studio_sdk/projects/types/projects_list_request_filter.py +1 -1
  95. label_studio_sdk/prompts/__init__.py +4 -10
  96. label_studio_sdk/prompts/client.py +511 -442
  97. label_studio_sdk/prompts/indicators/__init__.py +3 -0
  98. label_studio_sdk/prompts/indicators/client.py +47 -49
  99. label_studio_sdk/prompts/indicators/types/__init__.py +5 -0
  100. label_studio_sdk/{types/key_indicator_value.py → prompts/indicators/types/indicators_list_response_item.py} +3 -3
  101. label_studio_sdk/prompts/runs/client.py +113 -135
  102. label_studio_sdk/prompts/types/__init__.py +2 -12
  103. label_studio_sdk/prompts/types/prompts_compatible_projects_request_project_type.py +7 -0
  104. label_studio_sdk/prompts/versions/client.py +372 -312
  105. label_studio_sdk/tasks/__init__.py +2 -2
  106. label_studio_sdk/tasks/client.py +514 -213
  107. label_studio_sdk/tasks/types/__init__.py +1 -2
  108. label_studio_sdk/tokens/client.py +160 -152
  109. label_studio_sdk/tokens/client_ext.py +3 -3
  110. label_studio_sdk/types/__init__.py +258 -142
  111. label_studio_sdk/{webhooks/types/webhooks_update_request_actions_item.py → types/actions_enum.py} +4 -1
  112. label_studio_sdk/types/all_roles_project_list.py +197 -0
  113. label_studio_sdk/types/all_roles_project_list_sampling.py +7 -0
  114. label_studio_sdk/types/all_roles_project_list_skip_queue.py +7 -0
  115. label_studio_sdk/types/annotated_enum.py +5 -0
  116. label_studio_sdk/types/annotation.py +24 -10
  117. label_studio_sdk/types/annotation_last_action.py +3 -15
  118. label_studio_sdk/types/{annotations_dm_field.py → annotation_request.py} +21 -30
  119. label_studio_sdk/types/annotation_request_last_action.py +7 -0
  120. label_studio_sdk/types/assignment_settings.py +31 -0
  121. label_studio_sdk/types/assignment_settings_label_stream_task_distribution.py +7 -0
  122. label_studio_sdk/types/assignment_settings_request.py +32 -0
  123. label_studio_sdk/types/assignment_settings_request_label_stream_task_distribution.py +7 -0
  124. label_studio_sdk/types/{key_indicators_item_additional_kpis_item.py → associated_project.py} +9 -6
  125. label_studio_sdk/types/auth_method_enum.py +5 -0
  126. label_studio_sdk/types/azure_blob_export_storage.py +8 -12
  127. label_studio_sdk/types/azure_blob_import_storage.py +8 -12
  128. label_studio_sdk/types/{prompt_associated_projects_item_id.py → batch_failed_predictions.py} +4 -4
  129. label_studio_sdk/types/{access_token_response.py → batch_predictions.py} +6 -8
  130. label_studio_sdk/types/blank_enum.py +5 -0
  131. label_studio_sdk/types/{key_indicators_item_extra_kpis_item.py → blueprint_list.py} +12 -6
  132. label_studio_sdk/types/budget_reset_period_enum.py +5 -0
  133. label_studio_sdk/types/child_filter.py +44 -0
  134. label_studio_sdk/types/comment.py +39 -14
  135. label_studio_sdk/types/comment_request.py +32 -0
  136. label_studio_sdk/types/comment_serializer_with_expanded_user.py +53 -0
  137. label_studio_sdk/types/converted_format.py +5 -5
  138. label_studio_sdk/types/{api_token_response.py → converted_format_request.py} +8 -15
  139. label_studio_sdk/types/custom_scripts_editable_by_enum.py +5 -0
  140. label_studio_sdk/types/default_role_enum.py +5 -0
  141. label_studio_sdk/types/edition_enum.py +5 -0
  142. label_studio_sdk/types/export.py +7 -7
  143. label_studio_sdk/types/file_upload.py +5 -5
  144. label_studio_sdk/types/filter.py +9 -6
  145. label_studio_sdk/types/filter_group.py +3 -3
  146. label_studio_sdk/types/finished_enum.py +5 -0
  147. label_studio_sdk/types/gcs_export_storage.py +8 -12
  148. label_studio_sdk/types/gcs_import_storage.py +8 -12
  149. label_studio_sdk/types/{rotate_token_response.py → hotkeys.py} +5 -8
  150. label_studio_sdk/types/{base_task.py → import_api_request.py} +11 -34
  151. label_studio_sdk/types/inference_run_cost_estimate.py +2 -2
  152. label_studio_sdk/types/label_stream_task_distribution_enum.py +5 -0
  153. label_studio_sdk/types/{annotations_dm_field_last_action.py → last_action_enum.py} +1 -1
  154. label_studio_sdk/types/local_files_export_storage.py +8 -12
  155. label_studio_sdk/types/local_files_import_storage.py +8 -12
  156. label_studio_sdk/types/{annotation_filter_options.py → lse_annotation_filter_options.py} +12 -2
  157. label_studio_sdk/types/lse_annotation_filter_options_request.py +42 -0
  158. label_studio_sdk/types/lse_annotation_filter_options_request_reviewed.py +7 -0
  159. label_studio_sdk/types/lse_annotation_filter_options_reviewed.py +7 -0
  160. label_studio_sdk/types/{export_snapshot.py → lse_export_create.py} +11 -11
  161. label_studio_sdk/types/lse_fields.py +49 -0
  162. label_studio_sdk/types/lse_fields_onboarding_state.py +8 -0
  163. label_studio_sdk/types/lse_fields_trial_role.py +8 -0
  164. label_studio_sdk/types/lse_key_indicator_value.py +35 -0
  165. label_studio_sdk/types/lse_organization.py +57 -0
  166. label_studio_sdk/types/lse_organization_custom_scripts_editable_by.py +7 -0
  167. label_studio_sdk/types/lse_project_create.py +196 -0
  168. label_studio_sdk/types/lse_project_create_sampling.py +7 -0
  169. label_studio_sdk/types/lse_project_create_skip_queue.py +7 -0
  170. label_studio_sdk/types/lse_project_update.py +215 -0
  171. label_studio_sdk/types/lse_project_update_sampling.py +7 -0
  172. label_studio_sdk/types/lse_project_update_skip_queue.py +7 -0
  173. label_studio_sdk/types/lse_s3export_storage.py +134 -0
  174. label_studio_sdk/{import_storage/s3/types/s3create_response.py → types/lse_s3export_storage_request.py} +47 -21
  175. label_studio_sdk/{import_storage/s3/types/s3update_response.py → types/lse_s3import_storage.py} +60 -21
  176. label_studio_sdk/types/{s3s_import_storage.py → lse_s3import_storage_request.py} +32 -21
  177. label_studio_sdk/types/lse_task.py +117 -0
  178. label_studio_sdk/types/{data_manager_task_serializer_drafts_item.py → lse_task_drafts_item.py} +2 -2
  179. label_studio_sdk/types/lse_task_filter_options.py +63 -0
  180. label_studio_sdk/types/lse_task_filter_options_annotated.py +7 -0
  181. label_studio_sdk/types/lse_task_filter_options_finished.py +7 -0
  182. label_studio_sdk/types/lse_task_filter_options_request.py +63 -0
  183. label_studio_sdk/types/lse_task_filter_options_request_annotated.py +7 -0
  184. label_studio_sdk/types/lse_task_filter_options_request_finished.py +7 -0
  185. label_studio_sdk/types/lse_task_filter_options_request_reviewed.py +7 -0
  186. label_studio_sdk/types/lse_task_filter_options_request_skipped.py +7 -0
  187. label_studio_sdk/types/lse_task_filter_options_reviewed.py +7 -0
  188. label_studio_sdk/types/lse_task_filter_options_skipped.py +7 -0
  189. label_studio_sdk/types/{data_manager_task_serializer_predictions_item.py → lse_task_predictions_item.py} +4 -5
  190. label_studio_sdk/types/lse_task_serializer_for_annotators.py +54 -0
  191. label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +22 -0
  192. label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +28 -0
  193. label_studio_sdk/types/lse_task_serializer_for_reviewers.py +117 -0
  194. label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +22 -0
  195. label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +28 -0
  196. label_studio_sdk/types/lse_user.py +49 -0
  197. label_studio_sdk/types/{base_user.py → lse_user_api.py} +17 -6
  198. label_studio_sdk/types/lseapi_token_create.py +21 -0
  199. label_studio_sdk/types/lseapi_token_list.py +21 -0
  200. label_studio_sdk/types/lsejwt_settings.py +32 -0
  201. label_studio_sdk/types/maybe_expanded_comment.py +7 -0
  202. label_studio_sdk/types/ml_backend.py +16 -17
  203. label_studio_sdk/types/mode_enum.py +5 -0
  204. label_studio_sdk/types/model_interface.py +44 -0
  205. label_studio_sdk/types/model_interface_request.py +40 -0
  206. label_studio_sdk/types/model_interface_serializer_get.py +45 -0
  207. label_studio_sdk/types/model_provider_connection.py +48 -17
  208. label_studio_sdk/types/model_provider_connection_budget_reset_period.py +3 -1
  209. label_studio_sdk/types/model_provider_connection_request.py +71 -0
  210. label_studio_sdk/types/model_run.py +40 -0
  211. label_studio_sdk/types/{inference_run_status.py → model_run_status_enum.py} +1 -1
  212. label_studio_sdk/types/null_enum.py +3 -0
  213. label_studio_sdk/types/onboarding_state_enum.py +7 -0
  214. label_studio_sdk/types/organization_billing.py +20 -0
  215. label_studio_sdk/types/organization_id.py +28 -0
  216. label_studio_sdk/types/organization_invite.py +20 -0
  217. label_studio_sdk/types/organization_member.py +37 -0
  218. label_studio_sdk/types/organization_membership.py +24 -0
  219. label_studio_sdk/{projects/types/projects_list_response.py → types/paginated_all_roles_project_list_list.py} +5 -5
  220. label_studio_sdk/types/{jwt_settings_response.py → paginated_role_based_task_list.py} +11 -9
  221. label_studio_sdk/types/pause.py +55 -14
  222. label_studio_sdk/types/pause_request.py +41 -0
  223. label_studio_sdk/types/prediction.py +7 -11
  224. label_studio_sdk/types/prediction_request.py +56 -0
  225. label_studio_sdk/types/project.py +32 -39
  226. label_studio_sdk/types/project_import.py +12 -13
  227. label_studio_sdk/types/project_label_config.py +2 -2
  228. label_studio_sdk/types/project_label_config_request.py +22 -0
  229. label_studio_sdk/types/project_sampling.py +3 -3
  230. label_studio_sdk/types/project_skip_queue.py +3 -1
  231. label_studio_sdk/types/project_subset_enum.py +5 -0
  232. label_studio_sdk/types/{prompt_version_provider.py → provider_enum.py} +1 -1
  233. label_studio_sdk/types/reason_enum.py +7 -0
  234. label_studio_sdk/types/redis_export_storage.py +8 -12
  235. label_studio_sdk/types/redis_import_storage.py +8 -12
  236. label_studio_sdk/types/refined_prompt_response.py +5 -6
  237. label_studio_sdk/types/requeue_rejected_tasks_mode_enum.py +5 -0
  238. label_studio_sdk/types/review_criteria_enum.py +5 -0
  239. label_studio_sdk/types/review_settings.py +80 -0
  240. label_studio_sdk/types/review_settings_request.py +80 -0
  241. label_studio_sdk/types/review_settings_request_requeue_rejected_tasks_mode.py +8 -0
  242. label_studio_sdk/types/review_settings_request_review_criteria.py +7 -0
  243. label_studio_sdk/types/review_settings_requeue_rejected_tasks_mode.py +8 -0
  244. label_studio_sdk/types/review_settings_review_criteria.py +7 -0
  245. label_studio_sdk/types/reviewed_enum.py +5 -0
  246. label_studio_sdk/types/role_based_task.py +8 -0
  247. label_studio_sdk/types/s3export_storage.py +8 -12
  248. label_studio_sdk/types/s3import_storage.py +8 -12
  249. label_studio_sdk/types/sampling_enum.py +7 -0
  250. label_studio_sdk/types/scope_enum.py +5 -0
  251. label_studio_sdk/types/selected_items_request.py +23 -0
  252. label_studio_sdk/types/serialization_option.py +2 -6
  253. label_studio_sdk/types/serialization_option_request.py +22 -0
  254. label_studio_sdk/types/serialization_options.py +17 -5
  255. label_studio_sdk/types/serialization_options_request.py +47 -0
  256. label_studio_sdk/types/skill_name_enum.py +5 -0
  257. label_studio_sdk/types/skip_queue_enum.py +5 -0
  258. label_studio_sdk/types/skipped_enum.py +5 -0
  259. label_studio_sdk/types/state_enum.py +5 -0
  260. label_studio_sdk/types/status7bf_enum.py +5 -0
  261. label_studio_sdk/types/{azure_blob_import_storage_status.py → status_c5a_enum.py} +2 -2
  262. label_studio_sdk/types/third_party_model_version.py +65 -0
  263. label_studio_sdk/types/third_party_model_version_request.py +54 -0
  264. label_studio_sdk/types/token_refresh_response.py +19 -0
  265. label_studio_sdk/types/token_rotate_response.py +19 -0
  266. label_studio_sdk/types/trial_role_enum.py +16 -0
  267. label_studio_sdk/types/user_simple.py +8 -5
  268. label_studio_sdk/types/user_simple_request.py +28 -0
  269. label_studio_sdk/types/version_response.py +49 -0
  270. label_studio_sdk/types/view.py +8 -15
  271. label_studio_sdk/types/webhook.py +9 -13
  272. label_studio_sdk/types/webhook_serializer_for_update.py +15 -13
  273. label_studio_sdk/types/workspace.py +14 -34
  274. label_studio_sdk/types/workspace_member_create.py +27 -0
  275. label_studio_sdk/types/workspace_member_list.py +24 -0
  276. label_studio_sdk/users/client.py +604 -87
  277. label_studio_sdk/users/types/users_get_token_response.py +4 -11
  278. label_studio_sdk/users/types/users_reset_token_response.py +4 -11
  279. label_studio_sdk/versions/__init__.py +0 -3
  280. label_studio_sdk/versions/client.py +14 -14
  281. label_studio_sdk/views/client.py +227 -141
  282. label_studio_sdk/views/types/views_create_request_data.py +2 -2
  283. label_studio_sdk/views/types/views_create_request_data_filters.py +2 -2
  284. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +2 -2
  285. label_studio_sdk/views/types/views_update_request_data.py +2 -2
  286. label_studio_sdk/views/types/views_update_request_data_filters.py +2 -2
  287. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +2 -2
  288. label_studio_sdk/webhooks/__init__.py +36 -2
  289. label_studio_sdk/webhooks/client.py +173 -367
  290. label_studio_sdk/webhooks/types/__init__.py +34 -2
  291. label_studio_sdk/webhooks/types/webhooks_info_response.py +80 -0
  292. label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +24 -0
  293. label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +24 -0
  294. label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +24 -0
  295. label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +24 -0
  296. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +24 -0
  297. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +24 -0
  298. label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +24 -0
  299. label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +24 -0
  300. label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +24 -0
  301. label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +24 -0
  302. label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +24 -0
  303. label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +24 -0
  304. label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +24 -0
  305. label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +24 -0
  306. label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +24 -0
  307. label_studio_sdk/workspaces/__init__.py +1 -2
  308. label_studio_sdk/workspaces/client.py +97 -117
  309. label_studio_sdk/workspaces/members/__init__.py +0 -3
  310. label_studio_sdk/workspaces/members/client.py +65 -81
  311. {label_studio_sdk-1.0.19.dist-info → label_studio_sdk-2.0.0.dist-info}/METADATA +1 -1
  312. label_studio_sdk-2.0.0.dist-info/RECORD +424 -0
  313. {label_studio_sdk-1.0.19.dist-info → label_studio_sdk-2.0.0.dist-info}/WHEEL +1 -1
  314. label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +0 -34
  315. label_studio_sdk/export_storage/azure/types/__init__.py +0 -6
  316. label_studio_sdk/export_storage/azure/types/azure_create_response.py +0 -57
  317. label_studio_sdk/export_storage/azure/types/azure_update_response.py +0 -57
  318. label_studio_sdk/export_storage/gcs/types/__init__.py +0 -6
  319. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +0 -57
  320. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +0 -57
  321. label_studio_sdk/export_storage/local/types/__init__.py +0 -6
  322. label_studio_sdk/export_storage/local/types/local_create_response.py +0 -47
  323. label_studio_sdk/export_storage/local/types/local_update_response.py +0 -47
  324. label_studio_sdk/export_storage/redis/types/__init__.py +0 -6
  325. label_studio_sdk/export_storage/redis/types/redis_create_response.py +0 -62
  326. label_studio_sdk/export_storage/redis/types/redis_update_response.py +0 -62
  327. label_studio_sdk/export_storage/s3/types/__init__.py +0 -6
  328. label_studio_sdk/export_storage/s3/types/s3create_response.py +0 -81
  329. label_studio_sdk/export_storage/s3/types/s3update_response.py +0 -81
  330. label_studio_sdk/import_storage/azure/types/__init__.py +0 -6
  331. label_studio_sdk/import_storage/azure/types/azure_create_response.py +0 -72
  332. label_studio_sdk/import_storage/azure/types/azure_update_response.py +0 -72
  333. label_studio_sdk/import_storage/gcs/types/__init__.py +0 -6
  334. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +0 -72
  335. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +0 -72
  336. label_studio_sdk/import_storage/local/types/__init__.py +0 -6
  337. label_studio_sdk/import_storage/local/types/local_create_response.py +0 -47
  338. label_studio_sdk/import_storage/local/types/local_update_response.py +0 -47
  339. label_studio_sdk/import_storage/redis/types/__init__.py +0 -6
  340. label_studio_sdk/import_storage/redis/types/redis_create_response.py +0 -62
  341. label_studio_sdk/import_storage/redis/types/redis_update_response.py +0 -62
  342. label_studio_sdk/import_storage/s3/types/__init__.py +0 -6
  343. label_studio_sdk/ml/types/ml_create_response.py +0 -68
  344. label_studio_sdk/ml/types/ml_create_response_auth_method.py +0 -5
  345. label_studio_sdk/ml/types/ml_update_response.py +0 -68
  346. label_studio_sdk/ml/types/ml_update_response_auth_method.py +0 -5
  347. label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +0 -44
  348. label_studio_sdk/projects/types/projects_create_response.py +0 -91
  349. label_studio_sdk/projects/types/projects_update_response.py +0 -96
  350. label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +0 -32
  351. label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +0 -59
  352. label_studio_sdk/tasks/types/tasks_list_response.py +0 -38
  353. label_studio_sdk/types/annotation_completed_by.py +0 -6
  354. label_studio_sdk/types/azure_blob_export_storage_status.py +0 -7
  355. label_studio_sdk/types/base_task_updated_by.py +0 -7
  356. label_studio_sdk/types/comment_created_by.py +0 -5
  357. label_studio_sdk/types/converted_format_status.py +0 -5
  358. label_studio_sdk/types/data_manager_task_serializer.py +0 -118
  359. label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +0 -5
  360. label_studio_sdk/types/data_manager_task_serializer_comment_authors_item.py +0 -5
  361. label_studio_sdk/types/data_manager_task_serializer_predictions_item_model_run.py +0 -5
  362. label_studio_sdk/types/export_format.py +0 -25
  363. label_studio_sdk/types/export_snapshot_status.py +0 -5
  364. label_studio_sdk/types/export_status.py +0 -5
  365. label_studio_sdk/types/gcs_export_storage_status.py +0 -7
  366. label_studio_sdk/types/gcs_import_storage_status.py +0 -7
  367. label_studio_sdk/types/inference_run.py +0 -34
  368. label_studio_sdk/types/inference_run_created_by.py +0 -5
  369. label_studio_sdk/types/inference_run_organization.py +0 -5
  370. label_studio_sdk/types/inference_run_project_subset.py +0 -5
  371. label_studio_sdk/types/key_indicators.py +0 -6
  372. label_studio_sdk/types/key_indicators_item.py +0 -41
  373. label_studio_sdk/types/local_files_export_storage_status.py +0 -7
  374. label_studio_sdk/types/local_files_import_storage_status.py +0 -7
  375. label_studio_sdk/types/ml_backend_auth_method.py +0 -5
  376. label_studio_sdk/types/ml_backend_state.py +0 -5
  377. label_studio_sdk/types/model_provider_connection_created_by.py +0 -5
  378. label_studio_sdk/types/model_provider_connection_organization.py +0 -5
  379. label_studio_sdk/types/model_provider_connection_provider.py +0 -7
  380. label_studio_sdk/types/model_provider_connection_scope.py +0 -5
  381. label_studio_sdk/types/pause_paused_by.py +0 -5
  382. label_studio_sdk/types/project_import_status.py +0 -5
  383. label_studio_sdk/types/prompt.py +0 -71
  384. label_studio_sdk/types/prompt_associated_projects_item.py +0 -6
  385. label_studio_sdk/types/prompt_created_by.py +0 -5
  386. label_studio_sdk/types/prompt_organization.py +0 -5
  387. label_studio_sdk/types/prompt_version.py +0 -32
  388. label_studio_sdk/types/prompt_version_created_by.py +0 -5
  389. label_studio_sdk/types/prompt_version_organization.py +0 -5
  390. label_studio_sdk/types/redis_export_storage_status.py +0 -7
  391. label_studio_sdk/types/redis_import_storage_status.py +0 -7
  392. label_studio_sdk/types/refined_prompt_response_refinement_status.py +0 -7
  393. label_studio_sdk/types/s3export_storage_status.py +0 -7
  394. label_studio_sdk/types/s3import_storage_status.py +0 -7
  395. label_studio_sdk/types/s3s_export_storage.py +0 -73
  396. label_studio_sdk/types/s3s_import_storage_status.py +0 -7
  397. label_studio_sdk/types/task.py +0 -156
  398. label_studio_sdk/types/task_annotators_item.py +0 -5
  399. label_studio_sdk/types/task_comment_authors_item.py +0 -5
  400. label_studio_sdk/types/task_filter_options.py +0 -39
  401. label_studio_sdk/types/webhook_actions_item.py +0 -21
  402. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +0 -21
  403. label_studio_sdk/versions/types/__init__.py +0 -6
  404. label_studio_sdk/versions/types/versions_get_response.py +0 -73
  405. label_studio_sdk/versions/types/versions_get_response_edition.py +0 -5
  406. label_studio_sdk/workspaces/members/types/__init__.py +0 -6
  407. label_studio_sdk/workspaces/members/types/members_create_response.py +0 -22
  408. label_studio_sdk/workspaces/members/types/members_list_response_item.py +0 -22
  409. label_studio_sdk-1.0.19.dist-info/RECORD +0 -374
  410. {label_studio_sdk-1.0.19.dist-info → label_studio_sdk-2.0.0.dist-info}/LICENSE +0 -0
@@ -4,12 +4,10 @@ import typing
4
4
  from ...core.client_wrapper import SyncClientWrapper
5
5
  from ...core.request_options import RequestOptions
6
6
  from ...types.s3import_storage import S3ImportStorage
7
- from ...core.pydantic_utilities import parse_obj_as
7
+ from ...core.unchecked_base_model import construct_type
8
8
  from json.decoder import JSONDecodeError
9
9
  from ...core.api_error import ApiError
10
- from .types.s3create_response import S3CreateResponse
11
10
  from ...core.jsonable_encoder import jsonable_encoder
12
- from .types.s3update_response import S3UpdateResponse
13
11
  from ...core.client_wrapper import AsyncClientWrapper
14
12
 
15
13
  # this is used as the default value for optional parameters
@@ -21,18 +19,20 @@ class S3Client:
21
19
  self._client_wrapper = client_wrapper
22
20
 
23
21
  def list(
24
- self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
22
+ self,
23
+ *,
24
+ ordering: typing.Optional[str] = None,
25
+ project: typing.Optional[int] = None,
26
+ request_options: typing.Optional[RequestOptions] = None,
25
27
  ) -> typing.List[S3ImportStorage]:
26
28
  """
27
-
28
- You can connect your S3 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.
29
-
30
- 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).
31
-
32
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
29
+ Get a list of all S3 import storage connections.
33
30
 
34
31
  Parameters
35
32
  ----------
33
+ ordering : typing.Optional[str]
34
+ Which field to use when ordering the results.
35
+
36
36
  project : typing.Optional[int]
37
37
  Project ID
38
38
 
@@ -57,6 +57,7 @@ class S3Client:
57
57
  "api/storages/s3/",
58
58
  method="GET",
59
59
  params={
60
+ "ordering": ordering,
60
61
  "project": project,
61
62
  },
62
63
  request_options=request_options,
@@ -65,7 +66,7 @@ class S3Client:
65
66
  if 200 <= _response.status_code < 300:
66
67
  return typing.cast(
67
68
  typing.List[S3ImportStorage],
68
- parse_obj_as(
69
+ construct_type(
69
70
  type_=typing.List[S3ImportStorage], # type: ignore
70
71
  object_=_response.json(),
71
72
  ),
@@ -95,16 +96,9 @@ class S3Client:
95
96
  region_name: typing.Optional[str] = OMIT,
96
97
  s3endpoint: typing.Optional[str] = OMIT,
97
98
  request_options: typing.Optional[RequestOptions] = None,
98
- ) -> S3CreateResponse:
99
+ ) -> S3ImportStorage:
99
100
  """
100
-
101
- Create a new source storage connection to a S3 bucket.
102
-
103
- For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
104
-
105
- <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>
106
-
107
- <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>
101
+ Create new S3 import storage
108
102
 
109
103
  Parameters
110
104
  ----------
@@ -161,7 +155,7 @@ class S3Client:
161
155
 
162
156
  Returns
163
157
  -------
164
- S3CreateResponse
158
+ S3ImportStorage
165
159
 
166
160
 
167
161
  Examples
@@ -203,9 +197,9 @@ class S3Client:
203
197
  try:
204
198
  if 200 <= _response.status_code < 300:
205
199
  return typing.cast(
206
- S3CreateResponse,
207
- parse_obj_as(
208
- type_=S3CreateResponse, # type: ignore
200
+ S3ImportStorage,
201
+ construct_type(
202
+ type_=S3ImportStorage, # type: ignore
209
203
  object_=_response.json(),
210
204
  ),
211
205
  )
@@ -214,148 +208,13 @@ class S3Client:
214
208
  raise ApiError(status_code=_response.status_code, body=_response.text)
215
209
  raise ApiError(status_code=_response.status_code, body=_response_json)
216
210
 
217
- def validate(
218
- self,
219
- *,
220
- id: typing.Optional[int] = OMIT,
221
- regex_filter: typing.Optional[str] = OMIT,
222
- use_blob_urls: typing.Optional[bool] = OMIT,
223
- presign: typing.Optional[bool] = OMIT,
224
- presign_ttl: typing.Optional[int] = OMIT,
225
- recursive_scan: typing.Optional[bool] = OMIT,
226
- title: typing.Optional[str] = OMIT,
227
- description: typing.Optional[str] = OMIT,
228
- project: typing.Optional[int] = OMIT,
229
- bucket: typing.Optional[str] = OMIT,
230
- prefix: typing.Optional[str] = OMIT,
231
- aws_access_key_id: typing.Optional[str] = OMIT,
232
- aws_secret_access_key: typing.Optional[str] = OMIT,
233
- aws_session_token: typing.Optional[str] = OMIT,
234
- aws_sse_kms_key_id: typing.Optional[str] = OMIT,
235
- region_name: typing.Optional[str] = OMIT,
236
- s3endpoint: typing.Optional[str] = OMIT,
237
- request_options: typing.Optional[RequestOptions] = None,
238
- ) -> None:
239
- """
240
-
241
- Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
242
-
243
- Parameters
244
- ----------
245
- id : typing.Optional[int]
246
- Storage ID. If set, storage with specified ID will be updated
247
-
248
- regex_filter : typing.Optional[str]
249
- Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
250
-
251
- use_blob_urls : typing.Optional[bool]
252
- Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
253
-
254
- presign : typing.Optional[bool]
255
- Presign URLs for download
256
-
257
- presign_ttl : typing.Optional[int]
258
- Presign TTL in minutes
259
-
260
- recursive_scan : typing.Optional[bool]
261
- Scan recursively
262
-
263
- title : typing.Optional[str]
264
- Storage title
265
-
266
- description : typing.Optional[str]
267
- Storage description
268
-
269
- project : typing.Optional[int]
270
- Project ID
271
-
272
- bucket : typing.Optional[str]
273
- S3 bucket name
274
-
275
- prefix : typing.Optional[str]
276
- S3 bucket prefix
277
-
278
- aws_access_key_id : typing.Optional[str]
279
- AWS_ACCESS_KEY_ID
280
-
281
- aws_secret_access_key : typing.Optional[str]
282
- AWS_SECRET_ACCESS_KEY
283
-
284
- aws_session_token : typing.Optional[str]
285
- AWS_SESSION_TOKEN
286
-
287
- aws_sse_kms_key_id : typing.Optional[str]
288
- AWS SSE KMS Key ID
289
-
290
- region_name : typing.Optional[str]
291
- AWS Region
292
-
293
- s3endpoint : typing.Optional[str]
294
- S3 Endpoint
295
-
296
- request_options : typing.Optional[RequestOptions]
297
- Request-specific configuration.
298
-
299
- Returns
300
- -------
301
- None
302
-
303
- Examples
304
- --------
305
- from label_studio_sdk import LabelStudio
306
-
307
- client = LabelStudio(
308
- api_key="YOUR_API_KEY",
309
- )
310
- client.import_storage.s3.validate()
311
- """
312
- _response = self._client_wrapper.httpx_client.request(
313
- "api/storages/s3/validate",
314
- method="POST",
315
- json={
316
- "id": id,
317
- "regex_filter": regex_filter,
318
- "use_blob_urls": use_blob_urls,
319
- "presign": presign,
320
- "presign_ttl": presign_ttl,
321
- "recursive_scan": recursive_scan,
322
- "title": title,
323
- "description": description,
324
- "project": project,
325
- "bucket": bucket,
326
- "prefix": prefix,
327
- "aws_access_key_id": aws_access_key_id,
328
- "aws_secret_access_key": aws_secret_access_key,
329
- "aws_session_token": aws_session_token,
330
- "aws_sse_kms_key_id": aws_sse_kms_key_id,
331
- "region_name": region_name,
332
- "s3_endpoint": s3endpoint,
333
- },
334
- headers={
335
- "content-type": "application/json",
336
- },
337
- request_options=request_options,
338
- omit=OMIT,
339
- )
340
- try:
341
- if 200 <= _response.status_code < 300:
342
- return
343
- _response_json = _response.json()
344
- except JSONDecodeError:
345
- raise ApiError(status_code=_response.status_code, body=_response.text)
346
- raise ApiError(status_code=_response.status_code, body=_response_json)
347
-
348
211
  def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
349
212
  """
350
-
351
- Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
352
-
353
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
213
+ Get a specific S3 import storage connection.
354
214
 
355
215
  Parameters
356
216
  ----------
357
217
  id : int
358
- A unique integer value identifying this s3 import storage.
359
218
 
360
219
  request_options : typing.Optional[RequestOptions]
361
220
  Request-specific configuration.
@@ -385,7 +244,7 @@ class S3Client:
385
244
  if 200 <= _response.status_code < 300:
386
245
  return typing.cast(
387
246
  S3ImportStorage,
388
- parse_obj_as(
247
+ construct_type(
389
248
  type_=S3ImportStorage, # type: ignore
390
249
  object_=_response.json(),
391
250
  ),
@@ -397,17 +256,11 @@ class S3Client:
397
256
 
398
257
  def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
399
258
  """
400
-
401
- Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
402
-
403
- 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.
404
-
405
- 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.
259
+ Delete a specific S3 import storage connection.
406
260
 
407
261
  Parameters
408
262
  ----------
409
263
  id : int
410
- A unique integer value identifying this s3 import storage.
411
264
 
412
265
  request_options : typing.Optional[RequestOptions]
413
266
  Request-specific configuration.
@@ -461,17 +314,13 @@ class S3Client:
461
314
  region_name: typing.Optional[str] = OMIT,
462
315
  s3endpoint: typing.Optional[str] = OMIT,
463
316
  request_options: typing.Optional[RequestOptions] = None,
464
- ) -> S3UpdateResponse:
317
+ ) -> S3ImportStorage:
465
318
  """
466
-
467
- Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
468
-
469
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
319
+ Update a specific S3 import storage connection.
470
320
 
471
321
  Parameters
472
322
  ----------
473
323
  id : int
474
- A unique integer value identifying this s3 import storage.
475
324
 
476
325
  regex_filter : typing.Optional[str]
477
326
  Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
@@ -526,7 +375,7 @@ class S3Client:
526
375
 
527
376
  Returns
528
377
  -------
529
- S3UpdateResponse
378
+ S3ImportStorage
530
379
 
531
380
 
532
381
  Examples
@@ -570,9 +419,9 @@ class S3Client:
570
419
  try:
571
420
  if 200 <= _response.status_code < 300:
572
421
  return typing.cast(
573
- S3UpdateResponse,
574
- parse_obj_as(
575
- type_=S3UpdateResponse, # type: ignore
422
+ S3ImportStorage,
423
+ construct_type(
424
+ type_=S3ImportStorage, # type: ignore
576
425
  object_=_response.json(),
577
426
  ),
578
427
  )
@@ -583,12 +432,7 @@ class S3Client:
583
432
 
584
433
  def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
585
434
  """
586
-
587
- Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
588
-
589
- 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.
590
-
591
- <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>
435
+ Sync tasks from an S3 import storage connection.
592
436
 
593
437
  Parameters
594
438
  ----------
@@ -623,7 +467,7 @@ class S3Client:
623
467
  if 200 <= _response.status_code < 300:
624
468
  return typing.cast(
625
469
  S3ImportStorage,
626
- parse_obj_as(
470
+ construct_type(
627
471
  type_=S3ImportStorage, # type: ignore
628
472
  object_=_response.json(),
629
473
  ),
@@ -633,77 +477,10 @@ class S3Client:
633
477
  raise ApiError(status_code=_response.status_code, body=_response.text)
634
478
  raise ApiError(status_code=_response.status_code, body=_response_json)
635
479
 
636
-
637
- class AsyncS3Client:
638
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
639
- self._client_wrapper = client_wrapper
640
-
641
- async def list(
642
- self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
643
- ) -> typing.List[S3ImportStorage]:
644
- """
645
-
646
- You can connect your S3 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.
647
-
648
- 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).
649
-
650
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
651
-
652
- Parameters
653
- ----------
654
- project : typing.Optional[int]
655
- Project ID
656
-
657
- request_options : typing.Optional[RequestOptions]
658
- Request-specific configuration.
659
-
660
- Returns
661
- -------
662
- typing.List[S3ImportStorage]
663
-
664
-
665
- Examples
666
- --------
667
- import asyncio
668
-
669
- from label_studio_sdk import AsyncLabelStudio
670
-
671
- client = AsyncLabelStudio(
672
- api_key="YOUR_API_KEY",
673
- )
674
-
675
-
676
- async def main() -> None:
677
- await client.import_storage.s3.list()
678
-
679
-
680
- asyncio.run(main())
681
- """
682
- _response = await self._client_wrapper.httpx_client.request(
683
- "api/storages/s3/",
684
- method="GET",
685
- params={
686
- "project": project,
687
- },
688
- request_options=request_options,
689
- )
690
- try:
691
- if 200 <= _response.status_code < 300:
692
- return typing.cast(
693
- typing.List[S3ImportStorage],
694
- parse_obj_as(
695
- type_=typing.List[S3ImportStorage], # type: ignore
696
- object_=_response.json(),
697
- ),
698
- )
699
- _response_json = _response.json()
700
- except JSONDecodeError:
701
- raise ApiError(status_code=_response.status_code, body=_response.text)
702
- raise ApiError(status_code=_response.status_code, body=_response_json)
703
-
704
- async def create(
480
+ def validate(
705
481
  self,
706
482
  *,
483
+ id: typing.Optional[int] = OMIT,
707
484
  regex_filter: typing.Optional[str] = OMIT,
708
485
  use_blob_urls: typing.Optional[bool] = OMIT,
709
486
  presign: typing.Optional[bool] = OMIT,
@@ -721,19 +498,15 @@ class AsyncS3Client:
721
498
  region_name: typing.Optional[str] = OMIT,
722
499
  s3endpoint: typing.Optional[str] = OMIT,
723
500
  request_options: typing.Optional[RequestOptions] = None,
724
- ) -> S3CreateResponse:
501
+ ) -> None:
725
502
  """
726
-
727
- Create a new source storage connection to a S3 bucket.
728
-
729
- For information about the required fields and prerequisites, see [Amazon S3](https://labelstud.io/guide/storage#Amazon-S3) in the Label Studio documentation.
730
-
731
- <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>
732
-
733
- <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>
503
+ Validate a specific S3 import storage connection.
734
504
 
735
505
  Parameters
736
506
  ----------
507
+ id : typing.Optional[int]
508
+ Storage ID. If set, storage with specified ID will be updated
509
+
737
510
  regex_filter : typing.Optional[str]
738
511
  Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
739
512
 
@@ -787,30 +560,22 @@ class AsyncS3Client:
787
560
 
788
561
  Returns
789
562
  -------
790
- S3CreateResponse
791
-
563
+ None
792
564
 
793
565
  Examples
794
566
  --------
795
- import asyncio
796
-
797
- from label_studio_sdk import AsyncLabelStudio
567
+ from label_studio_sdk import LabelStudio
798
568
 
799
- client = AsyncLabelStudio(
569
+ client = LabelStudio(
800
570
  api_key="YOUR_API_KEY",
801
571
  )
802
-
803
-
804
- async def main() -> None:
805
- await client.import_storage.s3.create()
806
-
807
-
808
- asyncio.run(main())
572
+ client.import_storage.s3.validate()
809
573
  """
810
- _response = await self._client_wrapper.httpx_client.request(
811
- "api/storages/s3/",
574
+ _response = self._client_wrapper.httpx_client.request(
575
+ "api/storages/s3/validate",
812
576
  method="POST",
813
577
  json={
578
+ "id": id,
814
579
  "regex_filter": regex_filter,
815
580
  "use_blob_urls": use_blob_urls,
816
581
  "presign": presign,
@@ -834,12 +599,77 @@ class AsyncS3Client:
834
599
  request_options=request_options,
835
600
  omit=OMIT,
836
601
  )
602
+ try:
603
+ if 200 <= _response.status_code < 300:
604
+ return
605
+ _response_json = _response.json()
606
+ except JSONDecodeError:
607
+ raise ApiError(status_code=_response.status_code, body=_response.text)
608
+ raise ApiError(status_code=_response.status_code, body=_response_json)
609
+
610
+
611
+ class AsyncS3Client:
612
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
613
+ self._client_wrapper = client_wrapper
614
+
615
+ async def list(
616
+ self,
617
+ *,
618
+ ordering: typing.Optional[str] = None,
619
+ project: typing.Optional[int] = None,
620
+ request_options: typing.Optional[RequestOptions] = None,
621
+ ) -> typing.List[S3ImportStorage]:
622
+ """
623
+ Get a list of all S3 import storage connections.
624
+
625
+ Parameters
626
+ ----------
627
+ ordering : typing.Optional[str]
628
+ Which field to use when ordering the results.
629
+
630
+ project : typing.Optional[int]
631
+ Project ID
632
+
633
+ request_options : typing.Optional[RequestOptions]
634
+ Request-specific configuration.
635
+
636
+ Returns
637
+ -------
638
+ typing.List[S3ImportStorage]
639
+
640
+
641
+ Examples
642
+ --------
643
+ import asyncio
644
+
645
+ from label_studio_sdk import AsyncLabelStudio
646
+
647
+ client = AsyncLabelStudio(
648
+ api_key="YOUR_API_KEY",
649
+ )
650
+
651
+
652
+ async def main() -> None:
653
+ await client.import_storage.s3.list()
654
+
655
+
656
+ asyncio.run(main())
657
+ """
658
+ _response = await self._client_wrapper.httpx_client.request(
659
+ "api/storages/s3/",
660
+ method="GET",
661
+ params={
662
+ "ordering": ordering,
663
+ "project": project,
664
+ },
665
+ request_options=request_options,
666
+ )
837
667
  try:
838
668
  if 200 <= _response.status_code < 300:
839
669
  return typing.cast(
840
- S3CreateResponse,
841
- parse_obj_as(
842
- type_=S3CreateResponse, # type: ignore
670
+ typing.List[S3ImportStorage],
671
+ construct_type(
672
+ type_=typing.List[S3ImportStorage], # type: ignore
843
673
  object_=_response.json(),
844
674
  ),
845
675
  )
@@ -848,10 +678,9 @@ class AsyncS3Client:
848
678
  raise ApiError(status_code=_response.status_code, body=_response.text)
849
679
  raise ApiError(status_code=_response.status_code, body=_response_json)
850
680
 
851
- async def validate(
681
+ async def create(
852
682
  self,
853
683
  *,
854
- id: typing.Optional[int] = OMIT,
855
684
  regex_filter: typing.Optional[str] = OMIT,
856
685
  use_blob_urls: typing.Optional[bool] = OMIT,
857
686
  presign: typing.Optional[bool] = OMIT,
@@ -869,16 +698,12 @@ class AsyncS3Client:
869
698
  region_name: typing.Optional[str] = OMIT,
870
699
  s3endpoint: typing.Optional[str] = OMIT,
871
700
  request_options: typing.Optional[RequestOptions] = None,
872
- ) -> None:
701
+ ) -> S3ImportStorage:
873
702
  """
874
-
875
- Validate a specific S3 import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
703
+ Create new S3 import storage
876
704
 
877
705
  Parameters
878
706
  ----------
879
- id : typing.Optional[int]
880
- Storage ID. If set, storage with specified ID will be updated
881
-
882
707
  regex_filter : typing.Optional[str]
883
708
  Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
884
709
 
@@ -932,7 +757,8 @@ class AsyncS3Client:
932
757
 
933
758
  Returns
934
759
  -------
935
- None
760
+ S3ImportStorage
761
+
936
762
 
937
763
  Examples
938
764
  --------
@@ -946,16 +772,15 @@ class AsyncS3Client:
946
772
 
947
773
 
948
774
  async def main() -> None:
949
- await client.import_storage.s3.validate()
775
+ await client.import_storage.s3.create()
950
776
 
951
777
 
952
778
  asyncio.run(main())
953
779
  """
954
780
  _response = await self._client_wrapper.httpx_client.request(
955
- "api/storages/s3/validate",
781
+ "api/storages/s3/",
956
782
  method="POST",
957
783
  json={
958
- "id": id,
959
784
  "regex_filter": regex_filter,
960
785
  "use_blob_urls": use_blob_urls,
961
786
  "presign": presign,
@@ -981,7 +806,13 @@ class AsyncS3Client:
981
806
  )
982
807
  try:
983
808
  if 200 <= _response.status_code < 300:
984
- return
809
+ return typing.cast(
810
+ S3ImportStorage,
811
+ construct_type(
812
+ type_=S3ImportStorage, # type: ignore
813
+ object_=_response.json(),
814
+ ),
815
+ )
985
816
  _response_json = _response.json()
986
817
  except JSONDecodeError:
987
818
  raise ApiError(status_code=_response.status_code, body=_response.text)
@@ -989,15 +820,11 @@ class AsyncS3Client:
989
820
 
990
821
  async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
991
822
  """
992
-
993
- Get a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
994
-
995
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
823
+ Get a specific S3 import storage connection.
996
824
 
997
825
  Parameters
998
826
  ----------
999
827
  id : int
1000
- A unique integer value identifying this s3 import storage.
1001
828
 
1002
829
  request_options : typing.Optional[RequestOptions]
1003
830
  Request-specific configuration.
@@ -1035,7 +862,7 @@ class AsyncS3Client:
1035
862
  if 200 <= _response.status_code < 300:
1036
863
  return typing.cast(
1037
864
  S3ImportStorage,
1038
- parse_obj_as(
865
+ construct_type(
1039
866
  type_=S3ImportStorage, # type: ignore
1040
867
  object_=_response.json(),
1041
868
  ),
@@ -1047,17 +874,11 @@ class AsyncS3Client:
1047
874
 
1048
875
  async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
1049
876
  """
1050
-
1051
- Delete a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
1052
-
1053
- 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.
1054
-
1055
- 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.
877
+ Delete a specific S3 import storage connection.
1056
878
 
1057
879
  Parameters
1058
880
  ----------
1059
881
  id : int
1060
- A unique integer value identifying this s3 import storage.
1061
882
 
1062
883
  request_options : typing.Optional[RequestOptions]
1063
884
  Request-specific configuration.
@@ -1119,17 +940,13 @@ class AsyncS3Client:
1119
940
  region_name: typing.Optional[str] = OMIT,
1120
941
  s3endpoint: typing.Optional[str] = OMIT,
1121
942
  request_options: typing.Optional[RequestOptions] = None,
1122
- ) -> S3UpdateResponse:
943
+ ) -> S3ImportStorage:
1123
944
  """
1124
-
1125
- Update a specific S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
1126
-
1127
- For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
945
+ Update a specific S3 import storage connection.
1128
946
 
1129
947
  Parameters
1130
948
  ----------
1131
949
  id : int
1132
- A unique integer value identifying this s3 import storage.
1133
950
 
1134
951
  regex_filter : typing.Optional[str]
1135
952
  Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
@@ -1184,7 +1001,7 @@ class AsyncS3Client:
1184
1001
 
1185
1002
  Returns
1186
1003
  -------
1187
- S3UpdateResponse
1004
+ S3ImportStorage
1188
1005
 
1189
1006
 
1190
1007
  Examples
@@ -1236,9 +1053,9 @@ class AsyncS3Client:
1236
1053
  try:
1237
1054
  if 200 <= _response.status_code < 300:
1238
1055
  return typing.cast(
1239
- S3UpdateResponse,
1240
- parse_obj_as(
1241
- type_=S3UpdateResponse, # type: ignore
1056
+ S3ImportStorage,
1057
+ construct_type(
1058
+ type_=S3ImportStorage, # type: ignore
1242
1059
  object_=_response.json(),
1243
1060
  ),
1244
1061
  )
@@ -1249,12 +1066,7 @@ class AsyncS3Client:
1249
1066
 
1250
1067
  async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ImportStorage:
1251
1068
  """
1252
-
1253
- Sync tasks from an S3 import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
1254
-
1255
- 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.
1256
-
1257
- <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>
1069
+ Sync tasks from an S3 import storage connection.
1258
1070
 
1259
1071
  Parameters
1260
1072
  ----------
@@ -1297,7 +1109,7 @@ class AsyncS3Client:
1297
1109
  if 200 <= _response.status_code < 300:
1298
1110
  return typing.cast(
1299
1111
  S3ImportStorage,
1300
- parse_obj_as(
1112
+ construct_type(
1301
1113
  type_=S3ImportStorage, # type: ignore
1302
1114
  object_=_response.json(),
1303
1115
  ),
@@ -1306,3 +1118,141 @@ class AsyncS3Client:
1306
1118
  except JSONDecodeError:
1307
1119
  raise ApiError(status_code=_response.status_code, body=_response.text)
1308
1120
  raise ApiError(status_code=_response.status_code, body=_response_json)
1121
+
1122
+ async def validate(
1123
+ self,
1124
+ *,
1125
+ id: typing.Optional[int] = OMIT,
1126
+ regex_filter: typing.Optional[str] = OMIT,
1127
+ use_blob_urls: typing.Optional[bool] = OMIT,
1128
+ presign: typing.Optional[bool] = OMIT,
1129
+ presign_ttl: typing.Optional[int] = OMIT,
1130
+ recursive_scan: typing.Optional[bool] = OMIT,
1131
+ title: typing.Optional[str] = OMIT,
1132
+ description: typing.Optional[str] = OMIT,
1133
+ project: typing.Optional[int] = OMIT,
1134
+ bucket: typing.Optional[str] = OMIT,
1135
+ prefix: typing.Optional[str] = OMIT,
1136
+ aws_access_key_id: typing.Optional[str] = OMIT,
1137
+ aws_secret_access_key: typing.Optional[str] = OMIT,
1138
+ aws_session_token: typing.Optional[str] = OMIT,
1139
+ aws_sse_kms_key_id: typing.Optional[str] = OMIT,
1140
+ region_name: typing.Optional[str] = OMIT,
1141
+ s3endpoint: typing.Optional[str] = OMIT,
1142
+ request_options: typing.Optional[RequestOptions] = None,
1143
+ ) -> None:
1144
+ """
1145
+ Validate a specific S3 import storage connection.
1146
+
1147
+ Parameters
1148
+ ----------
1149
+ id : typing.Optional[int]
1150
+ Storage ID. If set, storage with specified ID will be updated
1151
+
1152
+ regex_filter : typing.Optional[str]
1153
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
1154
+
1155
+ use_blob_urls : typing.Optional[bool]
1156
+ Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
1157
+
1158
+ presign : typing.Optional[bool]
1159
+ Presign URLs for download
1160
+
1161
+ presign_ttl : typing.Optional[int]
1162
+ Presign TTL in minutes
1163
+
1164
+ recursive_scan : typing.Optional[bool]
1165
+ Scan recursively
1166
+
1167
+ title : typing.Optional[str]
1168
+ Storage title
1169
+
1170
+ description : typing.Optional[str]
1171
+ Storage description
1172
+
1173
+ project : typing.Optional[int]
1174
+ Project ID
1175
+
1176
+ bucket : typing.Optional[str]
1177
+ S3 bucket name
1178
+
1179
+ prefix : typing.Optional[str]
1180
+ S3 bucket prefix
1181
+
1182
+ aws_access_key_id : typing.Optional[str]
1183
+ AWS_ACCESS_KEY_ID
1184
+
1185
+ aws_secret_access_key : typing.Optional[str]
1186
+ AWS_SECRET_ACCESS_KEY
1187
+
1188
+ aws_session_token : typing.Optional[str]
1189
+ AWS_SESSION_TOKEN
1190
+
1191
+ aws_sse_kms_key_id : typing.Optional[str]
1192
+ AWS SSE KMS Key ID
1193
+
1194
+ region_name : typing.Optional[str]
1195
+ AWS Region
1196
+
1197
+ s3endpoint : typing.Optional[str]
1198
+ S3 Endpoint
1199
+
1200
+ request_options : typing.Optional[RequestOptions]
1201
+ Request-specific configuration.
1202
+
1203
+ Returns
1204
+ -------
1205
+ None
1206
+
1207
+ Examples
1208
+ --------
1209
+ import asyncio
1210
+
1211
+ from label_studio_sdk import AsyncLabelStudio
1212
+
1213
+ client = AsyncLabelStudio(
1214
+ api_key="YOUR_API_KEY",
1215
+ )
1216
+
1217
+
1218
+ async def main() -> None:
1219
+ await client.import_storage.s3.validate()
1220
+
1221
+
1222
+ asyncio.run(main())
1223
+ """
1224
+ _response = await self._client_wrapper.httpx_client.request(
1225
+ "api/storages/s3/validate",
1226
+ method="POST",
1227
+ json={
1228
+ "id": id,
1229
+ "regex_filter": regex_filter,
1230
+ "use_blob_urls": use_blob_urls,
1231
+ "presign": presign,
1232
+ "presign_ttl": presign_ttl,
1233
+ "recursive_scan": recursive_scan,
1234
+ "title": title,
1235
+ "description": description,
1236
+ "project": project,
1237
+ "bucket": bucket,
1238
+ "prefix": prefix,
1239
+ "aws_access_key_id": aws_access_key_id,
1240
+ "aws_secret_access_key": aws_secret_access_key,
1241
+ "aws_session_token": aws_session_token,
1242
+ "aws_sse_kms_key_id": aws_sse_kms_key_id,
1243
+ "region_name": region_name,
1244
+ "s3_endpoint": s3endpoint,
1245
+ },
1246
+ headers={
1247
+ "content-type": "application/json",
1248
+ },
1249
+ request_options=request_options,
1250
+ omit=OMIT,
1251
+ )
1252
+ try:
1253
+ if 200 <= _response.status_code < 300:
1254
+ return
1255
+ _response_json = _response.json()
1256
+ except JSONDecodeError:
1257
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1258
+ raise ApiError(status_code=_response.status_code, body=_response_json)