o
    �¨ÊhÞK  ã                   @   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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 )aH  
        Initialize the QueryList

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

        :returns: twilio.rest.preview.understand.assistant.query.QueryList
        :rtype: twilio.rest.preview.understand.assistant.query.QueryList
        Úassistant_sidz#/Assistants/{assistant_sid}/QueriesN© )Úsuperr   Ú__init__Ú	_solutionÚformatÚ_uri)ÚselfÚversionr
   ©Ú	__class__r   ú`/var/www/html/env/lib/python3.10/site-packages/twilio/rest/preview/understand/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 of the sample.
        :param unicode model_build: The Model Build Sid or unique name of the 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.preview.understand.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 )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: An ISO language-country string of the sample.
        :param unicode model_build: The Model Build Sid or unique name of the 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.preview.understand.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 of the sample.
        :param unicode model_build: The Model Build Sid or unique name of the 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.preview.understand.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 )a<  
        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.preview.understand.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 )a›  
        Create a new QueryInstance

        :param unicode language: An ISO language-country string of the sample.
        :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 Model Build Sid or unique name of the Model Build to be queried.
        :param unicode field: Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format task-unique-name-1:field-unique-name

        :returns: Newly created QueryInstance
        :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance
        )r"   ÚQueryÚTasksr#   ÚFieldÚPOST©Údatar
   ©r
   )r   r*   r   Úcreater   ÚQueryInstancer   )r   r   ÚqueryÚtasksr   Úfieldr9   Ú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.preview.understand.assistant.query.QueryContext
        :rtype: twilio.rest.preview.understand.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.Preview.Understand.QueryList>r   ©r   r   r   r   Ú__repr__É   ó   zQueryList.__repr__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úunsetr   r!   r   r3   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 unique ID of the parent Assistant.

        :returns: twilio.rest.preview.understand.assistant.query.QueryPage
        :rtype: twilio.rest.preview.understand.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.preview.understand.assistant.query.QueryInstance
        :rtype: twilio.rest.preview.understand.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.Preview.Understand.QueryPage>r   rM   r   r   r   rN   ó   rO   zQueryPage.__repr__)rP   rQ   rR   rS   r   rW   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 unique ID of the Assistant.
        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.preview.understand.assistant.query.QueryContext
        :rtype: twilio.rest.preview.understand.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   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.preview.understand.assistant.query.QueryInstance
        r'   r(   r
   rD   rC   )r   r*   r   Úfetchr   r<   r   )r   r)   r@   r   r   r   rY     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.preview.understand.assistant.query.QueryInstance
        )Ú	SampleSidr$   r7   r8   r
   rD   rC   )r   r*   r   Úupdater   r<   r   )r   Ú
sample_sidr   r9   r@   r   r   r   r\   )  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   rM   r   r   r   r_   B  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>R  ó   € z(QueryContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Understand.QueryContext {}>©Újoinr   Úitemsr   ©r   Úcontextr   r   r   rN   K  ó   
zQueryContext.__repr__)rP   rQ   rR   rS   r   rY   r   rT   r\   r_   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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.preview.understand.assistant.query.QueryInstance
        :rtype: twilio.rest.preview.understand.assistant.query.QueryInstance
        Úaccount_sidÚdate_createdÚdate_updatedÚresultsr   Úmodel_build_sidr=   r]   r
   rD   r   ÚurlÚsource_channel)rq   rr   rs   rt   r   ru   r=   r]   r
   rD   r   rv   rw   NrC   )r   r<   r   r   Úiso8601_datetimeÚ_propertiesÚ_contextr   )r   r   r@   r
   rD   r   r   r   r   [  s"   ózQueryInstance.__init__c                 C   s.   | j du rt| j| jd | jd d�| _ | j S )a2  
        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.preview.understand.assistant.query.QueryContext
        Nr
   rD   rC   )rz   rF   r   r   rM   r   r   r   Ú_proxyy  s   
	ýzQueryInstance._proxyc                 C   ó
   | j d S )zi
        :returns: The unique ID of the Account that created this Query.
        :rtype: unicode
        rq   ©ry   rM   r   r   r   rq   Š  ó   
zQueryInstance.account_sidc                 C   r|   )z\
        :returns: The date that this resource was created
        :rtype: datetime
        rr   r}   rM   r   r   r   rr   ’  r~   zQueryInstance.date_createdc                 C   r|   )za
        :returns: The date that this resource was last updated
        :rtype: datetime
        rs   r}   rM   r   r   r   rs   š  r~   zQueryInstance.date_updatedc                 C   r|   )z¯
        :returns: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields.
        :rtype: dict
        rt   r}   rM   r   r   r   rt   ¢  r~   zQueryInstance.resultsc                 C   r|   )za
        :returns: An ISO language-country string of the sample.
        :rtype: unicode
        r   r}   rM   r   r   r   r   ª  r~   zQueryInstance.languagec                 C   r|   )z]
        :returns: The unique ID of the Model Build queried.
        :rtype: unicode
        ru   r}   rM   r   r   r   ru   ²  r~   zQueryInstance.model_build_sidc                 C   r|   )zZ
        :returns: The end-user's natural language input.
        :rtype: unicode
        r=   r}   rM   r   r   r   r=   º  r~   zQueryInstance.queryc                 C   r|   )zp
        :returns: An optional reference to the Sample created from this query.
        :rtype: unicode
        r]   r}   rM   r   r   r   r]   Â  r~   zQueryInstance.sample_sidc                 C   r|   )zZ
        :returns: The unique ID of the parent Assistant.
        :rtype: unicode
        r
   r}   rM   r   r   r   r
   Ê  r~   zQueryInstance.assistant_sidc                 C   r|   )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rD   r}   rM   r   r   r   rD   Ò  r~   zQueryInstance.sidc                 C   r|   )z”
        :returns: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :rtype: unicode
        r   r}   rM   r   r   r   r   Ú  r~   zQueryInstance.statusc                 C   r|   )z;
        :returns: The url
        :rtype: unicode
        rv   r}   rM   r   r   r   rv   â  r~   zQueryInstance.urlc                 C   r|   )zq
        :returns: The communication channel where this end-user input came from
        :rtype: unicode
        rw   r}   rM   r   r   r   rw   ê  r~   zQueryInstance.source_channelc                 C   ó
   | j  ¡ S )rX   )r{   rY   rM   r   r   r   rY   ò  ó   
zQueryInstance.fetchc                 C   s   | j j||d�S )rZ   )r]   r   )r{   r\   )r   r]   r   r   r   r   r\   û  s   
zQueryInstance.updatec                 C   r   )r^   )r{   r_   rM   r   r   r   r_     r€   zQueryInstance.deletec                 C   r`   )rL   ra   c                 s   rb   rc   rd   re   r   r   r   ri     rj   z)QueryInstance.__repr__.<locals>.<genexpr>z,<Twilio.Preview.Understand.QueryInstance {}>rk   rn   r   r   r   rN     rp   zQueryInstance.__repr__)N)rP   rQ   rR   rS   r   Úpropertyr{   rq   rr   rs   rt   r   ru   r=   r]   r
   rD   r   rv   rw   rY   r   rT   r\   r_   rN   rU   r   r   r   r   r<   V  sF    













		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    C*Y