o
    �¨ÊhÓQ  ã                   @   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
 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)Ú	serialize)Úvalues)ÚInstanceContext)ÚInstanceResource)ÚListResource)ÚPagec                       s¤   e Zd ZdZ‡ fdd„Zejejejejej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 )ÚMessageListú  c                    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 unique id of the Service this message belongs to.
        :param channel_sid: The channel_sid

        :returns: twilio.rest.chat.v2.service.channel.message.MessageList
        :rtype: twilio.rest.chat.v2.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/env/lib/python3.10/site-packages/twilio/rest/chat/v2/service/channel/message.pyr      s   zMessageList.__init__c           
   
   C   sX   t  ||t |¡t |¡|||dœ¡}| jjd| j|d�}	t| j|	| jd | jd d�S )am  
        Create a new MessageInstance

        :param unicode from_: The identity of the message's author. Defaults to system if not specified.
        :param unicode attributes: The attributes metadata field you can use to store any data you wish.
        :param datetime date_created: The ISO8601 time specifying the datetime the Message should be set as being created.
        :param datetime date_updated: The ISO8601 time specifying the datetime the Message should be set as having been last updated.
        :param unicode last_updated_by: Specify the Identity of the User that last updated the Message
        :param unicode body: The message body string.
        :param unicode media_sid:  The Media Sid to be attached to this Message.

        :returns: Newly created MessageInstance
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance
        )ÚFromÚ
AttributesÚDateCreatedÚDateUpdatedÚLastUpdatedByÚBodyÚMediaSidÚPOST©Údatar   r   r   )	r   Úofr   Úiso8601_datetimeÚ_versionÚcreater   ÚMessageInstancer   )
r   Úfrom_Ú
attributesÚdate_createdÚdate_updatedÚlast_updated_byÚbodyÚ	media_sidr"   Úpayloadr   r   r   r&   &   s(   ù
ýüzMessageList.createNc                 C   s8   | j  ||¡}| j||d d�}| j  ||d |d ¡S )aH  
        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: Specifies sorting order for messages list, possible values are: `asc` or `desc`.
        :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.v2.service.channel.message.MessageInstance]
        Ú	page_size)Úorderr0   ÚlimitÚ
page_limit)r%   Úread_limitsÚpageÚstream)r   r1   r2   r0   Úlimitsr5   r   r   r   r6   O   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: Specifies sorting order for messages list, possible values are: `asc` or `desc`.
        :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.v2.service.channel.message.MessageInstance]
        )r1   r2   r0   )Úlistr6   )r   r1   r2   r0   r   r   r   r8   g   s   zMessageList.listc                 C   s8   t  ||||dœ¡}| jjd| j|d�}t| j|| jƒS )aH  
        Retrieve a single page of MessageInstance records from the API.
        Request is executed immediately

        :param MessageInstance.OrderType order: Specifies sorting order for messages list, possible values are: `asc` or `desc`.
        :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.v2.service.channel.message.MessagePage
        )ÚOrderÚ	PageTokenr   ÚPageSizeÚGET©Úparams)r   r#   r%   r5   r   ÚMessagePager   )r   r1   Ú
page_tokenÚpage_numberr0   r>   Úresponser   r   r   r5   z   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.v2.service.channel.message.MessagePage
        r<   )r%   ÚdomainÚtwilioÚrequestr?   r   )r   Ú
target_urlrB   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: Key that uniquely defines the message to fetch.

        :returns: twilio.rest.chat.v2.service.channel.message.MessageContext
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext
        r   r   ©r   r   Úsid©ÚMessageContextr%   r   ©r   rK   r   r   r   Úget¨   ó   	üzMessageList.getc                 C   rH   rI   rL   rN   r   r   r   Ú__call__¸   rP   zMessageList.__call__c                 C   ó   dS )úz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Chat.V2.MessageList>r   ©r   r   r   r   Ú__repr__È   ó   zMessageList.__repr__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úunsetr&   r6   r8   r5   rG   rO   rQ   rU   Ú__classcell__r   r   r   r   r	      s"    
ý)
ÿr	   c                       s0   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Z‡  ZS )r?   r
   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 unique id of the Service this message belongs to.
        :param channel_sid: The channel_sid

        :returns: twilio.rest.chat.v2.service.channel.message.MessagePage
        :rtype: twilio.rest.chat.v2.service.channel.message.MessagePage
        N)r   r?   r   r   )r   r   rB   Ú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.v2.service.channel.message.MessageInstance
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance
        r   r   r   )r'   r%   r   )r   r/   r   r   r   Úget_instanceæ   s   	üzMessagePage.get_instancec                 C   rR   )rS   z<Twilio.Chat.V2.MessagePage>r   rT   r   r   r   rU   ö   rV   zMessagePage.__repr__)rW   rX   rY   rZ   r   r^   rU   r\   r   r   r   r   r?   Ò   s
    r?   c                       sZ   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zejejejejejejfdd	„Z	d
