a
    !fAg                     @   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 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 - Preview
    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values)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   e Zd ZdZdeeeef eee d fddZ	e
dddd	Zedd
dZedddZd dddZd dddZejejfeeef eeef d dddZejejfeeef eeef d dddZedddZ  ZS )QueryInstancea  
    :ivar account_sid: The unique ID of the Account that created this Query.
    :ivar date_created: The date that this resource was created
    :ivar date_updated: The date that this resource was last updated
    :ivar results: The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields.
    :ivar language: An ISO language-country string of the sample.
    :ivar model_build_sid: The unique ID of the Model Build queried.
    :ivar query: The end-user's natural language input.
    :ivar sample_sid: An optional reference to the Sample created from this query.
    :ivar assistant_sid: The unique ID of the parent Assistant.
    :ivar sid: A 34 character string that uniquely identifies this resource.
    :ivar status: A string that described the query status. The values can be: pending_review, reviewed, discarded
    :ivar url:
    :ivar source_channel: The communication channel where this end-user input came from
    N)versionpayloadassistant_sidsidc                    s   t  | |d| _t|d| _t|d| _|d| _|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _||p| jd| _d | _d S )Naccount_siddate_createddate_updatedresultslanguagemodel_build_sidquery
sample_sidr   r   statusurlsource_channelr   r   )super__init__getr   r
   iso8601_datetimer   r   r   r   r   r   r   r   r   r   r   r    	_solution_context)selfr   r   r   r   	__class__ o/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/preview/understand/assistant/query.pyr#   ,   s,    zQueryInstance.__init__QueryContextreturnc                 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: QueryContext for this QueryInstance
        Nr   r   r!   )r'   r-   _versionr&   r(   r+   r+   r,   _proxyM   s    
