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 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)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd ZdZ fddZejejejejddfddZ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fd	d
Z	dd Z
ejejfddZdd Zdd Zdd Z  ZS )	QueryList PLEASE NOTE that this class contains preview products that are subject
    to change. Use them with caution. If you currently do not have developer
    preview access, please contact help@twilio.com. c                    s2   t t| | d|i| _djdi | j| _dS )aQ  
        Initialize the QueryList

        :param Version version: Version that contains the resource
        :param assistant_sid: The SID of the Assistant that is the parent of the resource

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryList
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryList
        assistant_sidz#/Assistants/{assistant_sid}/QueriesN )superr   __init__	_solutionformat_uri)selfversionr
   	__class__r   [/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/autopilot/v1/assistant/query.pyr      s   

zQueryList.__init__Nc           	      C   s8   | j ||}| j|||||d d}| j ||d S )aV  
        Streams QueryInstance 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 unicode language: The ISO language-country string that specifies the language used by the Query resources to read
        :param unicode model_build: The SID or unique name of the Model Build to be queried
        :param unicode status: The status of the resources to read
        :param unicode dialogue_sid: The SID of the `Dialogue <https://www.twilio.com/docs/autopilot/api/dialogue>`_.
        :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.autopilot.v1.assistant.query.QueryInstance]
        	page_size)languagemodel_buildstatusdialogue_sidr   limit)_versionread_limitspagestream)	r   r   r   r   r   r   r   limitsr   r   r   r   r   &   s   zQueryList.streamc              	   C   s   t | j||||||dS )a  
        Lists QueryInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read
        :param unicode model_build: The SID or unique name of the Model Build to be queried
        :param unicode status: The status of the resources to read
        :param unicode dialogue_sid: The SID of the `Dialogue <https://www.twilio.com/docs/autopilot/api/dialogue>`_.
        :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.autopilot.v1.assistant.query.QueryInstance]
        )r   r   r   r   r   r   )listr   )r   r   r   r   r   r   r   r   r   r   r!   I   s   zQueryList.listc           
   
   C   s>   t |||||||d}| jjd| j|d}	t| j|	| jS )aT  
        Retrieve a single page of QueryInstance records from the API.
        Request is executed immediately

        :param unicode language: The ISO language-country string that specifies the language used by the Query resources to read
        :param unicode model_build: The SID or unique name of the Model Build to be queried
        :param unicode status: The status of the resources to read
        :param unicode dialogue_sid: The SID of the `Dialogue <https://www.twilio.com/docs/autopilot/api/dialogue>`_.
        :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 QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage
        )Language
ModelBuildStatusDialogueSid	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   	QueryPager   )
r   r   r   r   r   
page_tokenpage_numberr   dataresponser   r   r   r   h   s   
zQueryList.pagec                 C   s"   | j jjd|}t| j || jS )a6  
        Retrieve a specific page of QueryInstance records from the API.
        Request is executed immediately

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

        :returns: Page of QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage
        r(   )r   domaintwiliorequestr-   r   )r   
target_urlr1   r   r   r   get_page   s
   

zQueryList.get_pagec                 C   s>   t ||||d}| jjd| j|d}t| j|| jd dS )a  
        Create the QueryInstance

        :param unicode language: The ISO language-country string that specifies the language used for the new query
        :param unicode query: The end-user's natural language input
        :param unicode tasks: The list of tasks to limit the new query to
        :param unicode model_build: The SID or unique name of the Model Build to be queried

        :returns: The created QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        )r"   QueryTasksr#   POSTr)   r*   r0   r
   r
   )r   r,   r   creater   QueryInstancer   )r   r   querytasksr   r0   payloadr   r   r   r<      s   zQueryList.createc                 C      t | j| jd |dS z
        Constructs a QueryContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext
        r
   r
   sidQueryContextr   r   r   rD   r   r   r   get      	zQueryList.getc                 C   rA   rB   rE   rG   r   r   r   __call__   rI   zQueryList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Autopilot.V1.QueryList>r   r   r   r   r   __repr__      zQueryList.__repr__)__name__
__module____qualname____doc__r   r   unsetr   r!   r   r6   r<   rH   rJ   rN   __classcell__r   r   r   r   r      s*    

#


!r   c                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )r-   r	   c                    s   t t| || || _dS )a  
        Initialize the QueryPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param assistant_sid: The SID of the Assistant that is the parent of the resource

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryPage
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage
        N)r   r-   r   r   )r   r   r1   solutionr   r   r   r      s   
zQueryPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of QueryInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        r
   r;   )r=   r   r   r   r@   r   r   r   get_instance   rI   zQueryPage.get_instancec                 C   rK   )rL   z<Twilio.Autopilot.V1.QueryPage>r   rM   r   r   r   rN      rO   zQueryPage.__repr__)rP   rQ   rR   rS   r   rX   rN   rU   r   r   r   r   r-      s
    r-   c                       sJ   e Zd ZdZ fddZdd ZejejfddZdd	 Z	d
