label-studio-sdk 2.0.10__py3-none-any.whl → 2.0.12__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.
- label_studio_sdk/__init__.py +10 -0
- label_studio_sdk/activity_logs/client.py +12 -0
- label_studio_sdk/annotation_history/client.py +36 -0
- label_studio_sdk/annotation_reviews/client.py +60 -0
- label_studio_sdk/billing/client.py +12 -0
- label_studio_sdk/comments/client.py +72 -0
- label_studio_sdk/export_storage/azure_spi/client.py +84 -0
- label_studio_sdk/export_storage/databricks/client.py +84 -0
- label_studio_sdk/export_storage/gcswif/client.py +84 -0
- label_studio_sdk/export_storage/s3s/client.py +84 -0
- label_studio_sdk/import_storage/azure_spi/client.py +84 -0
- label_studio_sdk/import_storage/databricks/client.py +84 -0
- label_studio_sdk/import_storage/gcswif/client.py +84 -0
- label_studio_sdk/import_storage/s3s/client.py +84 -0
- label_studio_sdk/label_interface/control_tags.py +12 -7
- label_studio_sdk/ml/client.py +14 -2
- label_studio_sdk/model_providers/client.py +72 -0
- label_studio_sdk/organizations/client.py +30 -6
- label_studio_sdk/organizations/invites/client.py +24 -0
- label_studio_sdk/organizations/members/client.py +24 -0
- label_studio_sdk/organizations/permissions/client.py +60 -0
- label_studio_sdk/project_templates/client.py +76 -4
- label_studio_sdk/projects/__init__.py +14 -1
- label_studio_sdk/projects/assignments/client.py +60 -0
- label_studio_sdk/projects/client.py +20 -0
- label_studio_sdk/projects/members/bulk/client.py +24 -0
- label_studio_sdk/projects/members/client.py +149 -30
- label_studio_sdk/projects/members/paginated/client.py +12 -0
- label_studio_sdk/projects/metrics/client.py +24 -0
- label_studio_sdk/projects/pauses/client.py +60 -0
- label_studio_sdk/projects/roles/__init__.py +2 -0
- label_studio_sdk/projects/roles/client.py +555 -0
- label_studio_sdk/projects/stats/__init__.py +12 -0
- label_studio_sdk/projects/stats/client.py +766 -1
- label_studio_sdk/projects/stats/types/__init__.py +14 -0
- label_studio_sdk/projects/stats/types/stats_agreement_annotators_response.py +22 -0
- label_studio_sdk/projects/stats/types/stats_model_version_annotator_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_model_version_ground_truth_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_model_version_prediction_agreement_response.py +19 -0
- label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response.py +27 -0
- label_studio_sdk/projects/stats/types/stats_users_prediction_agreement_response_agreement_value.py +5 -0
- label_studio_sdk/prompts/client.py +96 -0
- label_studio_sdk/prompts/indicators/client.py +24 -0
- label_studio_sdk/prompts/runs/client.py +36 -0
- label_studio_sdk/prompts/versions/client.py +84 -0
- label_studio_sdk/sso/saml/client.py +24 -0
- label_studio_sdk/sso/scim/client.py +24 -0
- label_studio_sdk/types/__init__.py +10 -0
- label_studio_sdk/types/all_roles_project_list.py +5 -1
- label_studio_sdk/types/default_role.py +2 -2
- label_studio_sdk/types/lse_organization.py +1 -1
- label_studio_sdk/types/lse_project.py +5 -1
- label_studio_sdk/types/lse_project_create.py +5 -1
- label_studio_sdk/types/lse_project_response.py +5 -1
- label_studio_sdk/types/lse_project_update.py +5 -1
- label_studio_sdk/types/project.py +198 -0
- label_studio_sdk/types/project_member.py +19 -0
- label_studio_sdk/types/project_role.py +35 -0
- label_studio_sdk/types/project_sampling.py +7 -0
- label_studio_sdk/types/project_skip_queue.py +7 -0
- label_studio_sdk/types/project_template.py +1 -1
- label_studio_sdk/types/project_template_request.py +1 -1
- label_studio_sdk/users/client.py +24 -0
- label_studio_sdk/versions/client.py +12 -0
- label_studio_sdk/workspaces/__init__.py +2 -2
- label_studio_sdk/workspaces/client.py +4 -0
- label_studio_sdk/workspaces/projects/__init__.py +2 -0
- label_studio_sdk/workspaces/projects/client.py +352 -0
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/METADATA +1 -1
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/RECORD +72 -57
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.10.dist-info → label_studio_sdk-2.0.12.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.unchecked_base_model import UncheckedBaseModel
|
|
4
|
+
from .role9e7enum import Role9E7Enum
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import typing
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ProjectRole(UncheckedBaseModel):
|
|
11
|
+
id: int
|
|
12
|
+
project: int
|
|
13
|
+
role: Role9E7Enum = pydantic.Field()
|
|
14
|
+
"""
|
|
15
|
+
User role in project
|
|
16
|
+
|
|
17
|
+
* `OW` - Owner
|
|
18
|
+
* `AD` - Administrator
|
|
19
|
+
* `MA` - Manager
|
|
20
|
+
* `RE` - Reviewer
|
|
21
|
+
* `AN` - Annotator
|
|
22
|
+
* `DI` - Deactivated
|
|
23
|
+
* `NO` - Not Activated
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
user: int
|
|
27
|
+
|
|
28
|
+
if IS_PYDANTIC_V2:
|
|
29
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
30
|
+
else:
|
|
31
|
+
|
|
32
|
+
class Config:
|
|
33
|
+
frozen = True
|
|
34
|
+
smart_union = True
|
|
35
|
+
extra = pydantic.Extra.allow
|
|
@@ -13,7 +13,7 @@ class ProjectTemplate(UncheckedBaseModel):
|
|
|
13
13
|
created_by: typing.Optional[int] = None
|
|
14
14
|
custom_script: typing.Optional[str] = pydantic.Field(default=None)
|
|
15
15
|
"""
|
|
16
|
-
custom script for projects created from this template
|
|
16
|
+
custom script (Plugin) for projects created from this template
|
|
17
17
|
"""
|
|
18
18
|
|
|
19
19
|
description: typing.Optional[str] = None
|
|
@@ -11,7 +11,7 @@ class ProjectTemplateRequest(UncheckedBaseModel):
|
|
|
11
11
|
created_by: typing.Optional[int] = None
|
|
12
12
|
custom_script: typing.Optional[str] = pydantic.Field(default=None)
|
|
13
13
|
"""
|
|
14
|
-
custom script for projects created from this template
|
|
14
|
+
custom script (Plugin) for projects created from this template
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
description: typing.Optional[str] = None
|
label_studio_sdk/users/client.py
CHANGED
|
@@ -26,6 +26,12 @@ class UsersClient:
|
|
|
26
26
|
|
|
27
27
|
def get_current_user(self, *, request_options: typing.Optional[RequestOptions] = None) -> LseUserApi:
|
|
28
28
|
"""
|
|
29
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
30
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
31
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
32
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
33
|
+
</p>
|
|
34
|
+
</Card>
|
|
29
35
|
Get info about the currently authenticated user.
|
|
30
36
|
|
|
31
37
|
Parameters
|
|
@@ -84,6 +90,12 @@ class UsersClient:
|
|
|
84
90
|
request_options: typing.Optional[RequestOptions] = None,
|
|
85
91
|
) -> LseUserApi:
|
|
86
92
|
"""
|
|
93
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
94
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
95
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
96
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
97
|
+
</p>
|
|
98
|
+
</Card>
|
|
87
99
|
Update details for the currently authenticated user.
|
|
88
100
|
|
|
89
101
|
Parameters
|
|
@@ -739,6 +751,12 @@ class AsyncUsersClient:
|
|
|
739
751
|
|
|
740
752
|
async def get_current_user(self, *, request_options: typing.Optional[RequestOptions] = None) -> LseUserApi:
|
|
741
753
|
"""
|
|
754
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
755
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
756
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
757
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
758
|
+
</p>
|
|
759
|
+
</Card>
|
|
742
760
|
Get info about the currently authenticated user.
|
|
743
761
|
|
|
744
762
|
Parameters
|
|
@@ -805,6 +823,12 @@ class AsyncUsersClient:
|
|
|
805
823
|
request_options: typing.Optional[RequestOptions] = None,
|
|
806
824
|
) -> LseUserApi:
|
|
807
825
|
"""
|
|
826
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
827
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
828
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
829
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
830
|
+
</p>
|
|
831
|
+
</Card>
|
|
808
832
|
Update details for the currently authenticated user.
|
|
809
833
|
|
|
810
834
|
Parameters
|
|
@@ -16,6 +16,12 @@ class VersionsClient:
|
|
|
16
16
|
|
|
17
17
|
def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> VersionResponse:
|
|
18
18
|
"""
|
|
19
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
20
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
21
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
22
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
23
|
+
</p>
|
|
24
|
+
</Card>
|
|
19
25
|
Get version information about the Label Studio instance.
|
|
20
26
|
|
|
21
27
|
Parameters
|
|
@@ -63,6 +69,12 @@ class AsyncVersionsClient:
|
|
|
63
69
|
|
|
64
70
|
async def get(self, *, request_options: typing.Optional[RequestOptions] = None) -> VersionResponse:
|
|
65
71
|
"""
|
|
72
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
73
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
74
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
75
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
76
|
+
</p>
|
|
77
|
+
</Card>
|
|
66
78
|
Get version information about the Label Studio instance.
|
|
67
79
|
|
|
68
80
|
Parameters
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
from ..core.client_wrapper import SyncClientWrapper
|
|
5
5
|
from .members.client import MembersClient
|
|
6
|
+
from .projects.client import ProjectsClient
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
7
8
|
from ..types.workspace import Workspace
|
|
8
9
|
from ..core.unchecked_base_model import construct_type
|
|
@@ -11,6 +12,7 @@ from ..core.api_error import ApiError
|
|
|
11
12
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
12
13
|
from ..core.client_wrapper import AsyncClientWrapper
|
|
13
14
|
from .members.client import AsyncMembersClient
|
|
15
|
+
from .projects.client import AsyncProjectsClient
|
|
14
16
|
|
|
15
17
|
# this is used as the default value for optional parameters
|
|
16
18
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -20,6 +22,7 @@ class WorkspacesClient:
|
|
|
20
22
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
23
|
self._client_wrapper = client_wrapper
|
|
22
24
|
self.members = MembersClient(client_wrapper=self._client_wrapper)
|
|
25
|
+
self.projects = ProjectsClient(client_wrapper=self._client_wrapper)
|
|
23
26
|
|
|
24
27
|
def list(
|
|
25
28
|
self,
|
|
@@ -358,6 +361,7 @@ class AsyncWorkspacesClient:
|
|
|
358
361
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
359
362
|
self._client_wrapper = client_wrapper
|
|
360
363
|
self.members = AsyncMembersClient(client_wrapper=self._client_wrapper)
|
|
364
|
+
self.projects = AsyncProjectsClient(client_wrapper=self._client_wrapper)
|
|
361
365
|
|
|
362
366
|
async def list(
|
|
363
367
|
self,
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ...core.request_options import RequestOptions
|
|
6
|
+
from ...types.project import Project
|
|
7
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ...core.unchecked_base_model import construct_type
|
|
9
|
+
from json.decoder import JSONDecodeError
|
|
10
|
+
from ...core.api_error import ApiError
|
|
11
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ProjectsClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._client_wrapper = client_wrapper
|
|
20
|
+
|
|
21
|
+
def list(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Project]:
|
|
22
|
+
"""
|
|
23
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
24
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
25
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
26
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
27
|
+
</p>
|
|
28
|
+
</Card>
|
|
29
|
+
Retrieve a list of all projects in a specific workspace.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
id : int
|
|
34
|
+
|
|
35
|
+
request_options : typing.Optional[RequestOptions]
|
|
36
|
+
Request-specific configuration.
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
typing.List[Project]
|
|
41
|
+
Projects list
|
|
42
|
+
|
|
43
|
+
Examples
|
|
44
|
+
--------
|
|
45
|
+
from label_studio_sdk import LabelStudio
|
|
46
|
+
|
|
47
|
+
client = LabelStudio(
|
|
48
|
+
api_key="YOUR_API_KEY",
|
|
49
|
+
)
|
|
50
|
+
client.workspaces.projects.list(
|
|
51
|
+
id=1,
|
|
52
|
+
)
|
|
53
|
+
"""
|
|
54
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
55
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
56
|
+
method="GET",
|
|
57
|
+
request_options=request_options,
|
|
58
|
+
)
|
|
59
|
+
try:
|
|
60
|
+
if 200 <= _response.status_code < 300:
|
|
61
|
+
return typing.cast(
|
|
62
|
+
typing.List[Project],
|
|
63
|
+
construct_type(
|
|
64
|
+
type_=typing.List[Project], # type: ignore
|
|
65
|
+
object_=_response.json(),
|
|
66
|
+
),
|
|
67
|
+
)
|
|
68
|
+
_response_json = _response.json()
|
|
69
|
+
except JSONDecodeError:
|
|
70
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
71
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
72
|
+
|
|
73
|
+
def add(self, id: int, *, project: int, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
74
|
+
"""
|
|
75
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
76
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
77
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
78
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
79
|
+
</p>
|
|
80
|
+
</Card>
|
|
81
|
+
Add a project to a specific workspace.
|
|
82
|
+
|
|
83
|
+
Parameters
|
|
84
|
+
----------
|
|
85
|
+
id : int
|
|
86
|
+
|
|
87
|
+
project : int
|
|
88
|
+
|
|
89
|
+
request_options : typing.Optional[RequestOptions]
|
|
90
|
+
Request-specific configuration.
|
|
91
|
+
|
|
92
|
+
Returns
|
|
93
|
+
-------
|
|
94
|
+
None
|
|
95
|
+
|
|
96
|
+
Examples
|
|
97
|
+
--------
|
|
98
|
+
from label_studio_sdk import LabelStudio
|
|
99
|
+
|
|
100
|
+
client = LabelStudio(
|
|
101
|
+
api_key="YOUR_API_KEY",
|
|
102
|
+
)
|
|
103
|
+
client.workspaces.projects.add(
|
|
104
|
+
id=1,
|
|
105
|
+
project=1,
|
|
106
|
+
)
|
|
107
|
+
"""
|
|
108
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
109
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
110
|
+
method="POST",
|
|
111
|
+
json={
|
|
112
|
+
"project": project,
|
|
113
|
+
},
|
|
114
|
+
headers={
|
|
115
|
+
"content-type": "application/json",
|
|
116
|
+
},
|
|
117
|
+
request_options=request_options,
|
|
118
|
+
omit=OMIT,
|
|
119
|
+
)
|
|
120
|
+
try:
|
|
121
|
+
if 200 <= _response.status_code < 300:
|
|
122
|
+
return
|
|
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 remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
129
|
+
"""
|
|
130
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
131
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
132
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
133
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
134
|
+
</p>
|
|
135
|
+
</Card>
|
|
136
|
+
Remove a project from a specific workspace.
|
|
137
|
+
|
|
138
|
+
Parameters
|
|
139
|
+
----------
|
|
140
|
+
id : int
|
|
141
|
+
|
|
142
|
+
request_options : typing.Optional[RequestOptions]
|
|
143
|
+
Request-specific configuration.
|
|
144
|
+
|
|
145
|
+
Returns
|
|
146
|
+
-------
|
|
147
|
+
None
|
|
148
|
+
|
|
149
|
+
Examples
|
|
150
|
+
--------
|
|
151
|
+
from label_studio_sdk import LabelStudio
|
|
152
|
+
|
|
153
|
+
client = LabelStudio(
|
|
154
|
+
api_key="YOUR_API_KEY",
|
|
155
|
+
)
|
|
156
|
+
client.workspaces.projects.remove(
|
|
157
|
+
id=1,
|
|
158
|
+
)
|
|
159
|
+
"""
|
|
160
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
161
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
162
|
+
method="DELETE",
|
|
163
|
+
request_options=request_options,
|
|
164
|
+
)
|
|
165
|
+
try:
|
|
166
|
+
if 200 <= _response.status_code < 300:
|
|
167
|
+
return
|
|
168
|
+
_response_json = _response.json()
|
|
169
|
+
except JSONDecodeError:
|
|
170
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
171
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
class AsyncProjectsClient:
|
|
175
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
176
|
+
self._client_wrapper = client_wrapper
|
|
177
|
+
|
|
178
|
+
async def list(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Project]:
|
|
179
|
+
"""
|
|
180
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
181
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
182
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
183
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
184
|
+
</p>
|
|
185
|
+
</Card>
|
|
186
|
+
Retrieve a list of all projects in a specific workspace.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
id : int
|
|
191
|
+
|
|
192
|
+
request_options : typing.Optional[RequestOptions]
|
|
193
|
+
Request-specific configuration.
|
|
194
|
+
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
typing.List[Project]
|
|
198
|
+
Projects list
|
|
199
|
+
|
|
200
|
+
Examples
|
|
201
|
+
--------
|
|
202
|
+
import asyncio
|
|
203
|
+
|
|
204
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
205
|
+
|
|
206
|
+
client = AsyncLabelStudio(
|
|
207
|
+
api_key="YOUR_API_KEY",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
async def main() -> None:
|
|
212
|
+
await client.workspaces.projects.list(
|
|
213
|
+
id=1,
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
asyncio.run(main())
|
|
218
|
+
"""
|
|
219
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
220
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
221
|
+
method="GET",
|
|
222
|
+
request_options=request_options,
|
|
223
|
+
)
|
|
224
|
+
try:
|
|
225
|
+
if 200 <= _response.status_code < 300:
|
|
226
|
+
return typing.cast(
|
|
227
|
+
typing.List[Project],
|
|
228
|
+
construct_type(
|
|
229
|
+
type_=typing.List[Project], # type: ignore
|
|
230
|
+
object_=_response.json(),
|
|
231
|
+
),
|
|
232
|
+
)
|
|
233
|
+
_response_json = _response.json()
|
|
234
|
+
except JSONDecodeError:
|
|
235
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
236
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
237
|
+
|
|
238
|
+
async def add(self, id: int, *, project: int, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
239
|
+
"""
|
|
240
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
241
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
242
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
243
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
244
|
+
</p>
|
|
245
|
+
</Card>
|
|
246
|
+
Add a project to a specific workspace.
|
|
247
|
+
|
|
248
|
+
Parameters
|
|
249
|
+
----------
|
|
250
|
+
id : int
|
|
251
|
+
|
|
252
|
+
project : int
|
|
253
|
+
|
|
254
|
+
request_options : typing.Optional[RequestOptions]
|
|
255
|
+
Request-specific configuration.
|
|
256
|
+
|
|
257
|
+
Returns
|
|
258
|
+
-------
|
|
259
|
+
None
|
|
260
|
+
|
|
261
|
+
Examples
|
|
262
|
+
--------
|
|
263
|
+
import asyncio
|
|
264
|
+
|
|
265
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
266
|
+
|
|
267
|
+
client = AsyncLabelStudio(
|
|
268
|
+
api_key="YOUR_API_KEY",
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
async def main() -> None:
|
|
273
|
+
await client.workspaces.projects.add(
|
|
274
|
+
id=1,
|
|
275
|
+
project=1,
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
asyncio.run(main())
|
|
280
|
+
"""
|
|
281
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
282
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
283
|
+
method="POST",
|
|
284
|
+
json={
|
|
285
|
+
"project": project,
|
|
286
|
+
},
|
|
287
|
+
headers={
|
|
288
|
+
"content-type": "application/json",
|
|
289
|
+
},
|
|
290
|
+
request_options=request_options,
|
|
291
|
+
omit=OMIT,
|
|
292
|
+
)
|
|
293
|
+
try:
|
|
294
|
+
if 200 <= _response.status_code < 300:
|
|
295
|
+
return
|
|
296
|
+
_response_json = _response.json()
|
|
297
|
+
except JSONDecodeError:
|
|
298
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
299
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
300
|
+
|
|
301
|
+
async def remove(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
302
|
+
"""
|
|
303
|
+
<Card href="https://humansignal.com/goenterprise">
|
|
304
|
+
<img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
|
|
305
|
+
<p style="margin-top: 10px; font-size: 14px;">
|
|
306
|
+
This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
|
|
307
|
+
</p>
|
|
308
|
+
</Card>
|
|
309
|
+
Remove a project from a specific workspace.
|
|
310
|
+
|
|
311
|
+
Parameters
|
|
312
|
+
----------
|
|
313
|
+
id : int
|
|
314
|
+
|
|
315
|
+
request_options : typing.Optional[RequestOptions]
|
|
316
|
+
Request-specific configuration.
|
|
317
|
+
|
|
318
|
+
Returns
|
|
319
|
+
-------
|
|
320
|
+
None
|
|
321
|
+
|
|
322
|
+
Examples
|
|
323
|
+
--------
|
|
324
|
+
import asyncio
|
|
325
|
+
|
|
326
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
327
|
+
|
|
328
|
+
client = AsyncLabelStudio(
|
|
329
|
+
api_key="YOUR_API_KEY",
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
async def main() -> None:
|
|
334
|
+
await client.workspaces.projects.remove(
|
|
335
|
+
id=1,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
asyncio.run(main())
|
|
340
|
+
"""
|
|
341
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
342
|
+
f"api/workspaces/{jsonable_encoder(id)}/projects/",
|
|
343
|
+
method="DELETE",
|
|
344
|
+
request_options=request_options,
|
|
345
|
+
)
|
|
346
|
+
try:
|
|
347
|
+
if 200 <= _response.status_code < 300:
|
|
348
|
+
return
|
|
349
|
+
_response_json = _response.json()
|
|
350
|
+
except JSONDecodeError:
|
|
351
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
352
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|