Skip to content

Commit f1b9ad9

Browse files
feat: UTC-522: Modify Bulk Assignment endpoint to allow all=True (#743)
Co-authored-by: fern-api[bot] <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 8a5bf98 commit f1b9ad9

6 files changed

Lines changed: 313 additions & 83 deletions

File tree

reference.md

Lines changed: 83 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29590,19 +29590,14 @@ Assign tags to multiple organization members in bulk.
2959029590
<dd>
2959129591

2959229592
```python
29593-
from label_studio_sdk import LabelStudio, OrganizationMemberTagAssignmentRequest
29593+
from label_studio_sdk import LabelStudio
2959429594

2959529595
client = LabelStudio(
2959629596
api_key="YOUR_API_KEY",
2959729597
)
2959829598
client.organizations.member_tags.assign(
2959929599
id=1,
29600-
assignments=[
29601-
OrganizationMemberTagAssignmentRequest(
29602-
tag_ids=[1],
29603-
user_id=1,
29604-
)
29605-
],
29600+
all_=True,
2960629601
)
2960729602

2960829603
```
@@ -29627,7 +29622,79 @@ client.organizations.member_tags.assign(
2962729622
<dl>
2962829623
<dd>
2962929624

29630-
**assignments:** `typing.Sequence[OrganizationMemberTagAssignmentRequest]` — List of member tag assignments to assign.
29625+
**all_:** `bool` — If true, assign tags to all organization members. If false, assign tags to the provided users.
29626+
29627+
</dd>
29628+
</dl>
29629+
29630+
<dl>
29631+
<dd>
29632+
29633+
**exclude_project_id:** `typing.Optional[float]` — Filter exclude_project_id by exact match
29634+
29635+
</dd>
29636+
</dl>
29637+
29638+
<dl>
29639+
<dd>
29640+
29641+
**exclude_workspace_id:** `typing.Optional[float]` — Filter exclude_workspace_id by exact match
29642+
29643+
</dd>
29644+
</dl>
29645+
29646+
<dl>
29647+
<dd>
29648+
29649+
**is_deleted:** `typing.Optional[bool]` — Filter is_deleted by exact match
29650+
29651+
</dd>
29652+
</dl>
29653+
29654+
<dl>
29655+
<dd>
29656+
29657+
**role:** `typing.Optional[str]` — Filter role by in list (comma-separated values)
29658+
29659+
</dd>
29660+
</dl>
29661+
29662+
<dl>
29663+
<dd>
29664+
29665+
**tags:** `typing.Optional[str]` — Filter tags by in list (comma-separated values)
29666+
29667+
</dd>
29668+
</dl>
29669+
29670+
<dl>
29671+
<dd>
29672+
29673+
**user_last_activity_gte:** `typing.Optional[str]` — Filter user__last_activity by greater than or equal to
29674+
29675+
</dd>
29676+
</dl>
29677+
29678+
<dl>
29679+
<dd>
29680+
29681+
**user_last_activity_lte:** `typing.Optional[str]` — Filter user__last_activity by less than or equal to
29682+
29683+
</dd>
29684+
</dl>
29685+
29686+
<dl>
29687+
<dd>
29688+
29689+
**excluded:** `typing.Optional[typing.Sequence[int]]` — List of user IDs to exclude from the assignment.
29690+
29691+
</dd>
29692+
</dl>
29693+
29694+
<dl>
29695+
<dd>
29696+
29697+
**included:** `typing.Optional[typing.Sequence[int]]` — List of user IDs to include in the assignment.
2963129698

2963229699
</dd>
2963329700
</dl>
@@ -29643,6 +29710,14 @@ client.organizations.member_tags.assign(
2964329710
<dl>
2964429711
<dd>
2964529712

29713+
**bulk_organization_member_tag_assignment_request_tags:** `typing.Optional[typing.Sequence[int]]` — List of tag IDs to assign.
29714+
29715+
</dd>
29716+
</dl>
29717+
29718+
<dl>
29719+
<dd>
29720+
2964629721
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
2964729722

2964829723
</dd>

src/label_studio_sdk/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
OrganizationMemberContributedToProjectsItem,
129129
OrganizationMemberCreatedProjectsItem,
130130
OrganizationMemberTag,
131-
OrganizationMemberTagAssignmentRequest,
132131
OrganizationMemberTagImportStatus,
133132
OrganizationMemberTagImportStatusStatusEnum,
134133
OrganizationMembership,
@@ -506,7 +505,6 @@
506505
"OrganizationMemberContributedToProjectsItem": ".types",
507506
"OrganizationMemberCreatedProjectsItem": ".types",
508507
"OrganizationMemberTag": ".types",
509-
"OrganizationMemberTagAssignmentRequest": ".types",
510508
"OrganizationMemberTagImportStatus": ".types",
511509
"OrganizationMemberTagImportStatusStatusEnum": ".types",
512510
"OrganizationMembership": ".types",
@@ -842,7 +840,6 @@ def __dir__():
842840
"OrganizationMemberContributedToProjectsItem",
843841
"OrganizationMemberCreatedProjectsItem",
844842
"OrganizationMemberTag",
845-
"OrganizationMemberTagAssignmentRequest",
846843
"OrganizationMemberTagImportStatus",
847844
"OrganizationMemberTagImportStatusStatusEnum",
848845
"OrganizationMembership",

src/label_studio_sdk/organizations/member_tags/client.py

Lines changed: 118 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
99
from ...core.request_options import RequestOptions
1010
from ...types.organization_member_tag import OrganizationMemberTag
11-
from ...types.organization_member_tag_assignment_request import OrganizationMemberTagAssignmentRequest
1211
from ...types.organization_member_tag_import_status import OrganizationMemberTagImportStatus
1312
from ...types.paginated_organization_member_tag_list import PaginatedOrganizationMemberTagList
1413
from .raw_client import AsyncRawMemberTagsClient, RawMemberTagsClient
@@ -144,8 +143,18 @@ def assign(
144143
self,
145144
id: int,
146145
*,
147-
assignments: typing.Sequence[OrganizationMemberTagAssignmentRequest],
146+
all_: bool,
147+
exclude_project_id: typing.Optional[float] = None,
148+
exclude_workspace_id: typing.Optional[float] = None,
149+
is_deleted: typing.Optional[bool] = None,
150+
role: typing.Optional[str] = None,
151+
tags: typing.Optional[str] = None,
152+
user_last_activity_gte: typing.Optional[str] = None,
153+
user_last_activity_lte: typing.Optional[str] = None,
154+
excluded: typing.Optional[typing.Sequence[int]] = OMIT,
155+
included: typing.Optional[typing.Sequence[int]] = OMIT,
148156
overwrite: typing.Optional[bool] = OMIT,
157+
bulk_organization_member_tag_assignment_request_tags: typing.Optional[typing.Sequence[int]] = OMIT,
149158
request_options: typing.Optional[RequestOptions] = None,
150159
) -> AssignMemberTagsResponse:
151160
"""
@@ -162,12 +171,42 @@ def assign(
162171
id : int
163172
A unique integer value identifying this organization.
164173
165-
assignments : typing.Sequence[OrganizationMemberTagAssignmentRequest]
166-
List of member tag assignments to assign.
174+
all_ : bool
175+
If true, assign tags to all organization members. If false, assign tags to the provided users.
176+
177+
exclude_project_id : typing.Optional[float]
178+
Filter exclude_project_id by exact match
179+
180+
exclude_workspace_id : typing.Optional[float]
181+
Filter exclude_workspace_id by exact match
182+
183+
is_deleted : typing.Optional[bool]
184+
Filter is_deleted by exact match
185+
186+
role : typing.Optional[str]
187+
Filter role by in list (comma-separated values)
188+
189+
tags : typing.Optional[str]
190+
Filter tags by in list (comma-separated values)
191+
192+
user_last_activity_gte : typing.Optional[str]
193+
Filter user__last_activity by greater than or equal to
194+
195+
user_last_activity_lte : typing.Optional[str]
196+
Filter user__last_activity by less than or equal to
197+
198+
excluded : typing.Optional[typing.Sequence[int]]
199+
List of user IDs to exclude from the assignment.
200+
201+
included : typing.Optional[typing.Sequence[int]]
202+
List of user IDs to include in the assignment.
167203
168204
overwrite : typing.Optional[bool]
169205
If true, replace all existing tag assignments for each user with the provided ones. If false, only add new assignments.
170206
207+
bulk_organization_member_tag_assignment_request_tags : typing.Optional[typing.Sequence[int]]
208+
List of tag IDs to assign.
209+
171210
request_options : typing.Optional[RequestOptions]
172211
Request-specific configuration.
173212
@@ -178,23 +217,31 @@ def assign(
178217
179218
Examples
180219
--------
181-
from label_studio_sdk import LabelStudio, OrganizationMemberTagAssignmentRequest
220+
from label_studio_sdk import LabelStudio
182221
183222
client = LabelStudio(
184223
api_key="YOUR_API_KEY",
185224
)
186225
client.organizations.member_tags.assign(
187226
id=1,
188-
assignments=[
189-
OrganizationMemberTagAssignmentRequest(
190-
tag_ids=[1],
191-
user_id=1,
192-
)
193-
],
227+
all_=True,
194228
)
195229
"""
196230
_response = self._raw_client.assign(
197-
id, assignments=assignments, overwrite=overwrite, request_options=request_options
231+
id,
232+
all_=all_,
233+
exclude_project_id=exclude_project_id,
234+
exclude_workspace_id=exclude_workspace_id,
235+
is_deleted=is_deleted,
236+
role=role,
237+
tags=tags,
238+
user_last_activity_gte=user_last_activity_gte,
239+
user_last_activity_lte=user_last_activity_lte,
240+
excluded=excluded,
241+
included=included,
242+
overwrite=overwrite,
243+
bulk_organization_member_tag_assignment_request_tags=bulk_organization_member_tag_assignment_request_tags,
244+
request_options=request_options,
198245
)
199246
return _response.data
200247

@@ -575,8 +622,18 @@ async def assign(
575622
self,
576623
id: int,
577624
*,
578-
assignments: typing.Sequence[OrganizationMemberTagAssignmentRequest],
625+
all_: bool,
626+
exclude_project_id: typing.Optional[float] = None,
627+
exclude_workspace_id: typing.Optional[float] = None,
628+
is_deleted: typing.Optional[bool] = None,
629+
role: typing.Optional[str] = None,
630+
tags: typing.Optional[str] = None,
631+
user_last_activity_gte: typing.Optional[str] = None,
632+
user_last_activity_lte: typing.Optional[str] = None,
633+
excluded: typing.Optional[typing.Sequence[int]] = OMIT,
634+
included: typing.Optional[typing.Sequence[int]] = OMIT,
579635
overwrite: typing.Optional[bool] = OMIT,
636+
bulk_organization_member_tag_assignment_request_tags: typing.Optional[typing.Sequence[int]] = OMIT,
580637
request_options: typing.Optional[RequestOptions] = None,
581638
) -> AssignMemberTagsResponse:
582639
"""
@@ -593,12 +650,42 @@ async def assign(
593650
id : int
594651
A unique integer value identifying this organization.
595652
596-
assignments : typing.Sequence[OrganizationMemberTagAssignmentRequest]
597-
List of member tag assignments to assign.
653+
all_ : bool
654+
If true, assign tags to all organization members. If false, assign tags to the provided users.
655+
656+
exclude_project_id : typing.Optional[float]
657+
Filter exclude_project_id by exact match
658+
659+
exclude_workspace_id : typing.Optional[float]
660+
Filter exclude_workspace_id by exact match
661+
662+
is_deleted : typing.Optional[bool]
663+
Filter is_deleted by exact match
664+
665+
role : typing.Optional[str]
666+
Filter role by in list (comma-separated values)
667+
668+
tags : typing.Optional[str]
669+
Filter tags by in list (comma-separated values)
670+
671+
user_last_activity_gte : typing.Optional[str]
672+
Filter user__last_activity by greater than or equal to
673+
674+
user_last_activity_lte : typing.Optional[str]
675+
Filter user__last_activity by less than or equal to
676+
677+
excluded : typing.Optional[typing.Sequence[int]]
678+
List of user IDs to exclude from the assignment.
679+
680+
included : typing.Optional[typing.Sequence[int]]
681+
List of user IDs to include in the assignment.
598682
599683
overwrite : typing.Optional[bool]
600684
If true, replace all existing tag assignments for each user with the provided ones. If false, only add new assignments.
601685
686+
bulk_organization_member_tag_assignment_request_tags : typing.Optional[typing.Sequence[int]]
687+
List of tag IDs to assign.
688+
602689
request_options : typing.Optional[RequestOptions]
603690
Request-specific configuration.
604691
@@ -611,10 +698,7 @@ async def assign(
611698
--------
612699
import asyncio
613700
614-
from label_studio_sdk import (
615-
AsyncLabelStudio,
616-
OrganizationMemberTagAssignmentRequest,
617-
)
701+
from label_studio_sdk import AsyncLabelStudio
618702
619703
client = AsyncLabelStudio(
620704
api_key="YOUR_API_KEY",
@@ -624,19 +708,27 @@ async def assign(
624708
async def main() -> None:
625709
await client.organizations.member_tags.assign(
626710
id=1,
627-
assignments=[
628-
OrganizationMemberTagAssignmentRequest(
629-
tag_ids=[1],
630-
user_id=1,
631-
)
632-
],
711+
all_=True,
633712
)
634713
635714
636715
asyncio.run(main())
637716
"""
638717
_response = await self._raw_client.assign(
639-
id, assignments=assignments, overwrite=overwrite, request_options=request_options
718+
id,
719+
all_=all_,
720+
exclude_project_id=exclude_project_id,
721+
exclude_workspace_id=exclude_workspace_id,
722+
is_deleted=is_deleted,
723+
role=role,
724+
tags=tags,
725+
user_last_activity_gte=user_last_activity_gte,
726+
user_last_activity_lte=user_last_activity_lte,
727+
excluded=excluded,
728+
included=included,
729+
overwrite=overwrite,
730+
bulk_organization_member_tag_assignment_request_tags=bulk_organization_member_tag_assignment_request_tags,
731+
request_options=request_options,
640732
)
641733
return _response.data
642734

0 commit comments

Comments
 (0)