o
    i'(                     @  s   d dl mZ d dlZd dlZd dlZddlmZ ddlmZm	Z	 ddl
mZ ejrad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 ddlmZmZ ddlmZmZ ddlm Z m!Z! G dd dZ"G dd dZ#dS )    )annotationsN   )ApiError)AsyncClientWrapperSyncClientWrapper)DeepgramClientEnvironment)AgentClientAsyncAgentClient)AsyncAuthClient
AuthClient)AsyncListenClientListenClient)AsyncManageClientManageClient)AsyncReadClient
ReadClient)AsyncSelfHostedClientSelfHostedClient)AsyncSpeakClientSpeakClientc                   @     e Zd ZdZejeddddddd"ddZe	dd Z
e	dd Ze	dd Ze	dd Ze	dd Ze	dd Ze	d d! ZdS )#
BaseClienta0  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    environment : DeepgramClientEnvironment
        The environment to use for requests from the client. from .environment import DeepgramClientEnvironment



        Defaults to DeepgramClientEnvironment.PRODUCTION



    api_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.Client]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from deepgram import DeepgramClient

    client = DeepgramClient(
        api_key="YOUR_API_KEY",
    )
    DEEPGRAM_API_KEYNTenvironmentapi_keyheaderstimeoutfollow_redirectshttpx_clientr   r   r   typing.Optional[str]r   &typing.Optional[typing.Dict[str, str]]r   typing.Optional[float]r   typing.Optional[bool]r   typing.Optional[httpx.Client]c                C     |d ur|n	|d u rdn|j j}|d u rtddt||||d ur#|n|d ur.tj||dntj|d|d| _d | _d | _d | _	d | _
d | _d | _d | _d S N<   zXThe client must be instantiated be either passing in api_key or setting DEEPGRAM_API_KEY)body)r   r   )r   )r   r   r   r   r   )r   readr   r   httpxClient_client_wrapper_agent_auth_listen_manage_read_self_hosted_speakselfr   r   r   r   r   r   _defaulted_timeout r7   H/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/base_client.py__init__<   0   

zBaseClient.__init__c                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   client_wrapper)r-   agent.clientr   r,   )r5   r   r7   r7   r8   agent`      
zBaseClient.agentc                 C  r;   )Nr   )r   r<   )r.   auth.clientr   r,   )r5   r   r7   r7   r8   authh   r@   zBaseClient.authc                 C  r;   )Nr   )r   r<   )r/   listen.clientr   r,   )r5   r   r7   r7   r8   listenp   r@   zBaseClient.listenc                 C  r;   )Nr   )r   r<   )r0   manage.clientr   r,   )r5   r   r7   r7   r8   managex   r@   zBaseClient.managec                 C  r;   )Nr   )r   r<   )r1   read.clientr   r,   )r5   r   r7   r7   r8   r)      r@   zBaseClient.readc                 C  r;   )Nr   )r   r<   )r2   self_hosted.clientr   r,   )r5   r   r7   r7   r8   self_hosted   r@   zBaseClient.self_hostedc                 C  r;   )Nr   )r   r<   )r3   speak.clientr   r,   )r5   r   r7   r7   r8   speak   r@   zBaseClient.speak)r   r   r   r    r   r!   r   r"   r   r#   r   r$   __name__
__module____qualname____doc__r   
PRODUCTIONosgetenvr9   propertyr?   rB   rD   rF   r)   rI   rK   r7   r7   r7   r8   r      .    '$





r   c                   @  r   )#AsyncBaseClienta?  
    Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propagate to these functions.

    Parameters
    ----------
    environment : DeepgramClientEnvironment
        The environment to use for requests from the client. from .environment import DeepgramClientEnvironment



        Defaults to DeepgramClientEnvironment.PRODUCTION



    api_key : typing.Optional[str]
    headers : typing.Optional[typing.Dict[str, str]]
        Additional headers to send with every request.

    timeout : typing.Optional[float]
        The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.

    follow_redirects : typing.Optional[bool]
        Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.

    httpx_client : typing.Optional[httpx.AsyncClient]
        The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.

    Examples
    --------
    from deepgram import AsyncDeepgramClient

    client = AsyncDeepgramClient(
        api_key="YOUR_API_KEY",
    )
    r   NTr   r   r   r   r    r   r!   r   r"   r   r#   r   "typing.Optional[httpx.AsyncClient]c                C  r%   r&   )r   r)   r   r   r*   AsyncClientr,   r-   r.   r/   r0   r1   r2   r3   r4   r7   r7   r8   r9      r:   zAsyncBaseClient.__init__c                 C  r;   )Nr   )r	   r<   )r-   r>   r	   r,   )r5   r	   r7   r7   r8   r?      r@   zAsyncBaseClient.agentc                 C  r;   )Nr   )r
   r<   )r.   rA   r
   r,   )r5   r
   r7   r7   r8   rB      r@   zAsyncBaseClient.authc                 C  r;   )Nr   )r   r<   )r/   rC   r   r,   )r5   r   r7   r7   r8   rD      r@   zAsyncBaseClient.listenc                 C  r;   )Nr   )r   r<   )r0   rE   r   r,   )r5   r   r7   r7   r8   rF      r@   zAsyncBaseClient.managec                 C  r;   )Nr   )r   r<   )r1   rG   r   r,   )r5   r   r7   r7   r8   r)     r@   zAsyncBaseClient.readc                 C  r;   )Nr   )r   r<   )r2   rH   r   r,   )r5   r   r7   r7   r8   rI   
  r@   zAsyncBaseClient.self_hostedc                 C  r;   )Nr   )r   r<   )r3   rJ   r   r,   )r5   r   r7   r7   r8   rK     r@   zAsyncBaseClient.speak)r   r   r   r    r   r!   r   r"   r   r#   r   rW   rL   r7   r7   r7   r8   rV      rU   rV   )$
__future__r   rR   typingr*   core.api_errorr   core.client_wrapperr   r   r   r   TYPE_CHECKINGr>   r   r	   rA   r
   r   rC   r   r   rE   r   r   rG   r   r   rH   r   r   rJ   r   r   r   rV   r7   r7   r7   r8   <module>   s$    