
    pie                         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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 - Monitor
    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	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                   r     e Zd ZdZ	 ddedeeef   dee   f fdZ	e
dd       ZddZdd	Zdefd
Z xZS )EventInstancea	  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Event resource.
    :ivar actor_sid: The SID of the actor that caused the event, if available. This can be either a User ID (matching the pattern `^US[0-9a-fA-F]{32}$`) or an Account SID (matching the pattern `^AC[0-9a-fA-F]{32}$`). If the actor's SID isn't available, this field will be `null`.
    :ivar actor_type: The type of actor that caused the event. Can be: `user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on.
    :ivar description: A description of the event. Can be `null`.
    :ivar event_data: An object with additional data about the event. The  contents depend on `event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource.
    :ivar event_date: The date and time in GMT when the event was recorded specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar event_type: The event's type. Event-types are typically in the form: `RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types).
    :ivar resource_sid: The SID of the resource that was affected.
    :ivar resource_type: The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](https://www.twilio.com/docs/usage/monitor-events#event-types).
    :ivar sid: The unique string that we created to identify the Event resource.
    :ivar source: The originating system or interface that caused the event.  Can be: `web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or   `twilio` for events caused by an automated or internal Twilio system.
    :ivar source_ip_address: The IP address of the source, if the source is outside the Twilio cloud. This value is `null` for events with `source` of `twilio`
    :ivar url: The absolute URL of the resource that was affected. Can be `null`.
    :ivar links: The absolute URLs of related resources.
    versionpayloadsidc                    t         |   |       |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        t        j                  |j                  d            | _
        |j                  d      | _        |j                  d      | _        |j                  d	      | _        |j                  d
      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        d
|xs | j                  i| _        d | _        y )Naccount_sid	actor_sid
actor_typedescription
event_data
event_date
event_typeresource_sidresource_typer   sourcesource_ip_addressurllinks)super__init__getr   r   r   r   r   r   iso8601_datetimer   r   r    r!   r   r"   r#   r$   r%   	_solution_context)selfr   r   r   	__class__s       ^/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/twilio/rest/monitor/v1/event.pyr'   zEventInstance.__init__+   s)    	!*1++m*D(/K(@)0\)B*1++m*D7>{{<7P.9.J.JKK%/
 *1\)B+2;;~+F,3KK,H")++e"4%,[[%:07<O0P")++e"429++g2F
 3?$((
 15    returnc                     | j                   )t        | j                  | 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: EventContext for this EventInstance
        r   r   )r+   EventContext_versionr*   r,   s    r.   _proxyzEventInstance._proxyF   s9     == (NN5)DM }}r/   c                 6    | j                   j                         S )W
        Fetch the EventInstance


        :returns: The fetched EventInstance
        )r6   fetchr5   s    r.   r9   zEventInstance.fetchU   s     {{  ""r/   c                 R   K   | j                   j                          d{   S 7 w)q
        Asynchronous coroutine to fetch the EventInstance


        :returns: The fetched EventInstance
        N)r6   fetch_asyncr5   s    r.   r<   zEventInstance.fetch_async^   s!      [[,,....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)EventInstance.__repr__.<locals>.<genexpr>m        SDAq7>>!Q/S   !z$<Twilio.Monitor.V1.EventInstance {}>joinr*   itemsrC   r,   contexts     r.   __repr__zEventInstance.__repr__g   s6     ((SDNN<P<P<RSS5<<WEEr/   )N)r0   r3   )r0   r   )__name__
__module____qualname____doc__r   r   strr   r   r'   propertyr6   r9   r<   rP   __classcell__r-   s   @r.   r   r      sd    $ OS55)-c3h5>Fsm56  #/F# Fr/   r   c                   L     e Zd Zdedef fdZdefdZdefdZdefdZ	 xZ
S )r3   r   r   c                 x    t         |   |       d|i| _         dj                  di | j                  | _        y)z
        Initialize the EventContext

        :param version: Version that contains the resource
        :param sid: The SID of the Event resource to fetch.
        r   z/Events/{sid}N )r&   r'   r*   rC   _uri)r,   r   r   r-   s      r.   r'   zEventContext.__init__s   s?     	! 3
 +O**<T^^<	r/   r0   c                     t        j                  i       }d|d<   | j                  j                  d| j                  |      }t        | j                  || j                  d         S )r8   application/jsonAcceptGETmethoduriheadersr   r2   )r   ofr4   r9   r\   r   r*   r,   rd   r   s      r.   r9   zEventContext.fetch   s]     ))B-.--%%U		7%SMMu%
 	
r/   c                    K   t        j                  i       }d|d<   | j                  j                  d| j                  |       d{   }t        | j                  || j                  d         S 7 )w)r;   r^   r_   r`   ra   Nr   r2   )r   re   r4   r<   r\   r   r*   rf   s      r.   r<   zEventContext.fetch_async   sr      ))B-.11dii 2 
 
 MMu%
 	
	
