U
    ^g%i\                     @   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 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values)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   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edd
dZedddZd dddZd dddZejejfeeef eeef d dddZejejfeeef eeef d dddZedddZ  ZS )VariableInstancea  
    :ivar sid: The unique string that we created to identify the Variable resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Variable resource.
    :ivar service_sid: The SID of the Service that the Variable resource is associated with.
    :ivar environment_sid: The SID of the Environment in which the Variable exists.
    :ivar key: A string by which the Variable resource can be referenced.
    :ivar value: A string that contains the actual value of the Variable.
    :ivar date_created: The date and time in GMT when the Variable resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the Variable resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar url: The absolute URL of the Variable resource.
    N)versionpayloadservice_sidenvironment_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _|||p| jd
| _d | _d S )Nr   account_sidr   r   keyvaluedate_createddate_updatedurlr   r   r   )super__init__getr   r   r   r   r   r   r
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   r   	__class__ u/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/serverless/v1/service/environment/variable.pyr   &   s&    zVariableInstance.__init__VariableContext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: VariableContext for this VariableInstance
        Nr   r   r   r   )r"   r(   _versionr!   r#   r&   r&   r'   _proxyE   s    
zVariableInstance._proxyc                 C   s
   | j  S )k
        Deletes the VariableInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r&   r&   r'   r/   V   s    zVariableInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the VariableInstance


        :returns: True if delete succeeds, False otherwise
        N)r-   delete_asyncr,   r&   r&   r'   r1   _   s    zVariableInstance.delete_asyncc                 C   s
   | j  S )]
        Fetch the VariableInstance


        :returns: The fetched VariableInstance
        )r-   fetchr,   r&   r&   r'   r3   h   s    zVariableInstance.fetchc                    s   | j  I dH S )w
        Asynchronous coroutine to fetch the VariableInstance


        :returns: The fetched VariableInstance
        N)r-   fetch_asyncr,   r&   r&   r'   r5   q   s    zVariableInstance.fetch_asyncr   r   r*   c                 C   s   | j j||dS )M  
        Update the VariableInstance

        :param key: A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
        :param value: A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

        :returns: The updated VariableInstance
        r   r   )r-   updater#   r   r   r&   r&   r'   r9   z   s    zVariableInstance.updatec                    s   | j j||dI dH S )g  
        Asynchronous coroutine to update the VariableInstance

        :param key: A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
        :param value: A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

        :returns: The updated VariableInstance
        r8   N)r-   update_asyncr:   r&   r&   r'   r<      s    zVariableInstance.update_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>   s     z,VariableInstance.__repr__.<locals>.<genexpr>z*<Twilio.Serverless.V1.VariableInstance {}>joinr!   itemsrA   r#   contextr&   r&   r'   __repr__   s    zVariableInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr/   r1   r3   r5   r   unsetr   objectr9   r<   rL   __classcell__r&   r&   r$   r'   r      s<    
			



r   c                       s   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
e	dddZejejfeeef eeef e	dddZejejfeeef eeef 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 )ag  
        Initialize the VariableContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the Service to update the Variable resource under.
        :param environment_sid: The SID of the Environment with the Variable resource to update.
        :param sid: The SID of the Variable resource to update.
        r   zF/Services/{service_sid}/Environments/{environment_sid}/Variables/{sid}Nr   r   r!   rA   _uri)r#   r   r   r   r   r$   r&   r'   r      s    zVariableContext.__init__r)   c                 C   s   t i }| jjd| j|dS )r.   DELETEmethoduriheaders)r   ofr+   r/   rX   r#   r]   r&   r&   r'   r/      s    
zVariableContext.deletec                    s$   t i }| jjd| j|dI dH S )r0   rY   rZ   N)r   r^   r+   r1   rX   r_   r&   r&   r'   r1      s    
  zVariableContext.delete_asyncc                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r2   application/jsonAcceptGETrZ   r   r   r   r   )r   r^   r+   r3   rX   r   r!   r#   r]   r   r&   r&   r'   r3      s    
