o
    �¨ÊhìM  ã                   @   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ddfdd„Zejejejddfdd„Z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 )a<  
        Initialize the QueryList

        :param Version version: Version that contains the resource
        :param assistant_sid: The unique ID of the parent Assistant.

        :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   úZ/var/www/html/env/lib/python3.10/site-packages/twilio/rest/autopilot/v1/assistant/query.pyr      s   

zQueryList.__init__Nc                 C   s<   | j  ||¡}| j||||d d�}| j  ||d |d ¡S )a«  
        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: An [ISO language-country string](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) that specifies the language used for this query. For example: `en-US`.
        :param unicode model_build: The Sid or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param unicode status: A string that described the query status. The values can be: `pending_review`, `reviewed`, `discarded`
        :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Ústatusr   ÚlimitÚ
page_limit)Ú_versionÚread_limitsÚpageÚstream)r   r   r   r   r   r   Úlimitsr   r   r   r   r   &   s   üzQueryList.streamc                 C   s   t | j|||||d�ƒS )aK  
        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: An [ISO language-country string](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) that specifies the language used for this query. For example: `en-US`.
        :param unicode model_build: The Sid or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param unicode status: A string that described the query status. The values can be: `pending_review`, `reviewed`, `discarded`
        :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   )Úlistr   )r   r   r   r   r   r   r   r   r   r!   F   s   ûzQueryList.listc           	   	   C   s<   t  ||||||dœ¡}| jjd| j|d�}t| j|| jƒS )a©  
        Retrieve a single page of QueryInstance records from the API.
        Request is executed immediately

        :param unicode language: An [ISO language-country string](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) that specifies the language used for this query. For example: `en-US`.
        :param unicode model_build: The Sid or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param unicode status: A string that described the query status. The values can be: `pending_review`, `reviewed`, `discarded`
        :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Ú	PageTokenr   ÚPageSizeÚGET©Úparams)r   Úofr   r   r   Ú	QueryPager   )	r   r   r   r   Ú
page_tokenÚpage_numberr   r)   Úresponser   r   r   r   b   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_urlr.   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 )au  
        Create a new QueryInstance

        :param unicode language: An [ISO language-country string](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) that specifies the language used for this query. For example: `en-US`.
        :param unicode query: A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long.
        :param unicode tasks: Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated task-unique-name-1, task-unique-name-2
        :param unicode model_build: The Sid or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.

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

        :param sid: A 34-character string that uniquely identifies this resource.

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext
        r
   ©r
   Úsid©ÚQueryContextr   r   ©r   rB   r   r   r   Úget«   ó   	zQueryList.getc                 C   r?   r@   rC   rE   r   r   r   Ú__call__¶   rG   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   r3   r:   rF   rH   rL   Ú__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 )at  
        Initialize the QueryPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param assistant_sid: The unique ID of the parent Assistant.

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryPage
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryPage
        N)r   r+   r   r   )r   r   r.   Ú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
   r9   )r;   r   r   )r   r>   r   r   r   Úget_instanceà   rG   zQueryPage.get_instancec                 C   rI   )rJ   z<Twilio.Autopilot.V1.QueryPage>r   rK   r   r   r   rL   ë   rM   zQueryPage.__repr__)rN   rO   rP   rQ   r   rU   rL   rS   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 )rD   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 unique ID of the Assistant.
        :param sid: A 34-character string that uniquely identifies this resource.

        :returns: twilio.rest.autopilot.v1.assistant.query.QueryContext
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryContext
        rA   z)/Assistants/{assistant_sid}/Queries/{sid}Nr   )r   rD   r   r   r   r   )r   r   r
   rB   r   r   r   r   ú   s   zQueryContext.__init__c                 C   s<   t  i ¡}| jjd| j|d�}t| j|| jd | jd d�S )ú—
        Fetch a QueryInstance

        :returns: Fetched QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        r'   r(   r
   rB   rA   )r   r*   r   Úfetchr   r;   r   )r   r)   r>   r   r   r   rW     s   
ýüzQueryContext.fetchc                 C   sB   t  ||dœ¡}| jjd| j|d�}t| j|| jd | jd d�S )á�  
        Update the QueryInstance

        :param unicode sample_sid: An optional reference to the Sample created from this query.
        :param unicode status: A string that described the query status. The values can be: `pending_review`, `reviewed`, `discarded`

        :returns: Updated QueryInstance
        :rtype: twilio.rest.autopilot.v1.assistant.query.QueryInstance
        )Ú	SampleSidr$   r6   r7   r
   rB   rA   )r   r*   r   Úupdater   r;   r   )r   Ú
