
    ]jd                    B   d dl mZ d dlZ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 ddlmZ dd	lmZ dd
lmZ ddlmZmZ ej.                  r ddlmZmZ ddlmZmZ ddlmZm Z  ddl!m"Z"m#Z#  ejH                  ejJ                  d      Z& G d d      Z' G d d      Z(y)    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)DefaultRole)LseOrganization)OrganizationId)OrganizationInvite)Role9E7Enum   )AsyncRawOrganizationsClientRawOrganizationsClient)AsyncInvitesClientInvitesClient)AsyncMemberTagsClientMemberTagsClient)AsyncMembersClientMembersClient)AsyncPermissionsClientPermissionsClient.c                  >   e Zd ZddZedd       ZddddZddd	 	 	 	 	 ddZddddZe	e	e	e	e	e	e	e	dd			 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Z
e	e	e	e	e	e	e	e	e	e	e	dd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZed        Zed        Zed        Zed        Zy)OrganizationsClientc               l    t        |      | _        || _        d | _        d | _        d | _        d | _        y Nclient_wrapper)r   _raw_client_client_wrapper_invites_member_tags_members_permissionsselfr   s     O/root/env/lib/python3.12/site-packages/label_studio_sdk/organizations/client.py__init__zOrganizationsClient.__init__   s5    1P-8<?C8<@D    c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawOrganizationsClient
        r   r%   s    r&   with_raw_responsez%OrganizationsClient.with_raw_response#        r(   Nrequest_optionsc               R    | j                   j                  |      }|j                  S )a  
        Reset the token used in the invitation link to invite someone to an organization.

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

        Returns
        -------
        OrganizationInvite


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.organizations.reset_token()
        r.   r   reset_tokendatar%   r/   	_responses      r&   r2   zOrganizationsClient.reset_token.   s'    . $$000Q	~~r(   orderingr/   c               T    | j                   j                  ||      }|j                  S )ad  

                Return a list of the organizations you've created or that you have access to.


        Parameters
        ----------
        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        typing.List[OrganizationId]


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.organizations.list()
        r6   r   listr3   r%   r7   r/   r5   s       r&   r:   zOrganizationsClient.listH   s)    < $$))8_)]	~~r(   c               T    | j                   j                  ||      }|j                  S )a  
        Retrieve the settings for a specific organization by ID.

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

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

        Returns
        -------
        LseOrganization


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.organizations.get(
            id=1,
        )
        r.   r   getr3   r%   idr/   r5   s       r&   r>   zOrganizationsClient.geti   s)    6 $$((_(M	~~r(   	contact_info
created_bycustom_scripts_enabledemail_notification_settingsembed_domainsembed_settingstitletokenr/   c       	        d    | 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 organization details including title, embed domains, and Plugins settings.

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

        contact_info : typing.Optional[str]

        created_by : typing.Optional[int]

        custom_scripts_enabled : typing.Optional[bool]
            Plugins

        email_notification_settings : typing.Optional[typing.Any]
            Email Notification Settings

        embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Supported domains

        embed_settings : typing.Optional[typing.Any]
            Public Verification Key and Public Verification Algorithms configuration

        title : typing.Optional[str]
            Organization name

        token : typing.Optional[str]

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

        Returns
        -------
        LseOrganization


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.organizations.update(
            id=1,
        )
        rA   r   updater3   r%   r@   rB   rC   rD   rE   rF   rG   rH   rI   r/   r5   s               r&   rL   zOrganizationsClient.update   sJ    F $$++%!#9(C')+ , 
	 ~~r(   &annotator_reviewer_firewall_enabled_atcustom_scripts_enabled_atdefault_rolerE   rF   rG   external_idextra_data_on_activity_logs#label_stream_navigation_disabled_atorganizationread_only_quick_view_enabled_atr/   c               j    | 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 default role for members of a specific organization.

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

        annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime]
            Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI.

        custom_scripts_enabled_at : typing.Optional[dt.datetime]
            Set to current time to enable custom scripts (Plugins) for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts (Plugins).

        default_role : typing.Optional[Role9E7Enum]
            Default membership role for invited users

            * `OW` - Owner
            * `AD` - Administrator
            * `MA` - Manager
            * `RE` - Reviewer
            * `AN` - Annotator
            * `DI` - Deactivated
            * `NO` - Not Activated

        email_notification_settings : typing.Optional[typing.Any]
            Email notification settings for this organization. Controls which email notifications users can receive. Structure: {"notifications_allowed": {"notification_type": bool}}

        embed_domains : typing.Optional[typing.Any]
            List of objects: {"domain": "example.com"}. Used for CSP header on /embed routes.

        embed_settings : typing.Optional[typing.Any]
            Embed settings for this organization

        external_id : typing.Optional[str]
            External ID to uniquely identify this organization

        extra_data_on_activity_logs : typing.Optional[bool]

        label_stream_navigation_disabled_at : typing.Optional[dt.datetime]
            Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels.

        organization : typing.Optional[int]
            A unique integer value identifying this organization.

        read_only_quick_view_enabled_at : typing.Optional[dt.datetime]
            Set to current time to prevent creating or editing annotations in quick view.

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

        Returns
        -------
        DefaultRole


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

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.organizations.update_default_role(
            id=1,
        )
        rN   r   update_default_roler3   r%   r@   rO   rP   rQ   rE   rF   rG   rR   rS   rT   rU   rV   r/   r5   s                  r&   rY   z'OrganizationsClient.update_default_role   sS    r $$883Y&?%(C')#(C0S%,K+ 9 
	 ~~r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r    invites.clientr   r   )r%   r   s     r&   inviteszOrganizationsClient.invitesB  +    == 5)9M9MNDM}}r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r!   member_tags.clientr   r   )r%   r   s     r&   member_tagszOrganizationsClient.member_tagsJ  s0    $< 0@T@T UD   r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r"   members.clientr   r   )r%   r   s     r&   memberszOrganizationsClient.membersR  r^   r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r#   permissions.clientr   r   )r%   r   s     r&   permissionszOrganizationsClient.permissionsZ  s0    $= 1AUAU VD   r(   )r   r   )returnr   r/   typing.Optional[RequestOptions]rh   r   r7   typing.Optional[str]r/   rj   rh   ztyping.List[OrganizationId]r@   intr/   rj   rh   r	   r@   rn   rB   rl   rC   typing.Optional[int]rD   typing.Optional[bool]rE   typing.Optional[typing.Any]rF   z7typing.Optional[typing.Sequence[typing.Dict[str, str]]]rG   rr   rH   rl   rI   rl   r/   rj   rh   r	   r@   rn   rO   typing.Optional[dt.datetime]rP   rt   rQ   ztyping.Optional[Role9E7Enum]rE   rr   rF   rr   rG   rr   rR   rl   rS   rq   rT   rt   rU   rp   rV   rt   r/   rj   rh   r   __name__
