o
    /it                     @   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dedeeef dedee f fddZ	e
dddZd	efddZd	efddZdddZdddZejejfdeeef deeef d	d fddZejejfdeeef deeef d	d fddZd	ef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| _||pe| 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__ c/var/www/html/philips/venv/lib/python3.10/site-packages/twilio/rest/autopilot/v1/assistant/query.pyr$   -   s.   
zQueryInstance.__init__returnQueryContextc                 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   
   | j  S )h
        Deletes the QueryInstance


        :returns: True if delete succeeds, False otherwise
        )r2   deleter1   r,   r,   r-   r5   _      
zQueryInstance.deletec                       | 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-   r9   h      zQueryInstance.delete_asyncc                 C   r3   )W
        Fetch the QueryInstance


        :returns: The fetched QueryInstance
        )r2   fetchr1   r,   r,   r-   r<   q   r6   zQueryInstance.fetchc                    r7   )q
        Asynchronous coroutine to fetch the QueryInstance


        :returns: The fetched QueryInstance
        N)r2   fetch_asyncr1   r,   r,   r-   r>   z   r:   zQueryInstance.fetch_asyncr   r   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   )r2   updater)   r   r   r,   r,   r-   rA      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)r2   update_asyncrB   r,   r,   r-   rD      s
   zQueryInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 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'   itemsrK   r)   contextr,   r,   r-   __repr__      
zQueryInstance.__repr__N)r.   r/   )r.   r   )__name__
__module____qualname____doc__r   r   strr   r   r$   propertyr2   boolr5   r9   r<   r>   r   unsetr   objectrA   rD   rW   __classcell__r,   r,   r*   r-   r      sJ    
"	
	
	





r   c                       s   e Zd Zdededef fddZdefddZdefd	d
Zde	fddZ
de	fddZejejfdeeef deeef de	fddZejejfdeeef deeef de	fddZdefddZ  ZS )r/   r   r   r   c                    s0   t  | ||d| _djd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}Nr,   r#   r$   r'   rK   _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)r0   r5   re   r1   r,   r,   r-   r5      s   zQueryContext.deletec                    s   | j jd| jdI dH S )r8   rf   rg   N)r0   r9   re   r1   r,   r,   r-   r9      s
   zQueryContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r;   GETrg   r   r   r"   )r0   r<   re   r   r'   r)   r   r,   r,   r-   r<      s   zQueryContext.fetchc                    s8   | j jd| jdI dH }t| j || jd | jd dS )r=   rj   rg   Nr   r   r"   )r0   r>   re   r   r'   rk   r,   r,   r-   r>      s   zQueryContext.fetch_asyncr   r   c                 C   sB   t ||d}| jjd| j|d}t| j|| jd | jd dS )r?   	SampleSidStatusPOSTrh   ri   datar   r   r"   )r   ofr0   rA   re   r   r'   r)   r   r   rq   r   r,   r,   r-   rA     s    zQueryContext.updatec                    sJ   t ||d}| jjd| j|dI dH }t| j|| jd | jd dS )rC   rl   ro   rp   Nr   r   r"   )r   rr   r0   rD   re   r   r'   rs   r,   r,   r-   rD   $  s"   zQueryContext.update_asyncc                 C   rE   )rF   rG   c                 s   rH   rI   rJ   rL   r,   r,   r-   rP   K  rQ   z(QueryContext.__repr__.<locals>.<genexpr>z%<Twilio.Autopilot.V1.QueryContext {}>rR   rU   r,   r,   r-   rW   E  rX   zQueryContext.__repr__)rZ   r[   r\   r   r^   r$   r`   r5   r9   r   r<   r>   r   ra   r   rb   rA   rD   rW   rc   r,   r,   r*   r-   r/      s2    


#


!r/   c                   @   s4   e Zd Zdeeef defddZdefddZdS )	QueryPager   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'   rk   r,   r,   r-   get_instanceP     zQueryPage.get_instancec                 C      dS )rF   z<Twilio.Autopilot.V1.QueryPage>r,   r1   r,   r,   r-   rW   Z     zQueryPage.__repr__N)	rZ   r[   r\   r   r^   r   r   rv   rW   r,   r,   r,   r-   rt   O  s    
rt   c                       s  e Zd Zdedef fddZejejfdededeee	f deee	f d	e
f
d
dZejejfdededeee	f deee	f d	e
f
ddZejejejejddfdeee	f deee	f deee	f deee	f dee dee d	ee
 fddZejejejejddfdeee	f deee	f deee	f deee	f dee dee d	ee
 fddZejejejejddfdeee	f deee	f deee	f deee	f dee dee d	ee
 fddZejejejejddfdeee	f deee	f deee	f deee	f dee dee d	ee
 fddZejejejejejejejfdeee	f deee	f deee	f deee	f deee	f deee	f deee	f d	efddZejejejejejejejfdeee	f deee	f deee	f deee	f deee	f deee	f deee	f d	efdd Zd!ed	efd"d#Zd!ed	efd$d%Zd&ed	efd'd(Zd&ed	efd)d*Zd	efd+d,Z  ZS )-	QueryListr   r   c                    s.   t  | d|i| _djd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,   rd   )r)   r   r   r*   r,   r-   r$   d  s   zQueryList.__init__r   r   tasksmodel_buildr.   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
        LanguageQueryTasks
ModelBuildro   rp   r   ru   )r   rr   r0   createre   r   r'   r)   r   r   r{   r|   rq   r   r,   r,   r-   r   t  s   	zQueryList.createc                    sF   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
        r}   ro   rp   Nr   ru   )r   rr   r0   create_asyncre   r   r'   r   r,   r,   r-   r     s    	zQueryList.create_asyncNr   r!   limit	page_sizec           	      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
        r   r   r|   r   r!   r   r   )r0   read_limitspagestream	r)   r   r|   r   r!   r   r   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
        r   r   Nr   )r0   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   r|   r   r!   r   r   )listr   r)   r   r|   r   r!   r   r   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 rY   r,   )rM   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
page_tokenpage_numberc           
   
   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
        r~   r   rn   DialogueSid	PageTokenr   PageSizerj   rh   ri   params)r   rr   r0   r   re   rt   r'   
r)   r   r|   r   r!   r   r   r   rq   responser,   r,   r-   r   W  s   zQueryList.pagec           
   
      sF   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   rj   r   N)r   rr   r0   r   re   rt   r'   r   r,   r,   r-   r   ~  s   zQueryList.page_async
target_urlc                 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
        rj   )r0   domaintwiliorequestrt   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
        rj   N)r0   r   r   request_asyncrt   r'   r   r,   r,   r-   get_page_async  s   	zQueryList.get_page_asyncr   c                 C      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/   r0   r'   r)   r   r,   r,   r-   r%     rw   zQueryList.getc                 C   r   r   r   r   r,   r,   r-   __call__  rw   zQueryList.__call__c                 C   rx   )rF   z<Twilio.Autopilot.V1.QueryList>r,   r1   r,   r,   r-   rW     ry   zQueryList.__repr__) rZ   r[   r\   r   r^   r$   r   ra   r   rb   r   r   r   r   intr   r   r	   r   r   r   r   rt   r   r   r   r   r/   r%   r   rW   rc   r,   r,   r*   r-   rz   c  sJ   


(


&




)




)




(




)






	
)






	
)

rz   N)r]   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r/   rt   rz   r,   r,   r,   r-   <module>   s    $  