zVariableContext.fetchc                    sR   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r4   r`   ra   rb   rZ   Nr   r   r   r   )r   r^   r+   r5   rX   r   r!   rc   r&   r&   r'   r5      s    
  zVariableContext.fetch_asyncr6   c                 C   sf   t ||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 | jd
 dS )r7   KeyValue!application/x-www-form-urlencodedContent-Typer`   ra   POSTr[   r\   datar]   r   r   r   r   )r   r^   r+   r9   rX   r   r!   r#   r   r   rk   r]   r   r&   r&   r'   r9   	  s*    
   zVariableContext.updatec                    sl   t ||d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 | jd dS )r;   rd   rg   rh   r`   ra   ri   rj   Nr   r   r   r   )r   r^   r+   r<   rX   r   r!   rl   r&   r&   r'   r<   /  s*    
   zVariableContext.update_asyncc                 C   s$   d dd | j D }d|S )r=   r>   c                 s   s   | ]\}}d  ||V  qdS r?   r@   rB   r&   r&   r'   rF   [  s     z+VariableContext.__repr__.<locals>.<genexpr>z)<Twilio.Serverless.V1.VariableContext {}>rG   rJ   r&   r&   r'   rL   U  s    zVariableContext.__repr__)rM   rN   rO   r   rQ   r   rS   r/   r1   r   r3   r5   r   rT   r   rU   r9   r<   rL   rV   r&   r&   r$   r'   r(      s0      

(

&r(   c                   @   s2   e Zd Zeeef edddZedddZdS )VariablePage)r   r*   c                 C   s   t | j|| jd | jd dS )zn
        Build an instance of VariableInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r+   r!   )r#   r   r&   r&   r'   get_instancea  s    zVariablePage.get_instancer)   c                 C   s   dS )r=   z#<Twilio.Serverless.V1.VariablePage>r&   r,   r&   r&   r'   rL   n  s    zVariablePage.__repr__N)	rM   rN   rO   r   rQ   r   r   ro   rL   r&   r&   r&   r'   rm   _  s   rm   c                       s  e Zd Zeeed fddZeeedddZeeedddZd%e	e
 e	e
 ee d
ddZd&e	e
 e	e
 ee d
ddZd'e	e
 e	e
 ee d
ddZd(e	e
 e	e
 ee d
ddZejejejfeeef ee
ef ee
ef edddZejejej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 ))VariableList)r   r   r   c                    s,   t  | ||d| _djf | j| _dS )a"  
        Initialize the VariableList

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

        rn   z@/Services/{service_sid}/Environments/{environment_sid}/VariablesNrW   )r#   r   r   r   r$   r&   r'   r   y  s    	zVariableList.__init__r6   c                 C   sb   t ||d}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )aM  
        Create the VariableInstance

        :param key: A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
        :param value: A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

        :returns: The created VariableInstance
        rd   rh   rg   r`   ra   ri   rj   r   r   rn   )r   r^   r+   createrX   r   r!   rl   r&   r&   r'   rq     s(    
   zVariableList.createc                    sh   t ||d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )a\  
        Asynchronously create the VariableInstance

        :param key: A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
        :param value: A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.

        :returns: The created VariableInstance
        rd   rh   rg   r`   ra   ri   rj   Nr   r   rn   )r   r^   r+   create_asyncrX   r   r!   rl   r&   r&   r'   rr     s(    
   zVariableList.create_asyncN)limit	page_sizer*   c                 C   s0   | j ||}| j|d d}| j ||d S )a^  
        Streams VariableInstance 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 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
        rt   rt   rs   )r+   read_limitspagestreamr#   rs   rt   Zlimitsrw   r&   r&   r'   rx     s    zVariableList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )am  
        Asynchronously streams VariableInstance 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 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
        rt   ru   Nrs   )r+   rv   
page_asyncstream_asyncry   r&   r&   r'   r{     s    zVariableList.stream_asyncc                 C   s   t | j||dS )a  
        Lists VariableInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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
        rs   rt   )listrx   r#   rs   rt   r&   r&   r'   r}     s    zVariableList.listc                    s$   dd | j ||dI dH 2 I dH S )a
  
        Asynchronously lists VariableInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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&   )rC   recordr&   r&   r'   
<listcomp>0  s   z+VariableList.list_async.<locals>.<listcomp>r|   N)r{   r~   r&   r&   r'   
list_async  s    
zVariableList.list_async)
page_tokenpage_numberrt   r*   c                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| jS )au  
        Retrieve a single page of VariableInstance records from the API.
        Request is executed immediately

        :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 VariableInstance
        Z	PageTokenr   ZPageSizerh   rg   r`   ra   rb   r[   r\   paramsr]   )r   r^   r+   rw   rX   rm   r!   r#   r   r   rt   rk   r]   responser&   r&   r'   rw   8  s       zVariableList.pagec                    sT   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 VariableInstance records from the API.
        Request is executed immediately

        :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 VariableInstance
        r   rh   rg   r`   ra   rb   r   N)r   r^   r+   rz   rX   rm   r!   r   r&   r&   r'   rz   Y  s       zVariableList.page_async)
target_urlr*   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of VariableInstance records from the API.
        Request is executed immediately

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

        :returns: Page of VariableInstance
        rb   )r+   domaintwiliorequestrm   r!   r#   r   r   r&   r&   r'   get_pagez  s    	zVariableList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of VariableInstance records from the API.
        Request is executed immediately

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

        :returns: Page of VariableInstance
        rb   N)r+   r   r   Zrequest_asyncrm   r!   r   r&   r&   r'   get_page_async  s    	zVariableList.get_page_async)r   r*   c                 C   s   t | j| jd | jd |dS zo
        Constructs a VariableContext

        :param sid: The SID of the Variable resource to update.
        r   r   r   r(   r+   r!   r#   r   r&   r&   r'   r      s    zVariableList.getc                 C   s   t | j| jd | jd |dS r   r   r   r&   r&   r'   __call__  s    zVariableList.__call__r)   c                 C   s   dS )r=   z#<Twilio.Serverless.V1.VariableList>r&   r,   r&   r&   r'   rL     s    zVariableList.__repr__)NN)NN)NN)NN) rM   rN   rO   r   rQ   r   r   rq   rr   r   intr   rx   r	   r{   r   r}   r   r   rT   r   rU   rm   rw   rz   r   r   r(   r    r   rL   rV   r&   r&   r$   r'   rp   w  sl   !#        


#


!rp   N)rP   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   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(   rm   rp   r&   r&   r&   r'   <module>   s   $  8