
    pik                         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e      Z G d de      Z G d de      Z G d de      Zy)a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Chat
    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                   R    e Zd Z G d de      Z	 	 ddedeeef   dedede	e   f
 fdZ
edd
       Zd	efdZd	efdZddZddZej&                  ej&                  fdeeef   deeef   d	d fdZej&                  ej&                  fdeeef   deeef   d	d fdZd	efdZ xZS )MessageInstancec                       e Zd ZdZdZy)MessageInstance.OrderTypeascdescN)__name__
__module____qualname__ASCDESC     m/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/twilio/rest/chat/v1/service/channel/message.py	OrderTyper      s    r   r    versionpayloadservice_sidchannel_sidsidc                    t         |   |       |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        t        j                  |j                  d            | _        t        j                  |j                  d            | _        |j                  d	      | _        |j                  d
      | _        |j                  d      | _        t        j                   |j                  d            | _        |j                  d      | _        |||xs | j                  d| _        d | _        y )Nr%   account_sid
attributesr#   tor$   date_createddate_updated
was_editedfrombodyindexurlr#   r$   r%   )super__init__getr%   r'   r(   r#   r)   r$   r   iso8601_datetimer*   r+   r,   _fromr.   integerr/   r0   	_solution_context)selfr!   r"   r#   r$   r%   	__class__s         r   r3   zMessageInstance.__init__/   s7    	!")++e"4*1++m*D)0\)B*1++m*D!(T!2*1++m*D0;0L0LKK'1
 1<0L0LKK'1
 +2++l*C$+KK$7
#*;;v#6	$/$7$7G8L$M
")++e"4 '&?$((

 37r   returnc                     | j                   Et        | j                  | j                  d   | j                  d   | j                  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: MessageContext for this MessageInstance
        r#   r$   r%   r1   )r9   MessageContext_versionr8   r:   s    r   _proxyzMessageInstance._proxyR   sQ     == * NN=9 NN=9NN5)	DM }}r   c                 6    | j                   j                         S )j
        Deletes the MessageInstance


        :returns: True if delete succeeds, False otherwise
        )rA   deleter@   s    r   rD   zMessageInstance.deletec   s     {{!!##r   c                 R   K   | j                   j                          d{   S 7 w)
        Asynchronous coroutine that deletes the MessageInstance


        :returns: True if delete succeeds, False otherwise
        N)rA   delete_asyncr@   s    r   rG   zMessageInstance.delete_asyncl   s!      [[--////   '%'c                 6    | j                   j                         S )[
        Fetch the MessageInstance


        :returns: The fetched MessageInstance
        )rA   fetchr@   s    r   rK   zMessageInstance.fetchu   s     {{  ""r   c                 R   K   | j                   j                          d{   S 7 w)u
        Asynchronous coroutine to fetch the MessageInstance


        :returns: The fetched MessageInstance
        N)rA   fetch_asyncr@   s    r   rN   zMessageInstance.fetch_async~   s!      [[,,....rH   r.   r(   c                 <    | j                   j                  ||      S )  
        Update the MessageInstance

        :param body: The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
        :param attributes: A valid JSON string that contains application-specific data.

        :returns: The updated MessageInstance
        r.   r(   )rA   updater:   r.   r(   s      r   rR   zMessageInstance.update   s&     {{!!! " 
 	
r   c                 X   K   | j                   j                  ||       d{   S 7 w)  
        Asynchronous coroutine to update the MessageInstance

        :param body: The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
        :param attributes: A valid JSON string that contains application-specific data.

        :returns: The updated MessageInstance
        rQ   N)rA   update_asyncrS   s      r   rV   zMessageInstance.update_async   s4      [[--! . 
 
 	
 
s   !*(*c                     dj                  d | j                  j                         D              }dj                  |      S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c              3   F   K   | ]  \  }}d j                  ||        ywz{}={}Nformat.0kvs      r   	<genexpr>z+MessageInstance.__repr__.<locals>.<genexpr>        SDAq7>>!Q/S   !z#<Twilio.Chat.V1.MessageInstance {}>joinr8   itemsr]   r:   contexts     r   __repr__zMessageInstance.__repr__   s6     ((SDNN<P<P<RSS4;;GDDr   )N)r<   r>   )r<   r   )r   r   r   objectr    r   r   strr   r   r3   propertyrA   boolrD   rG   rK   rN   r   unsetr   rR   rV   rj   __classcell__r;   s   @r   r   r      s%   F , "!7!7 c3h!7 	!7
 !7 c]!7F   $ $0D 0#/ $*<<)/
CK 
 #v+&
 
	
( $*<<)/
CK 
 #v+&
 
	
$E# Er   r   c                       e Zd Zdedededef fdZdefdZdefdZde	fd	Z
de	fd
Zej                  ej                  fdeeef   deeef   de	fdZej                  ej                  fdeeef   deeef   de	fdZdefdZ xZS )r>   r!   r#   r$   r%   c                 |    t         |   |       |||d| _         dj                  di | j                  | _        y)a  
        Initialize the MessageContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) to update the resource from.
        :param channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the message belongs to. Can be the Channel's `sid` or `unique_name`.
        :param sid: The Twilio-provided string that uniquely identifies the Message resource to update.
        r1   z=/Services/{service_sid}/Channels/{channel_sid}/Messages/{sid}Nr   r2   r3   r8   r]   _uri)r:   r!   r#   r$   r%   r;   s        r   r3   zMessageContext.__init__   sM     	! '&
 SKRR .. 		r   r<   c                 |    t        j                  i       }| j                  j                  d| j                  |      S )rC   DELETEmethoduriheaders)r   ofr?   rD   ru   r:   r{   s     r   rD   zMessageContext.delete   s1     ))B-}}##8G#TTr   c                    K   t        j                  i       }| j                  j                  d| j                  |       d{   S 7 w)rF   rw   rx   N)r   r|   r?   rG   ru   r}   s     r   rG   zMessageContext.delete_async   sF      ))B-]]//G 0 
 
 	
 
