o
    f>hL                     @   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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d	ef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	| _||pG| 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
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   r   	__class__ b/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/messaging/v1/service/channel_sender.pyr   &   s$   
zChannelSenderInstance.__init__returnChannelSenderContextc                 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: ChannelSenderContext for this ChannelSenderInstance
        Nr   r   r   )r#   r*   _versionr"   r$   r'   r'   r(   _proxyC   s   
zChannelSenderInstance._proxyc                 C   
   | j  S )p
        Deletes the ChannelSenderInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r'   r'   r(   r0   S      
zChannelSenderInstance.deletec                       | 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(   r4   \      z"ChannelSenderInstance.delete_asyncc                 C   r.   )g
        Fetch the ChannelSenderInstance


        :returns: The fetched ChannelSenderInstance
        )r-   fetchr,   r'   r'   r(   r7   e   r1   zChannelSenderInstance.fetchc                    r2   )
        Asynchronous coroutine to fetch the ChannelSenderInstance


        :returns: The fetched ChannelSenderInstance
        N)r-   fetch_asyncr,   r'   r'   r(   r9   n   r5   z!ChannelSenderInstance.fetch_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>}       z1ChannelSenderInstance.__repr__.<locals>.<genexpr>z.<Twilio.Messaging.V1.ChannelSenderInstance {}>joinr"   itemsr@   r$   contextr'   r'   r(   __repr__w      
zChannelSenderInstance.__repr__N)r)   r*   )r)   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr0   r4   r7   r9   rL   __classcell__r'   r'   r%   r(   r      s&    
	
	
		r   c                       sp   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defddZ  ZS )r*   r   r   r   c                    s0   t  | ||d| _djdi | 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}Nr'   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+   r0   rX   r$   r]   r'   r'   r(   r0      s   
zChannelSenderContext.deletec                    s&   t i }| jjd| j|dI dH S )r3   rY   rZ   N)r   r^   r+   r4   rX   r_   r'   r'   r(   r4      s
   
z!ChannelSenderContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r6   application/jsonAcceptGETrZ   r   r   r   )r   r^   r+   r7   rX   r   r"   r$   r]   r   r'   r'   r(   r7      s   
zChannelSenderContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r8   r`   ra   rb   rZ   Nr   r   r   )r   r^   r+   r9   rX   r   r"   rc   r'   r'   r(   r9      s   
z ChannelSenderContext.fetch_asyncc                 C   r:   )r;   r<   c                 s   r=   r>   r?   rA   r'   r'   r(   rE      rF   z0ChannelSenderContext.__repr__.<locals>.<genexpr>z-<Twilio.Messaging.V1.ChannelSenderContext {}>rG   rJ   r'   r'   r(   rL      rM   zChannelSenderContext.__repr__)rO   rP   rQ   r   rS   r   rU   r0   r4   r   r7   r9   rL   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 )ChannelSenderPager   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_instancec                 C      dS )r;   z'<Twilio.Messaging.V1.ChannelSenderPage>r'   r,   r'   r'   r(   rL         zChannelSenderPage.__repr__N)	rO   rP   rQ   r   rS   r   r   rf   rL   r'   r'   r'   r(   rd      s    rd   c                	       s  e Zd Zdedef fddZdedefddZde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 )(ChannelSenderListr   r   c                    s.   t  | d|i| _djdi | 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}/ChannelSendersNr'   rW   )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-urlencodedr`   ra   POSTr[   r\   datar]   r   re   )r   r^   r+   createrX   r   r"   r$   r   ro   r]   r   r'   r'   r(   rp     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
        rj   rk   rl   r`   ra   rm   rn   Nr   re   )r   r^   r+   create_asyncrX   r   r"   rq   r'   r'   r(   rr   /  s    	
zChannelSenderList.create_asyncNlimit	page_sizec                 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
        rt   rt   rs   )r+   read_limitspagestreamr$   rs   rt   limitsrw   r'   r'   r(   rx   M  s   zChannelSenderList.streamc                    s8   | 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
        rt   ru   Nrs   )r+   rv   
page_asyncstream_asyncry   r'   r'   r(   r|   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
        rs   rt   )listrx   r$   rs   rt   r'   r'   r(   r~     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 rN   r'   )rB   recordr'   r'   r(   
<listcomp>  s
    z0ChannelSenderList.list_async.<locals>.<listcomp>r}   N)r|   r   r'   r'   r(   
list_async  s   
zChannelSenderList.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 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
        	PageTokenr   PageSizerk   rl   r`   ra   rb   r[   r\   paramsr]   )r   r^   r+   rw   rX   rd   r"   r$   r   r   rt   ro   r]   responser'   r'   r(   rw     s   
zChannelSenderList.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 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
        r   rk   rl   r`   ra   rb   r   N)r   r^   r+   r{   rX   rd   r"   r   r'   r'   r(   r{     s   
zChannelSenderList.page_async
target_urlc                 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
        rb   )r+   domaintwiliorequestrd   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
        rb   N)r+   r   r   request_asyncrd   r"   r   r'   r'   r(   get_page_async  s   	z ChannelSenderList.get_page_asyncc                 C      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      
   zChannelSenderList.getc                 C   r   r   r   r   r'   r'   r(   __call__  r   zChannelSenderList.__call__c                 C   rg   )r;   z'<Twilio.Messaging.V1.ChannelSenderList>r'   r,   r'   r'   r(   rL   &  rh   zChannelSenderList.__repr__)NN) rO   rP   rQ   r   rS   r   r   rp   rr   r   intr   rx   r	   r|   r   r~   r   r   unsetr   objectrd   rw   r{   r   r   r*   r    r   rL   rV   r'   r'   r%   r(   ri      s     







#



!ri   N)rR   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*   rd   ri   r'   r'   r'   r(   <module>   s    $he