U
    ^g%iS                     @   s   d 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 - Events
    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.
    )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 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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 )SubscribedEventInstancea<  
    :ivar account_sid: The unique SID identifier of the Account.
    :ivar type: Type of event being subscribed to.
    :ivar schema_version: The schema version that the Subscription should use.
    :ivar subscription_sid: The unique SID identifier of the Subscription.
    :ivar url: The URL of this resource.
    N)versionpayloadsubscription_sidtypec                    sj   t  | |d| _|d| _t|d| _|d| _|d| _	||pX| jd| _
d | _d S )Naccount_sidr   schema_versionr   urlr   r   )super__init__getr   r   r	   integerr   r   r   	_solution_context)selfr   r   r   r   	__class__ r/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/events/v1/subscription/subscribed_event.pyr   !   s    z SubscribedEventInstance.__init__SubscribedEventContextreturnc                 C   s.   | j dkr(t| j| 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: SubscribedEventContext for this SubscribedEventInstance
        Nr   r   r   )r   r$   _versionr   r   r"   r"   r#   _proxy8   s    
zSubscribedEventInstance._proxyc                 C   s
   | j  S )r
        Deletes the SubscribedEventInstance


        :returns: True if delete succeeds, False otherwise
        )r)   deleter(   r"   r"   r#   r+   H   s    zSubscribedEventInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the SubscribedEventInstance


        :returns: True if delete succeeds, False otherwise
        N)r)   delete_asyncr(   r"   r"   r#   r-   Q   s    z$SubscribedEventInstance.delete_asyncc                 C   s
   | j  S )k
        Fetch the SubscribedEventInstance


        :returns: The fetched SubscribedEventInstance
        )r)   fetchr(   r"   r"   r#   r/   Z   s    zSubscribedEventInstance.fetchc                    s   | j  I dH S )
        Asynchronous coroutine to fetch the SubscribedEventInstance


        :returns: The fetched SubscribedEventInstance
        N)r)   fetch_asyncr(   r"   r"   r#   r1   c   s    z#SubscribedEventInstance.fetch_asyncr   r&   c                 C   s   | j j|dS )
        Update the SubscribedEventInstance

        :param schema_version: The schema version that the Subscription should use.

        :returns: The updated SubscribedEventInstance
        r   )r)   updater   r   r"   r"   r#   r5   l   s    
zSubscribedEventInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the SubscribedEventInstance

        :param schema_version: The schema version that the Subscription should use.

        :returns: The updated SubscribedEventInstance
        r4   N)r)   update_asyncr6   r"   r"   r#   r8   z   s    
z$SubscribedEventInstance.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     z3SubscribedEventInstance.__repr__.<locals>.<genexpr>z-<Twilio.Events.V1.SubscribedEventInstance {}>joinr   itemsr=   r   contextr"   r"   r#   __repr__   s    z SubscribedEventInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr)   boolr+   r-   r/   r1   r
   unsetr   intobjectr5   r8   rH   __classcell__r"   r"   r    r#   r      s2    
			


r   c                       s   e Zd Z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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   r   c                    s,   t  | ||d| _djf | j| _dS )z
        Initialize the SubscribedEventContext

        :param version: Version that contains the resource
        :param subscription_sid: The unique SID identifier of the Subscription.
        :param type: Type of event being subscribed to.
        r   z9/Subscriptions/{subscription_sid}/SubscribedEvents/{type}Nr   r   r   r=   _uri)r   r   r   r   r    r"   r#   r      s    zSubscribedEventContext.__init__r%   c                 C   s   t i }| jjd| j|dS )r*   DELETEmethoduriheaders)r
   ofr'   r+   rU   r   rZ   r"   r"   r#   r+      s    
zSubscribedEventContext.deletec                    s$   t i }| jjd| j|dI dH S )r,   rV   rW   N)r
   r[   r'   r-   rU   r\   r"   r"   r#   r-      s    
  z#SubscribedEventContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r.   application/jsonAcceptGETrW   r   r   r   )r
   r[   r'   r/   rU   r   r   r   rZ   r   r"   r"   r#   r/      s    
zSubscribedEventContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r0   r]   r^   r_   rW   Nr   r   r   )r
   r[   r'   r1   rU   r   r   r`   r"   r"   r#   r1      s    
  z"SubscribedEventContext.fetch_asyncr2   c                 C   s\   t d|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )r3   SchemaVersion!application/x-www-form-urlencodedContent-Typer]   r^   POSTrX   rY   datarZ   r   r   r   )r
   r[   r'   r5   rU   r   r   r   r   rf   rZ   r   r"   r"   r#   r5      s(     
   zSubscribedEventContext.updatec                    sb   t d|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )r7   ra   rb   rc   r]   r^   rd   re   Nr   r   r   )r
   r[   r'   r8   rU   r   r   rg   r"   r"   r#   r8     s(     
   z#SubscribedEventContext.update_asyncc                 C   s$   d dd | j D }d|S )r9   r:   c                 s   s   | ]\}}d  ||V  qdS r;   r<   r>   r"   r"   r#   rB   5  s     z2SubscribedEventContext.__repr__.<locals>.<genexpr>z,<Twilio.Events.V1.SubscribedEventContext {}>rC   rF   r"   r"   r#   rH   /  s    zSubscribedEventContext.__repr__)rI   rJ   rK   r   rM   r   rO   r+   r-   r   r/   r1   r
   rP   r   rQ   rR   r5   r8   rH   rS   r"   r"   r    r#   r$      s    
"
!r$   c                   @   s2   e Zd Zeeef edddZedddZdS )SubscribedEventPage)r   r&   c                 C   s   t | j|| jd dS )zu
        Build an instance of SubscribedEventInstance

        :param payload: Payload response from the API
        r   r   )r   r'   r   )r   r   r"   r"   r#   get_instance;  s
      z SubscribedEventPage.get_instancer%   c                 C   s   dS )r9   z&<Twilio.Events.V1.SubscribedEventPage>r"   r(   r"   r"   r#   rH   E  s    zSubscribedEventPage.__repr__N)	rI   rJ   rK   r   rM   r   r   rj   rH   r"   r"   r"   r#   rh   9  s   
