U
    ^g%ie                     @   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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 - 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                       st   e Zd ZdZdeeeef ee d fddZ	e
dddd	Zd dd
dZd dddZedddZ  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.
    N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _d
|p| ji| _d | _d S )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__ [/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/monitor/v1/event.pyr$   +   s*     zEventInstance.__init__EventContextreturnc                 C   s&   | j dkr t| j| 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: EventContext for this EventInstance
        Nr   r   )r(   r.   _versionr'   r)   r,   r,   r-   _proxyF   s    
zEventInstance._proxyc                 C   s
   | j  S )W
        Fetch the EventInstance


        :returns: The fetched EventInstance
        )r4   fetchr3   r,   r,   r-   r6   U   s    zEventInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the EventInstance


        :returns: The fetched EventInstance
        N)r4   fetch_asyncr3   r,   r,   r-   r8   ^   s    zEventInstance.fetch_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr,   r,   r-   	<genexpr>m   s     z)EventInstance.__repr__.<locals>.<genexpr>z$<Twilio.Monitor.V1.EventInstance {}>joinr'   itemsr=   r)   contextr,   r,   r-   __repr__g   s    zEventInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r$   propertyr4   r6   r8   rH   __classcell__r,   r,   r*   r-   r      s     
 		r   c                       sN   e Zd Zeed fddZedddZedddZedd	d
Z	  Z
S )r.   )r   r   c                    s*   t  | d|i| _djf | j| _dS )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'   r=   _uri)r)   r   r   r*   r,   r-   r$   s   s
     zEventContext.__init__r/   c                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r5   application/jsonAcceptGETmethoduriheadersr   r1   )r   ofr2   r6   rP   r   r'   r)   rW   r   r,   r,   r-   r6      s    
zEventContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r7   rQ   rR   rS   rT   Nr   r1   )r   rX   r2   r8   rP   r   r'   rY   r,   r,   r-   r8      s    
  zEventContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r9   r:   c                 s   s   | ]\}}d  ||V  qdS r;   r<   r>   r,   r,   r-   rB      s     z(EventContext.__repr__.<locals>.<genexpr>z#<Twilio.Monitor.V1.EventContext {}>rC   rF   r,   r,   r-   rH      s    zEventContext.__repr__)rI   rJ   rK   r   rM   r$   r   r6   r8   rH   rO   r,   r,   r*   r-   r.   q   s   r.   c                   @   s2   e Zd Zeeef edddZedddZdS )	EventPage)r   r0   c                 C   s   t | j|S )zk
        Build an instance of EventInstance

        :param payload: Payload response from the API
        )r   r2   )r)   r   r,   r,   r-   get_instance   s    zEventPage.get_instancer/   c                 C   s   dS )r9   z<Twilio.Monitor.V1.EventPage>r,   r3   r,   r,   r-   rH      s    zEventPage.__repr__N)	rI   rJ   rK   r   rM   r   r   r[   rH   r,   r,   r,   r-   rZ      s   rZ   c                       sl  e Zd Zed fddZejejejejejejddfeee	f eee	f eee	f eee	f ee
e	f ee
e	f ee ee ee d	ddZejejejejejejddfeee	f eee	f eee	f eee	f ee
e	f ee
e	f ee ee ee d	dd	Zejejejejejejddfeee	f eee	f eee	f eee	f ee
e	f ee
e	f ee ee ee d	d
dZejejejejejejddfeee	f eee	f eee	f eee	f ee
e	f ee
e	f ee ee ee d	ddZejejejejejejejejejf	eee	f eee	f eee	f eee	f ee
e	f ee
e	f eee	f eee	f eee	f ed
ddZejejejejejejejejejf	eee	f eee	f eee	f eee	f ee
e	f ee
e	f eee	f eee	f eee	f ed
ddZeedddZeedddZeedddZeedddZedddZ  ZS ) 	EventList)r   c                    s   t  | d| _dS )zg
        Initialize the EventList

        :param version: Version that contains the resource

        z/EventsN)r#   r$   rP   )r)   r   r*   r,   r-   r$      s    zEventList.__init__N)	r   r   r   r    
start_dateend_datelimit	page_sizer0   c	              	   C   s<   | j ||}	| j|||||||	d d}
| 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
        r`   r   r   r   r    r]   r^   r`   r_   )r2   read_limitspagestreamr)   r   r   r   r    r]   r^   r_   r`   Zlimitsrc   r,   r,   r-   rd      s     
zEventList.streamc	              	      sB   | j ||}	| j|||||||	d dI dH }
| j |
|	d S )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
        r`   ra   Nr_   )r2   rb   
page_asyncstream_asyncre   r,   r,   r-   rg     s     
zEventList.stream_asyncc	           	      C   s   t | j||||||||d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    r]   r^   r_   r`   )listrd   	r)   r   r   r   r    r]   r^   r_   r`   r,   r,   r-   ri   0  s    zEventList.listc	           	         s0   dd | j ||||||||dI dH 2 I dH S )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
        c                    s   g | z3 d H W }|q6 S )Nr,   )r?   recordr,   r,   r-   
<listcomp>{  s   z(EventList.list_async.<locals>.<listcomp>rh   N)rg   rj   r,   r,   r-   
list_async\  s    
zEventList.list_async)
r   r   r   r    r]   r^   
page_tokenpage_numberr`   r0   c
                 C   sb   t ||||t|t||||	d	}
t ddi}d|d< | jjd| j|
|d}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
        	ZActorSidZ	EventTypeZResourceSidZSourceIpAddressZ	StartDateZEndDateZ	PageTokenr   ZPageSizeContent-Type!application/x-www-form-urlencodedrQ   rR   rS   rU   rV   paramsrW   )r   rX   r   r&   r2   rc   rP   rZ   r)   r   r   r   r    r]   r^   rn   ro   r`   datarW   responser,   r,   r-   rc     s*       zEventList.pagec
                    sh   t ||||t|t||||	d	}
t ddi}d|d< | jjd| j|
|dI dH }t| j|S )	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
        rp   rq   rr   rQ   rR   rS   rs   N)r   rX   r   r&   r2   rf   rP   rZ   ru   r,   r,   r-   rf     s*       zEventList.page_async)
target_urlr0   c                 C   s   | 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
        rS   )r2   domaintwiliorequestrZ   r)   rx   rw   r,   r,   r-   get_page  s    	zEventList.get_pagec                    s$   | j jjd|I dH }t| j |S )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
        rS   N)r2   ry   rz   Zrequest_asyncrZ   r|   r,   r,   r-   get_page_async  s    	zEventList.get_page_async)r   r0   c                 C   s   t | j|dS zh
        Constructs a EventContext

        :param sid: The SID of the Event resource to fetch.
        r1   r.   r2   r)   r   r,   r,   r-   r%     s    zEventList.getc                 C   s   t | j|dS r   r   r   r,   r,   r-   __call__  s    zEventList.__call__r/   c                 C   s   dS )r9   z<Twilio.Monitor.V1.EventList>r,   r3   r,   r,   r-   rH     s    zEventList.__repr__)rI   rJ   rK   r   r$   r   unsetr   rM   objectr   r   intr   r   rd   r	   rg   r   ri   rm   rZ   rc   rf   r}   r~   r.   r%   r   rH   rO   r,   r,   r*   r-   r\      s   





/





/





.





/








5








3r\   N)rL   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r.   rZ   r\   r,   r,   r,   r-   <module>   s   $XE