o
    i$                     @   s   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 G dd dZG dd dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)BadRequestError)DeleteProjectMemberV1Response)ListProjectMembersV1Responsec                
   @   j   e Zd ZdefddZdddedeje de	e
 fd	d
Zdddededeje de	e fddZdS )RawMembersClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   b/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/manage/v1/projects/members/raw_client.py__init__      
zRawMembersClient.__init__Nrequest_options
project_idr   returnc             	   C   s   | j jjdt| d| j  jd|d}z@d|j  kr!dk r6n ntt	t
t	| d}t||dW S |jd	krPtt|jttjt
tj| dd
| }W n tyh   t|jt|j|jdw t|jt|j|d)a  
        Retrieves a list of members for a given project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        HttpResponse[ListProjectMembersV1Response]
            A list of members for a given project
        v1/projects//membersGETbase_urlmethodr      ,  type_object_responsedata  headersbodystatus_coder0   r1   )r   httpx_clientrequestr	   get_environmentbaser3   typingcastr   r   jsonr   r   dictr0   Anyr   r   textr   r   r   	_response_data_response_jsonr   r   r   list   s@   


zRawMembersClient.list	member_idc             	   C   s   | j jjdt| dt| | j  jd|d}z@d|j  kr%dk r:n ntt	t
t	| d}t||dW S |jd	krTtt|jttjt
tj| dd
| }W n tyl   t|jt|j|jdw t|jt|j|d)a  
        Removes a member from the project using their unique member ID

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

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

        Returns
        -------
        HttpResponse[DeleteProjectMemberV1Response]
            Delete the specific member from the project
        r    	/members/DELETEr#   r&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r	   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   r   r   rC   r   r?   r@   rA   r   r   r   deleteH   s@   


zRawMembersClient.delete)__name__
__module____qualname__r   r   strr8   Optionalr
   r   r   rB   r   rG   r   r   r   r   r      (    
4r   c                
   @   r   )AsyncRawMembersClientr   c                C   r   r   r   r   r   r   r   r      r   zAsyncRawMembersClient.__init__Nr   r   r   r   c             	      s   | j jjdt| d| j  jd|dI dH }z@d|j  kr%dk r:n ntt	t
t	| d}t||d	W S |jd
krTtt|jttjt
tj| dd| }W n tyl   t|jt|j|jdw t|jt|j|d)a  
        Retrieves a list of members for a given project

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

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

        Returns
        -------
        AsyncHttpResponse[ListProjectMembersV1Response]
            A list of members for a given project
        r    r!   r"   r#   Nr&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r	   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   r>   r   r   r   rB      sB   


zAsyncRawMembersClient.listrC   c             	      s   | j jjdt| dt| | j  jd|dI dH }z@d|j  kr)dk r>n ntt	t
t	| d}t||d	W S |jd
krXtt|jttjt
tj| dd| }W n typ   t|jt|j|jdw t|jt|j|d)a  
        Removes a member from the project using their unique member ID

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        member_id : str
            The unique identifier of the Member

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

        Returns
        -------
        AsyncHttpResponse[DeleteProjectMemberV1Response]
            Delete the specific member from the project
        r    rD   rE   r#   Nr&   r'   r(   r+   r.   r/   r2   )r   r4   r5   r	   r6   r7   r3   r8   r9   r   r   r:   r   r   r;   r0   r<   r   r   r=   rF   r   r   r   rG      sB   


zAsyncRawMembersClient.delete)rH   rI   rJ   r   r   rK   r8   rL   r
   r   r   rB   r   rG   r   r   r   r   rN      rM   rN   )r8   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.jsonable_encoderr	   core.request_optionsr
   core.unchecked_base_modelr   errors.bad_request_errorr   &types.delete_project_member_v1responser   %types.list_project_members_v1responser   r   rN   r   r   r   r   <module>   s   n