s   AA
AA
c                    t        j                  i       }d|d<   | j                  j                  d| j                  |      }t        | j                  || j                  d   | j                  d   | j                  d         S )	rJ   application/jsonAcceptGETrx   r#   r$   r%   r1   )r   r|   r?   rK   ru   r   r8   r:   r{   r"   s      r   rK   zMessageContext.fetch   su     ))B-.--%%U		7%SMM}5}5u%
 	
r   c                 $  K   t        j                  i       }d|d<   | j                  j                  d| j                  |       d{   }t        | j                  || j                  d   | j                  d   | j                  d   	      S 7 Ew)
rM   r   r   r   rx   Nr#   r$   r%   r1   )r   r|   r?   rN   ru   r   r8   r   s      r   rN   zMessageContext.fetch_async   s      ))B-.11dii 2 
 
 MM}5}5u%
 	
	
s   ABB	ABr.   r(   c                 D   t        j                  ||d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||      }t        | j                  || j                  d   | j                  d	   | j                  d
         S )rP   Body
Attributes!application/x-www-form-urlencodedContent-Typer   r   POSTry   rz   datar{   r#   r$   r%   r1   )r   r|   r?   rR   ru   r   r8   r:   r.   r(   r   r{   r"   s         r   rR   zMessageContext.update  s     yy(
 ))B-"E.--&&tyytW ' 
 MM}5}5u%
 	