__module____qualname__r'   propertyr,   r2   r:   r>   OMITrL   rY   r]   ra   rd   rg    r(   r&   r   r      s   E     QU 6 37ko/Ih	$B RV D .2+/8<CGQU6:&*&*;?OO +	O
 )O !6O &AO OO 4O $O $O 9O 
Oj PTBF59CG596:,0=ALP-1HL;?hh 1M	h
 $@h 3h &Ah 3h 4h *h &;h .Jh +h *Fh 9h  
!hT   ! !   ! !r(   r   c                  >   e Zd ZddZedd       ZddddZddd	 	 	 	 	 ddZddddZe	e	e	e	e	e	e	e	dd			 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
Z
e	e	e	e	e	e	e	e	e	e	e	dd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZed        Zed        Zed        Zed        Zy)AsyncOrganizationsClientc               l    t        |      | _        || _        d | _        d | _        d | _        d | _        y r   )r   r   r   r    r!   r"   r#   r$   s     r&   r'   z!AsyncOrganizationsClient.__init__d  s5    6nU-=ADH=AEIr(   c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawOrganizationsClient
        r*   r+   s    r&   r,   z*AsyncOrganizationsClient.with_raw_responsel  r-   r(   Nr.   c               n   K   | j                   j                  |       d{   }|j                  S 7 w)ag  
        Reset the token used in the invitation link to invite someone to an organization.

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

        Returns
        -------
        OrganizationInvite


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.organizations.reset_token()


        asyncio.run(main())
        r.   Nr1   r4   s      r&   r2   z$AsyncOrganizationsClient.reset_tokenw  s4     > **666WW	~~ Xs    535r6   c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)a  

                Return a list of the organizations you've created or that you have access to.


        Parameters
        ----------
        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        typing.List[OrganizationId]


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.organizations.list()


        asyncio.run(main())
        r6   Nr9   r;   s       r&   r:   zAsyncOrganizationsClient.list  s8     L **//Sb/cc	~~ d   !646c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)ax  
        Retrieve the settings for a specific organization by ID.

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

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

        Returns
        -------
        LseOrganization


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.organizations.get(
                id=1,
            )


        asyncio.run(main())
        r.   Nr=   r?   s       r&   r>   zAsyncOrganizationsClient.get  s7     F **..r?.SS	~~ Tr   rA   c       	           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 organization details including title, embed domains, and Plugins settings.

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

        contact_info : typing.Optional[str]

        created_by : typing.Optional[int]

        custom_scripts_enabled : typing.Optional[bool]
            Plugins

        email_notification_settings : typing.Optional[typing.Any]
            Email Notification Settings

        embed_domains : typing.Optional[typing.Sequence[typing.Dict[str, str]]]
            Supported domains

        embed_settings : typing.Optional[typing.Any]
            Public Verification Key and Public Verification Algorithms configuration

        title : typing.Optional[str]
            Organization name

        token : typing.Optional[str]

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

        Returns
        -------
        LseOrganization


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.organizations.update(
                id=1,
            )


        asyncio.run(main())
        rA   NrK   rM   s               r&   rL   zAsyncOrganizationsClient.update  sX     V **11%!#9(C')+ 2 
 
	 ~~
