o
    f>h݁                     @   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 - Taskrouter
    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                
       sr   e Zd ZdZ	ddedeeef dedee f fddZ	e
dddZdddZdddZd	ef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 resource that triggered the event.
    :ivar actor_type: The type of resource that triggered the event.
    :ivar actor_url: The absolute URL of the resource that triggered the event.
    :ivar description: A description of the event.
    :ivar event_data: Data about the event. For more information, see [Event types](https://www.twilio.com/docs/taskrouter/api/event#event-types).
    :ivar event_date: The time the event was sent, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar event_date_ms: The time the event was sent in milliseconds.
    :ivar event_type: The identifier for the event.
    :ivar resource_sid: The SID of the object the event is most relevant to, such as a TaskSid, ReservationSid, or a  WorkerSid.
    :ivar resource_type: The type of object the event is most relevant to, such as a Task, Reservation, or a Worker).
    :ivar resource_url: The URL of the resource the event is most relevant to.
    :ivar sid: The unique string that we created to identify the Event resource.
    :ivar source: Where the Event originated.
    :ivar source_ip_address: The IP from which the Event originated.
    :ivar url: The absolute URL of the Event resource.
    :ivar workspace_sid: The SID of the Workspace that contains the Event.
    Nversionpayloadworkspace_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _|d| _|d| _|d| _||pt| jd| _d | _d S )Naccount_sid	actor_sid
actor_type	actor_urldescription
event_data
event_dateevent_date_ms
event_typeresource_sidresource_typeresource_urlr   sourcesource_ip_addressurlr   r   r   )super__init__getr   r   r   r   r   r   r
   iso8601_datetimer   r   r   r    r!   r"   r   r#   r$   r%   r   	_solution_context)selfr   r   r   r   	__class__ \/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/taskrouter/v1/workspace/event.pyr(   .   s0   
zEventInstance.__init__returnEventContextc                 C   s.   | j du rt| j| jd | 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,   r3   _versionr+   r-   r0   r0   r1   _proxyQ   s   
zEventInstance._proxyc                 C   s
   | j  S )W
        Fetch the EventInstance


        :returns: The fetched EventInstance
        )r6   fetchr5   r0   r0   r1   r8   a   s   
zEventInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the EventInstance


        :returns: The fetched EventInstance
        N)r6   fetch_asyncr5   r0   r0   r1   r:   j   s   zEventInstance.fetch_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr0   r0   r1   	<genexpr>y       z)EventInstance.__repr__.<locals>.<genexpr>z'<Twilio.Taskrouter.V1.EventInstance {}>joinr+   itemsrA   r-   contextr0   r0   r1   __repr__s      
zEventInstance.__repr__N)r2   r3   )r2   r   )__name__
__module____qualname____doc__r   r   strr   r   r(   propertyr6   r8   r:   rM   __classcell__r0   r0   r.   r1   r      s"    
#

		r   c                       sT   e Zd Zdededef fddZdefddZdefd	d
ZdefddZ	  Z
S )r3   r   r   r   c                    s0   t  | ||d| _djdi | j| _dS )z
        Initialize the EventContext

        :param version: Version that contains the resource
        :param workspace_sid: The SID of the Workspace with the Event to fetch.
        :param sid: The SID of the Event resource to fetch.
        r&   z(/Workspaces/{workspace_sid}/Events/{sid}Nr0   r'   r(   r+   rA   _uri)r-   r   r   r   r.   r0   r1   r(      s
   zEventContext.__init__r2   c                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r7   application/jsonAcceptGETmethoduriheadersr   r   r&   )r   ofr4   r8   rX   r   r+   r-   r_   r   r0   r0   r1   r8      s   
zEventContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r9   rY   rZ   r[   r\   Nr   r   r&   )r   r`   r4   r:   rX   r   r+   ra   r0   r0   r1   r:      s   
zEventContext.fetch_asyncc                 C   r;   )r<   r=   c                 s   r>   r?   r@   rB   r0   r0   r1   rF      rG   z(EventContext.__repr__.<locals>.<genexpr>z&<Twilio.Taskrouter.V1.EventContext {}>rH   rK   r0   r0   r1   rM      rN   zEventContext.__repr__)rP   rQ   rR   r   rT   r(   r   r8   r:   rM   rV   r0   r0   r.   r1   r3   }   s
    r3   c                   @   s4   e Zd Zdeeef defddZdefddZdS )	EventPager   r2   c                 C   s   t | j|| jd dS )zk
        Build an instance of EventInstance

        :param payload: Payload response from the API
        r   )r   )r   r4   r+   )r-   r   r0   r0   r1   get_instance      zEventPage.get_instancec                 C      dS )r<   z <Twilio.Taskrouter.V1.EventPage>r0   r5   r0   r0   r1   rM         zEventPage.__repr__N)	rP   rQ   rR   r   rT   r   r   rc   rM   r0   r0   r0   r1   rb      s    
rb   c                       s  e Zd Zdedef fddZejejejejej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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dZejejejejej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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dZejejejejej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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dZejejejejej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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dZejejejejej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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dZejejejejej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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 d!Zd"edefd#d$Zd"edefd%d&Zdedefd'd(Zdedefd)d*Zdefd+d,Z  ZS )-	EventListr   r   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the EventList

        :param version: Version that contains the resource
        :param workspace_sid: The SID of the Workspace with the Events to read. Returns only the Events that pertain to the specified Workspace.

        r   z"/Workspaces/{workspace_sid}/EventsNr0   rW   )r-   r   r   r.   r0   r1   r(      s   zEventList.__init__Nend_dater   minutesreservation_sid
start_datetask_queue_sidtask_sid
worker_sidworkflow_sidtask_channelr   limit	page_sizer2   c                 C   sF   | 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 datetime end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param str event_type: The type of Events to read. Returns only Events of the type specified.
        :param int minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param str reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param datetime start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param str task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param str task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param str worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param str workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param str task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param str sid: The SID of the Event resource to read.
        :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
        rr   rh   r   ri   rj   rk   rl   rm   rn   ro   rp   r   rr   rq   )r4   read_limitspagestreamr-   rh   r   ri   rj   rk   rl   rm   rn   ro   rp   r   rq   rr   limitsru   r0   r0   r1   rv      s    *zEventList.streamc                    sN   | j ||}| j|||||||||	|
||d dI dH }| j ||d S )a	  
        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 datetime end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param str event_type: The type of Events to read. Returns only Events of the type specified.
        :param int minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param str reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param datetime start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param str task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param str task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param str worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param str workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param str task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param str sid: The SID of the Event resource to read.
        :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
        rr   rs   Nrq   )r4   rt   
page_asyncstream_asyncrw   r0   r0   r1   rz   )  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 datetime end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param str event_type: The type of Events to read. Returns only Events of the type specified.
        :param int minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param str reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param datetime start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param str task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param str task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param str worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param str workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param str task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param str sid: The SID of the Event resource to read.
        :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
        rh   r   ri   rj   rk   rl   rm   rn   ro   rp   r   rq   rr   )listrv   r-   rh   r   ri   rj   rk   rl   rm   rn   ro   rp   r   rq   rr   r0   r0   r1   r|   e  s"   )zEventList.listc                    s<   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 datetime end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param str event_type: The type of Events to read. Returns only Events of the type specified.
        :param int minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param str reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param datetime start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param str task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param str task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param str worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param str workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param str task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param str sid: The SID of the Event resource to read.
        :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 rO   r0   )rC   recordr0   r0   r1   
<listcomp>  s
    z(EventList.list_async.<locals>.<listcomp>r{   N)rz   r}   r0   r0   r1   
list_async  s$   )
zEventList.list_async
page_tokenpage_numberc                 C   sp   t t||||t|||||	|
||||d}t ddi}d|d< | jjd| j||d}t| j|| jS )a  
        Retrieve a single page of EventInstance records from the API.
        Request is executed immediately

        :param end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param event_type: The type of Events to read. Returns only Events of the type specified.
        :param minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param sid: The SID of the Event resource to read.
        :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
        EndDate	EventTypeMinutesReservationSid	StartDateTaskQueueSidTaskSid	WorkerSidWorkflowSidTaskChannelSid	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedrY   rZ   r[   r]   r^   paramsr_   )	r   r`   r   r*   r4   ru   rX   rb   r+   r-   rh   r   ri   rj   rk   rl   rm   rn   ro   rp   r   r   r   rr   datar_   responser0   r0   r1   ru     s.   &
zEventList.pagec                    sx   t t||||t|||||	|
||||d}t ddi}d|d< | jjd| j||dI dH }t| j|| jS )	a  
        Asynchronously retrieve a single page of EventInstance records from the API.
        Request is executed immediately

        :param end_date: Only include Events that occurred on or before this date, specified in GMT as an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time.
        :param event_type: The type of Events to read. Returns only Events of the type specified.
        :param minutes: The period of events to read in minutes. Returns only Events that occurred since this many minutes in the past. The default is `15` minutes. Task Attributes for Events occuring more 43,200 minutes ago will be redacted.
        :param reservation_sid: The SID of the Reservation with the Events to read. Returns only Events that pertain to the specified Reservation.
        :param start_date: Only include Events from on or after this date and time, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. Task Attributes for Events older than 30 days will be redacted.
        :param task_queue_sid: The SID of the TaskQueue with the Events to read. Returns only the Events that pertain to the specified TaskQueue.
        :param task_sid: The SID of the Task with the Events to read. Returns only the Events that pertain to the specified Task.
        :param worker_sid: The SID of the Worker with the Events to read. Returns only the Events that pertain to the specified Worker.
        :param workflow_sid: The SID of the Workflow with the Events to read. Returns only the Events that pertain to the specified Workflow.
        :param task_channel: The TaskChannel with the Events to read. Returns only the Events that pertain to the specified TaskChannel.
        :param sid: The SID of the Event resource to read.
        :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   rY   rZ   r[   r   N)	r   r`   r   r*   r4   ry   rX   rb   r+   r   r0   r0   r1   ry     s0   &
zEventList.page_async
target_urlc                 C   s"   | j jjd|}t| j || 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requestrb   r+   r-   r   r   r0   r0   r1   get_page`  s   	zEventList.get_pagec                    s*   | j jjd|I dH }t| j || 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
        r[   N)r4   r   r   request_asyncrb   r+   r   r0   r0   r1   get_page_asyncl  s   	zEventList.get_page_asyncc                 C      t | j| jd |dS zh
        Constructs a EventContext

        :param sid: The SID of the Event resource to fetch.
        r   r&   r3   r4   r+   r-   r   r0   r0   r1   r)   x  rd   zEventList.getc                 C   r   r   r   r   r0   r0   r1   __call__  rd   zEventList.__call__c                 C   re   )r<   z <Twilio.Taskrouter.V1.EventList>r0   r5   r0   r0   r1   rM     rf   zEventList.__repr__)rP   rQ   rR   r   rT   r(   r   unsetr   r   objectintr   r   r   rv   r	   rz   r   r|   r   rb   ru   ry   r   r   r3   r)   r   rM   rV   r0   r0   r.   r1   rg      s   







	




>







	




>







	




=







	




>







	







D







	







B

rg   N)rS   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   rb   rg   r0   r0   r0   r1   <module>   s    $dI