o
    e0D                     @   s   d 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	 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z fddZejejfddZejddfddZejddfdd	Zejejejejfd
dZ	dd Z
dd Zdd Zdd Z  ZS )MessageListc                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the MessageList

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service that the resource is associated with
        :param channel_sid: The unique ID of the Channel the Message resource belongs to

        :returns: twilio.rest.chat.v1.service.channel.message.MessageList
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageList
        service_sidchannel_sidz7/Services/{service_sid}/Channels/{channel_sid}/MessagesN )superr   __init__	_solutionformat_uri)selfversionr
   r   	__class__r   ^/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/chat/v1/service/channel/message.pyr      s   zMessageList.__init__c                 C   sD   t |||d}| jjd| j|d}t| j|| jd | jd dS )a  
        Create the MessageInstance

        :param unicode body: The message to send to the channel
        :param unicode from_: The identity of the new message's author
        :param unicode attributes: A valid JSON string that contains application-specific data

        :returns: The created MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance
        )BodyFrom
AttributesPOSTmethoduridatar
   r   r	   )r   of_versioncreater   MessageInstancer   )r   bodyfrom_
attributesr   payloadr   r   r   r!   $   s   zMessageList.createNc                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams MessageInstance 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 MessageInstance.OrderType order: The sort order of the returned messages
        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance]
        	page_size)orderr'   limit)r    read_limitspagestream)r   r(   r)   r'   limitsr+   r   r   r   r,   :   s   zMessageList.streamc                 C   s   t | j|||dS )a  
        Lists MessageInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param MessageInstance.OrderType order: The sort order of the returned messages
        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.chat.v1.service.channel.message.MessageInstance]
        )r(   r)   r'   )listr,   )r   r(   r)   r'   r   r   r   r.   R   s   zMessageList.listc                 C   s8   t ||||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of MessageInstance records from the API.
        Request is executed immediately

        :param MessageInstance.OrderType order: The sort order of the returned messages
        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage
        )Order	PageTokenr   PageSizeGET)r   r   params)r   r   r    r+   r   MessagePager   )r   r(   
page_tokenpage_numberr'   r   responser   r   r   r+   e   s   zMessageList.pagec                 C   s"   | j jjd|}t| j || jS )a?  
        Retrieve a specific page of MessageInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage
        r2   )r    domaintwiliorequestr4   r   )r   
target_urlr7   r   r   r   get_page~   s
   

zMessageList.get_pagec                 C      t | j| jd | jd |dS a
  
        Constructs a MessageContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.chat.v1.service.channel.message.MessageContext
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext
        r
   r   r
   r   sidMessageContextr    r   r   r@   r   r   r   get      	zMessageList.getc                 C   r=   r>   rA   rC   r   r   r   __call__   rE   zMessageList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Chat.V1.MessageList>r   r   r   r   r   __repr__      zMessageList.__repr__)__name__
__module____qualname__r   r   unsetr!   r,   r.   r+   r<   rD   rF   rJ   __classcell__r   r   r   r   r      s    
r   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r4   c                    s   t t| || || _dS )a  
        Initialize the MessagePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: The SID of the Service that the resource is associated with
        :param channel_sid: The unique ID of the Channel the Message resource belongs to

        :returns: twilio.rest.chat.v1.service.channel.message.MessagePage
        :rtype: twilio.rest.chat.v1.service.channel.message.MessagePage
        N)r   r4   r   r   )r   r   r7   solutionr   r   r   r      s   
zMessagePage.__init__c                 C   s   t | j|| jd | jd dS )a  
        Build an instance of MessageInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance
        r
   r   r	   )r"   r    r   r   r&   r   r   r   get_instance   s   	zMessagePage.get_instancec                 C   rG   )rH   z<Twilio.Chat.V1.MessagePage>r   rI   r   r   r   rJ      rK   zMessagePage.__repr__)rL   rM   rN   r   rS   rJ   rP   r   r   r   r   r4      s    r4   c                       sF   e Zd Z fddZdd Zdd ZejejfddZd	d
 Z	  Z
S )rB   c                    s6   t t| | |||d| _djdi | j| _dS )a  
        Initialize the MessageContext

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the resource from
        :param channel_sid: The unique ID of the Channel the message to fetch belongs to
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.chat.v1.service.channel.message.MessageContext
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext
        r?   z=/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}Nr   )r   rB   r   r   r   r   )r   r   r
   r   r@   r   r   r   r      s   zMessageContext.__init__c                 C   s8   | j jd| jd}t| j || jd | jd | jd dS )
        Fetch the MessageInstance

        :returns: The fetched MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance
        r2   r   r   r
   r   r@   r?   )r    fetchr   r"   r   rR   r   r   r   rV      s   zMessageContext.fetchc                 C   s   | j jd| jdS )~
        Deletes the MessageInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErU   )r    deleter   rI   r   r   r   rY     s   zMessageContext.deletec                 C   sJ   t ||d}| jjd| j|d}t| j|| jd | jd | jd dS )G  
        Update the MessageInstance

        :param unicode body: The message to send to the channel
        :param unicode attributes: A valid JSON string that contains application-specific data

        :returns: The updated MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance
        )r   r   r   r   r
   r   r@   r?   )r   r   r    updater   r"   r   )r   r#   r%   r   r&   r   r   r   r[     s   
