U
    ^g%ifJ                     @   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 - Flex
    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 d fddZ	e
dddd	Zejfeeef d d
ddZejfeeef d d
ddZedddZ  ZS )PluginReleaseInstancea5  
    :ivar sid: The unique string that we created to identify the Plugin Release resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Plugin Release resource and owns this resource.
    :ivar configuration_sid: The SID of the Plugin Configuration resource to release.
    :ivar date_created: The date and time in GMT when the Flex Plugin Release was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar url: The absolute URL of the Plugin Release resource.
    N)versionpayloadsidc                    sh   t  | |d| _|d| _|d| _t|d| _|d| _	d|pX| ji| _
d | _d S )Nr   account_sidconfiguration_siddate_createdurl)super__init__getr   r   r   r
   Ziso8601_datetimer   r   	_solution_context)selfr   r   r   	__class__ e/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/flex_api/v1/plugin_release.pyr   "   s     zPluginReleaseInstance.__init__PluginReleaseContextreturnc                 C   s&   | j dkr t| j| 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: PluginReleaseContext for this PluginReleaseInstance
        Nr   r   )r   r#   _versionr   r   r!   r!   r"   _proxy4   s    
zPluginReleaseInstance._proxyflex_metadatar%   c                 C   s   | j j|dS )
        Fetch the PluginReleaseInstance

        :param flex_metadata: The Flex-Metadata HTTP request header

        :returns: The fetched PluginReleaseInstance
        r+   )r)   fetchr   r+   r!   r!   r"   r.   C   s    
zPluginReleaseInstance.fetchc                    s   | j j|dI dH S )
        Asynchronous coroutine to fetch the PluginReleaseInstance

        :param flex_metadata: The Flex-Metadata HTTP request header

        :returns: The fetched PluginReleaseInstance
        r-   N)r)   fetch_asyncr/   r!   r!   r"   r1   Q   s    
z!PluginReleaseInstance.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>e   s     z1PluginReleaseInstance.__repr__.<locals>.<genexpr>z,<Twilio.FlexApi.V1.PluginReleaseInstance {}>joinr   itemsr6   r   contextr!   r!   r"   __repr___   s    zPluginReleaseInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr)   r   unsetr   objectr.   r1   rA   __classcell__r!   r!   r   r"   r      s(   	  
 

r   c                       sn   e Zd Zeed fddZejfeee	f e
dddZejfeee	f e
dddZed	d
dZ  ZS )r#   )r   r   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the PluginReleaseContext

        :param version: Version that contains the resource
        :param sid: The SID of the Flex Plugin Release resource to fetch.
        r   z/PluginService/Releases/{sid}N)r   r   r   r6   _uri)r   r   r   r   r!   r"   r   k   s
     zPluginReleaseContext.__init__r*   c                 C   s\   t i }|t jks*t|tr"|r*||d< d|d< | jjd| j|d}t| j|| j	d dS )r,   Flex-Metadataapplication/jsonAcceptGETmethoduriheadersr   r&   )
r   ofrH   
isinstancerF   r'   r.   rK   r   r   r   r+   rS   r   r!   r!   r"   r.   z   s    
zPluginReleaseContext.fetchc                    sb   t i }|t jks*t|tr"|r*||d< d|d< | jjd| j|dI dH }t| j|| j	d dS )	r0   rL   rM   rN   rO   rP   Nr   r&   )
r   rT   rH   rU   rF   r'   r1   rK   r   r   rV   r!   r!   r"   r1      s&    
  z PluginReleaseContext.fetch_asyncr$   c                 C   s$   d dd | j D }d|S )r2   r3   c                 s   s   | ]\}}d  ||V  qdS r4   r5   r7   r!   r!   r"   r;      s     z0PluginReleaseContext.__repr__.<locals>.<genexpr>z+<Twilio.FlexApi.V1.PluginReleaseContext {}>r<   r?   r!   r!   r"   rA      s    zPluginReleaseContext.__repr__)rB   rC   rD   r   rF   r   r   rH   r   rI   r   r.   r1   rA   rJ   r!   r!   r   r"   r#   i   s   

r#   c                   @   s2   e Zd Zeeef edddZedddZdS )PluginReleasePage)r   r%   c                 C   s   t | j|S )zs
        Build an instance of PluginReleaseInstance

        :param payload: Payload response from the API
        )r   r'   )r   r   r!   r!   r"   get_instance   s    zPluginReleasePage.get_instancer$   c                 C   s   dS )r2   z%<Twilio.FlexApi.V1.PluginReleasePage>r!   r(   r!   r!   r"   rA      s    zPluginReleasePage.__repr__N)	rB   rC   rD   r   rF   r   r   rX   rA   r!   r!   r!   r"   rW      s   rW   c                       s  e Zd Zed fddZejfeeee	f e
dddZejfeeee	f e
dddZejd	d	feee	f ee ee ee
 d
ddZejd	d	feee	f ee ee ee
 d
ddZejd	d	feee	f ee ee ee
 d
ddZejd	d	feee	f ee ee ee
 d