d„ Z
‡  ZS )rM   r
   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: Sid of the Service this message belongs to.
        :param channel_sid: Key that uniquely defines the channel this message belongs to.
        :param sid: Key that uniquely defines the message to fetch.

        :returns: twilio.rest.chat.v2.service.channel.message.MessageContext
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageContext
        rJ   z=/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}Nr   )r   rM   r   r   r   r   )r   r   r   r   rK   r   r   r   r     s   zMessageContext.__init__c                 C   sD   t  i ¡}| jjd| j|d�}t| j|| jd | jd | jd d�S )ú 
        Fetch a MessageInstance

        :returns: Fetched MessageInstance
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance
        r<   r=   r   r   rK   rJ   )r   r#   r%   Úfetchr   r'   r   )r   r>   r/   r   r   r   r`     s   
ýûzMessageContext.fetchc                 C   s   | j  d| j¡S )ú~
        Deletes the MessageInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        Údelete)r%   rb   r   rT   r   r   r   rb   ,  s   zMessageContext.deletec           	   	   C   s^   t  ||t |¡t |¡||dœ¡}| jjd| j|d�}t| j|| jd | jd | jd d�S )áï  
        Update the MessageInstance

        :param unicode body: The message body string.
        :param unicode attributes: The attributes metadata field you can use to store any data you wish.
        :param datetime date_created: The ISO8601 time specifying the datetime the Message should be set as being created.
        :param datetime date_updated: The ISO8601 time specifying the datetime the Message should be set as having been last updated.
        :param unicode last_updated_by: Specify the Identity of the User that last updated the Message
        :param unicode from_: The identity of the message's author.

        :returns: Updated MessageInstance
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance
        )r   r   r   r   r   r   r    r!   r   r   rK   rJ   )	r   r#   r   r$   r%   Úupdater   r'   r   )	r   r-   r)   r*   r+   r,   r(   r"   r/   r   r   r   rd   5  s(   ú	ýûzMessageContext.updatec                 C   ó$   d  dd„ | j ¡ D ƒ¡}d |¡S )rS   ú c                 s   ó    � | ]\}}d   ||¡V  qdS ©z{}={}N©r   ©Ú.0ÚkÚvr   r   r   Ú	<genexpr>c  ó   € z*MessageContext.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.MessageContext {}>©Újoinr   Úitemsr   ©r   Úcontextr   r   r   rU   \  ó   
