o
    eK                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ G d	d
 d
e
ZG dd deZG dd deZG dd deZdS )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z 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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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d	Zd
d Z	dd Z
dd Zdd Z  ZS )	EventListc                    s2   t t| | d|i| _djdi | j| _dS )aH  
        Initialize the EventList

        :param Version version: Version that contains the resource
        :param workspace_sid: The SID of the Workspace that contains the Event

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventList
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventList
        workspace_sidz"/Workspaces/{workspace_sid}/EventsN )superr	   __init__	_solutionformat_uri)selfversionr
   	__class__r   \/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/taskrouter/v1/workspace/event.pyr      s   

zEventList.__init__Nc                 C   sF   | j ||}| j|||||||||	|
||d d}| j ||d S )a0  
        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 usage that occurred on or before this date
        :param unicode event_type: The type of Events to read
        :param unicode minutes: The period of events to read in minutes
        :param unicode reservation_sid: The SID of the Reservation with the Events to read
        :param datetime start_date: Only include Events from on or after this date
        :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read
        :param unicode task_sid: The SID of the Task with the Events to read
        :param unicode worker_sid: The SID of the Worker with the Events to read
        :param unicode workflow_sid: The SID of the Worker with the Events to read
        :param unicode task_channel: The TaskChannel with the Events to read
        :param unicode sid: The unique string that identifies the resource
        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int page_size: Number of records to fetch per request, when not set will use
                              the default value of 50 records.  If no page_size is defined
                              but a limit is defined, stream() will attempt to read the
                              limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        :rtype: list[twilio.rest.taskrouter.v1.workspace.event.EventInstance]
        	page_size)end_date
event_typeminutesreservation_sid
start_datetask_queue_sidtask_sid
worker_sidworkflow_sidtask_channelsidr   limit)_versionread_limitspagestream)r   r   r   r   r   r   r   r   r   r   r    r!   r"   r   limitsr%   r   r   r   r&   $   s    !zEventList.streamc                 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 usage that occurred on or before this date
        :param unicode event_type: The type of Events to read
        :param unicode minutes: The period of events to read in minutes
        :param unicode reservation_sid: The SID of the Reservation with the Events to read
        :param datetime start_date: Only include Events from on or after this date
        :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read
        :param unicode task_sid: The SID of the Task with the Events to read
        :param unicode worker_sid: The SID of the Worker with the Events to read
        :param unicode workflow_sid: The SID of the Worker with the Events to read
        :param unicode task_channel: The TaskChannel with the Events to read
        :param unicode sid: The unique string that identifies the resource
        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int page_size: Number of records to fetch per request, when not set will use
                              the default value of 50 records.  If no page_size is defined
                              but a limit is defined, list() will attempt to read the limit
                              with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        :rtype: list[twilio.rest.taskrouter.v1.workspace.event.EventInstance]
        )r   r   r   r   r   r   r   r   r   r    r!   r"   r   )listr&   )r   r   r   r   r   r   r   r   r   r   r    r!   r"   r   r   r   r   r(   X   s    zEventList.listc                 C   sX   t t||||t|||||	|
||||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 datetime end_date: Only include usage that occurred on or before this date
        :param unicode event_type: The type of Events to read
        :param unicode minutes: The period of events to read in minutes
        :param unicode reservation_sid: The SID of the Reservation with the Events to read
        :param datetime start_date: Only include Events from on or after this date
        :param unicode task_queue_sid: The SID of the TaskQueue with the Events to read
        :param unicode task_sid: The SID of the Task with the Events to read
        :param unicode worker_sid: The SID of the Worker with the Events to read
        :param unicode workflow_sid: The SID of the Worker with the Events to read
        :param unicode task_channel: The TaskChannel with the Events to read
        :param unicode sid: The unique string that identifies the resource
        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of EventInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage
        )EndDate	EventTypeMinutesReservationSid	StartDateTaskQueueSidTaskSid	WorkerSidWorkflowSidTaskChannelSid	PageTokenr   PageSizeGET)methoduriparams)	r   ofr   iso8601_datetimer#   r%   r   	EventPager   )r   r   r   r   r   r   r   r   r   r   r    r!   
page_tokenpage_numberr   dataresponser   r   r   r%      s$   zEventList.pagec                 C   s"   | j jjd|}t| j || jS )a7  
        Retrieve a specific page of EventInstance records from the API.
        Request is executed immediately

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

        :returns: Page of EventInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage
        r6   )r#   domaintwiliorequestr<   r   )r   
target_urlr@   r   r   r   get_page   s
   

zEventList.get_pagec                 C      t | j| jd |dS z
        Constructs a EventContext

        :param sid: The SID of the resource to fetch

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext
        r
   r
   r!   EventContextr#   r   r   r!   r   r   r   get      	zEventList.getc                 C   rF   rG   rI   rK   r   r   r   __call__   rM   zEventList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z <Twilio.Taskrouter.V1.EventList>r   r   r   r   r   __repr__      zEventList.__repr__)__name__
__module____qualname__r   r   unsetr&   r(   r%   rE   rL   rN   rR   __classcell__r   r   r   r   r	      s8    
4
0
2r	   c                       ,   e Zd Z fddZdd Zdd Z  ZS )r<   c                    s   t t| || || _dS )a  
        Initialize the EventPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param workspace_sid: The SID of the Workspace that contains the Event

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventPage
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventPage
        N)r   r<   r   r   )r   r   r@   solutionr   r   r   r      s   
zEventPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of EventInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance
        r
   )r
   )EventInstancer#   r   r   payloadr   r   r   get_instance   rM   zEventPage.get_instancec                 C   rO   )rP   z <Twilio.Taskrouter.V1.EventPage>r   rQ   r   r   r   rR     rS   zEventPage.__repr__)rT   rU   rV   r   r^   rR   rX   r   r   r   r   r<      s    r<   c                       rY   )rJ   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the EventContext

        :param Version 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 resource to fetch

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventContext
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext
        rH   z(/Workspaces/{workspace_sid}/Events/{sid}Nr   )r   rJ   r   r   r   r   )r   r   r
   r!   r   r   r   r     s   zEventContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the EventInstance

        :returns: The fetched EventInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance
        r6   )r7   r8   r
   r!   rH   )r#   fetchr   r[   r   r\   r   r   r   r`   %  s   zEventContext.fetchc                 C   $   d dd | j D }d|S )rP    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr><      z(EventContext.__repr__.<locals>.<genexpr>z&<Twilio.Taskrouter.V1.EventContext {}>joinr   itemsr   r   contextr   r   r   rR   5     
zEventContext.__repr__)rT   rU   rV   r   r`   rR   rX   r   r   r   r   rJ     s    rJ   c                       s  e Zd Zd, fdd	Zedd Zedd Zedd	 Zed
d Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zed d! Zed"d# Zed$d% Zed&d' Zd(d) Zd*d+ Z  ZS )-r[   Nc                    s  t t| | i d|dd|dd|dd|dd|dd|ddt|ddt|dd	|d	d
|d
d|dd|dd|dd|dd|dd|dd|d| _d| _||p| jd d| _	dS )z
        Initialize the EventInstance

        :returns: twilio.rest.taskrouter.v1.workspace.event.EventInstance
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventInstance
        account_sid	actor_sid
actor_type	actor_urldescription
event_data
event_dateevent_date_msr   resource_sidresource_typeresource_urlr!   sourcesource_ip_addressurlr
   NrH   )
r   r[   r   rL   r   r;   integer_properties_contextr   )r   r   r]   r
   r!   r   r   r   r   B  sL   






	








zEventInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )a-  
        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
        :rtype: twilio.rest.taskrouter.v1.workspace.event.EventContext
        Nr
   r!   rH   )r   rJ   r#   r   rQ   r   r   r   _proxyd  s   
	zEventInstance._proxyc                 C   
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rr   r   rQ   r   r   r   rr   u     
zEventInstance.account_sidc                 C   r   )zd
        :returns: The SID of the resource that triggered the event
        :rtype: unicode
        rs   r   rQ   r   r   r   rs   }  r   zEventInstance.actor_sidc                 C   r   )za
        :returns: The type of resource that triggered the event
        :rtype: unicode
        rt   r   rQ   r   r   r   rt     r   zEventInstance.actor_typec                 C   r   )zm
        :returns: The absolute URL of the resource that triggered the event
        :rtype: unicode
        ru   r   rQ   r   r   r   ru     r   zEventInstance.actor_urlc                 C   r   )zN
        :returns: A description of the event
        :rtype: unicode
        rv   r   rQ   r   r   r   rv     r   zEventInstance.descriptionc                 C   r   )zE
        :returns: Data about the event
        :rtype: dict
        rw   r   rQ   r   r   r   rw     r   zEventInstance.event_datac                 C   r   )zP
        :returns: The time the event was sent
        :rtype: datetime
        rx   r   rQ   r   r   r   rx     r   zEventInstance.event_datec                 C   r   )z_
        :returns: The time the event was sent in milliseconds
        :rtype: unicode
        ry   r   rQ   r   r   r   ry     r   zEventInstance.event_date_msc                 C   r   )zP
        :returns: The identifier for the event
        :rtype: unicode
        r   r   rQ   r   r   r   r     r   zEventInstance.event_typec                 C   r   )zg
        :returns: The SID of the object the event is most relevant to
        :rtype: unicode
        rz   r   rQ   r   r   r   rz     r   zEventInstance.resource_sidc                 C   r   )zd
        :returns: The type of object the event is most relevant to
        :rtype: unicode
        r{   r   rQ   r   r   r   r{     r   zEventInstance.resource_typec                 C   r   )zi
        :returns: The URL of the resource the event is most relevant to
        :rtype: unicode
        r|   r   rQ   r   r   r   r|     r   zEventInstance.resource_urlc                 C   r   )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r!   r   rQ   r   r   r   r!     r   zEventInstance.sidc                 C   r   )zN
        :returns: Where the Event originated
        :rtype: unicode
        r}   r   rQ   r   r   r   r}     r   zEventInstance.sourcec                 C   r   )zZ
        :returns: The IP from which the Event originated
        :rtype: unicode
        r~   r   rQ   r   r   r   r~     r   zEventInstance.source_ip_addressc                 C   r   )zZ
        :returns: The absolute URL of the Event resource
        :rtype: unicode
        r   r   rQ   r   r   r   r     r   zEventInstance.urlc                 C   r   )zd
        :returns: The SID of the Workspace that contains the Event
        :rtype: unicode
        r
   r   rQ   r   r   r   r
     r   zEventInstance.workspace_sidc                 C   s
   | j  S )r_   )r   r`   rQ   r   r   r   r`     s   
zEventInstance.fetchc                 C   ra   )rP   rb   c                 s   rc   rd   re   rf   r   r   r   rj     rk   z)EventInstance.__repr__.<locals>.<genexpr>z'<Twilio.Taskrouter.V1.EventInstance {}>rl   ro   r   r   r   rR     rq   zEventInstance.__repr__)N)rT   rU   rV   r   propertyr   rr   rs   rt   ru   rv   rw   rx   ry   r   rz   r{   r|   r!   r}   r~   r   r
   r`   rR   rX   r   r   r   r   r[   @  sP    "

















	r[   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r<   rJ   r[   r   r   r   r   <module>   s    Z'.