s   )><>rN   c                  K   | j                   j                  |||||||||	|
|||       d{   }|j                  S 7 w)aL  
        <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 default role for members of a specific organization.

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

        annotator_reviewer_firewall_enabled_at : typing.Optional[dt.datetime]
            Set to current time to restrict data sharing between annotators and reviewers in the label stream, review stream, and notifications (which will be disabled). In these settings, information about annotator and reviewer identity is suppressed in the UI.

        custom_scripts_enabled_at : typing.Optional[dt.datetime]
            Set to current time to enable custom scripts (Plugins) for this organization. Can only be enabled if no organization members are active members of any other organizations; otherwise an error will be raised. If this occurs, contact the LEAP team for assistance with enabling custom scripts (Plugins).

        default_role : typing.Optional[Role9E7Enum]
            Default membership role for invited users

            * `OW` - Owner
            * `AD` - Administrator
            * `MA` - Manager
            * `RE` - Reviewer
            * `AN` - Annotator
            * `DI` - Deactivated
            * `NO` - Not Activated

        email_notification_settings : typing.Optional[typing.Any]
            Email notification settings for this organization. Controls which email notifications users can receive. Structure: {"notifications_allowed": {"notification_type": bool}}

        embed_domains : typing.Optional[typing.Any]
            List of objects: {"domain": "example.com"}. Used for CSP header on /embed routes.

        embed_settings : typing.Optional[typing.Any]
            Embed settings for this organization

        external_id : typing.Optional[str]
            External ID to uniquely identify this organization

        extra_data_on_activity_logs : typing.Optional[bool]

        label_stream_navigation_disabled_at : typing.Optional[dt.datetime]
            Set to current time to disable the label stream navigation for this organization. This will prevent users from going back in the label stream to view previous labels.

        organization : typing.Optional[int]
            A unique integer value identifying this organization.

        read_only_quick_view_enabled_at : typing.Optional[dt.datetime]
            Set to current time to prevent creating or editing annotations in quick view.

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

        Returns
        -------
        DefaultRole


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.organizations.update_default_role(
                id=1,
            )


        asyncio.run(main())
        rN   NrX   rZ   s                  r&   rY   z,AsyncOrganizationsClient.update_default_roleA  sa     B **>>3Y&?%(C')#(C0S%,K+ ? 
 
	 ~~
s   ,A?Ac                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r    r\   r   r   )r%   r   s     r&   r]   z AsyncOrganizationsClient.invites  +    == :.d>R>RSDM}}r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r!   r`   r   r   )r%   r   s     r&   ra   z$AsyncOrganizationsClient.member_tags  s0    $A 5TEYEY ZD   r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r"   rc   r   r   )r%   r   s     r&   rd   z AsyncOrganizationsClient.members  r   r(   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r#   rf   r   r   )r%   r   s     r&   rg   z$AsyncOrganizationsClient.permissions  s0    $B 6dFZFZ [D   r(   )r   r   )rh   r   ri   rk   rm   ro   rs   ru   r{   r(   r&   r}   r}   c  s   J     W[  F 37ko'/'Ih'	$'R X\ $T .2+/8<CGQU6:&*&*;?WW +	W
 )W !6W &AW OW 4W $W $W 9W 
Wz PTBF59CG596:,0=ALP-1HL;?pp 1M	p
 $@p 3p &Ap 3p 4p *p &;p .Jp +p *Fp 9p  
!pd   ! !   ! !r(   r}   ))
__future__r   datetimedttypingcore.client_wrapperr   r   core.request_optionsr   types.default_roler   types.lse_organizationr	   types.organization_idr
   types.organization_inviter   types.role9e7enumr   
raw_clientr   r   TYPE_CHECKINGr\   r   r   r`   r   r   rc   r   r   rf   r   r   castAnyrz   r   r}   r{   r(   r&   <module>r      sl    #   G 1 , 4 2 : + K	AKAMv{{6::s#F! F!R
n! n!r(   