ddZ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dddZ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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 )%PluginReleaseList)r   c                    s   t  | d| _dS )zo
        Initialize the PluginReleaseList

        :param version: Version that contains the resource

        z/PluginService/ReleasesN)r   r   rK   )r   r   r   r!   r"   r      s    zPluginReleaseList.__init__)configuration_idr+   r%   c                 C   sP   t d|i}t |dd}d|d< d|d< | jjd| j||d}t| j|S )	a  
        Create the PluginReleaseInstance

        :param configuration_id: The SID or the Version of the Flex Plugin Configuration to release.
        :param flex_metadata: The Flex-Metadata HTTP request header

        :returns: The created PluginReleaseInstance
        ConfigurationId!application/x-www-form-urlencodedrL   Content-Typer^   rM   rN   POSTrQ   rR   datarS   )r   rT   r'   createrK   r   r   rZ   r+   ra   rS   r   r!   r!   r"   rb      s&        zPluginReleaseList.createc                    sV   t d|i}t |dd}d|d< d|d< | jjd| j||dI d	H }t| j|S )
a   
        Asynchronously create the PluginReleaseInstance

        :param configuration_id: The SID or the Version of the Flex Plugin Configuration to release.
        :param flex_metadata: The Flex-Metadata HTTP request header

        :returns: The created PluginReleaseInstance
        r[   r\   r]   r^   rM   rN   r_   r`   N)r   rT   r'   create_asyncrK   r   rc   r!   r!   r"   rd     s&        zPluginReleaseList.create_asyncN)r+   limit	page_sizer%   c                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams PluginReleaseInstance 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 flex_metadata: The Flex-Metadata HTTP request header
        :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
        rf   r+   rf   re   )r'   read_limitspagestreamr   r+   re   rf   Zlimitsri   r!   r!   r"   rj   $  s    zPluginReleaseList.streamc                    s8   | j ||}| j||d dI dH }| j ||d S )a  
        Asynchronously streams PluginReleaseInstance 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 flex_metadata: The Flex-Metadata HTTP request header
        :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
        rf   rg   Nre   )r'   rh   
page_asyncstream_asyncrk   r!   r!   r"   rm   ?  s     zPluginReleaseList.stream_asyncc                 C   s   t | j|||dS )aH  
        Lists PluginReleaseInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str flex_metadata: The Flex-Metadata HTTP request header
        :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+   re   rf   )listrj   r   r+   re   rf   r!   r!   r"   ro   \  s    zPluginReleaseList.listc                    s&   dd | j |||dI dH 2 I dH S )aW  
        Asynchronously lists PluginReleaseInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str flex_metadata: The Flex-Metadata HTTP request header
        :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!   )r8   recordr!   r!   r"   
<listcomp>  s   z0PluginReleaseList.list_async.<locals>.<listcomp>rn   N)rm   rp   r!   r!   r"   
list_asyncy  s    
zPluginReleaseList.list_async)r+   
page_tokenpage_numberrf   r%   c                 C   sN   t ||||d}t |dd}d|d< | jjd| j||d}t| j|S )a  
        Retrieve a single page of PluginReleaseInstance records from the API.
        Request is executed immediately

        :param flex_metadata: The Flex-Metadata HTTP request header
        :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 PluginReleaseInstance
        rL   Z	PageTokenr   ZPageSizer\   r]   rM   rN   rO   rQ   rR   paramsrS   )r   rT   r'   ri   rK   rW   r   r+   rt   ru   rf   ra   rS   responser!   r!   r"   ri     s(    	   zPluginReleaseList.pagec                    sT   t ||||d}t |dd}d|d< | jjd| j||dI dH }t| j|S )	a  
        Asynchronously retrieve a single page of PluginReleaseInstance records from the API.
        Request is executed immediately

        :param flex_metadata: The Flex-Metadata HTTP request header
        :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 PluginReleaseInstance
        rv   r\   r]   rM   rN   rO   rw   N)r   rT   r'   rl   rK   rW   ry   r!   r!   r"   rl     s(    	   zPluginReleaseList.page_async)
target_urlr%   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of PluginReleaseInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PluginReleaseInstance
        rO   )r'   domaintwiliorequestrW   r   r{   rz   r!   r!   r"   get_page  s    	zPluginReleaseList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of PluginReleaseInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PluginReleaseInstance
        rO   N)r'   r|   r}   Zrequest_asyncrW   r   r!   r!   r"   get_page_async  s    	z PluginReleaseList.get_page_async)r   r%   c                 C   s   t | j|dS z~
        Constructs a PluginReleaseContext

        :param sid: The SID of the Flex Plugin Release resource to fetch.
        r&   r#   r'   r   r   r!   r!   r"   r     s    zPluginReleaseList.getc                 C   s   t | j|dS r   r   r   r!   r!   r"   __call__	  s    zPluginReleaseList.__call__r$   c                 C   s   dS )r2   z%<Twilio.FlexApi.V1.PluginReleaseList>r!   r(   r!   r!   r"   rA     s    zPluginReleaseList.__repr__) rB   rC   rD   r   r   r   rH   rF   r   rI   r   rb   rd   r   intr   rj   r	   rm   r   ro   rs   rW   ri   rl   r   r   r#   r   r   rA   rJ   r!   r!   r   r"   rY      s    
# 
$



 



+



)rY   N)rE   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#   rW   rY   r!   r!   r!   r"   <module>   s   $PW