s   AA4A2	*A4c                     dj                  d | j                  j                         D              }dj                  |      S )r>   r?   c              3   F   K   | ]  \  }}d j                  ||        ywrA   rB   rD   s      r.   rH   z(EventContext.__repr__.<locals>.<genexpr>   rI   rJ   z#<Twilio.Monitor.V1.EventContext {}>rK   rN   s     r.   rP   zEventContext.__repr__   s6     ((SDNN<P<P<RSS4;;GDDr/   )rQ   rR   rS   r   rU   r'   r   r9   r<   rP   rW   rX   s   @r.   r3   r3   q   s<    = =c =
} 
(
= 
,E# Er/   r3   c                   2    e Zd Zdeeef   defdZdefdZy)	EventPager   r0   c                 .    t        | j                  |      S )zk
        Build an instance of EventInstance

        :param payload: Payload response from the API
        )r   r4   )r,   r   s     r.   get_instancezEventPage.get_instance   s     T]]G44r/   c                      y)r>   z<Twilio.Monitor.V1.EventPage>r[   r5   s    r.   rP   zEventPage.__repr__        /r/   N)	rQ   rR   rS   r   rU   r   r   rm   rP   r[   r/   r.   rk   rk      s)    5DcN 5} 5/# /r/   rk   c                   $    e Zd Zdef fdZej                  ej                  ej                  ej                  ej                  ej                  ddfdeee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
e	f   d
ee   dee   dee   fdZej                  ej                  ej                  ej                  ej                  ej                  ddfdeee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
e	f   d
ee   dee   dee   fdZej                  ej                  ej                  ej                  ej                  ej                  ddfdeee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
e	f   d
ee   dee   dee   fdZej                  ej                  ej                  ej                  ej                  ej                  ddfdeee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
e	f   d
ee   dee   dee   fdZej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  ej                  f	deee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
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                  ej                  ej                  ej                  ej                  ej                  f	deee	f   deee	f   deee	f   deee	f   dee
e	f   d	ee
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 )	EventListr   c                 2    t         |   |       d| _        y)zg
        Initialize the EventList

        :param version: Version that contains the resource

        z/EventsN)r&   r'   r\   )r,   r   r-   s     r.   r'   zEventList.__init__   s     	!	r/   Nr   r   r    r#   
start_dateend_datelimit	page_sizer0   c	           
          | j                   j                  ||      }	| j                  |||||||	d         }
| j                   j                  |
|	d         S )a!  
        Streams EventInstance 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 str actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param str event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param str resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param str source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param datetime start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param datetime end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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
        rv   r   r   r    r#   rs   rt   rv   ru   )r4   read_limitspagestreamr,   r   r   r    r#   rs   rt   ru   rv   limitsrz   s              r.   r{   zEventList.stream   se    @ **5)<yy!%/![)  
 }}##D&/::r/   c	           
         K   | j                   j                  ||      }	| j                  |||||||	d          d{   }
| j                   j                  |
|	d         S 7 #w)a0  
        Asynchronously streams EventInstance 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 str actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param str event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param str resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param str source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param datetime start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param datetime end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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
        rv   rx   Nru   )r4   ry   
page_asyncstream_asyncr|   s              r.   r   zEventList.stream_async  ss     @ **5)<__!%/![) % 
 
 }}))$w@@
s   ;A#A!$A#c	                 F    t        | j                  ||||||||            S )a  
        Lists EventInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param str event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param str resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param str source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param datetime start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param datetime end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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    r#   rs   rt   ru   rv   )listr{   )	r,   r   r   r    r#   rs   rt   ru   rv   s	            r.   r   zEventList.list0  s:    > KK#%)"3%!#  	
 	
r/   c	           
         K   | j                  ||||||||       d{   2 	cg c3 d{   }	|	7 7 	6 c}	S c c}	w w)a  
        Asynchronously lists EventInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param str event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param str resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param str source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param datetime start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param datetime end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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    r#   rs   rt   ru   rv   records
             r.   
list_asynczEventList.list_async\  sg     B '+&7&7#%)"3%!# '8 	' 	!
 
 	!
 
 	
 
s4   A4A<86
8<A8<A
page_tokenpage_numberc
                 B   t        j                  ||||t        j                  |      t        j                  |      |||	d	      }
