
    ]jY                         d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	m
Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ  e j2                  e j4                  d      Z G d d      Z G d d      Zy)    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)TaskAssignment   )AsyncRawAssignmentsClientRawAssignmentsClient)AssignAssignmentsRequestType)#BulkAssignAssignmentsRequestFilters))BulkAssignAssignmentsRequestSelectedItems) BulkAssignAssignmentsRequestType)BulkAssignAssignmentsResponse)DeleteAssignmentsRequestType)UpdateAssignmentsRequestType.c                   &   e Zd ZdefdZedefd       Zeddde	de
d	ed
ej                  e	   dej                  e   dej                  e   defdZddde	de	dej                  e   dej&                  e   fdZddde	de	d	ed
ej                  e	   dej                  e   defdZddddde	de	d	ej                  e   d
ej                  e   dej                  e   ddfdZddde	de	d	ed
ej                  e	   dej                  e   defdZy)AssignmentsClientclient_wrapperc                &    t        |      | _        y N)r   )r
   _raw_clientselfr   s     V/root/env/lib/python3.12/site-packages/label_studio_sdk/projects/assignments/client.py__init__zAssignmentsClient.__init__   s    /~N    returnc                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawAssignmentsClient
        r   r   s    r   with_raw_responsez#AssignmentsClient.with_raw_response        r   Nfiltersrequest_optionsidselected_itemstypeusersr$   r%   c                \    | j                   j                  ||||||      }|j                  S )a4	  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Assign multiple users to a collection of tasks within a specific project.

        Parameters
        ----------
        id : int

        selected_items : BulkAssignAssignmentsRequestSelectedItems
            Task selection by IDs. If filters are applied, the selection will be applied to the filtered tasks.If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br>Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`

        type : BulkAssignAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        filters : typing.Optional[BulkAssignAssignmentsRequestFilters]
            Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkAssignAssignmentsResponse
            Success

        Examples
        --------
        from label_studio_sdk import LabelStudio
        from label_studio_sdk.projects.assignments import (
            BulkAssignAssignmentsRequestSelectedItemsIncluded,
        )

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.assignments.bulk_assign(
            id=1,
            selected_items=BulkAssignAssignmentsRequestSelectedItemsIncluded(
                all_=True,
            ),
            type="AN",
            users=[1],
        )
        r'   r(   r)   r$   r%   r   bulk_assigndatar   r&   r'   r(   r)   r$   r%   	_responses           r   r-   zAssignmentsClient.bulk_assign$   s:    | $$00~Dwhw 1 
	 ~~r   r%   task_pkc                V    | j                   j                  |||      }|j                  S )a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Retrieve a list of tasks and assignees for those tasks for a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TaskAssignment]
            List of assignments for the task

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.assignments.list(
            id=1,
            task_pk=1,
        )
        r1   r   listr.   r   r&   r2   r%   r0   s        r   r5   zAssignmentsClient.listg   s,    P $$))"g)W	~~r   c                Z    | j                   j                  |||||      }|j                  S )a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Assign a user to a task in a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : AssignAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TaskAssignment


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.assignments.assign(
            id=1,
            task_pk=1,
            type="AN",
            users=[1],
        )
        r(   r)   r%   r   assignr.   r   r&   r2   r(   r)   r%   r0   s          r   r:   zAssignmentsClient.assign   1    l $$++Bd%ap+q	~~r   r8   c                Z    | j                   j                  |||||      }|j                  S )a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Remove assignees for a task within a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : typing.Optional[DeleteAssignmentsRequestType]
            Assignment type to delete (optional). If omitted, deletes all assignments for the task.

        users : typing.Optional[str]
            Comma separated list of user IDs to delete, as a string. If omitted, deletes all assignees for the given type.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.assignments.delete(
            id=1,
            task_pk=1,
        )
        r8   r   deleter.   r;   s          r   r?   zAssignmentsClient.delete   s1    f $$++Bd%ap+q	~~r   c                Z    | j                   j                  |||||      }|j                  S )a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Update the assignee for a task in a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : UpdateAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TaskAssignment


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.projects.assignments.update(
            id=1,
            task_pk=1,
            type="AN",
            users=[1],
        )
        r8   r   updater.   r;   s          r   rB   zAssignmentsClient.update  r<   r   )__name__
__module____qualname__r   r   propertyr
   r!   OMITintr   r   typingSequenceOptionalr   r   r   r-   Listr   r5   r   r:   r   strr?   r   rB    r   r   r   r      s   O*; O  #7    " IM;?AA B	A
 /A s#A !DEA  8A 
'AH \`)) #)9?9X)	^	$)d <@77 7
 +7 s#7  87 
7| ?C&*;?44 4
 oo:;4 s#4  84 
4z <@77 7
 +7 s#7  87 
7r   r   c                   &   e Zd ZdefdZedefd       Zeddde	de
d	ed
ej                  e	   dej                  e   dej                  e   defdZddde	de	dej                  e   dej&                  e   fdZddde	de	d	ed
ej                  e	   dej                  e   defdZddddde	de	d	ej                  e   d
ej                  e   dej                  e   ddfdZddde	de	d	ed
ej                  e	   dej                  e   defdZy)AsyncAssignmentsClientr   c                &    t        |      | _        y r   )r	   r   r   s     r   r   zAsyncAssignmentsClient.__init__<  s    4NSr   r   c                     | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawAssignmentsClient
        r   r    s    r   r!   z(AsyncAssignmentsClient.with_raw_response?  r"   r   Nr#   r&   r'   r(   r)   r$   r%   c                x   K   | j                   j                  ||||||       d{   }|j                  S 7 w)a	  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Assign multiple users to a collection of tasks within a specific project.

        Parameters
        ----------
        id : int

        selected_items : BulkAssignAssignmentsRequestSelectedItems
            Task selection by IDs. If filters are applied, the selection will be applied to the filtered tasks.If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br>Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`

        type : BulkAssignAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        filters : typing.Optional[BulkAssignAssignmentsRequestFilters]
            Filters to apply on tasks. You can use [the helper class `Filters` from this page](https://labelstud.io/sdk/data_manager.html) to create Data Manager Filters.<br>Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkAssignAssignmentsResponse
            Success

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio
        from label_studio_sdk.projects.assignments import (
            BulkAssignAssignmentsRequestSelectedItemsIncluded,
        )

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.assignments.bulk_assign(
                id=1,
                selected_items=BulkAssignAssignmentsRequestSelectedItemsIncluded(
                    all_=True,
                ),
                type="AN",
                users=[1],
            )


        asyncio.run(main())
        r+   Nr,   r/   s           r   r-   z"AsyncAssignmentsClient.bulk_assignJ  sH     L **66~Dwhw 7 
 
	 ~~
s   %:8:r1   r2   c                r   K   | j                   j                  |||       d{   }|j                  S 7 w)as  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Retrieve a list of tasks and assignees for those tasks for a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        typing.List[TaskAssignment]
            List of assignments for the task

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.assignments.list(
                id=1,
                task_pk=1,
            )


        asyncio.run(main())
        r1   Nr4   r6   s        r   r5   zAsyncAssignmentsClient.list  s9     ` **//G_/]]	~~ ^s   "757c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Assign a user to a task in a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : AssignAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TaskAssignment


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.assignments.assign(
                id=1,
                task_pk=1,
                type="AN",
                users=[1],
            )


        asyncio.run(main())
        r8   Nr9   r;   s          r   r:   zAsyncAssignmentsClient.assign  ?     | **11"gDPUgv1ww	~~ x   $979r8   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a\  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Remove assignees for a task within a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : typing.Optional[DeleteAssignmentsRequestType]
            Assignment type to delete (optional). If omitted, deletes all assignments for the task.

        users : typing.Optional[str]
            Comma separated list of user IDs to delete, as a string. If omitted, deletes all assignees for the given type.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.assignments.delete(
                id=1,
                task_pk=1,
            )


        asyncio.run(main())
        r8   Nr>   r;   s          r   r?   zAsyncAssignmentsClient.delete	  s?     v **11"gDPUgv1ww	~~ xrW   c                v   K   | j                   j                  |||||       d{   }|j                  S 7 w)a  
        <Card href="https://humansignal.com/goenterprise">
                <img style="pointer-events: none; margin-left: 0px; margin-right: 0px;" src="https://docs.humansignal.com/images/badge.svg" alt="Label Studio Enterprise badge"/>
                <p style="margin-top: 10px; font-size: 14px;">
                    This endpoint is not available in Label Studio Community Edition. [Learn more about Label Studio Enterprise](https://humansignal.com/goenterprise)
                </p>
            </Card>
        Update the assignee for a task in a specific project.

        Parameters
        ----------
        id : int
            A unique integer value identifying this project.

        task_pk : int
            A unique integer value identifying this task.

        type : UpdateAssignmentsRequestType
            Assignment type. Use AN for annotate or RE for review.

        users : typing.Sequence[int]
            List of user IDs to assign

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TaskAssignment


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.projects.assignments.update(
                id=1,
                task_pk=1,
                type="AN",
                users=[1],
            )


        asyncio.run(main())
        r8   NrA   r;   s          r   rB   zAsyncAssignmentsClient.updateG  rV   rW   )rC   rD   rE   r   r   rF   r	   r!   rG   rH   r   r   rI   rJ   rK   r   r   r   r-   rL   r   r5   r   r:   r   rM   r?   r   rB   rN   r   r   rP   rP   ;  s   T*< T  #<    " IM;?II B	I
 /I s#I !DEI  8I 
'IX \`11 #19?9X1	^	$1t <@?? ?
 +? s#?  8? 
?L ?C&*;?<< <
 oo:;< s#<  8< 
<J <@?? ?
 +? s#?  8? 
?r   rP   )rI   core.client_wrapperr   r   core.request_optionsr   types.task_assignmentr   
raw_clientr	   r
   %types.assign_assignments_request_typer   -types.bulk_assign_assignments_request_filtersr   4types.bulk_assign_assignments_request_selected_itemsr   *types.bulk_assign_assignments_request_typer   &types.bulk_assign_assignments_responser   %types.delete_assignments_request_typer   %types.update_assignments_request_typer   castAnyrG   r   rP   rN   r   r   <module>rg      s\     H 2 3 G O ^ k X Q O O v{{6::s#c cL	K Kr   