zMessageContext.__repr__)rW   rX   rY   rZ   r   r`   rb   r   r[   rd   rU   r\   r   r   r   r   rM      s    	
þ'rM   c                       sH  e Zd ZdZG dd„ deƒZG dd„ deƒZd3‡ 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ed%d&„ ƒZed'd(„ ƒZed)d*„ ƒZd+d,„ Zd-d.„ Zejejejejejejfd/d0„Zd1d2„ Z‡  Z S )4r'   r
   c                   @   ó   e Zd ZdZdZdS )zMessageInstance.OrderTypeÚascÚdescN)rW   rX   rY   ÚASCÚDESCr   r   r   r   Ú	OrderTypej  ó    r{   c                   @   rv   )z"MessageInstance.WebhookEnabledTypeÚtrueÚfalseN)rW   rX   rY   ÚTRUEÚFALSEr   r   r   r   ÚWebhookEnabledTypen  r|   r�   Nc                    sê   t t| ƒ |¡ i d|d “d|d “d|d “d|d “d|d “d|d “dt |d ¡“dt |d ¡“d	|d	 “d
|d
 “d|d “d|d “dt |d ¡“d|d “d|d “d|d “| _d| _|||po| jd dœ| _dS )zË
        Initialize the MessageInstance

        :returns: twilio.rest.chat.v2.service.channel.message.MessageInstance
        :rtype: twilio.rest.chat.v2.service.channel.message.MessageInstance
        rK   Úaccount_sidr)   r   Útor   r*   r+   r,   Ú
was_editedr(   Úfromr-   ÚindexÚtypeÚmediaÚurlNrJ   )	r   r'   r   r   r$   ÚintegerÚ_propertiesÚ_contextr   )r   r   r/   r   r   rK   r   r   r   r   r  sN   ÿþýüûúùø	÷
öõôóòñðý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.v2.service.channel.message.MessageContext
        Nr   r   rK   rJ   )rŒ   rM   r%   r   rT   r   r   r   Ú_proxy—  s   
	üzMessageInstance._proxyc                 C   ó
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rK   ©r‹   rT   r   r   r   rK   ©  ó   
zMessageInstance.sidc                 C   rŽ   )zn
        :returns: The unique id of the Account responsible for this message.
        :rtype: unicode
        r‚   r�   rT   r   r   r   r‚   ±  r�   zMessageInstance.account_sidc                 C   rŽ   )zs
        :returns: A string metadata field you can use to store any data you wish.
        :rtype: unicode
        r)   r�   rT   r   r   r   r)   ¹  r�   zMessageInstance.attributesc                 C   rŽ   )zi
        :returns: The unique id of the Service this message belongs to.
        :rtype: unicode
        r   r�   rT   r   r   r   r   Á  r�   zMessageInstance.service_sidc                 C   rŽ   )zj
        :returns: The unique id of the Channel this message was sent to.
        :rtype: unicode
        rƒ   r�   rT   r   r   r   rƒ   É  r�   zMessageInstance.toc                 C   rŽ   )zC
        :returns: The channel_sid
        :rtype: unicode
        r   r�   rT   r   r   r   r   Ñ  r�   zMessageInstance.channel_sidc                 C   rŽ   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        r*   r�   rT   r   r   r   r*   Ù  r�   zMessageInstance.date_createdc                 C   rŽ   )zb
        :returns: The date that this resource was last updated.
        :rtype: datetime
        r+   r�   rT   r   r   r   r+   á  r�   zMessageInstance.date_updatedc                 C   rŽ   )z{
        :returns: Field to specify the Identity of the User that last updated the Message
        :rtype: unicode
        r,   r�   rT   r   r   r   r,   é  r�   zMessageInstance.last_updated_byc                 C   rŽ   )zk
        :returns: true if the message has been updated since it was created.
        :rtype: bool
        r„   r�   rT   r   r   r   r„   ñ  r�   zMessageInstance.was_editedc                 C   rŽ   )zY
        :returns: The identity of the message's author.
        :rtype: unicode
        r(   r�   rT   r   r   r   r(   ù  r�   zMessageInstance.from_c                 C   rŽ   )zP
        :returns: The contents of the message.
        :rtype: unicode
        r-   r�   rT   r   r   r   r-     r�   zMessageInstance.bodyc                 C   rŽ   )z_
        :returns: The index of the message within the Channel
        :rtype: unicode
        r†   r�   rT   r   r   r   r†   	  r�   zMessageInstance.indexc                 C   rŽ   )zA
        :returns: Message type.
        :rtype: unicode
        r‡   r�   rT   r   r   r   r‡     r�   zMessageInstance.typec                 C   rŽ   )z¤
        :returns: If a Media resource instance is attached to the Message, this will contain the Media object for the attached Media.
        :rtype: dict
        rˆ   r�   rT   r   r   r   rˆ     r�   zMessageInstance.mediac                 C   rŽ   )zU
        :returns: An absolute URL for this message.
        :rtype: unicode
        r‰   r�   rT   r   r   r   r‰   !  r�   zMessageInstance.urlc                 C   ó
   | j  ¡ S )r_   )r�   r`   rT   r   r   r   r`   )  ó   
zMessageInstance.fetchc                 C   r‘   )ra   )r�   rb   rT   r   r   r   rb   2  r’   zMessageInstance.deletec                 C   s   | j j||||||d�S )rc   )r-   r)   r*   r+   r,   r(   )r�   rd   )r   r-   r)   r*   r+   r,   r(   r   r   r   rd   ;  s   úzMessageInstance.updatec                 C   re   )rS   rf   c                 s   rg   rh   ri   rj   r   r   r   rn   [  ro   z+MessageInstance.__repr__.<locals>.<genexpr>z#<Twilio.Chat.V2.MessageInstance {}>rp   rs   r   r   r   rU   T  ru   zMessageInstance.__repr__)N)!rW   rX   rY   rZ   Úobjectr{   r�   r   Úpropertyr�   rK   r‚   r)   r   rƒ   r   r*   r+   r,   r„   r(   r-   r†   r‡   rˆ   r‰   r`   rb   r   r[   rd   rU   r\   r   r   r   r   r'   g  s\    %
















		
þr'   N)rZ   Útwilio.baser   r   r   Útwilio.base.instance_contextr   Útwilio.base.instance_resourcer   Útwilio.base.list_resourcer   Útwilio.base.pager   r	   r?   rM   r'   r   r   r   r   Ú<module>   s    A.g