t        j                  ddi      }d|d<   | j                  j                  d| j                  |
|      }t        | j                  |      S )a  
        Retrieve a single page of EventInstance records from the API.
        Request is executed immediately

        :param actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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 EventInstance
        	ActorSid	EventTypeResourceSidSourceIpAddress	StartDateEndDate	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedr^   r_   r`   rb   rc   paramsrd   )r   re   r   r)   r4   rz   r\   rk   r,   r   r   r    r#   rs   rt   r   r   rv   datard   responses                r.   rz   zEventList.page  s    8 yy%'+#4&77
C$55h?'#%

 ))^-PQR.==%%diig & 
 11r/   c
                 ^  K   t        j                  ||||t        j                  |      t        j                  |      |||	d	      }
t        j                  ddi      }d|d<   | j                  j                  d| j                  |
|       d{   }t        | j                  |      S 7 w)	a"  
        Asynchronously retrieve a single page of EventInstance records from the API.
        Request is executed immediately

        :param actor_sid: Only include events initiated by this Actor. Useful for auditing actions taken by specific users or API credentials.
        :param event_type: Only include events of this [Event Type](https://www.twilio.com/docs/usage/monitor-events#event-types).
        :param resource_sid: Only include events that refer to this resource. Useful for discovering the history of a specific resource.
        :param source_ip_address: Only include events that originated from this IP address. Useful for tracking suspicious activity originating from the API or the Twilio Console.
        :param start_date: Only include events that occurred on or after this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :param end_date: Only include events that occurred on or before this date. Specify the date in GMT and [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
        :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 EventInstance
        r   r   r   r^   r_   r`   r   N)r   re   r   r)   r4   r   r\   rk   r   s                r.   r   zEventList.page_async  s     8 yy%'+#4&77
C$55h?'#%

 ))^-PQR.11diig 2 
 
 11
s   BB-B+B-
target_urlc                     | j                   j                  j                  j                  d|      }t	        | j                   |      S )z
        Retrieve a specific page of EventInstance records from the API.
        Request is executed immediately

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

        :returns: Page of EventInstance
        r`   )r4   domaintwiliorequestrk   r,   r   r   s      r.   get_pagezEventList.get_page  s7     ==''..66ujI11r/   c                    K   | j                   j                  j                  j                  d|       d{   }t	        | j                   |      S 7 w)z
        Asynchronously retrieve a specific page of EventInstance records from the API.
        Request is executed immediately

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

        :returns: Page of EventInstance
        r`   N)r4   r   r   request_asyncrk   r   s      r.   get_page_asynczEventList.get_page_async  sD      --44BB5*UU11 Vs   4AAAr   c                 0    t        | j                  |      S zh
        Constructs a EventContext

        :param sid: The SID of the Event resource to fetch.
        r2   r3   r4   r,   r   s     r.   r(   zEventList.get       DMMs33r/   c                 0    t        | j                  |      S r   r   r   s     r.   __call__zEventList.__call__  r   r/   c                      y)r>   z<Twilio.Monitor.V1.EventList>r[   r5   s    r.   rP   zEventList.__repr__  ro   r/   )rQ   rR   rS   r   r'   r   unsetr   rU   objectr   r   intr	   r   r{   r
   r   r   r   r   rk   rz   r   r   r   r3   r(   r   rP   rW   rX   s   @r.   rq   rq      s   	 	 )/)/+1<<06.4ll,2LL##'+;f%+; #v+&+; CK(	+;
 !f-+; (F*++; &()+; }+; C=+; 
-	 +;^ )/)/+1<<06.4ll,2LL##'+Af%+A #v+&+A CK(	+A
 !f-+A (F*++A &()+A }+A C=+A 
}	%+A^ )/)/+1<<06.4ll,2LL##'*
f%*
 #v+&*
 CK(	*

 !f-*
 (F*+*
 &()*
 }*
 C=*
 
m	*
\ )/)/+1<<06.4ll,2LL##'+
f%+
 #v+&+
 CK(	+

 !f-+
 (F*++
 &()+
 }+
 C=+
 
m	+
^ )/)/+1<<06.4ll,2LL)/*0,,(.12f%12 #v+&12 CK(	12
 !f-12 (F*+12 &()12 #v+&12 3;'12 f%12 
12j )/)/+1<<06.4ll,2LL)/*0,,(.12f%12 #v+&12 CK(	12
 !f-12 (F*+12 &()12 #v+&12 3;'12 f%12 
12f
23 
29 
2
2s 
2y 
24s 4| 44C 4L 4/# /r/   rq   N)rT   r   typingr   r   r   r   r   r	   r
   twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r3   rk   rq   r[   r/   r.   <module>r      sj     L L L 6 6 8 : 2 ' !UF$ UFpBE? BEJ/ /&T/ T/r/   