o
    i+X                     @   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 ddlmZ ddlmZ ddlmZ e e jd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)DeleteProjectV1Response)GetProjectV1Response)LeaveProjectV1Response)ListProjectsV1Response)UpdateProjectV1Response.c                   @      e Zd ZdefddZdddeje dee	 fdd	Z
dddd
dedeje deje deje dee f
ddZdddedeje dee fddZedddedeje deje dee fddZdddedeje dee fddZdS )RawProjectsClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   Z/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/manage/v1/projects/raw_client.py__init__      
zRawProjectsClient.__init__Nrequest_optionsr    returnc             	   C   s   | j jjd| j  jd|d}z@d|j  krdk r0n nttt	t|
 d}t||dW S |jdkrJtt|jttjt	tj|
 dd	|
 }W n tyb   t|jt|j|jd
w t|jt|j|d
)aV  
        Retrieves basic information about the projects associated with the API key

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

        Returns
        -------
        HttpResponse[ListProjectsV1Response]
            A list of projects
        v1/projectsGETbase_urlmethodr       ,  type_object_responsedata  headersbodystatus_coder1   r2   )r   httpx_clientrequestget_environmentbaser4   typingcastr   r   jsonr   r   dictr1   Anyr   r   textr   r    	_response_data_response_jsonr   r   r   list   s@   


zRawProjectsClient.listlimitpager    
project_idrE   rF   c             	   C   s   | j jjdt| | j  jd||d|d}z@d|j  kr$dk r9n ntt	t
t	| d}t||dW S |jd	krStt|jttjt
tj| dd
| }W n tyk   t|jt|j|jdw t|jt|j|d)a  
        Retrieves information about the specified project

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

        limit : typing.Optional[float]
            Number of results to return per page. Default 10. Range [1,1000]

        page : typing.Optional[float]
            Navigate and return the results to retrieve specific portions of information of the response

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

        Returns
        -------
        HttpResponse[GetProjectV1Response]
            A project
        v1/projects/r#   rE   rF   r%   r&   paramsr    r'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   r   rG   rE   rF   r    r@   rA   rB   r   r   r   getI   sF   



zRawProjectsClient.getc             	   C   s   | j jjdt| | j  jd|d}z@d|j  kr dk r5n ntt	t
t	| d}t||dW S |jdkrOtt|jttjt
tj| dd	| }W n tyg   t|jt|j|jd
w t|jt|j|d
)al  
        Deletes the specified project

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

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

        Returns
        -------
        HttpResponse[DeleteProjectV1Response]
            A project
        rH   DELETEr$   r'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   r   rG   r    r@   rA   rB   r   r   r   delete   s@   


zRawProjectsClient.deletenamer    rR   c             	   C   s   | j jjdt| | j  jdd|iddi|td}z@d|j  kr'dk r<n nt	t
tt
| d	}t||d
W S |jdkrVtt|jt	tjttj| d	d| }W n tyn   t|jt|j|jdw t|jt|j|d)a  
        Updates the name or other properties of an existing project

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

        name : typing.Optional[str]
            The name of the project

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

        Returns
        -------
        HttpResponse[UpdateProjectV1Response]
            A project
        rH   PATCHrR   content-typeapplication/jsonr%   r&   r;   r1   r    omitr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   OMITr4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   r   rG   rR   r    r@   rA   rB   r   r   r   update   sJ   


zRawProjectsClient.updatec             	   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  
        Removes the authenticated account from the specific project

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

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

        Returns
        -------
        HttpResponse[LeaveProjectV1Response]
            Successfully removed account from project
        rH   /leaverN   r$   r'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   rO   r   r   r   leave   s@   


zRawProjectsClient.leave)__name__
__module____qualname__r   r   r9   Optionalr
   r   r   rC   strfloatr   rM   r   rP   rX   r   rZ   r   r\   r   r   r   r   r      sX    "2
C
7
Br   c                   @   r   )AsyncRawProjectsClientr   c                C   r   r   r   r   r   r   r   r   4  r   zAsyncRawProjectsClient.__init__Nr   r    r!   c             	      s   | j jjd| j  jd|dI dH }z@d|j  krdk r4n nttt	t|
 d}t||dW S |jd	krNtt|jttjt	tj|
 dd
|
 }W n tyf   t|jt|j|jdw t|jt|j|d)a[  
        Retrieves basic information about the projects associated with the API key

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

        Returns
        -------
        AsyncHttpResponse[ListProjectsV1Response]
            A list of projects
        r"   r#   r$   Nr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   r?   r   r   r   rC   7  sB   


zAsyncRawProjectsClient.listrD   rG   rE   rF   c             	      s   | j jjdt| | j  jd||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rWtt|jttjt
tj| dd| }W n tyo   t|jt|j|jdw t|jt|j|d)a  
        Retrieves information about the specified project

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

        limit : typing.Optional[float]
            Number of results to return per page. Default 10. Range [1,1000]

        page : typing.Optional[float]
            Navigate and return the results to retrieve specific portions of information of the response

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

        Returns
        -------
        AsyncHttpResponse[GetProjectV1Response]
            A project
        rH   r#   rI   rJ   Nr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   rL   r   r   r   rM   g  sH   



zAsyncRawProjectsClient.getc             	      s   | j jjdt| | j  jd|dI dH }z@d|j  kr$dk r9n ntt	t
t	| d}t||dW S |jd	krStt|jttjt
tj| dd
| }W n tyk   t|jt|j|jdw t|jt|j|d)aq  
        Deletes the specified project

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

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

        Returns
        -------
        AsyncHttpResponse[DeleteProjectV1Response]
            A project
        rH   rN   r$   Nr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   rO   r   r   r   rP     sB   


zAsyncRawProjectsClient.deleterQ   rR   c             	      s   | j jjdt| | j  jdd|iddi|t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rZtt|jt	tjttj| d
d| }W n tyr   t|jt|j|jdw t|jt|j|d)a  
        Updates the name or other properties of an existing project

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

        name : typing.Optional[str]
            The name of the project

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

        Returns
        -------
        AsyncHttpResponse[UpdateProjectV1Response]
            A project
        rH   rS   rR   rT   rU   rV   Nr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   rX   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   rY   r   r   r   rZ     sL   


zAsyncRawProjectsClient.updatec             	      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  
        Removes the authenticated account from the specific project

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

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

        Returns
        -------
        AsyncHttpResponse[LeaveProjectV1Response]
            Successfully removed account from project
        rH   r[   rN   r$   Nr'   r(   r)   r,   r/   r0   r3   )r   r5   r6   r	   r7   r8   r4   r9   r:   r   r   r;   r   r   r<   r1   r=   r   r   r>   rO   r   r   r   r\     sB   


zAsyncRawProjectsClient.leave)r]   r^   r_   r   r   r9   r`   r
   r   r   rC   ra   rb   r   rM   r   rP   rX   r   rZ   r   r\   r   r   r   r   rc   3  sb    
4
C
7
Brc   )"r9   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_v1responser   types.get_project_v1responser   types.leave_project_v1responser   types.list_projects_v1responser   types.update_project_v1responser   r:   r=   rX   r   rc   r   r   r   r   <module>   s&     