sample_sidr   r8   r>   r   r   r   rZ   !  s   
ýüzQueryContext.updatec                 C   s   | j  d| j¡S )ú|
        Deletes the QueryInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        Údelete)r   r]   r   rK   r   r   r   r]   :  s   zQueryContext.deletec                 C   ó$   d  dd„ | j ¡ D ƒ¡}d |¡S )rJ   ú c                 s   ó    � | ]\}}d   ||¡V  qdS ©z{}={}N©r   ©Ú.0ÚkÚvr   r   r   Ú	<genexpr>J  ó   € z(QueryContext.__repr__.<locals>.<genexpr>z%<Twilio.Autopilot.V1.QueryContext {}>©Újoinr   Úitemsr   ©r   Úcontextr   r   r   rL   C  ó   
zQueryContext.__repr__)rN   rO   rP   rQ   r   rW   r   rR   rZ   r]   rL   rS   r   r   r   r   rD   õ   s    	rD   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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| _||pC| 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
   rB   r   ÚurlÚsource_channel)ro   rp   rq   rr   r   rs   r<   r[   r
   rB   r   rt   ru   NrA   )r   r;   r   r   Úiso8601_datetimeÚ_propertiesÚ_contextr   )r   r   r>   r
   rB   r   r   r   r   S  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
   rB   rA   )rx   rD   r   r   rK   r   r   r   Ú_proxyq  s   
	ýzQueryInstance._proxyc                 C   ó
   | j d S )zi
        :returns: The unique ID of the Account that created this Query.
        :rtype: unicode
        ro   ©rw   rK   r   r   r   ro   ‚  ó   
zQueryInstance.account_sidc                 C   rz   )z\
        :returns: The date that this resource was created
        :rtype: datetime
        rp   r{   rK   r   r   r   rp   Š  r|   zQueryInstance.date_createdc                 C   rz   )za
        :returns: The date that this resource was last updated
        :rtype: datetime
        rq   r{   rK   r   r   r   rq   ’  r|   zQueryInstance.date_updatedc                 C   rz   )a  
        :returns: The natural language analysis results which include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized, the confidence score, and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field).
        :rtype: dict
        rr   r{   rK   r   r   r   rr   š  r|   zQueryInstance.resultsc                 C   rz   )zà
        :returns: An [ISO language-country string](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) that specifies the language used for this query. For example: `en-US`
        :rtype: unicode
        r   r{   rK   r   r   r   r   ¢  r|   zQueryInstance.languagec                 C   rz   )z–
        :returns: The unique ID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried.
        :rtype: unicode
        rs   r{   rK   r   r   r   rs   ª  r|   zQueryInstance.model_build_sidc                 C   rz   )zZ
        :returns: The end-user's natural language input.
        :rtype: unicode
        r<   r{   rK   r   r   r   r<   ²  r|   zQueryInstance.queryc                 C   rz   )zp
        :returns: An optional reference to the Sample created from this query.
        :rtype: unicode
        r[   r{   rK   r   r   r   r[   º  r|   zQueryInstance.sample_sidc                 C   rz   )zZ
        :returns: The unique ID of the parent Assistant.
        :rtype: unicode
        r
   r{   rK   r   r   r   r
   Â  r|   zQueryInstance.assistant_sidc                 C   rz   )zq
        :returns: A 34-character string that uniquely identifies this resource.
        :rtype: unicode
        rB   r{   rK   r   r   r   rB   Ê  r|   zQueryInstance.sidc                 C   rz   )zš
        :returns: A string that describes the query status. The values can be: `pending_review`, `reviewed`, `discarded`
        :rtype: unicode
        r   r{   rK   r   r   r   r   Ò  r|   zQueryInstance.statusc                 C   rz   )z;
        :returns: The url
        :rtype: unicode
        rt   r{   rK   r   r   r   rt   Ú  r|   zQueryInstance.urlc                 C   rz   )zq
        :returns: The communication channel where this end-user input came from
        :rtype: unicode
        ru   r{   rK   r   r   r   ru   â  r|   zQueryInstance.source_channelc                 C   ó
   | j  ¡ S )rV   )ry   rW   rK   r   r   r   rW   ê  ó   
zQueryInstance.fetchc                 C   s   | j j||d�S )rX   )r[   r   )ry   rZ   )r   r[   r   r   r   r   rZ   ó  s   
zQueryInstance.updatec                 C   r}   )r\   )ry   r]   rK   r   r   r   r]   ÿ  r~   zQueryInstance.deletec                 C   r^   )rJ   r_   c                 s   r`   ra   rb   rc   r   r   r   rg     rh   z)QueryInstance.__repr__.<locals>.<genexpr>z&<Twilio.Autopilot.V1.QueryInstance {}>ri   rl   r   r   r   rL     rn   zQueryInstance.__repr__)N)rN   rO   rP   rQ   r   Úpropertyry   ro   rp   rq   rr   r   rs   r<   r[   r
   rB   r   rt   ru   rW   r   rR   rZ   r]   rL   rS   r   r   r   r   r;   N  sF    













		r;   N)rQ   Útwilio.baser   r   Útwilio.base.instance_contextr   Útwilio.base.instance_resourcer   Útwilio.base.list_resourcer   Útwilio.base.pager   r   r+   rD   r;   r   r   r   r   Ú<module>   s    ;*Y