zMessageContext.updatec                 C   $   d dd | j D }d|S )rH    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>1      z*MessageContext.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V1.MessageContext {}>joinr   itemsr   r   contextr   r   r   rJ   *     
zMessageContext.__repr__)rL   rM   rN   r   rV   rY   r   rO   r[   rJ   rP   r   r   r   r   rB      s    	rB   c                       s   e Zd ZG dd deZd* fdd	Zedd Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zed d! Zd"d# Zd$d% Zejejfd&d'Zd(d) Z  ZS )+r"   c                   @   s   e Zd ZdZdZdS )zMessageInstance.OrderTypeascdescN)rL   rM   rN   ASCDESCr   r   r   r   	OrderType7  s    rq   Nc                    s   t t| | |d|d|d|d|d|dt|dt|d|d	|d
|dt|d|dd| _d| _|||pT| jd d| _	dS )z
        Initialize the MessageInstance

        :returns: twilio.rest.chat.v1.service.channel.message.MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageInstance
        r@   account_sidr%   r
   tor   date_createddate_updated
was_editedfromr#   indexurl)r@   rr   r%   r
   rs   r   rt   ru   rv   r$   r#   rx   ry   Nr?   )
r   r"   r   rD   r   iso8601_datetimeinteger_properties_contextr   )r   r   r&   r
   r   r@   r   r   r   r   ;  s(   zMessageInstance.__init__c                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )a5  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: MessageContext for this MessageInstance
        :rtype: twilio.rest.chat.v1.service.channel.message.MessageContext
        Nr
   r   r@   r?   )r}   rB   r    r   rI   r   r   r   _proxy]  s   
	zMessageInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r@   r|   rI   r   r   r   r@   o     
zMessageInstance.sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rr   r   rI   r   r   r   rr   w  r   zMessageInstance.account_sidc                 C   r   )zi
        :returns: The JSON string that stores application-specific data
        :rtype: unicode
        r%   r   rI   r   r   r   r%     r   zMessageInstance.attributesc                 C   r   )zo
        :returns: The SID of the Service that the resource is associated with
        :rtype: unicode
        r
   r   rI   r   r   r   r
     r   zMessageInstance.service_sidc                 C   r   )zg
        :returns: The SID of the Channel that the message was sent to
        :rtype: unicode
        rs   r   rI   r   r   r   rs     r   zMessageInstance.toc                 C   r   )zp
        :returns: The unique ID of the Channel the Message resource belongs to
        :rtype: unicode
        r   r   rI   r   r   r   r     r   zMessageInstance.channel_sidc                 C   r   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        rt   r   rI   r   r   r   rt     r   zMessageInstance.date_createdc                 C   r   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        ru   r   rI   r   r   r   ru     r   zMessageInstance.date_updatedc                 C   r   )zj
        :returns: Whether the message has been edited since  it was created
        :rtype: bool
        rv   r   rI   r   r   r   rv     r   zMessageInstance.was_editedc                 C   r   )zX
        :returns: The identity of the message's author
        :rtype: unicode
        r$   r   rI   r   r   r   r$     r   zMessageInstance.from_c                 C   r   )zN
        :returns: The content of the message
        :rtype: unicode
        r#   r   rI   r   r   r   r#     r   zMessageInstance.bodyc                 C   r   )z_
        :returns: The index of the message within the Channel
        :rtype: unicode
        rx   r   rI   r   r   r   rx     r   zMessageInstance.indexc                 C   r   )z\
        :returns: The absolute URL of the Message resource
        :rtype: unicode
        ry   r   rI   r   r   r   ry     r   zMessageInstance.urlc                 C   
   | j  S )rT   )r~   rV   rI   r   r   r   rV        
zMessageInstance.fetchc                 C   r   )rW   )r~   rY   rI   r   r   r   rY     r   zMessageInstance.deletec                 C   s   | j j||dS )rZ   )r#   r%   )r~   r[   )r   r#   r%   r   r   r   r[     s   
zMessageInstance.updatec                 C   r\   )rH   r]   c                 s   r^   r_   r`   ra   r   r   r   re     rf   z+MessageInstance.__repr__.<locals>.<genexpr>z#<Twilio.Chat.V1.MessageInstance {}>rg   rj   r   r   r   rJ     rl   zMessageInstance.__repr__)N)rL   rM   rN   objectrq   r   propertyr~   r@   rr   r%   r
   rs   r   rt   ru   rv   r$   r#   rx   ry   rV   rY   r   rO   r[   rJ   rP   r   r   r   r   r"   5  sF    "













		r"   N)__doc__twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r4   rB   r"   r   r   r   r   <module>   s    )-O