
    ]jD                         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  e j*                  e j,                  d      Z G d d      Z G d d      Zy)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)ProjectRole)Role9E7Enum.c                   x   e Zd ZdefdZdddddej                  e   dej                  e   dej                  e	   de
ej                  e      fd	Zdd
dedededej                  e	   de
e   f
dZdd
dedej                  e	   de
d   fdZdd
dedej                  e	   de
ej                  e      fdZy)RawRolesClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     T/root/env/lib/python3.12/site-packages/label_studio_sdk/projects/roles/raw_client.py__init__zRawRolesClient.__init__   
    -    Nidsorderingrequest_optionsr   r   r   returnc                R   | j                   j                  j                  dd||d|      }	 d|j                  cxk  rdk  rin nft	        j
                  t        j                  t           t        t        j                  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>

                List project roles for requested IDs for the current user


        Parameters
        ----------
        ids : typing.Optional[int]

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

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

        Returns
        -------
        HttpResponse[typing.List[ProjectRole]]

        api/projects/roles/GETr   r   methodparamsr      ,  type_object_responsedatastatus_codeheadersbody)r   httpx_clientrequestr1   typingcastListr   r   jsonr	   r   r   dictr2   textr   r   r   r   	_response_data_response_jsons          r   listzRawRolesClient.list   s   B ((55==!$ , > 
		ti++1c1KK,"$kk+6 ) 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&r   projectroleuserc                    | j                   j                  j                  d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>

                Create project role for user allowing the user the same access level provided by organization role.


        Parameters
        ----------
        project : int

        role : Role9E7Enum

        user : int

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

        Returns
        -------
        HttpResponse[ProjectRole]
            Role created
        r"   POSTrB   rC   rD   content-typeapplication/jsonr&   r9   r2   r   omitr(   r)   r*   r-   r0   )r   r4   r5   OMITr1   r6   r7   r   r   r9   r	   r   r   r:   r2   r;   r   rB   rC   rD   r   r=   r>   r?   s           r   addzRawRolesClient.addP   s   < ((55==!"  2 , > 
		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idc                   | j                   j                  j                  dt        |       dd|      }	 d|j                  cxk  rdk  rn nt        |d      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>

                Remove project role for user allowing the user the same access level provided by organization role.


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

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

        Returns
        -------
        HttpResponse[None]
        r"   /DELETEr&   r   r(   r)   Nr-   r0   )r   r4   r5   r
   r1   r	   r9   r   r   r:   r2   r;   r   rO   r   r=   r?   s        r   removezRawRolesClient.remove   s    0 ((55==!"22"6!7q9+ > 
	
	ti++1c1#YTBB&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   $B B ?Cc                d   | j                   j                  j                  dt        |       dd|      }	 d|j                  cxk  rdk  rin nft        j                  t
        j                  t           t        t
        j                  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>

                List users and their project level roles for a given project.
                If user is not listed here and is a member of the project then they would behave as assigned role in organization.


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

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

        Returns
        -------
        HttpResponse[typing.List[ProjectRole]]

        api/projects//rolesr#   rS   r(   r)   r*   r-   r0   )r   r4   r5   r
   r1   r6   r7   r8   r   r   r9   r	   r   r   r:   r2   r;   r   rO   r   r=   r>   r?   s         r   getzRawRolesClient.get   s   6 ((55==,R018+ > 
	
	ti++1c1KK,"$kk+6 ) 0 $YUCC&^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   A=C0 5C0 0?D/)__name__
__module____qualname__r   r   r6   Optionalintstrr   r	   r8   r   r@   r   rN   rU   rZ    r   r   r   r      s5   .*; . %))-;?7p __S!7p //#&	7p
  87p 
fkk+.	/7pt qu9p9p%09p8;9pNToo^lNm9p	k	"9pv UY #p #p&//.2Q #p]ijn]o #pL NR-p-p+1??>+J-p	fkk+.	/-pr   r   c                   x   e Zd ZdefdZdddddej                  e   dej                  e   dej                  e	   de
ej                  e      fd	Zdd
dedededej                  e	   de
e   f
dZdd
dedej                  e	   de
d   fdZdd
dedej                  e	   de
ej                  e      fdZy)AsyncRawRolesClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawRolesClient.__init__   r   r   Nr   r   r   r   r    c                n  K   | j                   j                  j                  dd||d|       d{   }	 d|j                  cxk  rdk  rin nft	        j
                  t        j                  t           t        t        j                  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>

                List project roles for requested IDs for the current user


        Parameters
        ----------
        ids : typing.Optional[int]

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

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

        Returns
        -------
        AsyncHttpResponse[typing.List[ProjectRole]]

        r"   r#   r$   r%   Nr(   r)   r*   r-   r0   )r   r4   r5   r1   r6   r7   r8   r   r   r9   r   r   r   r:   r2   r;   r<   s          r   r@   zAsyncRawRolesClient.list   s    B ..;;CC!$ , D 
 
		ti++1c1KK,"$kk+6 ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo-
(  	ty'<'<d9K\K\F]dmdrdrss	ts3   0D5C1D5A=C3 5D56C3 ,D53?D22D5rA   rB   rC   rD   c                <  K   | j                   j                  j                  d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>

                Create project role for user allowing the user the same access level provided by organization role.


        Parameters
        ----------
        project : int

        role : Role9E7Enum

        user : int

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

        Returns
        -------
        AsyncHttpResponse[ProjectRole]
            Role created
        r"   rF   rG   rH   rI   rJ   Nr(   r)   r*   r-   r0   )r   r4   r5   rL   r1   r6   r7   r   r   r9   r   r   r   r:   r2   r;   rM   s           r   rN   zAsyncRawRolesClient.add  s    < ..;;CC!"  2 , D 
 
		ti++1c1") ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo7
2  	ty'<'<d9K\K\F]dmdrdrss	ts4   9DCDAC DC -,D?DDrO   c                  K   | j                   j                  j                  dt        |       dd|       d{   }	 d|j                  cxk  rdk  rn nt        |d      S |j                         }t        |j                  t        |j                        |	      7 e# 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>

                Remove project role for user allowing the user the same access level provided by organization role.


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

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

        Returns
        -------
        AsyncHttpResponse[None]
        r"   rQ   rR   rS   Nr(   r)   r-   r0   )r   r4   r5   r
   r1   r   r9   r   r   r:   r2   r;   rT   s        r   rU   zAsyncRawRolesClient.removeX  s     4 ..;;CC!"22"6!7q9+ D 
 
	
	ti++1c1()$GG&^^-N 9#8#8$yGXGXBY`noo
  	ty'<'<d9K\K\F]dmdrdrss	ts3   9C%B!C%$B# %C%&B# 6,C%#?C""C%c                  K   | j                   j                  j                  dt        |       dd|       d{   }	 d|j                  cxk  rdk  rin nft        j                  t
        j                  t           t        t
        j                  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>

                List users and their project level roles for a given project.
                If user is not listed here and is a member of the project then they would behave as assigned role in organization.


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

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

        Returns
        -------
        AsyncHttpResponse[typing.List[ProjectRole]]

        rW   rX   r#   rS   Nr(   r)   r*   r-   r0   )r   r4   r5   r
   r1   r6   r7   r8   r   r   r9   r   r   r   r:   r2   r;   rY   s         r   rZ   zAsyncRawRolesClient.get  s    6 ..;;CC,R018+ D 
 
	
	ti++1c1KK,"$kk+6 ) 0 ))%HH&^^-N 9#8#8$yGXGXBY`noo%
   	ty'<'<d9K\K\F]dmdrdrss	ts4   9D>C:D>A=C< >D>?C< ,D><?D;;D>)r[   r\   r]   r   r   r6   r^   r_   r`   r   r   r8   r   r@   r   rN   rU   rZ   ra   r   r   rc   rc      s6   .*< . %))-;?7p __S!7p //#&	7p
  87p 
6;;{3	47pt qu9p9p%09p8;9pNToo^lNm9p	;	'9px NR%p%p+1??>+J%p	4	 %pP NR-p-p+1??>+J-p	6;;{3	4-pr   rc   )r6   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.unchecked_base_modelr   types.project_roler   types.role9e7enumr   r7   AnyrL   r   rc   ra   r   r   <module>rs      sZ     ( & H A 5 2 7 - , v{{6::s#Jp JpZLp Lpr   