o
    f>hS                     @   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dedeeef 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fdeeef d	d fddZejfdeeef d	d fddZd	ef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| _	||p,| 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__ f/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/events/v1/subscription/subscribed_event.pyr   !   s   
z SubscribedEventInstance.__init__returnSubscribedEventContextc                 C   s.   | j du 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   
   | j  S )r
        Deletes the SubscribedEventInstance


        :returns: True if delete succeeds, False otherwise
        )r(   deleter'   r"   r"   r#   r+   H      
zSubscribedEventInstance.deletec                       | 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      z$SubscribedEventInstance.delete_asyncc                 C   r)   )k
        Fetch the SubscribedEventInstance


        :returns: The fetched SubscribedEventInstance
        )r(   fetchr'   r"   r"   r#   r2   Z   r,   zSubscribedEventInstance.fetchc                    r-   )
        Asynchronous coroutine to fetch the SubscribedEventInstance


        :returns: The fetched SubscribedEventInstance
        N)r(   fetch_asyncr'   r"   r"   r#   r4   c   r0   z#SubscribedEventInstance.fetch_asyncr   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#   r7   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
        r6   N)r(   update_asyncr8   r"   r"   r#   r:   z   s   
z$SubscribedEventInstance.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>       z3SubscribedEventInstance.__repr__.<locals>.<genexpr>z-<Twilio.Events.V1.SubscribedEventInstance {}>joinr   itemsrA   r   contextr"   r"   r#   __repr__      
z SubscribedEventInstance.__repr__N)r$   r%   )r$   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr(   boolr+   r/   r2   r4   r
   unsetr   intobjectr7   r:   rM   __classcell__r"   r"   r    r#   r      s>    
	
	
	




r   c                       s   e Zd Z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fdeeef de	fddZejfdeeef de	fddZdefddZ  ZS )r%   r   r   r   c                    s0   t  | ||d| _djdi | 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}Nr"   r   r   r   rA   _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+   r\   r   ra   r"   r"   r#   r+      s   
zSubscribedEventContext.deletec                    s&   t i }| jjd| j|dI dH S )r.   r]   r^   N)r
   rb   r&   r/   r\   rc   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 )r1   application/jsonAcceptGETr^   r   r   r   )r
   rb   r&   r2   r\   r   r   r   ra   r   r"   r"   r#   r2      s   
zSubscribedEventContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r3   rd   re   rf   r^   Nr   r   r   )r
   rb   r&   r4   r\   r   r   rg   r"   r"   r#   r4      s   
z"SubscribedEventContext.fetch_asyncr   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 )r5   SchemaVersion!application/x-www-form-urlencodedContent-Typerd   re   POSTr_   r`   datara   r   r   r   )r
   rb   r&   r7   r\   r   r   r   r   rm   ra   r   r"   r"   r#   r7      s    

zSubscribedEventContext.updatec                    sd   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 )r9   rh   ri   rj   rd   re   rk   rl   Nr   r   r   )r
   rb   r&   r:   r\   r   r   rn   r"   r"   r#   r:     s"   

z#SubscribedEventContext.update_asyncc                 C   r;   )r<   r=   c                 s   r>   r?   r@   rB   r"   r"   r#   rF   5  rG   z2SubscribedEventContext.__repr__.<locals>.<genexpr>z,<Twilio.Events.V1.SubscribedEventContext {}>rH   rK   r"   r"   r#   rM   /  rN   zSubscribedEventContext.__repr__)rP   rQ   rR   r   rT   r   rV   r+   r/   r   r2   r4   r
   rW   r   rX   rY   r7   r:   rM   rZ   r"   r"   r    r#   r%      s&    

"

!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 )SubscribedEventPager   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_instancec                 C      dS )r<   z&<Twilio.Events.V1.SubscribedEventPage>r"   r'   r"   r"   r#   rM   E     zSubscribedEventPage.__repr__N)	rP   rQ   rR   r   rT   r   r   rq   rM   r"   r"   r"   r#   ro   9  s    
ro   c                	       s  e Zd Zdedef fddZejfdedee	e
f defdd	Zejfdedee	e
f 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 ))SubscribedEventListr   r   c                    s.   t  | d|i| _djdi | 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}/SubscribedEventsNr"   r[   )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
        Typerh   rj   ri   rd   re   rk   rl   r   rp   )r
   rb   r&   creater\   r   r   r   r   r   rm   ra   r   r"   r"   r#   rw   b  s   
zSubscribedEventList.createc                    sb   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
        ru   rj   ri   rd   re   rk   rl   Nr   rp   )r
   rb   r&   create_asyncr\   r   r   rx   r"   r"   r#   ry     s   
z SubscribedEventList.create_asyncNlimit	page_sizec                 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
        r{   r{   rz   )r&   read_limitspagestreamr   rz   r{   limitsr~   r"   r"   r#   r     s   zSubscribedEventList.streamc                    s8   | 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
        r{   r|   Nrz   )r&   r}   
page_asyncstream_asyncr   r"   r"   r#   r     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
        rz   r{   )listr   r   rz   r{   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 rO   r"   )rC   recordr"   r"   r#   
<listcomp>  s
    z2SubscribedEventList.list_async.<locals>.<listcomp>r   N)r   r   r"   r"   r#   
list_async  s   
zSubscribedEventList.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 )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
        	PageTokenr   PageSizerj   ri   rd   re   rf   r_   r`   paramsra   )r
   rb   r&   r~   r\   ro   r   r   r   r   r{   rm   ra   responser"   r"   r#   r~   	  s   
zSubscribedEventList.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 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   rj   ri   rd   re   rf   r   N)r
   rb   r&   r   r\   ro   r   r   r"   r"   r#   r   *  s   
zSubscribedEventList.page_async
target_urlc                 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
        rf   )r&   domaintwiliorequestro   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
        rf   N)r&   r   r   request_asyncro   r   r   r"   r"   r#   get_page_asyncW  s   	z"SubscribedEventList.get_page_asyncc                 C      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  
   zSubscribedEventList.getc                 C   r   r   r   r   r"   r"   r#   __call__o  r   zSubscribedEventList.__call__c                 C   rr   )r<   z&<Twilio.Events.V1.SubscribedEventList>r"   r'   r"   r"   r#   rM   {  rs   zSubscribedEventList.__repr__)NN) rP   rQ   rR   r   rT   r   r
   rW   r   rX   rY   r   rw   ry   r   r   r   r   r   r   r   r   ro   r~   r   r   r   r%   r   r   rM   rZ   r"   r"   r    r#   rt   N  s    

!

"







#



!rt   N)rS   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%   ro   rt   r"   r"   r"   r#   <module>   s    $z (