zQueryInstance._proxyc                 C   s
   | j  S )h
        Deletes the QueryInstance


        :returns: True if delete succeeds, False otherwise
        )r2   deleter1   r+   r+   r,   r4   ]   s    zQueryInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the QueryInstance


        :returns: True if delete succeeds, False otherwise
        N)r2   delete_asyncr1   r+   r+   r,   r6   f   s    zQueryInstance.delete_asyncc                 C   s
   | j  S )W
        Fetch the QueryInstance


        :returns: The fetched QueryInstance
        )r2   fetchr1   r+   r+   r,   r8   o   s    zQueryInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the QueryInstance


        :returns: The fetched QueryInstance
        N)r2   fetch_asyncr1   r+   r+   r,   r:   x   s    zQueryInstance.fetch_asyncr   r   r/   c                 C   s   | j j||dS )(  
        Update the QueryInstance

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

        :returns: The updated QueryInstance
        r   r   )r2   updater(   r   r   r+   r+   r,   r>      s    zQueryInstance.updatec                    s   | j j||dI dH S )B  
        Asynchronous coroutine to update the QueryInstance

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

        :returns: The updated QueryInstance
        r=   N)r2   update_asyncr?   r+   r+   r,   rA      s    zQueryInstance.update_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr+   r+   r,   	<genexpr>       z)QueryInstance.__repr__.<locals>.<genexpr>z,<Twilio.Preview.Understand.QueryInstance {}>joinr&   itemsrF   r(   contextr+   r+   r,   __repr__   s    zQueryInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r#   propertyr2   boolr4   r6   r8   r:   r   unsetr   objectr>   rA   rR   __classcell__r+   r+   r)   r,   r      s:    
!			



r   c                       s   e Zd Zeeed fddZedddZedddZe	dd	d
Z
e	dddZejejfeeef eeef e	dddZejejfeeef eeef e	dddZedddZ  ZS )r-   )r   r   r   c                    s0   t  | ||d| _djf i | j| _dS )a   
        Initialize the QueryContext

        :param version: Version that contains the resource
        :param assistant_sid: The unique ID of the parent Assistant.
        :param sid: A 34 character string that uniquely identifies this resource.
        r!   z)/Assistants/{assistant_sid}/Queries/{sid}Nr"   r#   r&   rF   _uri)r(   r   r   r   r)   r+   r,   r#      s
    zQueryContext.__init__r.   c                 C   s   | j jd| jdS )r3   DELETEmethoduri)r0   r4   r^   r1   r+   r+   r,   r4      s    zQueryContext.deletec                    s   | j jd| jdI dH S )r5   r_   r`   N)r0   r6   r^   r1   r+   r+   r,   r6      s    zQueryContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r7   GETr`   r   r   r!   )r0   r8   r^   r   r&   r(   r   r+   r+   r,   r8      s    zQueryContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )r9   rc   r`   Nr   r   r!   )r0   r:   r^   r   r&   rd   r+   r+   r,   r:      s    zQueryContext.fetch_asyncr;   c                 C   sB   t ||d}| jjd| j|d}t| j|| jd | jd dS )r<   Z	SampleSidStatusPOSTra   rb   datar   r   r!   )r   ofr0   r>   r^   r   r&   r(   r   r   ri   r   r+   r+   r,   r>     s     zQueryContext.updatec                    sH   t ||d}| jjd| j|dI dH }t| j|| jd | jd dS )r@   re   rg   rh   Nr   r   r!   )r   rj   r0   rA   r^   r   r&   rk   r+   r+   r,   rA   "  s     zQueryContext.update_asyncc                 C   s$   d dd | j D }d|S )rB   rC   c                 s   s   | ]\}}d  ||V  qdS rD   rE   rG   r+   r+   r,   rK   I  rL   z(QueryContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Understand.QueryContext {}>rM   rP   r+   r+   r,   rR   C  s    zQueryContext.__repr__)rS   rT   rU   r   rW   r#   rY   r4   r6   r   r8   r:   r   rZ   r   r[   r>   rA   rR   r\   r+   r+   r)   r,   r-      s(   

#

!r-   c                   @   s2   e Zd Zeeef edddZedddZdS )	QueryPage)r   r/   c                 C   s   t | j|| jd dS )zk
        Build an instance of QueryInstance

        :param payload: Payload response from the API
        r   r   )r   r0   r&   rd   r+   r+   r,   get_instanceN  s    zQueryPage.get_instancer.   c                 C   s   dS )rB   z%<Twilio.Preview.Understand.QueryPage>r+   r1   r+   r+   r,   rR   X  s    zQueryPage.__repr__N)	rS   rT   rU   r   rW   r   r   rn   rR   r+   r+   r+   r,   rl   M  s   
rl   c                	       s  e Zd Zeed fddZejejejfeeeee	f eee	f eee	f e
dddZejejejfeeeee	f eee	f eee	f e
dddZejejejd	d	feee	f eee	f eee	f ee ee ee
 d
ddZejejejd	d	feee	f eee	f eee	f ee ee ee
 d
ddZejejejd	d	feee	f eee	f eee	f ee ee ee
 d
ddZejejejd	d	feee	f eee	f eee	f ee ee ee
 d
ddZejejejejejejfeee	f eee	f eee	f eee	f eee	f eee	f edddZejejejejejejfeee	f eee	f eee	f eee	f eee	f eee	f edddZeedddZeedddZeedddZeedd d!Zed"d#d$Z  ZS )%	QueryList)r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the QueryList

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

        r   z#/Assistants/{assistant_sid}/QueriesNr]   )r(   r   r   r)   r+   r,   r#   b  s    zQueryList.__init__)r   r   tasksmodel_buildfieldr/   c                 C   s@   t |||||d}| jjd| j|d}t| j|| jd dS )a*  
        Create the QueryInstance

        :param language: An ISO language-country string of the sample.
        :param 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 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 model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param 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: The created QueryInstance
        LanguageZQueryZTasks
ModelBuildFieldrg   rh   r   rm   )r   rj   r0   creater^   r   r&   r(   r   r   rp   rq   rr   ri   r   r+   r+   r,   rw   r  s     
zQueryList.createc                    sF   t |||||d}| jjd| j|dI dH }t| j|| jd dS )a9  
        Asynchronously create the QueryInstance

        :param language: An ISO language-country string of the sample.
        :param 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 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 model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param 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: The created QueryInstance
        rs   rg   rh   Nr   rm   )r   rj   r0   create_asyncr^   r   r&   rx   r+   r+   r,   ry     s     
zQueryList.create_asyncN)r   rq   r   limit	page_sizer/   c                 C   s6   | j ||}| j||||d d}| j ||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 str language: An ISO language-country string of the sample.
        :param str model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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
        r{   r   rq   r   r{   rz   )r0   read_limitspagestreamr(   r   rq   r   rz   r{   Zlimitsr~   r+   r+   r,   r     s    zQueryList.streamc                    s<   | j ||}| j||||d dI dH }| j ||d S )a  
        Asynchronously 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 str language: An ISO language-country string of the sample.
        :param str model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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
        r{   r|   Nrz   )r0   r}   
page_asyncstream_asyncr   r+   r+   r,   r     s    zQueryList.stream_asyncc                 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 str language: An ISO language-country string of the sample.
        :param str model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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
        r   rq   r   rz   r{   )listr   r(   r   rq   r   rz   r{   r+   r+   r,   r     s    zQueryList.listc                    s*   dd | j |||||dI dH 2 I dH S )a3  
        Asynchronously 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 str language: An ISO language-country string of the sample.
        :param str model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param str status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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 )Nr+   )rH   recordr+   r+   r,   
<listcomp>D  s   z(QueryList.list_async.<locals>.<listcomp>r   N)r   r   r+   r+   r,   
list_async+  s    
zQueryList.list_async)r   rq   r   
page_tokenpage_numberr{   r/   c           	   	   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 language: An ISO language-country string of the sample.
        :param model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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 QueryInstance
        rt   ru   rf   Z	PageTokenr   ZPageSizerc   ra   rb   params)r   rj   r0   r~   r^   rl   r&   	r(   r   rq   r   r   r   r{   ri   responser+   r+   r,   r~   O  s    zQueryList.pagec           	   	      sB   t ||||||d}| jjd| j|dI dH }t| j|| jS )a  
        Asynchronously retrieve a single page of QueryInstance records from the API.
        Request is executed immediately

        :param language: An ISO language-country string of the sample.
        :param model_build: The Model Build Sid or unique name of the Model Build to be queried.
        :param status: A string that described the query status. The values can be: pending_review, reviewed, discarded
        :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 QueryInstance
        r   rc   r   N)r   rj   r0   r   r^   rl   r&   r   r+   r+   r,   r   s  s    zQueryList.page_async)
target_urlr/   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of QueryInstance records from the API.
        Request is executed immediately

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

        :returns: Page of QueryInstance
        rc   )r0   domaintwiliorequestrl   r&   r(   r   r   r+   r+   r,   get_page  s    	zQueryList.get_pagec                    s(   | j jjd|I dH }t| j || jS )z
        Asynchronously retrieve a specific page of QueryInstance records from the API.
        Request is executed immediately

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

        :returns: Page of QueryInstance
        rc   N)r0   r   r   Zrequest_asyncrl   r&   r   r+   r+   r,   get_page_async  s    	zQueryList.get_page_async)r   r/   c                 C   s   t | j| jd |dS z~
        Constructs a QueryContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r   r!   r-   r0   r&   r(   r   r+   r+   r,   r$     s    zQueryList.getc                 C   s   t | j| jd |dS r   r   r   r+   r+   r,   __call__  s    zQueryList.__call__r.   c                 C   s   dS )rB   z%<Twilio.Preview.Understand.QueryList>r+   r1   r+   r+   r,   rR     s    zQueryList.__repr__) rS   rT   rU   r   rW   r#   r   rZ   r   r[   r   rw   ry   r   intr   r   r	   r   r   r   r   rl   r~   r   r   r   r-   r$   r   rR   r\   r+   r+   r)   r,   ro   a  s   


+


)


&


&


%


&





&





&

ro   N)rV   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r-   rl   ro   r+   r+   r+   r,   <module>   s   $  