
    ]j;*                         d dl Z d dlmZ ddlmZ ddlmZ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  e j.                  e j0                  d      Z G d d      Z G d d      Zy)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)ProjectGroupRequest)ScimSettings)ScimSettingsUpdate.c                   f   e Zd ZdefdZdddej                  e   dee	   fdZ
eeeddd	ej                  ej                  e      d
ej                  ej                  ej                  e         dej                  ej                  ej                  e         dej                  e   dee   f
dZy)RawScimClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     N/root/env/lib/python3.12/site-packages/label_studio_sdk/sso/scim/raw_client.py__init__zRawScimClient.__init__   
    -    Nrequest_optionsr   returnc                   | j                   j                  j                  dd|      }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||      S |j                         }t        |j                  t        |j                        |      # t        $ r6 t        |j                  t        |j                        |j                        w xY 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>
        Retrieve SCIM settings for the currently active organization.

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

        Returns
        -------
        HttpResponse[ScimSettings]

        api/scim/settingsGETmethodr      ,  type_object_responsedatastatus_codeheadersbody)r   httpx_clientrequestr.   typingcastr   r   jsonr	   r   r   dictr/   textr   r   	_response_data_response_jsons        r   getzRawScimClient.get   s    ( ((55==+ > 
	
	ti++1c1 "* ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AC C ?D projects_groupsroles_groupsworkspaces_groupsr   r>   r?   r@   c          	      b   | j                   j                  j                  ddt        |t        j
                  t           d      ||dddi|t              }	 d	|j                  cxk  rd
k  rGn nDt	        j                  t        t        t        |j                                     }t        ||      S |j                         }t        |j                  t!        |j"                        |      # t        $ r6 t        |j                  t!        |j"                        |j$                        w xY 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 SCIM settings for the currently active organization.

        Parameters
        ----------
        projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
            Projects to Groups Mapping. List of objects with project_id, group, role.

        roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
            Organization Roles to Groups Mapping. List of [role_name, group_name] pairs.

        workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
            Workspaces to Groups Mapping. List of [workspace_title, group_name] pairs.

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

        Returns
        -------
        HttpResponse[ScimSettingsUpdate]

        r!   POSTwriter)   
annotation	directionr>   r?   r@   content-typeapplication/jsonr$   r5   r/   r   omitr%   r&   r'   r*   r-   )r   r1   r2   r   r3   Sequencer   OMITr.   r4   r   r   r5   r	   r   r   r6   r/   r7   r   r>   r?   r@   r   r9   r:   r;   s           r   updatezRawScimClient.update@   s   H ((55==#J+H[8\ho$ !-%6  2 , > 
	 	ti++1c1&"0 ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AC/ 4C/ /?D.)__name__
__module____qualname__r   r   r3   Optionalr
   r	   r   r<   rM   rL   r   strr   rO    r   r   r   r      s    .*; . IM &pfoon&E &pQ]^jQk &pV RVOSTX;?Ap  9L)MNAp oofoofooc6J&KL	Ap
 "??6??6??3;O+PQAp  8Ap 
(	)Apr   r   c                   f   e Zd ZdefdZdddej                  e   dee	   fdZ
eeeddd	ej                  ej                  e      d
ej                  ej                  ej                  e         dej                  ej                  ej                  e         dej                  e   dee   f
dZy)AsyncRawScimClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawScimClient.__init__   r   r   Nr   r   r   c                "  K   | j                   j                  j                  dd|       d{   }	 d|j                  cxk  rdk  rGn nDt	        j
                  t        t        t        |j                                     }t        ||      S |j                         }t        |j                  t        |j                        |	      7 # t        $ r6 t        |j                  t        |j                        |j                  	      w xY w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>
        Retrieve SCIM settings for the currently active organization.

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

        Returns
        -------
        AsyncHttpResponse[ScimSettings]

        r!   r"   r#   Nr%   r&   r'   r*   r-   )r   r1   r2   r.   r3   r4   r   r   r5   r   r   r   r6   r/   r7   r8   s        r   r<   zAsyncRawScimClient.get   s     ( ..;;CC+ D 
 
	
	ti++1c1 "* ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo%
   	ty'<'<d9K\K\F]dmdrdrss	ts3   ,DCDAC DC  ,D?DDr=   r>   r?   r@   c          	      ~  K   | j                   j                  j                  ddt        |t        j
                  t           d      ||dddi|t               d	{   }	 d
|j                  cxk  rdk  rGn nDt	        j                  t        t        t        |j                                     }t        ||      S |j                         }t        |j                  t!        |j"                        |      7 # t        $ r6 t        |j                  t!        |j"                        |j$                        w xY w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 SCIM settings for the currently active organization.

        Parameters
        ----------
        projects_groups : typing.Optional[typing.Sequence[ProjectGroupRequest]]
            Projects to Groups Mapping. List of objects with project_id, group, role.

        roles_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
            Organization Roles to Groups Mapping. List of [role_name, group_name] pairs.

        workspaces_groups : typing.Optional[typing.Sequence[typing.Sequence[str]]]
            Workspaces to Groups Mapping. List of [workspace_title, group_name] pairs.

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

        Returns
        -------
        AsyncHttpResponse[ScimSettingsUpdate]

        r!   rB   rC   rD   rG   rH   rI   rJ   Nr%   r&   r'   r*   r-   )r   r1   r2   r   r3   rL   r   rM   r.   r4   r   r   r5   r   r   r   r6   r/   r7   rN   s           r   rO   zAsyncRawScimClient.update   s-    H ..;;CC#J+H[8\ho$ !-%6  2 , D 
 
	 	ti++1c1&"0 ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	ts7   AD=C9D="AC; =D=>C; ,D=;?D::D=)rP   rQ   rR   r   r   r3   rS   r
   r   r   r<   rM   rL   r   rT   r   rO   rU   r   r   rW   rW      s    .*< . OS &pFOON,K &pWhiuWv &pV RVOSTX;?Ap  9L)MNAp oofoofooc6J&KL	Ap
 "??6??6??3;O+PQAp  8Ap 
-	.Apr   rW   )r3   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.request_optionsr
   core.serializationr   core.unchecked_base_modelr   types.project_group_requestr   types.scim_settingsr   types.scim_settings_updater   r4   AnyrM   r   rW   rU   r   r   <module>rf      s]     ( & H A 2 I 7 > / < v{{6::s#mp mp`mp mpr   