
    =hl                    x   d dl mZ d dlmZmZmZ d dlmZ d dlZddl	m
Z
mZmZmZmZ ddlmZmZmZmZmZmZ ddlmZmZ dd	lmZ dd
lmZmZ ddlmZm Z 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gZ- G d de      Z. G d de      Z/ G d d      Z0 G d d      Z1 G d d      Z2 G d d      Z3y)    )annotations)AnyDictcast)LiteralN   )call_list_paramscall_update_paramscall_create_web_call_paramscall_create_phone_call_paramscall_register_phone_call_params)	NOT_GIVENBodyQueryHeadersNoneTypeNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperto_streamed_response_wrapperasync_to_raw_response_wrapper"async_to_streamed_response_wrapper)make_request_options)CallResponse)WebCallResponse)CallListResponse)PhoneCallResponseCallResourceAsyncCallResourcec            
         e Zd Zedd       Zedd       Zddded	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Z	ddded	 	 	 	 	 	 	 	 	 	 	 dd
Z
eeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r"   c                    t        |       S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/RetellAI/retell-python-sdk#accessing-raw-response-data-eg-headers
        )CallResourceWithRawResponseselfs    e/var/www/html/phonemate/phone_mate_backend/venv/lib/python3.12/site-packages/retell/resources/call.pywith_raw_responsezCallResource.with_raw_response(   s     +400    c                    t        |       S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/RetellAI/retell-python-sdk#with_streaming_response
        )!CallResourceWithStreamingResponser(   s    r*   with_streaming_responsez$CallResource.with_streaming_response2   s     166r,   Nextra_headersextra_query
extra_bodytimeoutc                   |st        d|      t        t        | j                  d| t	        ||||      t        t
        t                          S )W  
        Retrieve details of a specific call

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        6Expected a non-empty value for `call_id` but received /v2/get-call/r1   optionscast_to
ValueErrorr   r   _getr   r   r)   call_idr2   r3   r4   r5   s         r*   retrievezCallResource.retrieve;   sf    . UV]U`abbIIy),"/[U_ip S,/  	
 		
r,   metadataopt_out_sensitive_data_storager2   r3   r4   r5   c                   |st        d|      t        t        | j                  d| t	        ||dt
        j                        t        ||||      t        t        t                          S )O  
        Update metadata and sensitive data storage settings for an existing call

        Args:
          metadata: An arbitrary object for storage purpose only. You can put anything here like
              your internal customer id associated with the call. Not used for processing. You
              can later get this field from the call object. Size limited to 50kB max.

          opt_out_sensitive_data_storage: Whether this call opts out of sensitive data storage like transcript, recording,
              logging. Can only be changed from false to true.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r8   /v2/update-call/rD   rE   r1   bodyr;   r<   )	r>   r   r   _patchr   r
   CallUpdateParamsr   r   r)   rA   rD   rE   r2   r3   r4   r5   s           r*   updatezCallResource.update_   s    @ UV]U`abbKK"7),$$,:X '77 -"/[U_ip S,/  
 	
r,   filter_criterialimitpagination_key
sort_orderr2   r3   r4   r5   c          
         | j                  dt        ||||dt        j                        t	        ||||      t
              S )5  
        Retrieve call details

        Args:
          filter_criteria: Filter criteria for the calls to retrieve.

          limit: Limit the number of calls returned. Default 50, Max 1000. To retrieve more than
              1000, use pagination_key to continue fetching the next page.

          pagination_key: The pagination key to continue fetching the next page of calls. Pagination key
              is represented by a call id here, and it's exclusive (not included in the
              fetched calls). The last call id from the list calls is usually used as
              pagination key here. If not set, will start from the beginning.

          sort_order: The calls will be sorted by `start_timestamp`, whether to return the calls in
              ascending or descending order.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        /v2/list-callsrQ   rR   rS   rT   r1   rJ   )_postr   r	   CallListParamsr   r    	r)   rQ   rR   rS   rT   r2   r3   r4   r5   s	            r*   listzCallResource.list   s\    N zz '6"&4",	 !// )+Q[el %  
 	
