U
    ^g%i4S                     @   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                       sx   e Zd ZdZdeeeef eeee d fddZ	e
dddd	Zd dd
dZd dddZedddZ  ZS )LogInstancea  
    :ivar sid: The unique string that we created to identify the Log resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Log resource.
    :ivar service_sid: The SID of the Service that the Log resource is associated with.
    :ivar environment_sid: The SID of the environment in which the log occurred.
    :ivar build_sid: The SID of the build that corresponds to the log.
    :ivar deployment_sid: The SID of the deployment that corresponds to the log.
    :ivar function_sid: The SID of the function whose invocation produced the log.
    :ivar request_sid: The SID of the request associated with the log.
    :ivar level: The log level.
    :ivar message: The log message.
    :ivar date_created: The date and time in GMT when the Log resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar url: The absolute URL of the Log resource.
    N)versionpayloadservice_sidenvironment_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _|d
| _t|d| _|d| _|||p| 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__ p/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/serverless/v1/service/environment/log.pyr#   )   s(    zLogInstance.__init__
LogContextreturnc                 C   s6   | j dkr0t| 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!   )r'   r-   _versionr&   r(   r+   r+   r,   _proxyI   s    
zLogInstance._proxyc                 C   s
   | j  S )S
        Fetch the LogInstance


        :returns: The fetched LogInstance
        )r2   fetchr1   r+   r+   r,   r4   Z   s    zLogInstance.fetchc                    s   | j  I dH S )m
        Asynchronous coroutine to fetch the LogInstance


        :returns: The fetched LogInstance
        N)r2   fetch_asyncr1   r+   r+   r,   r6   c   s    zLogInstance.fetch_asyncc                 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>r   s     z'LogInstance.__repr__.<locals>.<genexpr>z%<Twilio.Serverless.V1.LogInstance {}>joinr&   itemsr;   r(   contextr+   r+   r,   __repr__l   s    zLogInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r#   propertyr2   r4   r6   rF   __classcell__r+   r+   r)   r,   r      s    
 		r   c                       sR   e Zd Zeeeed fddZedddZedddZedd	d
Z	  Z
S )r-   )r   r   r   r   c                    s.   t  | |||d| _djf | 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}Nr"   r#   r&   r;   _uri)r(   r   r   r   r   r)   r+   r,   r#   x   s    zLogContext.__init__r.   c                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r3   application/jsonAcceptGETmethoduriheadersr   r   r   r!   )r   ofr0   r4   rO   r   r&   r(   rV   r   r+   r+   r,   r4      s    
zLogContext.fetchc                    sR   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r5   rP   rQ   rR   rS   Nr   r   r   r!   )r   rW   r0   r6   rO   r   r&   rX   r+   r+   r,   r6      s    
  zLogContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r7   r8   c                 s   s   | ]\}}d  ||V  qdS r9   r:   r<   r+   r+   r,   r@      s     z&LogContext.__repr__.<locals>.<genexpr>z$<Twilio.Serverless.V1.LogContext {}>rA   rD   r+   r+   r,   rF      s    zLogContext.__repr__)rG   rH   rI   r   rK   r#   r   r4   r6   rF   rM   r+   r+   r)   r,   r-   v   s      r-   c                   @   s2   e Zd Zeeef edddZedddZdS )LogPage)r   r/   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   r0   r&   )r(   r   r+   r+   r,   get_instance   s    zLogPage.get_instancer.   c                 C   s   dS )r7   z<Twilio.Serverless.V1.LogPage>r+   r1   r+   r+   r,   rF      s    zLogPage.__repr__N)	rG   rH   rI   r   rK   r   r   r[   rF   r+   r+   r+   r,   rY      s   rY   c                	       st  e Zd Zeeed fddZejejejddfeee	f ee
e	f ee
e	f ee ee ee dddZejejejddfeee	f ee
e	f ee
e	f ee ee ee ddd	Zejejejddfeee	f ee
e	f ee
e	f ee ee ee dd
dZejejejddfeee	f ee
e	f ee
e	f ee ee ee dddZejejejejejejfeee	f ee
e	f ee
e	f eee	f eee	f eee	f edddZejejejejejejfeee	f ee
e	f ee
e	f eee	f eee	f eee	f edddZeedddZeedddZeedddZeedddZedddZ  ZS ) LogList)r   r   r   c                    s,   t  | ||d| _djf | 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.

        rZ   z;/Services/{service_sid}/Environments/{environment_sid}/LogsNrN   )r(   r   r   r   r)   r+   r,   r#      s    	zLogList.__init__N)r   
start_dateend_datelimit	page_sizer/   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
        r`   r   r]   r^   r`   r_   )r0   read_limitspagestreamr(   r   r]   r^   r_   r`   Zlimitsrc   r+   r+   r,   rd      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
        r`   ra   Nr_   )r0   rb   
page_asyncstream_asyncre   r+   r+   r,   rg     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   r]   r^   r_   r`   )listrd   r(   r   r]   r^   r_   r`   r+   r+   r,   ri   A  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 )Nr+   )r=   recordr+   r+   r,   
<listcomp>}  s   z&LogList.list_async.<locals>.<listcomp>rh   N)rg   rj   r+   r+   r,   
list_asyncd  s    
zLogList.list_async)r   r]   r^   
page_tokenpage_numberr`   r/   c           
   	   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
        ZFunctionSidZ	StartDateZEndDateZ	PageTokenr   ZPageSizeContent-Type!application/x-www-form-urlencodedrP   rQ   rR   rT   rU   paramsrV   )	r   rW   r   r%   r0   rc   rO   rY   r&   
r(   r   r]   r^   rn   ro   r`   datarV   responser+   r+   r,   rc     s$       zLogList.pagec           
   	      sf   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
        rp   rq   rr   rP   rQ   rR   rs   N)	r   rW   r   r%   r0   rf   rO   rY   r&   ru   r+   r+   r,   rf     s$       zLogList.page_async)
target_urlr/   c                 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
        rR   )r0   domaintwiliorequestrY   r&   r(   rx   rw   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
        rR   N)r0   ry   rz   Zrequest_asyncrY   r&   r|   r+   r+   r,   get_page_async  s    	zLogList.get_page_async)r   r/   c                 C   s   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!   r-   r0   r&   r(   r   r+   r+   r,   r$     s    zLogList.getc                 C   s   t | j| jd | jd |dS r   r   r   r+   r+   r,   __call__  s    zLogList.__call__r.   c                 C   s   dS )r7   z<Twilio.Serverless.V1.LogList>r+   r1   r+   r+   r,   rF     s    zLogList.__repr__)rG   rH   rI   r   rK   r#   r   unsetr   objectr   r   intr   r   rd   r	   rg   r   ri   rm   rY   rc   rf   r}   r~   r-   r$   r   rF   rM   r+   r+   r)   r,   r\      s   


&


&


%


&





,





*r\   N)rJ   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r-   rY   r\   r+   r+   r+   r,   <module>   s   $]S