o
    f>h(;                     @   s   d Z ddlmZmZmZ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 G dd	 d	eZG d
d deZG dd deZdS )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Insights
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
    )AnyDictListOptionalUnionIteratorAsyncIterator)values)InstanceResource)ListResource)Version)Pagec                       sb   e Zd ZG dd deZG dd deZ	 dedeee	f def fdd	Z
d
efddZ  ZS )MetricInstancec                   @   s   e Zd ZdZdZdZdZdS )MetricInstance.StreamDirectionunknowninboundoutboundbothN)__name__
__module____qualname__UNKNOWNINBOUNDOUTBOUNDBOTH r   r   V/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/insights/v1/call/metric.pyStreamDirection   s
    r   c                   @   s    e Zd ZdZdZdZdZdZdS )MetricInstance.TwilioEdgeunknown_edgecarrier_edgesip_edgesdk_edgeclient_edgeN)r   r   r   UNKNOWN_EDGECARRIER_EDGESIP_EDGESDK_EDGECLIENT_EDGEr   r   r   r   
TwilioEdge    s    r)   versionpayloadcall_sidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _d|i| _d S )
N	timestampr,   account_sidedge	directionr    r!   r"   r#   )super__init__getr-   r,   r.   r/   r0   r    r!   r"   r#   	_solution)selfr*   r+   r,   	__class__r   r   r2   3   s   
zMetricInstance.__init__returnc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s     | ]\}}d  ||V  qdS )z{}={}N)format).0kvr   r   r   	<genexpr>L   s    z*MetricInstance.__repr__.<locals>.<genexpr>z&<Twilio.Insights.V1.MetricInstance {}>)joinr4   itemsr;   )r5   contextr   r   r   __repr__F   s   
zMetricInstance.__repr__)r   r   r   objectr   r)   r   r   strr   r2   rC   __classcell__r   r   r6   r   r      s    "r   c                   @   s4   e Zd Zdeeef defddZdefddZdS )
MetricPager+   r8   c                 C   s   t | j|| jd dS )zl
        Build an instance of MetricInstance

        :param payload: Payload response from the API
        r,   )r,   )r   _versionr4   )r5   r+   r   r   r   get_instanceR   s   zMetricPage.get_instancec                 C      dS )r9   z<Twilio.Insights.V1.MetricPage>r   r5   r   r   r   rC   \      zMetricPage.__repr__N)	r   r   r   r   rE   r   r   rI   rC   r   r   r   r   rG   P   s    
rG   c                       s8  e Zd Zdedef fddZejejddfdede	f ded	e	f d
e
e de
e dee f
ddZejejddfdede	f ded	e	f d
e
e de
e dee f
ddZejejddfdede	f ded	e	f d
e
e de
e dee f
ddZejejddfdede	f ded	e	f d
e
e de
e dee f
ddZejejejejejfdede	f ded	e	f deee	f deee	f deee	f defddZejejejejejfdede	f ded	e	f deee	f deee	f deee	f defddZdedefddZdedefddZdefd d!Z  ZS )"
MetricListr*   r,   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the MetricList

        :param version: Version that contains the resource
        :param call_sid: The unique SID identifier of the Call.

        r,   z/Voice/{call_sid}/MetricsNr   )r1   r2   r4   r;   _uri)r5   r*   r,   r6   r   r   r2   g   s   zMetricList.__init__Nr/   r   r0   r   limit	page_sizer8   c                 C   s4   | j ||}| j|||d d}| j ||d S )a  
        Streams MetricInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param &quot;MetricInstance.TwilioEdge&quot; edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param &quot;MetricInstance.StreamDirection&quot; direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rP   r/   r0   rP   rO   )rH   read_limitspagestreamr5   r/   r0   rO   rP   limitsrS   r   r   r   rT   w   s   zMetricList.streamc                    s<   | j ||}| j|||d dI dH }| j ||d S )a  
        Asynchronously streams MetricInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param &quot;MetricInstance.TwilioEdge&quot; edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param &quot;MetricInstance.StreamDirection&quot; direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rP   rQ   NrO   )rH   rR   
page_asyncstream_asyncrU   r   r   r   rX      s   
zMetricList.stream_asyncc                 C   s   t | j||||dS )a3  
        Lists MetricInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;MetricInstance.TwilioEdge&quot; edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param &quot;MetricInstance.StreamDirection&quot; direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        r/   r0   rO   rP   )listrT   r5   r/   r0   rO   rP   r   r   r   rZ      s   zMetricList.listc                    s*   dd | j ||||dI dH 2 I dH S )aB  
        Asynchronously lists MetricInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;MetricInstance.TwilioEdge&quot; edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param &quot;MetricInstance.StreamDirection&quot; direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        c                    s   g | z3 d H W }|q6 S )Nr   )r<   recordr   r   r   
<listcomp>   s
    z)MetricList.list_async.<locals>.<listcomp>rY   N)rX   r[   r   r   r   
list_async   s   
zMetricList.list_async
page_tokenpage_numberc           	      C   sR   t |||||d}t ddi}d|d< | jjd| j||d}t| j|| jS )aZ  
        Retrieve a single page of MetricInstance records from the API.
        Request is executed immediately

        :param edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of MetricInstance
        Edge	Direction	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedapplication/jsonAcceptGETmethoduriparamsheaders)r	   ofrH   rS   rN   rG   r4   	r5   r/   r0   r_   r`   rP   dataro   responser   r   r   rS      s   

zMetricList.pagec           	         sZ   t |||||d}t ddi}d|d< | jjd| j||dI dH }t| j|| jS )	ai  
        Asynchronously retrieve a single page of MetricInstance records from the API.
        Request is executed immediately

        :param edge: The Edge of this Metric. One of `unknown_edge`, `carrier_edge`, `sip_edge`, `sdk_edge` or `client_edge`.
        :param direction: The Direction of this Metric. One of `unknown`, `inbound`, `outbound` or `both`.
        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of MetricInstance
        ra   rf   rg   rh   ri   rj   rk   N)r	   rp   rH   rW   rN   rG   r4   rq   r   r   r   rW     s   

zMetricList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of MetricInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of MetricInstance
        rj   )rH   domaintwiliorequestrG   r4   r5   rt   rs   r   r   r   get_pageB  s   	zMetricList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a   
        Asynchronously retrieve a specific page of MetricInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of MetricInstance
        rj   N)rH   ru   rv   request_asyncrG   r4   rx   r   r   r   get_page_asyncN  s   	zMetricList.get_page_asyncc                 C   rJ   )r9   z<Twilio.Insights.V1.MetricList>r   rK   r   r   r   rC   Z  rL   zMetricList.__repr__)r   r   r   r   rE   r2   r	   unsetr   rD   r   intr   r   rT   r   rX   r   rZ   r^   rG   rS   rW   ry   r{   rC   rF   r   r   r6   r   rM   e   s    





!


"


#





)





'rM   N)__doc__typingr   r   r   r   r   r   r   twilio.baser	   twilio.base.instance_resourcer
   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   rG   rM   r   r   r   r   <module>   s    $8