o
    f>hM                     @   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 - Api
    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ddZdddZejfdedeeef d
d fddZejfdedeeef d
d fddZd
efddZ  ZS )MemberInstancea  
    :ivar call_sid: The SID of the [Call](https://www.twilio.com/docs/voice/api/call-resource) the Member resource is associated with.
    :ivar date_enqueued: The date that the member was enqueued, given in RFC 2822 format.
    :ivar position: This member's current position in the queue.
    :ivar uri: The URI of the resource, relative to `https://api.twilio.com`.
    :ivar wait_time: The number of seconds the member has been in the queue.
    :ivar queue_sid: The SID of the Queue the member is in.
    Nversionpayloadaccount_sid	queue_sidcall_sidc                    s   t  | |d| _t|d| _t|d| _|d| _	t|d| _
|d| _|||p9| jd| _d | _d S )Nr   date_enqueuedpositionuri	wait_timer   r   r   r   )super__init__getr   r
   rfc2822_datetimer   integerr   r   r   r   	_solution_context)selfr   r   r   r   r   	__class__ ]/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/api/v2010/account/queue/member.pyr   #   s   
zMemberInstance.__init__returnMemberContextc                 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: MemberContext for this MemberInstance
        Nr   r   r   r   )r"   r)   _versionr!   r#   r&   r&   r'   _proxy=   s   
zMemberInstance._proxyc                 C   s
   | j  S )Y
        Fetch the MemberInstance


        :returns: The fetched MemberInstance
        )r,   fetchr+   r&   r&   r'   r.   N   s   
zMemberInstance.fetchc                    s   | j  I dH S )s
        Asynchronous coroutine to fetch the MemberInstance


        :returns: The fetched MemberInstance
        N)r,   fetch_asyncr+   r&   r&   r'   r0   W   s   zMemberInstance.fetch_asyncurlmethodc                 C   s   | j j||dS )]  
        Update the MemberInstance

        :param url: The absolute URL of the Queue resource.
        :param method: How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters.

        :returns: The updated MemberInstance
        r1   r2   )r,   updater#   r1   r2   r&   r&   r'   r5   `   s   zMemberInstance.updatec                    s   | j j||dI dH S )w  
        Asynchronous coroutine to update the MemberInstance

        :param url: The absolute URL of the Queue resource.
        :param method: How to pass the update request data. Can be `GET` or `POST` and the default is `POST`. `POST` sends the data as encoded form data and `GET` sends the data as query parameters.

        :returns: The updated MemberInstance
        r4   N)r,   update_asyncr6   r&   r&   r'   r8   p   s
   zMemberInstance.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*MemberInstance.__repr__.<locals>.<genexpr>z$<Twilio.Api.V2010.MemberInstance {}>joinr!   itemsr?   r#   contextr&   r&   r'   __repr__      
zMemberInstance.__repr__N)r(   r)   )r(   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr,   r.   r0   r   unsetr   objectr5   r8   rK   __classcell__r&   r&   r$   r'   r      sF    


	




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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efddZ  ZS )r)   r   r   r   r   c                    s2   t  | |||d| _djdi | j| _dS )a  
        Initialize the MemberContext

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to update.
        :param queue_sid: The SID of the Queue in which to find the members to update.
        :param call_sid: The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resource(s) to update.
        r   zB/Accounts/{account_sid}/Queues/{queue_sid}/Members/{call_sid}.jsonNr&   r   r   r!   r?   _uri)r#   r   r   r   r   r$   r&   r'   r      s   zMemberContext.__init__r(   c                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r-   application/jsonAcceptGETr2   r   headersr   r   r   r   )r   ofr*   r.   rX   r   r!   r#   r]   r   r&   r&   r'   r.      s   
zMemberContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r/   rY   rZ   r[   r\   Nr   r   r   r   )r   r^   r*   r0   rX   r   r!   r_   r&   r&   r'   r0      s   
zMemberContext.fetch_asyncr1   r2   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 )r3   UrlMethod!application/x-www-form-urlencodedContent-TyperY   rZ   POSTr2   r   datar]   r   r   r   r   )r   r^   r*   r5   rX   r   r!   r#   r1   r2   rg   r]   r   r&   r&   r'   r5      s$   

