a
    !ft                     @   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 - Autopilot
    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 SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Query resource.
    :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar results: The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field).
    :ivar language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`.
    :ivar model_build_sid: The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried.
    :ivar query: The end-user's natural language input.
    :ivar sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query.
    :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.
    :ivar sid: The unique string that we created to identify the Query resource.
    :ivar status: The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded`
    :ivar url: The absolute URL of the Query resource.
    :ivar source_channel: The communication channel from where the end-user input came.
    :ivar dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
    N)versionpayloadassistant_sidsidc                    s   t  | |d| _t|d| _t|d| _|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dialogue_sidr   r   )super__init__getr   r
   iso8601_datetimer   r   r   r   r   r   r   r   r   r   r   r    r!   	_solution_context)selfr   r   r   r   	__class__ i/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/autopilot/v1/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-   _proxyO   s    
zQueryInstance._proxyc                 C   s
   | j  S )h
        Deletes the QueryInstance


        :returns: True if delete succeeds, False otherwise
        )r3   deleter2   r,   r,   r-   r5   _   s    zQueryInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the QueryInstance


        :returns: True if delete succeeds, False otherwise
        N)r3   delete_asyncr2   r,   r,   r-   r7   h   s    zQueryInstance.delete_asyncc                 C   s
   | j  S )W
        Fetch the QueryInstance


        :returns: The fetched QueryInstance
        )r3   fetchr2   r,   r,   r-   r9   q   s    zQueryInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the QueryInstance


        :returns: The fetched QueryInstance
        N)r3   fetch_asyncr2   r,   r,   r-   r;   z   s    zQueryInstance.fetch_asyncr   r   r0   c                 C   s   | j j||dS )_  
        Update the QueryInstance

        :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query.
        :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded`

        :returns: The updated QueryInstance
        r   r   )r3   updater)   r   r   r,   r,   r-   r?      s    zQueryInstance.updatec                    s   | j j||dI dH S )y  
        Asynchronous coroutine to update the QueryInstance

        :param sample_sid: The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query.
        :param status: The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded`

        :returns: The updated QueryInstance
        r>   N)r3   update_asyncr@   r,   r,   r-   rB      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.Autopilot.V1.QueryInstance {}>joinr'   itemsrG   r)   contextr,   r,   r-   __repr__   s    zQueryInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r$   propertyr3   boolr5   r7   r9   r;   r   unsetr   objectr?   rB   rS   __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 )ak  
        Initialize the QueryContext

        :param version: Version that contains the resource
        :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update.
        :param sid: The Twilio-provided string that uniquely identifies the Query resource to update.
        r"   z)/Assistants/{assistant_sid}/Queries/{sid}Nr#   r$   r'   rG   _uri)r)   r   r   r   r*   r,   r-   r$      s
    zQueryContext.__init__r/   c                 C   s   | j jd| jdS )r4   DELETEmethoduri)r1   r5   r_   r2   r,   r,   r-   r5      s    zQueryContext.deletec                    s   | j jd| jdI dH S )r6   r`   ra   N)r1   r7   r_   r2   r,   r,   r-   r7      s    zQueryContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r8   GETra   r   r   r"   )r1   r9   r_   r   r'   r)   r   r,   r,   r-   r9      s    zQueryContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )r:   rd   ra   Nr   r   r"   )r1   r;   r_   r   r'   re   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rb   rc   datar   r   r"   )r   ofr1   r?   r_   r   r'   r)   r   r   rj   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 )rA   rf   rh   ri   Nr   r   r"   )r   rk   r1   rB   r_   r   r'   rl   r,   r,   r-   rB   $  s     zQueryContext.update_asyncc                 C   s$   d dd | j D }d|S )rC   rD   c                 s   s   | ]\}}d  ||V  qdS rE   rF   rH   r,   r,   r-   rL   K  rM   z(QueryContext.__repr__.<locals>.<genexpr>z%<Twilio.Autopilot.V1.QueryContext {}>rN   rQ   r,   r,   r-   rS   E  s    zQueryContext.__repr__)rT   rU   rV   r   rX   r$   rZ   r5   r7   r   r9   r;   r   r[   r   r\   r?   rB   rS   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   r0   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   r1   r'   re   r,   r,   r-   get_instanceP  s    zQueryPage.get_instancer/   c                 C   s   dS )rC   z<Twilio.Autopilot.V1.QueryPage>r,   r2   r,   r,   r-   rS   Z  s    zQueryPage.__repr__N)	rT   rU   rV   r   rX   r   r   ro   rS   r,   r,   r,   r-   rm   O  s   
rm   c                
       s&  e Zd Zeed fddZejejfeeeee	f eee	f e
dddZejejfeeeee	f eee	f e
dddZejejejejd	d	feee	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d	d	feee	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d	d	feee	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d	d	feee	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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ee	f edddZej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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 )a  
        Initialize the QueryList

        :param version: Version that contains the resource
        :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read.

        r   z#/Assistants/{assistant_sid}/QueriesNr^   )r)   r   r   r*   r,   r-   r$   d  s    zQueryList.__init__)r   r   tasksmodel_buildr0   c                 C   s>   t ||||d}| jjd| j|d}t| j|| jd dS )a(  
        Create the QueryInstance

        :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`.
        :param query: The end-user's natural language input. It can be up to 2048 characters long.
        :param tasks: The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take.
        :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.

        :returns: The created QueryInstance
        LanguageZQueryZTasks
