o
    f>h\                     @   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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
efddZd
efddZd ddZd ddZejejfdeeef deeef d
d fddZejejfdeeef deeef d
d fddZd
ef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	| _|||pH| 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
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   r   	__class__ i/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/serverless/v1/service/environment/variable.pyr   &   s&   
zVariableInstance.__init__returnVariableContextc                 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: VariableContext for this VariableInstance
        Nr   r   r   r   )r#   r*   _versionr"   r$   r'   r'   r(   _proxyE   s   
zVariableInstance._proxyc                 C   
   | j  S )k
        Deletes the VariableInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r'   r'   r(   r0   V      
zVariableInstance.deletec                       | 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(   r4   _      zVariableInstance.delete_asyncc                 C   r.   )]
        Fetch the VariableInstance


        :returns: The fetched VariableInstance
        )r-   fetchr,   r'   r'   r(   r7   h   r1   zVariableInstance.fetchc                    r2   )w
        Asynchronous coroutine to fetch the VariableInstance


        :returns: The fetched VariableInstance
        N)r-   fetch_asyncr,   r'   r'   r(   r9   q   r5   zVariableInstance.fetch_asyncr   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(   r<   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
        r;   N)r-   update_asyncr=   r'   r'   r(   r?      s
   zVariableInstance.update_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>       z,VariableInstance.__repr__.<locals>.<genexpr>z*<Twilio.Serverless.V1.VariableInstance {}>joinr"   itemsrF   r$   contextr'   r'   r(   __repr__      
zVariableInstance.__repr__N)r)   r*   )r)   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr0   r4   r7   r9   r   unsetr   objectr<   r?   rR   __classcell__r'   r'   r%   r(   r      sN    
	
	
	





r   c                       s   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
de	fddZejejfdeeef deeef de	fddZejejfdeeef deeef de	fddZdefddZ  ZS )r*   r   r   r   r   c                    s2   t  | |||d| _djdi | 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}Nr'   r   r   r"   rF   _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+   r0   r`   r$   re   r'   r'   r(   r0      s   
zVariableContext.deletec                    s&   t i }| jjd| j|dI dH S )r3   ra   rb   N)r   rf   r+   r4   r`   rg   r'   r'   r(   r4      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 )	r6   application/jsonAcceptGETrb   r   r   r   r   )r   rf   r+   r7   r`   r   r"   r$   re   r   r'   r'   r(   r7      s   
zVariableContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r8   rh   ri   rj   rb   Nr   r   r   r   )r   rf   r+   r9   r`   r   r"   rk   r'   r'   r(   r9      s   
zVariableContext.fetch_asyncr   r   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 )r:   KeyValue!application/x-www-form-urlencodedContent-Typerh   ri   POSTrc   rd   datare   r   r   r   r   )r   rf   r+   r<   r`   r   r"   r$   r   r   rs   re   r   r'   r'   r(   r<   	  s$   

zVariableContext.updatec                    sn   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>   rl   ro   rp   rh   ri   rq   rr   Nr   r   r   r   )r   rf   r+   r?   r`   r   r"   rt   r'   r'   r(   r?   /  s&   

zVariableContext.update_asyncc                 C   r@   )rA   rB   c                 s   rC   rD   rE   rG   r'   r'   r(   rK   [  rL   z+VariableContext.__repr__.<locals>.<genexpr>z)<Twilio.Serverless.V1.VariableContext {}>rM   rP   r'   r'   r(   rR   U  rS   zVariableContext.__repr__)rU   rV   rW   r   rY   r   r[   r0   r4   r   r7   r9   r   r\   r   r]   r<   r?   rR   r^   r'   r'   r%   r(   r*      sB    


(


&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 )VariablePager   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_instancec                 C      dS )rA   z#<Twilio.Serverless.V1.VariablePage>r'   r,   r'   r'   r(   rR   n     zVariablePage.__repr__N)	rU   rV   rW   r   rY   r   r   rw   rR   r'   r'   r'   r(   ru   _  s    ru   c                	       s  e Zd Zdededef fddZdededefd	d
ZdededefddZ		d*de	e
 de	e
 dee fddZ		d*de	e
 de	e
 dee fddZ		d*de	e
 de	e
 dee fddZ		d*de	e
 de	e
 dee fddZejejej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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 )+VariableListr   r   r   c                    s0   t  | ||d| _djdi | 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.

        rv   z@/Services/{service_sid}/Environments/{environment_sid}/VariablesNr'   r_   )r$   r   r   r   r%   r'   r(   r   y  s   	zVariableList.__init__r   r   r)   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
        rl   rp   ro   rh   ri   rq   rr   r   r   rv   )r   rf   r+   creater`   r   r"   rt   r'   r'   r(   r{     s"   

zVariableList.createc                    sj   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
        rl   rp   ro   rh   ri   rq   rr   Nr   r   rv   )r   rf   r+   create_asyncr`   r   r"   rt   r'   r'   r(   r|     s$   

zVariableList.create_asyncNlimit	page_sizec                 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
        r~   r~   r}   )r+   read_limitspagestreamr$   r}   r~   limitsr   r'   r'   r(   r     s   zVariableList.streamc                    s8   | 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
        r~   r   Nr}   )r+   r   
page_asyncstream_asyncr   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
        r}   r~   )listr   r$   r}   r~   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 rT   r'   )rH   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_numberc                 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
        	PageTokenr   PageSizerp   ro   rh   ri   rj   rc   rd   paramsre   )r   rf   r+   r   r`   ru   r"   r$   r   r   r~   rs   re   responser'   r'   r(   r   8  s   
zVariableList.pagec                    sV   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   rp   ro   rh   ri   rj   r   N)r   rf   r+   r   r`   ru   r"   r   r'   r'   r(   r   Y  s   
zVariableList.page_async
target_urlc                 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
        rj   )r+   domaintwiliorequestru   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
        rj   N)r+   r   r   request_asyncru   r"   r   r'   r'   r(   get_page_async  s   	zVariableList.get_page_asyncr   c                 C      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         zVariableList.getc                 C   r   r   r   r   r'   r'   r(   __call__  r   zVariableList.__call__c                 C   rx   )rA   z#<Twilio.Serverless.V1.VariableList>r'   r,   r'   r'   r(   rR     ry   zVariableList.__repr__)NN) rU   rV   rW   r   rY   r   r   r{   r|   r   intr   r   r	   r   r   r   r   r   r\   r   r]   ru   r   r   r   r   r*   r    r   rR   r^   r'   r'   r%   r(   rz   w  s    !#







#



!rz   N)rX   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r*   ru   rz   r'   r'   r'   r(   <module>   s    $  8