o
    f>hS                     @   s   d Z ddlmZ ddlmZmZmZmZmZmZm	Z	 ddl
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G dd deZdS )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Serverless
    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.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserialize	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   e Zd ZG dd deZ	 	ddedeeef dedede	e f
 fd	d
Z
edddZdddZdddZdefddZ  ZS )LogInstancec                   @   s   e Zd ZdZdZdZdS )zLogInstance.LevelinfowarnerrorN)__name__
__module____qualname__INFOWARNERROR r   r   d/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/serverless/v1/service/environment/log.pyLevel   s    r   Nversionpayloadservice_sidenvironment_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _|d
| _t|d| _|d| _|||pW| jd| _d | _d S )Nr#   account_sidr!   r"   	build_siddeployment_sidfunction_sidrequest_sidlevelmessagedate_createdurlr!   r"   r#   )super__init__getr#   r$   r!   r"   r%   r&   r'   r(   r)   r*   r
   iso8601_datetimer+   r,   	_solution_context)selfr   r    r!   r"   r#   	__class__r   r   r/   /   s(   
zLogInstance.__init__return
LogContextc                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )z
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: LogContext for this LogInstance
        Nr!   r"   r#   r-   )r3   r8   _versionr2   r4   r   r   r   _proxyO   s   
zLogInstance._proxyc                 C   s
   | j  S )S
        Fetch the LogInstance


        :returns: The fetched LogInstance
        )r;   fetchr:   r   r   r   r=   `   s   
zLogInstance.fetchc                    s   | j  I dH S )m
        Asynchronous coroutine to fetch the LogInstance


        :returns: The fetched LogInstance
        N)r;   fetch_asyncr:   r   r   r   r?   i   s   zLogInstance.fetch_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>x       z'LogInstance.__repr__.<locals>.<genexpr>z%<Twilio.Serverless.V1.LogInstance {}>joinr2   itemsrF   r4   contextr   r   r   __repr__r      
zLogInstance.__repr__N)r7   r8   )r7   r   )r   r   r   objectr   r   r   strr   r   r/   propertyr;   r=   r?   rR   __classcell__r   r   r5   r   r      s(    
 

		r   c                       sX   e Zd Zdedededef fddZdefdd	Zdefd
dZdefddZ	  Z
S )r8   r   r!   r"   r#   c                    s2   t  | |||d| _djdi | j| _dS )aO  
        Initialize the LogContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the Log resource from.
        :param environment_sid: The SID of the environment with the Log resource to fetch.
        :param sid: The SID of the Log resource to fetch.
        r-   zA/Services/{service_sid}/Environments/{environment_sid}/Logs/{sid}Nr   r.   r/   r2   rF   _uri)r4   r   r!   r"   r#   r5   r   r   r/   ~   s   zLogContext.__init__r7   c                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r<   application/jsonAcceptGETmethoduriheadersr!   r"   r#   r-   )r   ofr9   r=   rZ   r   r2   r4   ra   r    r   r   r   r=      s   
zLogContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r>   r[   r\   r]   r^   Nr!   r"   r#   r-   )r   rb   r9   r?   rZ   r   r2   rc   r   r   r   r?      s   
zLogContext.fetch_asyncc                 C   r@   )rA   rB   c                 s   rC   rD   rE   rG   r   r   r   rK      rL   z&LogContext.__repr__.<locals>.<genexpr>z$<Twilio.Serverless.V1.LogContext {}>rM   rP   r   r   r   rR      rS   zLogContext.__repr__)r   r   r   r   rV   r/   r   r=   r?   rR   rX   r   r   r5   r   r8   |   s    r8   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 )LogPager    r7   c                 C   s   t | j|| jd | jd dS )zi
        Build an instance of LogInstance

        :param payload: Payload response from the API
        r!   r"   r!   r"   )r   r9   r2   )r4   r    r   r   r   get_instance   s   zLogPage.get_instancec                 C      dS )rA   z<Twilio.Serverless.V1.LogPage>r   r:   r   r   r   rR         zLogPage.__repr__N)	r   r   r   r   rV   r   r   rf   rR   r   r   r   r   rd      s    rd   c                       s  e Zd Zdededef fddZejejejddfdeee	f dee
e	f d	ee
e	f d
ee dee dee fddZejejejddfdeee	f dee
e	f d	ee
e	f d
ee dee dee fddZejejejddfdeee	f dee
e	f d	ee
e	f d
ee dee dee fddZejejejddfdeee	f dee
e	f d	ee
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ejfdeee	f dee
e	f d	ee
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ejfdeee	f dee
e	f d	ee
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defd!d"Zd edefd#d$Zdefd%d&Z  ZS )'LogListr   r!   r"   c                    s0   t  | ||d| _djdi | j| _dS )a  
        Initialize the LogList

        :param version: Version that contains the resource
        :param service_sid: The SID of the Service to read the Log resource from.
        :param environment_sid: The SID of the environment with the Log resources to read.

        re   z;/Services/{service_sid}/Environments/{environment_sid}/LogsNr   rY   )r4   r   r!   r"   r5   r   r   r/      s   	zLogList.__init__Nr'   
start_dateend_datelimit	page_sizer7   c                 C   s6   | j ||}| j||||d d}| j ||d S )a	  
        Streams LogInstance 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 str function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param datetime start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param datetime end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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
        rm   r'   rj   rk   rm   rl   )r9   read_limitspagestreamr4   r'   rj   rk   rl   rm   limitsrp   r   r   r   rq      s   zLogList.streamc                    s>   | j ||}| j||||d dI dH }| j ||d S )a  
        Asynchronously streams LogInstance 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 str function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param datetime start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param datetime end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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
        rm   rn   Nrl   )r9   ro   
page_asyncstream_asyncrr   r   r   r   ru   #  s   zLogList.stream_asyncc                 C   s   t | j|||||dS )a  
        Lists LogInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param datetime start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param datetime end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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'   rj   rk   rl   rm   )listrq   r4   r'   rj   rk   rl   rm   r   r   r   rw   G  s   zLogList.listc                    s,   dd | j |||||dI dH 2 I dH S )a  
        Asynchronously lists LogInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param datetime start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param datetime end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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 rT   r   )rH   recordr   r   r   
<listcomp>  s
    z&LogList.list_async.<locals>.<listcomp>rv   N)ru   rx   r   r   r   
list_asyncj  s   
zLogList.list_async
page_tokenpage_numberc           
   	   C   s`   t |t|t||||d}t ddi}d|d< | jjd| j||d}	t| j|	| jS )a  
        Retrieve a single page of LogInstance records from the API.
        Request is executed immediately

        :param function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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 LogInstance
        FunctionSid	StartDateEndDate	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedr[   r\   r]   r_   r`   paramsra   )	r   rb   r   r1   r9   rp   rZ   rd   r2   
r4   r'   rj   rk   r|   r}   rm   datara   responser   r   r   rp     s   
zLogList.pagec           
   	      sh   t |t|t||||d}t ddi}d|d< | jjd| j||dI dH }	t| j|	| jS )	a  
        Asynchronously retrieve a single page of LogInstance records from the API.
        Request is executed immediately

        :param function_sid: The SID of the function whose invocation produced the Log resources to read.
        :param start_date: The date/time (in GMT, ISO 8601) after which the Log resources must have been created. Defaults to 1 day prior to current date/time.
        :param end_date: The date/time (in GMT, ISO 8601) before which the Log resources must have been created. Defaults to current date/time.
        :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 LogInstance
        r~   r   r   r[   r\   r]   r   N)	r   rb   r   r1   r9   rt   rZ   rd   r2   r   r   r   r   rt     s    
zLogList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of LogInstance records from the API.
        Request is executed immediately

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

        :returns: Page of LogInstance
        r]   )r9   domaintwiliorequestrd   r2   r4   r   r   r   r   r   get_page  s   	zLogList.get_pagec                    s*   | j jjd|I dH }t| j || jS )z
        Asynchronously retrieve a specific page of LogInstance records from the API.
        Request is executed immediately

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

        :returns: Page of LogInstance
        r]   N)r9   r   r   request_asyncrd   r2   r   r   r   r   get_page_async  s   	zLogList.get_page_asyncr#   c                 C      t | j| jd | jd |dS zd
        Constructs a LogContext

        :param sid: The SID of the Log resource to fetch.
        r!   r"   r-   r8   r9   r2   r4   r#   r   r   r   r0        zLogList.getc                 C   r   r   r   r   r   r   r   __call__  r   zLogList.__call__c                 C   rg   )rA   z<Twilio.Serverless.V1.LogList>r   r:   r   r   r   rR     rh   zLogList.__repr__)r   r   r   r   rV   r/   r   unsetr   rU   r   r   intr   r   rq   r	   ru   r   rw   r{   rd   rp   rt   r   r   r8   r0   r   rR   rX   r   r   r5   r   ri      s    



&



&



%



&






,






*ri   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r8   rd   ri   r   r   r   r   <module>   s    $cS