zMemberContext.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 )r7   r`   rc   rd   rY   rZ   re   rf   Nr   r   r   r   )r   r^   r*   r8   rX   r   r!   rh   r&   r&   r'   r8      s&   

zMemberContext.update_asyncc                 C   r9   )r:   r;   c                 s   r<   r=   r>   r@   r&   r&   r'   rD   !  rE   z)MemberContext.__repr__.<locals>.<genexpr>z#<Twilio.Api.V2010.MemberContext {}>rF   rI   r&   r&   r'   rK     rL   zMemberContext.__repr__)rN   rO   rP   r   rR   r   r   r.   r0   r   rT   r   rU   r5   r8   rK   rV   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 )
MemberPager   r(   c                 C   s   t | j|| jd | jd dS )zl
        Build an instance of MemberInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r*   r!   )r#   r   r&   r&   r'   get_instance'  s   zMemberPage.get_instancec                 C      dS )r:   z<Twilio.Api.V2010.MemberPage>r&   r+   r&   r&   r'   rK   4     zMemberPage.__repr__N)	rN   rO   rP   r   rR   r   r   rk   rK   r&   r&   r&   r'   ri   %  s    ri   c                	       s  e Zd Zdededef 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 )%
MemberListr   r   r   c                    s0   t  | ||d| _djdi | j| _dS )aC  
        Initialize the MemberList

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Member resource(s) to read.
        :param queue_sid: The SID of the Queue in which to find the members

        rj   z7/Accounts/{account_sid}/Queues/{queue_sid}/Members.jsonNr&   rW   )r#   r   r   r   r$   r&   r'   r   ?  s   	zMemberList.__init__Nlimit	page_sizer(   c                 C   s0   | j ||}| j|d d}| j ||d S )a\  
        Streams MemberInstance 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
        rp   rp   ro   )r*   read_limitspagestreamr#   ro   rp   limitsrs   r&   r&   r'   rt   S  s   zMemberList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )ak  
        Asynchronously streams MemberInstance 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
        rp   rq   Nro   )r*   rr   
page_asyncstream_asyncru   r&   r&   r'   rx   l  s   zMemberList.stream_asyncc                 C   s   t | j||dS )a  
        Lists MemberInstance 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
        ro   rp   )listrt   r#   ro   rp   r&   r&   r'   rz     s   zMemberList.listc                    s&   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists MemberInstance 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 rM   r&   )rA   recordr&   r&   r'   
<listcomp>  s
    z)MemberList.list_async.<locals>.<listcomp>ry   N)rx   r{   r&   r&   r'   
list_async  s   
zMemberList.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 )aq  
        Retrieve a single page of MemberInstance 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 MemberInstance
        	PageTokenr   PageSizerd   rc   rY   rZ   r[   r2   r   paramsr]   )r   r^   r*   rs   rX   ri   r!   r#   r   r   rp   rg   r]   responser&   r&   r'   rs     s   
zMemberList.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 MemberInstance 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 MemberInstance
        r   rd   rc   rY   rZ   r[   r   N)r   r^   r*   rw   rX   ri   r!   r   r&   r&   r'   rw     s   
zMemberList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of MemberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MemberInstance
        r[   )r*   domaintwiliorequestri   r!   r#   r   r   r&   r&   r'   get_page  s   	zMemberList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a   
        Asynchronously retrieve a specific page of MemberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MemberInstance
        r[   N)r*   r   r   request_asyncri   r!   r   r&   r&   r'   get_page_async  s   	zMemberList.get_page_asyncr   c                 C      t | j| jd | jd |dS z
        Constructs a MemberContext

        :param call_sid: The [Call](https://www.twilio.com/docs/voice/api/call-resource) SID of the resource(s) to update.
        r   r   r   r)   r*   r!   r#   r   r&   r&   r'   r        zMemberList.getc                 C   r   r   r   r   r&   r&   r'   __call__!  r   zMemberList.__call__c                 C   rl   )r:   z<Twilio.Api.V2010.MemberList>r&   r+   r&   r&   r'   rK   .  rm   zMemberList.__repr__)NN)rN   rO   rP   r   rR   r   r   intr   r   rt   r	   rx   r   rz   r~   r   rT   r   rU   ri   rs   rw   r   r   r)   r   r   rK   rV   r&   r&   r$   r'   rn   =  s    







#



!rn   N)rQ   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)   ri   rn   r&   r&   r&   r'   <module>   s    $q 