ModelBuildrh   ri   r   rn   )r   rk   r1   creater_   r   r'   r)   r   r   rq   rr   rj   r   r,   r,   r-   rv   t  s    	zQueryList.createc                    sD   t ||||d}| jjd| j|dI dH }t| j|| jd dS )a7  
        Asynchronously create the QueryInstance

        :param language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`.
        :param query: The end-user's natural language input. It can be up to 2048 characters long.
        :param tasks: The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take.
        :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.

        :returns: The created QueryInstance
        rs   rh   ri   Nr   rn   )r   rk   r1   create_asyncr_   r   r'   rw   r,   r,   r-   rx     s    	zQueryList.create_asyncN)r   rr   r   r!   limit	page_sizer0   c           	      C   s8   | 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: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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
        rz   r   rr   r   r!   rz   ry   )r1   read_limitspagestream	r)   r   rr   r   r!   ry   rz   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: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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
        rz   r{   Nry   )r1   r|   
page_asyncstream_asyncr   r,   r,   r-   r     s    zQueryList.stream_asyncc              	   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 str language: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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   rr   r   r!   ry   rz   )listr~   r)   r   rr   r   r!   ry   rz   r,   r,   r-   r   
  s    zQueryList.listc              	      s,   dd | j ||||||dI dH 2 I dH S )aZ  
        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: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param str model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param str status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param str dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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,   )rI   recordr,   r,   r-   
<listcomp>K  s   z(QueryList.list_async.<locals>.<listcomp>r   N)r   r   r,   r,   r-   
list_async0  s    
zQueryList.list_async)r   rr   r   r!   
page_tokenpage_numberrz   r0   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: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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   rg   ZDialogueSidZ	PageTokenr   ZPageSizerd   rb   rc   params)r   rk   r1   r}   r_   rm   r'   
r)   r   rr   r   r!   r   r   rz   rj   responser,   r,   r-   r}   W  s    zQueryList.pagec           
   
      sD   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: The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`.
        :param model_build: The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried.
        :param status: The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded`
        :param dialogue_sid: The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue).
        :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   rd   r   N)r   rk   r1   r   r_   rm   r'   r   r,   r,   r-   r   ~  s    zQueryList.page_async)
target_urlr0   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
        rd   )r1   domaintwiliorequestrm   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
        rd   N)r1   r   r   Zrequest_asyncrm   r'   r   r,   r,   r-   get_page_async  s    	zQueryList.get_page_async)r   r0   c                 C   s   t | j| jd |dS z
        Constructs a QueryContext

        :param sid: The Twilio-provided string that uniquely identifies the Query resource to update.
        r   r"   r.   r1   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 )rC   z<Twilio.Autopilot.V1.QueryList>r,   r2   r,   r,   r-   rS     s    zQueryList.__repr__) rT   rU   rV   r   rX   r$   r   r[   r   r\   r   rv   rx   r   intr   r~   r	   r   r   r   r   rm   r}   r   r   r   r.   r%   r   rS   r]   r,   r,   r*   r-   rp   c  s   

(

&



)



)



(



)






)






)

rp   N)rW   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.   rm   rp   r,   r,   r,   r-   <module>   s   $  