d Z
  ZS )rF   r	   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the QueryContext

        :param Version version: Version that contains the resource
        :param assistant_sid: The SID of the Assistant that is the parent of the resource to fetch
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext
        rC   z)/Assistants/{assistant_sid}/Queries/{sid}Nr   )r   rF   r   r   r   r   )r   r   r
   rD   r   r   r   r      s   zQueryContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the QueryInstance

        :returns: The fetched QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        r(   r)   r*   r
   rD   rC   )r   fetchr   r=   r   rW   r   r   r   r[     s   zQueryContext.fetchc                 C   sB   t ||d}| jjd| j|d}t| j|| jd | jd dS )F  
        Update the QueryInstance

        :param unicode sample_sid: The SID of an optional reference to the Sample created from the query
        :param unicode status: The new status of the resource

        :returns: The updated QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        )	SampleSidr$   r9   r:   r
   rD   rC   )r   r,   r   updater   r=   r   )r   
sample_sidr   r0   r@   r   r   r   r^     s   
zQueryContext.updatec                 C   s   | j jd| jdS )|
        Deletes the QueryInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErZ   )r   deleter   rM   r   r   r   rb   1  s   zQueryContext.deletec                 C   $   d dd | j D }d|S )rL    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>A      z(QueryContext.__repr__.<locals>.<genexpr>z%<Twilio.Autopilot.V1.QueryContext {}>joinr   itemsr   r   contextr   r   r   rN   :     
zQueryContext.__repr__)rP   rQ   rR   rS   r   r[   r   rT   r^   rb   rN   rU   r   r   r   r   rF      s    	rF   c                       s   e Zd 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d#d$ Zejejfd%d&Zd'd( Zd)d* Z  ZS ),r=   r	   Nc                    s   t t| | |dt|dt|d|d|d|d|d|d|d	|d
|d|d|d|dd| _d| _||pT| jd
 d| _dS )z
        Initialize the QueryInstance

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        account_siddate_createddate_updatedresultsr   model_build_sidr>   r_   r
   rD   r   urlsource_channelr   )rt   ru   rv   rw   r   rx   r>   r_   r
   rD   r   ry   rz   r   NrC   )	r   r=   r   rH   r   iso8601_datetime_properties_contextr   )r   r   r@   r
   rD   r   r   r   r   J  s$   zQueryInstance.__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: QueryContext for this QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext
        Nr
   rD   rC   )r}   rF   r   r   rM   r   r   r   _proxyi  s   
	zQueryInstance._proxyc                 C   
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rt   r|   rM   r   r   r   rt   z     
zQueryInstance.account_sidc                 C   r   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        ru   r   rM   r   r   r   ru     r   zQueryInstance.date_createdc                 C   r   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        rv   r   rM   r   r   r   rv     r   zQueryInstance.date_updatedc                 C   r   )z
        :returns: The natural language analysis results that include the Task recognized and a list of identified Fields
        :rtype: dict
        rw   r   rM   r   r   r   rw     r   zQueryInstance.resultsc                 C   r   )z
        :returns: The ISO language-country string that specifies the language used by the Query
        :rtype: unicode
        r   r   rM   r   r   r   r     r   zQueryInstance.languagec                 C   r   )z
        :returns: The SID of the `Model Build <https://www.twilio.com/docs/autopilot/api/model-build>`_ queried
        :rtype: unicode
        rx   r   rM   r   r   r   rx     r   zQueryInstance.model_build_sidc                 C   r   )zY
        :returns: The end-user's natural language input
        :rtype: unicode
        r>   r   rM   r   r   r   r>     r   zQueryInstance.queryc                 C   r   )zy
        :returns: The SID of an optional reference to the Sample created from the query
        :rtype: unicode
        r_   r   rM   r   r   r   r_     r   zQueryInstance.sample_sidc                 C   r   )zo
        :returns: The SID of the Assistant that is the parent of the resource
        :rtype: unicode
        r
   r   rM   r   r   r   r
     r   zQueryInstance.assistant_sidc                 C   r   )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rD   r   rM   r   r   r   rD     r   zQueryInstance.sidc                 C   r   )zK
        :returns: The status of the Query
        :rtype: unicode
        r   r   rM   r   r   r   r     r   zQueryInstance.statusc                 C   r   )zZ
        :returns: The absolute URL of the Query resource
        :rtype: unicode
        ry   r   rM   r   r   r   ry     r   zQueryInstance.urlc                 C   r   )zp
        :returns: The communication channel from where the end-user input came
        :rtype: unicode
        rz   r   rM   r   r   r   rz     r   zQueryInstance.source_channelc                 C   r   )z
        :returns: The SID of the `Dialogue <https://www.twilio.com/docs/autopilot/api/dialogue>`_.
        :rtype: unicode
        r   r   rM   r   r   r   r     r   zQueryInstance.dialogue_sidc                 C   
   | j  S )rY   )r~   r[   rM   r   r   r   r[        
zQueryInstance.fetchc                 C   s   | j j||dS )r\   )r_   r   )r~   r^   )r   r_   r   r   r   r   r^     s   
zQueryInstance.updatec                 C   r   )r`   )r~   rb   rM   r   r   r   rb     r   zQueryInstance.deletec                 C   rc   )rL   rd   c                 s   re   rf   rg   rh   r   r   r   rl     rm   z)QueryInstance.__repr__.<locals>.<genexpr>z&<Twilio.Autopilot.V1.QueryInstance {}>rn   rq   r   r   r   rN     rs   zQueryInstance.__repr__)N)rP   rQ   rR   rS   r   propertyr~   rt   ru   rv   rw   r   rx   r>   r_   r
   rD   r   ry   rz   r   r[   r   rT   r^   rb   rN   rU   r   r   r   r   r=   E  sJ    














		r=   N)rS   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r-   rF   r=   r   r   r   r   <module>   s    <*O