r   c                 `  K   t        j                  ||d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||       d{   }t        | j                  || j                  d	   | j                  d
   | j                  d         S 7 Ew)rU   r   r   r   r   r   r   r   Nr#   r$   r%   r1   )r   r|   r?   rV   ru   r   r8   r   s         r   rV   zMessageContext.update_async<  s      yy(
 ))B-"E.22tyytW 3 
 
 MM}5}5u%
 	
	
s   A$B.&B,'AB.c                     dj                  d | j                  j                         D              }dj                  |      S )rX   rY   c              3   F   K   | ]  \  }}d j                  ||        ywr[   r\   r^   s      r   rb   z*MessageContext.__repr__.<locals>.<genexpr>h  rc   rd   z"<Twilio.Chat.V1.MessageContext {}>re   rh   s     r   rj   zMessageContext.__repr__b  s6     ((SDNN<P<P<RSS3::7CCr   )r   r   r   r   rl   r3   rn   rD   rG   r   rK   rN   r   ro   r   rk   rR   rV   rj   rp   rq   s   @r   r>   r>      s    
 
c 
 
RU 
.
U 
U
D 

 
,
? 
4 $*<<)/$
CK $
 #v+&$
 
	$
P $*<<)/$
CK $
 #v+&$
 
	$
LD# Dr   r>   c                   2    e Zd Zdeeef   defdZdefdZy)MessagePager"   r<   c                 h    t        | j                  || j                  d   | j                  d         S )zm
        Build an instance of MessageInstance

        :param payload: Payload response from the API
        r#   r$   r#   r$   )r   r?   r8   )r:   r"   s     r   get_instancezMessagePage.get_instancen  s3     MM}5}5	
 	
r   c                      y)rX   z<Twilio.Chat.V1.MessagePage>r   r@   s    r   rj   zMessagePage.__repr__{       .r   N)	r   r   r   r   rl   r   r   r   rj   r   r   r   r   r   l  s)    
DcN 
 
.# .r   r   c                       e Zd Zdededef fdZej                  ej                  fdedeee	f   deee	f   de
fd	Zej                  ej                  fdedeee	f   deee	f   de
fd
Zej                  ddfdede	f   dee   dee   dee
   fdZej                  ddfdede	f   dee   dee   dee
   fdZej                  ddfdede	f   dee   dee   dee
   fdZej                  ddfdede	f   dee   dee   dee
   fdZej                  ej                  ej                  ej                  fdede	f   deee	f   deee	f   deee	f   def
dZej                  ej                  ej                  ej                  fdede	f   deee	f   deee	f   deee	f   def
dZdedefdZdedefdZdedefdZdedefdZdefdZ xZS )MessageListr!   r#   r$   c                 z    t         |   |       ||d| _         dj                  di | j                  | _        y)a  
        Initialize the MessageList

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) to read the resources from.
        :param channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the message to read belongs to. Can be the Channel's `sid` or `unique_name`.

        r   z7/Services/{service_sid}/Channels/{channel_sid}/MessagesNr   rt   )r:   r!   r#   r$   r;   s       r   r3   zMessageList.__init__  sG     	! '&
 UMTT 
nn
	r   r.   from_r(   r<   c                 .   t        j                  |||d      }t        j                  ddi      }d|d<   d|d<   | j                  j                  d| j                  ||      }t        | j                  || j                  d   | j                  d	   
      S )a  
        Create the MessageInstance

        :param body: The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
        :param from_: The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message's author. The default value is `system`.
        :param attributes: A valid JSON string that contains application-specific data.

        :returns: The created MessageInstance
        r   Fromr   r   r   r   r   r   r   r#   r$   r   )r   r|   r?   createru   r   r8   r:   r.   r   r(   r   r{   r"   s          r   r   zMessageList.create  s      yy(
 ))^-PQR"E.--&&tyytW ' 
 MM}5}5	
 	
r   c                 J  K   t        j                  |||d      }t        j                  ddi      }d|d<   d|d<   | j                  j                  d| j                  ||       d{   }t        | j                  || j                  d	   | j                  d
         S 7 7w)a+  
        Asynchronously create the MessageInstance

        :param body: The message to send to the channel. Can also be an empty string or `null`, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.
        :param from_: The [identity](https://www.twilio.com/docs/api/chat/guides/identity) of the new message's author. The default value is `system`.
        :param attributes: A valid JSON string that contains application-specific data.

        :returns: The created MessageInstance
        r   r   r   r   r   r   r   Nr#   r$   r   )r   r|   r?   create_asyncru   r   r8   r   s          r   r   zMessageList.create_async  s       yy(
 ))^-PQR"E.22tyytW 3 
 
 MM}5}5	
 	
	
s   A'B#)B!*8B#Norderr   limit	page_sizec                     | j                   j                  ||      }| j                  ||d         }| j                   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 &quot;MessageInstance.OrderType&quot; order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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
        r   r   r   r   )r?   read_limitspagestreamr:   r   r   r   limitsr   s         r   r   zMessageList.stream  sL    , **5)<yyu{0CyD}}##D&/::r   c                    K   | j                   j                  ||      }| j                  ||d          d{   }| j                   j                  ||d         S 7 #w)a  
        Asynchronously 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 &quot;MessageInstance.OrderType&quot; order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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
        r   r   Nr   )r?   r   
page_asyncstream_asyncr   s         r   r   zMessageList.stream_async  sY     , **5)<__5F;<O_PP}}))$w@@ Qs   6AA$Ac                 <    t        | j                  |||            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 &quot;MessageInstance.OrderType&quot; order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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
        r   r   r   )listr   )r:   r   r   r   s       r   r   zMessageList.list   s+    * KK#  
 	
r   c                 |   K   | j                  |||       d{   2 cg c3 d{   }|7 7 	6 c}S c c}w w)a  
        Asynchronously 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 &quot;MessageInstance.OrderType&quot; order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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
        r   N)r   )r:   r   r   r   records        r   
list_asynczMessageList.list_async=  sW     . '+&7&7# '8 ' !
 
 !
 
 	
 
s0   </<731
37<37<
page_tokenpage_numberc                    t        j                  ||||d      }t        j                  ddi      }d|d<   | j                  j                  d| j                  ||      }t        | j                  || j                        S )a  
        Retrieve a single page of MessageInstance records from the API.
        Request is executed immediately

        :param order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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 MessageInstance
        Order	PageTokenr   PageSizer   r   r   r   r   ry   rz   paramsr{   )r   r|   r?   r   ru   r   r8   r:   r   r   r   r   r   r{   responses           r   r   zMessageList.page[  s    $ yy'#%	
 ))^-PQR.==%%diig & 
 4==(DNNCCr   c                   K   t        j                  ||||d      }t        j                  ddi      }d|d<   | j                  j                  d| j                  ||       d{   }t        | j                  || j                        S 7 %w)	a  
        Asynchronously retrieve a single page of MessageInstance records from the API.
        Request is executed immediately

        :param order: The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default.
        :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 MessageInstance
        r   r   r   r   r   r   r   N)r   r|   r?   r   ru   r   r8   r   s           r   r   zMessageList.page_async  s     $ yy'#%	
 ))^-PQR.11diig 2 
 
 4==(DNNCC
s   A#B%B&&B
target_urlc                     | j                   j                  j                  j                  d|      }t	        | j                   || j
                        S )z
        Retrieve a specific page of MessageInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MessageInstance
        r   )r?   domaintwiliorequestr   r8   r:   r   r   s      r   get_pagezMessageList.get_page  s=     ==''..66ujI4==(DNNCCr   c                    K   | j                   j                  j                  j                  d|       d{   }t	        | j                   || j
                        S 7 %w)a  
        Asynchronously retrieve a specific page of MessageInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MessageInstance
        r   N)r?   r   r   request_asyncr   r8   r   s      r   get_page_asynczMessageList.get_page_async  sJ      --44BB5*UU4==(DNNCC Vs   4AA&Ar%   c                 h    t        | j                  | j                  d   | j                  d   |      S z
        Constructs a MessageContext

        :param sid: The Twilio-provided string that uniquely identifies the Message resource to update.
        r#   r$   r1   r>   r?   r8   r:   r%   s     r   r4   zMessageList.get  3     MM}5}5	
 	
r   c                 h    t        | j                  | j                  d   | j                  d   |      S r   r   r   s     r   __call__zMessageList.__call__  r   r   c                      y)rX   z<Twilio.Chat.V1.MessageList>r   r@   s    r   rj   zMessageList.__repr__  r   r   ) r   r   r   r   rl   r3   r   ro   r   rk   r   r   r   r   intr	   r   r
   r   r   r   r   r   r   r   r   r   r>   r4   r   rj   rp   rq   s   @r   r   r     sk   
 
c 
 
. %+LL)/	&
&
 S&[!&
 #v+&	&

 
&
V %+LL)/	&
&
 S&[!&
 #v+&	&

 
&
T =CLL##'	;0&89; }; C=	;
 
/	";: =CLL##'	A0&89A }A C=	A
 
	'A: =CLL##'	
0&89
 }
 C=	

 
o	
> =CLL##'	
0&89
 }
 C=	

 
o	
@ =CLL)/*0,,(."D0&89"D #v+&"D 3;'	"D
 f%"D 
"DL =CLL)/*0,,(."D0&89"D #v+&"D 3;'	"D
 f%"D 
"DH
D3 
D; 
D
Ds 
D{ 
D
s 
~ 

C 
N 
.# .r   r   N)__doc__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>   r   r   r   r   r   <module>r      sg     L L L + 8 : 2 ' !YE& YExtD_ tDn.$ .0W., W.r   