U
    ^g%iL                     @   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 - Messaging
    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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dddZ  ZS )ChannelSenderInstancea  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the ChannelSender resource.
    :ivar messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/messaging/services) the resource is associated with.
    :ivar sid: The unique string that we created to identify the ChannelSender resource.
    :ivar sender: The unique string that identifies the sender e.g whatsapp:+123456XXXX.
    :ivar sender_type: A string value that identifies the sender type e.g WhatsApp, Messenger.
    :ivar country_code: The 2-character [ISO Country Code](https://www.iso.org/iso-3166-country-codes.html) of the number.
    :ivar date_created: The date and time in GMT when the 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 resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar url: The absolute URL of the ChannelSender resource.
    N)versionpayloadmessaging_service_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _||p| jd
| _d | _d S )Naccount_sidr   r   sendersender_typecountry_codedate_createddate_updatedurlr   r   )super__init__getr   r   r   r   r   r   r
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   	__class__ n/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/messaging/v1/service/channel_sender.pyr   &   s$    zChannelSenderInstance.__init__ChannelSenderContext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: ChannelSenderContext for this ChannelSenderInstance
        Nr   r   r   )r"   r(   _versionr!   r#   r&   r&   r'   _proxyC   s    
zChannelSenderInstance._proxyc                 C   s
   | j  S )p
        Deletes the ChannelSenderInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r&   r&   r'   r/   S   s    zChannelSenderInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the ChannelSenderInstance


        :returns: True if delete succeeds, False otherwise
        N)r-   delete_asyncr,   r&   r&   r'   r1   \   s    z"ChannelSenderInstance.delete_asyncc                 C   s
   | j  S )g
        Fetch the ChannelSenderInstance


        :returns: The fetched ChannelSenderInstance
        )r-   fetchr,   r&   r&   r'   r3   e   s    zChannelSenderInstance.fetchc                    s   | j  I dH S )
        Asynchronous coroutine to fetch the ChannelSenderInstance


        :returns: The fetched ChannelSenderInstance
        N)r-   fetch_asyncr,   r&   r&   r'   r5   n   s    z!ChannelSenderInstance.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>}   s     z1ChannelSenderInstance.__repr__.<locals>.<genexpr>z.<Twilio.Messaging.V1.ChannelSenderInstance {}>joinr!   itemsr:   r#   contextr&   r&   r'   __repr__w   s    zChannelSenderInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr/   r1   r3   r5   rE   __classcell__r&   r&   r$   r'   r      s    
				r   c                       sl   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dddZ  ZS )r(   )r   r   r   c                    s,   t  | ||d| _djf | j| _dS )aH  
        Initialize the ChannelSenderContext

        :param version: Version that contains the resource
        :param messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the resource from.
        :param sid: The SID of the ChannelSender resource to fetch.
        r   z6/Services/{messaging_service_sid}/ChannelSenders/{sid}Nr   r   r!   r:   _uri)r#   r   r   r   r$   r&   r'   r      s    zChannelSenderContext.__init__r)   c                 C   s   t i }| jjd| j|dS )r.   DELETEmethoduriheaders)r   ofr+   r/   rO   r#   rT   r&   r&   r'   r/      s    
zChannelSenderContext.deletec                    s$   t i }| jjd| j|dI dH S )r0   rP   rQ   N)r   rU   r+   r1   rO   rV   r&   r&   r'   r1      s    
  z!ChannelSenderContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r2   application/jsonAcceptGETrQ   r   r   r   )r   rU   r+   r3   rO   r   r!   r#   rT   r   r&   r&   r'   r3      s    
zChannelSenderContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r4   rW   rX   rY   rQ   Nr   r   r   )r   rU   r+   r5   rO   r   r!   rZ   r&   r&   r'   r5      s    
  z ChannelSenderContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r6   r7   c                 s   s   | ]\}}d  ||V  qdS r8   r9   r;   r&   r&   r'   r?      s     z0ChannelSenderContext.__repr__.<locals>.<genexpr>z-<Twilio.Messaging.V1.ChannelSenderContext {}>r@   rC   r&   r&   r'   rE      s    zChannelSenderContext.__repr__)rF   rG   rH   r   rJ   r   rL   r/   r1   r   r3   r5   rE   rM   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 )ChannelSenderPage)r   r*   c                 C   s   t | j|| jd dS )zs
        Build an instance of ChannelSenderInstance

        :param payload: Payload response from the API
        r   r   )r   r+   r!   )r#   r   r&   r&   r'   get_instance   s
    zChannelSenderPage.get_instancer)   c                 C   s   dS )r6   z'<Twilio.Messaging.V1.ChannelSenderPage>r&   r,   r&   r&   r'   rE      s    zChannelSenderPage.__repr__N)	rF   rG   rH   r   rJ   r   r   r]   rE   r&   r&   r&   r'   r[      s   r[   c                       s  e Zd Zeed fddZeedddZ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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 )(ChannelSenderList)r   r   c                    s*   t  | d|i| _djf | j| _dS )a  
        Initialize the ChannelSenderList

        :param version: Version that contains the resource
        :param messaging_service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the resources from.

        r   z0/Services/{messaging_service_sid}/ChannelSendersNrN   )r#   r   r   r$   r&   r'   r      s     zChannelSenderList.__init__)r   r*   c                 C   sX   t d|i}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd d	S )