r,   c          	         |st        d|      ddi|xs i }| j                  d| t        ||||      t              S )b  
        Delete a specific call and its associated data

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r8   Accept*/*/v2/delete-call/r1   r:   r>   _deleter   r   r@   s         r*   deletezCallResource.delete   sh    . UV]U`abb!5B]-@bB||wi((+Q[el   
 	
r,   rD   override_agent_idretell_llm_dynamic_variablesr2   r3   r4   r5   c       	            | j                  dt        |||||dt        j                        t	        ||||	      t
              S )+  
        Create a new outbound phone call

        Args:
          from_number: The number you own in E.164 format. Must be a number purchased from Retell or
              imported to Retell.

          to_number: The number you want to call, in E.164 format. If using a number purchased from
              Retell, only US numbers are supported as destination.

          metadata: An arbitrary object for storage purpose only. You can put anything here like
              your internal customer id associated with the call. Not used for processing. You
              can later get this field from the call object.

          override_agent_id: For this particular call, override the agent used with this agent id. This does
              not bind the agent to this number, this is for one time override.

          retell_llm_dynamic_variables: Add optional dynamic variables in key value pairs of string that injects into
              your Response Engine prompt and tool description. Only applicable for Response
              Engine.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        /v2/create-phone-callfrom_number	to_numberrD   rf   rg   r1   rJ   )rY   r   r   CallCreatePhoneCallParamsr   r!   
r)   rl   rm   rD   rf   rg   r2   r3   r4   r5   s
             r*   create_phone_callzCallResource.create_phone_call   s_    X zz# #.!* ():4P .GG	 )+Q[el &  
 	
r,   rD   rg   r2   r3   r4   r5   c          
         | j                  dt        |||dt        j                        t	        ||||      t
              S )  Create a new web call

        Args:
          agent_id: Unique id of agent used for the call.

        Your agent would contain the LLM Websocket
              url used for this call.

          metadata: An arbitrary object for storage purpose only. You can put anything here like
              your internal customer id associated with the call. Not used for processing. You
              can later get this field from the call object.

          retell_llm_dynamic_variables: Add optional dynamic variables in key value pairs of string that injects into
              your Response Engine prompt and tool description. Only applicable for Response
              Engine.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        /v2/create-web-callagent_idrD   rg   r1   rJ   )rY   r   r   CallCreateWebCallParamsr   r   r)   rv   rD   rg   r2   r3   r4   r5   s           r*   create_web_callzCallResource.create_web_call+  sY    J zz!  ( (4P
 ,CC )+Q[el $  
 	
r,   		directionrl   rD   rg   rm   r2   r3   r4   r5   c       
            | j                  dt        ||||||dt        j                        t	        |||	|
      t
              S )  
        Register a new phone call for custom telephony

        Args:
          agent_id: The agent to use for the call.

          direction: Direction of the phone call. Stored for tracking purpose.

          from_number: The number you own in E.164 format. Stored for tracking purpose.

          metadata: An arbitrary object for storage purpose only. You can put anything here like
              your internal customer id associated with the call. Not used for processing. You
              can later get this field from the call object.

          retell_llm_dynamic_variables: Add optional dynamic variables in key value pairs of string that injects into
              your Response Engine prompt and tool description. Only applicable for Response
              Engine.

          to_number: The number you want to call, in E.164 format. Stored for tracking purpose.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        /v2/register-phone-callrv   r{   rl   rD   rg   rm   r1   rJ   )rY   r   r   CallRegisterPhoneCallParamsr   r!   r)   rv   r{   rl   rD   rg   rm   r2   r3   r4   r5   s              r*   register_phone_callz CallResource.register_phone_call`  sb    X zz%  (!*#. (4P!* 0KK
 )+Q[el &!  
 	
r,   )returnr'   )r   r/   rA   strr2   Headers | Noner3   Query | Noner4   Body | Noner5   'float | httpx.Timeout | None | NotGivenr   r   rA   r   rD   object | NotGivenrE   zbool | NotGivenr2   r   r3   r   r4   r   r5   r   r   r   rQ   z*call_list_params.FilterCriteria | NotGivenrR   zint | NotGivenrS   str | NotGivenrT   z-Literal['ascending', 'descending'] | NotGivenr2   r   r3   r   r4   r   r5   r   r   r    rA   r   r2   r   r3   r   r4   r   r5   r   r   Nonerl   r   rm   r   rD   r   rf   r   rg   Dict[str, object] | NotGivenr2   r   r3   r   r4   r   r5   r   r   r!   rv   r   rD   r   rg   r   r2   r   r3   r   r4   r   r5   r   r   r   rv   r   r{   z)Literal['inbound', 'outbound'] | NotGivenrl   r   rD   r   rg   r   rm   r   r2   r   r3   r   r4   r   r5   r   r   r!   __name__
__module____qualname__r   r+   r0   r   rB   rO   r\   rd   rp   ry   r    r,   r*   r"   r"   '   s4   1 1 7 7 )-$("&;D"
"
 &"
 ""
  "
 9"
 
"
P '0:C )-$("&;D2
2
 $	2

 )82
 &2
 "2
  2
 92
 
2
n GP ))2DM )-$("&;D6
 D6
 	6

 '6
 B6
 &6
 "6
  6
 96
 
6
| )-$("&;D 
 
 & 
 " 
   
 9 
 
 
N '0,5EN )-$("&;D<
 <
 	<

 $<
 *<
 'C<
 &<
 "<
  <
 9<
 
<
D '0EN )-$("&;D3
 3
 $	3

 'C3
 &3
 "3
  3
 93
 
3
r @I&/&/EN$- )-$("&;D=
 =
 =	=

 $=
 $=
 'C=
 "=
 &=
 "=
  =
 9=
 
=
r,   c            
         e Zd Zedd       Zedd       Zddded	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Z	ddded	 	 	 	 	 	 	 	 	 	 	 dd
Z
eeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r#   c                    t        |       S r&   ) AsyncCallResourceWithRawResponser(   s    r*   r+   z#AsyncCallResource.with_raw_response  s     055r,   c                    t        |       S r.   )&AsyncCallResourceWithStreamingResponser(   s    r*   r0   z)AsyncCallResource.with_streaming_response  s     6d;;r,   Nr1   c                  K   |st        d|      t        t        | j                  d| t	        ||||      t        t
        t                     d{         S 7 w)r7   r8   r9   r1   r:   Nr=   r@   s         r*   rB   zAsyncCallResource.retrieve  st     . UV]U`abb))y),"/[U_ip S,/   	
 		
s   AA!A
	A!rC   c                 K   |st        d|      t        t        | j                  d| t	        ||dt
        j                         d{   t        ||||      t        t        t                     d{         S 7 67 
w)rG   r8   rH   rI   Nr1   rJ   )	r>   r   r   rL   r   r
   rM   r   r   rN   s           r*   rO   zAsyncCallResource.update  s     @ UV]U`abb++"7),0$,:X '77  -"/[U_ip S,/   
 	
s$   A
BB-B:B
;	BBrP   c          
        K   | j                  dt        ||||dt        j                         d{   t	        ||||      t
               d{   S 7 $7 w)rV   rW   rX   Nr1   rJ   )rY   r   r	   rZ   r   r    r[   s	            r*   r\   zAsyncCallResource.list  su     N ZZ,'6"&4",	 !//  )+Q[el %   
 
 	

s!   /AA
AAAAc          	        K   |st        d|      ddi|xs i }| j                  d| t        ||||      t               d{   S 7 w)r^   r8   r_   r`   ra   r1   r:   Nrb   r@   s         r*   rd   zAsyncCallResource.deleteD  sv     . UV]U`abb!5B]-@bB\\wi((+Q[el  " 
 
 	
 
s   AAA	Are   c       	           K   | j                  dt        |||||dt        j                         d{   t	        ||||	      t
               d{   S 7 $7 w)ri   rj   rk   Nr1   rJ   )rY   r   r   rn   r   r!   ro   s
             r*   rp   z#AsyncCallResource.create_phone_callf  sx     X ZZ#,#.!* ():4P .GG	 	 )+Q[el &   
 
 	
	
s!   0AA
AAAArq   c          
        K   | j                  dt        |||dt        j                         d{   t	        ||||      t
               d{   S 7 $7 w)rs   rt   ru   Nr1   rJ   )rY   r   r   rw   r   r   rx   s           r*   ry   z!AsyncCallResource.create_web_call  sr     J ZZ!, ( (4P
 ,CC  )+Q[el $   
 
 	

s!   .AA
AAAArz   c       
           K   | j                  dt        ||||||dt        j                         d{   t	        |||	|
      t
               d{   S 7 $7 w)r}   r~   r   Nr1   rJ   )rY   r   r   r   r   r!   r   s              r*   r   z%AsyncCallResource.register_phone_call  s{     X ZZ%, (!*#. (4P!* 0KK
 
 )+Q[el &!   
 
 	


s!   1AA
AAAA)r   r   )r   r   r   r   r   r   r   r   r   r   r   r,   r*   r#   r#     s4   6 6 < < )-$("&;D"
"
 &"
 ""
  "
 9"
 
"
P '0:C )-$("&;D2
2
 $	2

 )82
 &2
 "2
  2
 92
 
2
n GP ))2DM )-$("&;D6
 D6
 	6

 '6
 B6
 &6
 "6
  6
 96
 
6
| )-$("&;D 
 
 & 
 " 
   
 9 
 
 
N '0,5EN )-$("&;D<
 <
 	<

 $<
 *<
 'C<
 &<
 "<
  <
 9<
 
<
D '0EN )-$("&;D3
 3
 $	3

 'C3
 &3
 "3
  3
 93
 
3
r @I&/&/EN$- )-$("&;D=
 =
 =	=

 $=
 $=
 'C=
 "=
 &=
 "=
  =
 9=
 
=
r,   c                      e Zd ZddZy)r'   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y N)	_callr   rB   rO   r\   rd   rp   ry   r   r)   calls     r*   __init__z$CallResourceWithRawResponse.__init__  s    
/MM
 .KK
 ,II
	 .KK
 "9"""
  7   
 $;$$$
 r,   Nr   r"   r   r   r   r   r   r   r   r,   r*   r'   r'         
r,   r'   c                      e Zd ZddZy)r   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y r   )	r   r   rB   rO   r\   rd   rp   ry   r   r   s     r*   r   z)AsyncCallResourceWithRawResponse.__init__5  s    
5MM
 4KK
 2II
	 4KK
 "?"""
  =   
 $A$$$
 r,   Nr   r#   r   r   r   r   r,   r*   r   r   4  r   r,   r   c                      e Zd ZddZy)r/   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y r   )	r   r   rB   rO   r\   rd   rp   ry   r   r   s     r*   r   z*CallResourceWithStreamingResponse.__init__P  s    
4MM
 3KK
 1II
	 3KK
 ">"""
  <   
 $@$$$
 r,   Nr   r   r   r,   r*   r/   r/   O  r   r,   r/   c                      e Zd ZddZy)r   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y r   )	r   r   rB   rO   r\   rd   rp   ry   r   r   s     r*   r   z/AsyncCallResourceWithStreamingResponse.__init__k  s    
:MM
 9KK
 7II
	 9KK
 "D"""
  B   
 $F$$$
 r,   Nr   r   r   r,   r*   r   r   j  r   r,   r   )4
__future__r   typingr   r   r   typing_extensionsr   httpxtypesr	   r
   r   r   r   _typesr   r   r   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   r   r   _base_clientr   types.call_responser   types.web_call_responser   types.call_list_responser    types.phone_call_responser!   __all__r"   r#   r'   r   r/   r   r   r,   r*   <module>r      s    # " " %   I H & 9  0 . 5 7 9.
/v
? v
rv
( v
r
 
6
 
6
 
6
 
r,   