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 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)UsageV1Response   )UsageGetRequestDeployment)UsageGetRequestEndpoint)UsageGetRequestMethodc                `   @   P  e Zd ZdefddZdddddddddddddddddddddddddddddddddddddddddddddd-dedeje deje d	eje d
eje deje deje deje deje deje deje deje deje	 deje deje deje deje deje deje
 deje deje deje deje deje deje deje d eje d!eje d"eje d#eje d$eje d%eje d&eje d'eje d(eje d)eje d*eje d+eje d,eje d-eje d.eje d/eje d0eje d1eje d2eje d3eje d4ee f^d5d6ZdS )7RawUsageClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   `/home/ubuntu/.local/lib/python3.10/site-packages/deepgram/manage/v1/projects/usage/raw_client.py__init__      
zRawUsageClient.__init__N-startendaccessoralternativescallback_methodcallbackchannelscustom_intent_modecustom_intentcustom_topic_modecustom_topic
deploymentdetect_entitiesdetect_languagediarize	dictationencodingendpointextrafiller_wordsintentskeytermkeywordslanguagemeasurementsmethodmodelmultichannelnumerals
paragraphsprofanity_filter	punctuateredactreplacesample_ratesearch	sentimentsmart_format	summarizetagtopics	utt_split
utterancesversionrequest_options
project_idr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   returnc       -   2      C   s  | j jjdt| d| j  jdi d|d|d|d|d|d	|d
|d|	d|
d|d|d|d|d|d|d|d|i d|d|d|d|d|d|d|d|d|d|d|d |d!|d"| d#|!d$|"d%|#|$|%|&|'|(|)|*|+|,|-d&
|.d'}/z@d(|/j  krd)k rn ntt	t
t	|/ d*}0t|/|0d+W S |/jd,krtt|/jttjt
tj|/ d*d-|/ }1W n ty   t|/jt|/j|/jd.w t|/jt|/j|1d.)/a  
        Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

        accessor : typing.Optional[str]
            Filter for requests where a specific accessor was used

        alternatives : typing.Optional[bool]
            Filter for requests where alternatives were used

        callback_method : typing.Optional[bool]
            Filter for requests where callback method was used

        callback : typing.Optional[bool]
            Filter for requests where callback was used

        channels : typing.Optional[bool]
            Filter for requests where channels were used

        custom_intent_mode : typing.Optional[bool]
            Filter for requests where custom intent mode was used

        custom_intent : typing.Optional[bool]
            Filter for requests where custom intent was used

        custom_topic_mode : typing.Optional[bool]
            Filter for requests where custom topic mode was used

        custom_topic : typing.Optional[bool]
            Filter for requests where custom topic was used

        deployment : typing.Optional[UsageGetRequestDeployment]
            Filter for requests where a specific deployment was used

        detect_entities : typing.Optional[bool]
            Filter for requests where detect entities was used

        detect_language : typing.Optional[bool]
            Filter for requests where detect language was used

        diarize : typing.Optional[bool]
            Filter for requests where diarize was used

        dictation : typing.Optional[bool]
            Filter for requests where dictation was used

        encoding : typing.Optional[bool]
            Filter for requests where encoding was used

        endpoint : typing.Optional[UsageGetRequestEndpoint]
            Filter for requests where a specific endpoint was used

        extra : typing.Optional[bool]
            Filter for requests where extra was used

        filler_words : typing.Optional[bool]
            Filter for requests where filler words was used

        intents : typing.Optional[bool]
            Filter for requests where intents was used

        keyterm : typing.Optional[bool]
            Filter for requests where keyterm was used

        keywords : typing.Optional[bool]
            Filter for requests where keywords was used

        language : typing.Optional[bool]
            Filter for requests where language was used

        measurements : typing.Optional[bool]
            Filter for requests where measurements were used

        method : typing.Optional[UsageGetRequestMethod]
            Filter for requests where a specific method was used

        model : typing.Optional[str]
            Filter for requests where a specific model uuid was used

        multichannel : typing.Optional[bool]
            Filter for requests where multichannel was used

        numerals : typing.Optional[bool]
            Filter for requests where numerals were used

        paragraphs : typing.Optional[bool]
            Filter for requests where paragraphs were used

        profanity_filter : typing.Optional[bool]
            Filter for requests where profanity filter was used

        punctuate : typing.Optional[bool]
            Filter for requests where punctuate was used

        redact : typing.Optional[bool]
            Filter for requests where redact was used

        replace : typing.Optional[bool]
            Filter for requests where replace was used

        sample_rate : typing.Optional[bool]
            Filter for requests where sample rate was used

        search : typing.Optional[bool]
            Filter for requests where search was used

        sentiment : typing.Optional[bool]
            Filter for requests where sentiment was used

        smart_format : typing.Optional[bool]
            Filter for requests where smart format was used

        summarize : typing.Optional[bool]
            Filter for requests where summarize was used

        tag : typing.Optional[str]
            Filter for requests where a specific tag was used

        topics : typing.Optional[bool]
            Filter for requests where topics was used

        utt_split : typing.Optional[bool]
            Filter for requests where utt split was used

        utterances : typing.Optional[bool]
            Filter for requests where utterances was used

        version : typing.Optional[bool]
            Filter for requests where version was used

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

        Returns
        -------
        HttpResponse[UsageV1Response]
            A specific request for a specific project
        v1/projects//usageGETr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   
rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   base_urlr9   paramsrL      ,  type_object_responsedata  headersbodystatus_coder`   ra   )r   httpx_clientrequestr	   get_environmentbaserc   typingcastr   r   jsonr   r   dictr`   Anyr   r   text2r   rM   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   	_response_data_response_jsonr   r   r   get   s    G
	
 !"#.4

zRawUsageClient.get)__name__
__module____qualname__r   r   strrh   Optionalboolr   r   r   r
   r   r   rr   r   r   r   r   r         	
 !"#$%&'()*+,-./01r   c                `   @   r   )7AsyncRawUsageClientr   c                C   r   r   r   r   r   r   r   r   -  r   zAsyncRawUsageClient.__init__Nr   rM   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rN   c       -   2         s  | j jjdt| d| j  jdi d|d|d|d|d|d	|d
|d|	d|
d|d|d|d|d|d|d|d|i d|d|d|d|d|d|d|d|d|d|d|d |d!|d"| d#|!d$|"d%|#|$|%|&|'|(|)|*|+|,|-d&
|.d'I d(H }/z@d)|/j  krd*k rn ntt	t
t	|/ d+}0t|/|0d,W S |/jd-krtt|/jttjt
tj|/ d+d.|/ }1W n ty   t|/jt|/j|/jd/w t|/jt|/j|1d/)0a  
        Retrieves the usage for a specific project. Use Get Project Usage Breakdown for a more comprehensive usage summary.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

        accessor : typing.Optional[str]
            Filter for requests where a specific accessor was used

        alternatives : typing.Optional[bool]
            Filter for requests where alternatives were used

        callback_method : typing.Optional[bool]
            Filter for requests where callback method was used

        callback : typing.Optional[bool]
            Filter for requests where callback was used

        channels : typing.Optional[bool]
            Filter for requests where channels were used

        custom_intent_mode : typing.Optional[bool]
            Filter for requests where custom intent mode was used

        custom_intent : typing.Optional[bool]
            Filter for requests where custom intent was used

        custom_topic_mode : typing.Optional[bool]
            Filter for requests where custom topic mode was used

        custom_topic : typing.Optional[bool]
            Filter for requests where custom topic was used

        deployment : typing.Optional[UsageGetRequestDeployment]
            Filter for requests where a specific deployment was used

        detect_entities : typing.Optional[bool]
            Filter for requests where detect entities was used

        detect_language : typing.Optional[bool]
            Filter for requests where detect language was used

        diarize : typing.Optional[bool]
            Filter for requests where diarize was used

        dictation : typing.Optional[bool]
            Filter for requests where dictation was used

        encoding : typing.Optional[bool]
            Filter for requests where encoding was used

        endpoint : typing.Optional[UsageGetRequestEndpoint]
            Filter for requests where a specific endpoint was used

        extra : typing.Optional[bool]
            Filter for requests where extra was used

        filler_words : typing.Optional[bool]
            Filter for requests where filler words was used

        intents : typing.Optional[bool]
            Filter for requests where intents was used

        keyterm : typing.Optional[bool]
            Filter for requests where keyterm was used

        keywords : typing.Optional[bool]
            Filter for requests where keywords was used

        language : typing.Optional[bool]
            Filter for requests where language was used

        measurements : typing.Optional[bool]
            Filter for requests where measurements were used

        method : typing.Optional[UsageGetRequestMethod]
            Filter for requests where a specific method was used

        model : typing.Optional[str]
            Filter for requests where a specific model uuid was used

        multichannel : typing.Optional[bool]
            Filter for requests where multichannel was used

        numerals : typing.Optional[bool]
            Filter for requests where numerals were used

        paragraphs : typing.Optional[bool]
            Filter for requests where paragraphs were used

        profanity_filter : typing.Optional[bool]
            Filter for requests where profanity filter was used

        punctuate : typing.Optional[bool]
            Filter for requests where punctuate was used

        redact : typing.Optional[bool]
            Filter for requests where redact was used

        replace : typing.Optional[bool]
            Filter for requests where replace was used

        sample_rate : typing.Optional[bool]
            Filter for requests where sample rate was used

        search : typing.Optional[bool]
            Filter for requests where search was used

        sentiment : typing.Optional[bool]
            Filter for requests where sentiment was used

        smart_format : typing.Optional[bool]
            Filter for requests where smart format was used

        summarize : typing.Optional[bool]
            Filter for requests where summarize was used

        tag : typing.Optional[str]
            Filter for requests where a specific tag was used

        topics : typing.Optional[bool]
            Filter for requests where topics was used

        utt_split : typing.Optional[bool]
            Filter for requests where utt split was used

        utterances : typing.Optional[bool]
            Filter for requests where utterances was used

        version : typing.Optional[bool]
            Filter for requests where version was used

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

        Returns
        -------
        AsyncHttpResponse[UsageV1Response]
            A specific request for a specific project
        rO   rP   rQ   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rR   rS   NrV   rW   rX   r[   r^   r_   rb   )r   rd   re   r	   rf   rg   rc   rh   ri   r   r   rj   r   r   rk   r`   rl   r   r   rm   rn   r   r   r   rr   0  s    G
	
 !"#.4

zAsyncRawUsageClient.get)rs   rt   ru   r   r   rv   rh   rw   rx   r   r   r   r
   r   r   rr   r   r   r   r   rz   ,  ry   rz   )rh   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.usage_v1responser   "types.usage_get_request_deploymentr    types.usage_get_request_endpointr   types.usage_get_request_methodr   r   rz   r   r   r   r   <module>   s"     