rh   c                       s  e Zd Ze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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 ))SubscribedEventList)r   r   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the SubscribedEventList

        :param version: Version that contains the resource
        :param subscription_sid: The unique SID identifier of the Subscription.

        r   z2/Subscriptions/{subscription_sid}/SubscribedEventsNrT   )r   r   r   r    r"   r#   r   P  s     zSubscribedEventList.__init__)r   r   r&   c                 C   sZ   t ||d}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd d	S )
z
        Create the SubscribedEventInstance

        :param type: Type of event being subscribed to.
        :param schema_version: The schema version that the Subscription should use.

        :returns: The created SubscribedEventInstance
        Typera   rc   rb   r]   r^   rd   re   r   ri   )r
   r[   r'   createrU   r   r   r   r   r   rf   rZ   r   r"   r"   r#   rn   b  s&         zSubscribedEventList.createc                    s`   t ||d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )a  
        Asynchronously create the SubscribedEventInstance

        :param type: Type of event being subscribed to.
        :param schema_version: The schema version that the Subscription should use.

        :returns: The created SubscribedEventInstance
        rl   rc   rb   r]   r^   rd   re   Nr   ri   )r
   r[   r'   create_asyncrU   r   r   ro   r"   r"   r#   rp     s&         z SubscribedEventList.create_asyncN)limit	page_sizer&   c                 C   s0   | j ||}| j|d d}| j ||d S )ae  
        Streams SubscribedEventInstance 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
        rr   rr   rq   )r'   read_limitspagestreamr   rq   rr   Zlimitsru   r"   r"   r#   rv     s    zSubscribedEventList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )at  
        Asynchronously streams SubscribedEventInstance 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
        rr   rs   Nrq   )r'   rt   
page_asyncstream_asyncrw   r"   r"   r#   ry     s    z SubscribedEventList.stream_asyncc                 C   s   t | j||dS )a  
        Lists SubscribedEventInstance 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
        rq   rr   )listrv   r   rq   rr   r"   r"   r#   r{     s    zSubscribedEventList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists SubscribedEventInstance 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"   )r?   recordr"   r"   r#   
<listcomp>  s   z2SubscribedEventList.list_async.<locals>.<listcomp>rz   N)ry   r|   r"   r"   r#   
list_async  s    
zSubscribedEventList.list_async)
page_tokenpage_numberrr   r&   c                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| jS )a  
        Retrieve a single page of SubscribedEventInstance 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 SubscribedEventInstance
        Z	PageTokenr   ZPageSizerc   rb   r]   r^   r_   rX   rY   paramsrZ   )r
   r[   r'   ru   rU   rh   r   r   r   r   rr   rf   rZ   responser"   r"   r#   ru   	  s       zSubscribedEventList.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 SubscribedEventInstance 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 SubscribedEventInstance
        r   rc   rb   r]   r^   r_   r   N)r
   r[   r'   rx   rU   rh   r   r   r"   r"   r#   rx   *  s       zSubscribedEventList.page_async)
target_urlr&   c                 C   s"   | j jjd|}t| j || jS )a  
        Retrieve a specific page of SubscribedEventInstance records from the API.
        Request is executed immediately

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

        :returns: Page of SubscribedEventInstance
        r_   )r'   domaintwiliorequestrh   r   r   r   r   r"   r"   r#   get_pageK  s    	zSubscribedEventList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of SubscribedEventInstance records from the API.
        Request is executed immediately

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

        :returns: Page of SubscribedEventInstance
        r_   N)r'   r   r   Zrequest_asyncrh   r   r   r"   r"   r#   get_page_asyncW  s    	z"SubscribedEventList.get_page_async)r   r&   c                 C   s   t | j| jd |dS zn
        Constructs a SubscribedEventContext

        :param type: Type of event being subscribed to.
        r   r   r$   r'   r   r   r   r"   r"   r#   r   c  s
    zSubscribedEventList.getc                 C   s   t | j| jd |dS r   r   r   r"   r"   r#   __call__o  s
    zSubscribedEventList.__call__r%   c                 C   s   dS )r9   z&<Twilio.Events.V1.SubscribedEventList>r"   r(   r"   r"   r#   rH   {  s    zSubscribedEventList.__repr__)NN)NN)NN)NN) rI   rJ   rK   r   rM   r   r
   rP   r   rQ   rR   r   rn   rp   r   r   rv   r   ry   r   r{   r   rh   ru   rx   r   r   r$   r   r   rH   rS   r"   r"   r    r#   rk   N  s    
! 
"        


#


!rk   N)rL   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$   rh   rk   r"   r"   r"   r#   <module>   s   $z (