z
        Create the ChannelSenderInstance

        :param sid: The SID of the Channel Sender being added to the Service.

        :returns: The created ChannelSenderInstance
        SidContent-Type!application/x-www-form-urlencodedrW   rX   POSTrR   rS   datarT   r   r\   )r   rU   r+   createrO   r   r!   r#   r   rd   rT   r   r&   r&   r'   re     s&    	    zChannelSenderList.createc                    s^   t d|i}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )z
        Asynchronously create the ChannelSenderInstance

        :param sid: The SID of the Channel Sender being added to the Service.

        :returns: The created ChannelSenderInstance
        r_   r`   ra   rW   rX   rb   rc   Nr   r\   )r   rU   r+   create_asyncrO   r   r!   rf   r&   r&   r'   rg   /  s&    	    zChannelSenderList.create_asyncN)limit	page_sizer*   c                 C   s0   | j ||}| j|d d}| j ||d S )ac  
        Streams ChannelSenderInstance 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
        ri   ri   rh   )r+   read_limitspagestreamr#   rh   ri   Zlimitsrl   r&   r&   r'   rm   M  s    zChannelSenderList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ar  
        Asynchronously streams ChannelSenderInstance 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
        ri   rj   Nrh   )r+   rk   
page_asyncstream_asyncrn   r&   r&   r'   rp   f  s    zChannelSenderList.stream_asyncc                 C   s   t | j||dS )a   
        Lists ChannelSenderInstance 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
        rh   ri   )listrm   r#   rh   ri   r&   r&   r'   rr     s    zChannelSenderList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists ChannelSenderInstance 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   z0ChannelSenderList.list_async.<locals>.<listcomp>rq   N)rp   rs   r&   r&   r'   
list_async  s    
zChannelSenderList.list_async)
page_tokenpage_numberri   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 ChannelSenderInstance 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 ChannelSenderInstance
        Z	PageTokenr   ZPageSizer`   ra   rW   rX   rY   rR   rS   paramsrT   )r   rU   r+   rl   rO   r[   r!   r#   rw   rx   ri   rd   rT   responser&   r&   r'   rl     s       zChannelSenderList.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 ChannelSenderInstance 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 ChannelSenderInstance
        ry   r`   ra   rW   rX   rY   rz   N)r   rU   r+   ro   rO   r[   r!   r|   r&   r&   r'   ro     s       zChannelSenderList.page_async)
target_urlr*   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of ChannelSenderInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ChannelSenderInstance
        rY   )r+   domaintwiliorequestr[   r!   r#   r~   r}   r&   r&   r'   get_page  s    	zChannelSenderList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of ChannelSenderInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ChannelSenderInstance
        rY   N)r+   r   r   Zrequest_asyncr[   r!   r   r&   r&   r'   get_page_async  s    	z ChannelSenderList.get_page_asyncc                 C   s   t | j| jd |dS zx
        Constructs a ChannelSenderContext

        :param sid: The SID of the ChannelSender resource to fetch.
        r   r   r(   r+   r!   r#   r   r&   r&   r'   r      s
    zChannelSenderList.getc                 C   s   t | j| jd |dS r   r   r   r&   r&   r'   __call__  s
    zChannelSenderList.__call__r)   c                 C   s   dS )r6   z'<Twilio.Messaging.V1.ChannelSenderList>r&   r,   r&   r&   r'   rE   &  s    zChannelSenderList.__repr__)NN)NN)NN)NN) rF   rG   rH   r   rJ   r   r   re   rg   r   intr   rm   r	   rp   r   rr   rv   r   unsetr   objectr[   rl   ro   r   r   r(   r    r   rE   rM   r&   r&   r$   r'   r^      sl            


#


!r^   N)rI   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(   r[   r^   r&   r&   r&   r'   <module>   s   $he