o
    f>hdI                     @   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 - Assistants
    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ddZdddZd	efddZd	efddZd	efddZ  ZS )AssistantsKnowledgeInstancea  
    :ivar description: The type of knowledge source.
    :ivar id: The description of knowledge.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource.
    :ivar knowledge_source_details: The details of the knowledge source based on the type.
    :ivar name: The name of the knowledge source.
    :ivar status: The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED')
    :ivar type: The type of knowledge source ('Web', 'Database', 'Text', 'File')
    :ivar url: The url of the knowledge resource.
    :ivar embedding_model: The embedding model to be used for the knowledge source.
    :ivar date_created: The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    Nversionpayloadassistant_ididc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _t|d
| _t|d| _||pS| jd| _d | _d S )Ndescriptionr   account_sidknowledge_source_detailsnamestatustypeurlembedding_modeldate_createddate_updatedr   r   )super__init__getr   r   r   r   r   r   r   r   r   r
   iso8601_datetimer   r   	_solution_context)selfr   r   r   r   	__class__ k/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/assistants/v1/assistant/assistants_knowledge.pyr"   (   s,   
z$AssistantsKnowledgeInstance.__init__returnAssistantsKnowledgeContextc                 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: AssistantsKnowledgeContext for this AssistantsKnowledgeInstance
        Nr   r   r    )r&   r-   _versionr%   r'   r*   r*   r+   _proxyI   s   
z"AssistantsKnowledgeInstance._proxyc                 C   
   | j  S )t
        Create the AssistantsKnowledgeInstance


        :returns: The created AssistantsKnowledgeInstance
        )r0   creater/   r*   r*   r+   r3   Y      
z"AssistantsKnowledgeInstance.createc                       | j  I dH S )
        Asynchronous coroutine to create the AssistantsKnowledgeInstance


        :returns: The created AssistantsKnowledgeInstance
        N)r0   create_asyncr/   r*   r*   r+   r7   b      z(AssistantsKnowledgeInstance.create_asyncc                 C   r1   )v
        Deletes the AssistantsKnowledgeInstance


        :returns: True if delete succeeds, False otherwise
        )r0   deleter/   r*   r*   r+   r:   k   r4   z"AssistantsKnowledgeInstance.deletec                    r5   )
        Asynchronous coroutine that deletes the AssistantsKnowledgeInstance


        :returns: True if delete succeeds, False otherwise
        N)r0   delete_asyncr/   r*   r*   r+   r<   t   r8   z(AssistantsKnowledgeInstance.delete_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>       z7AssistantsKnowledgeInstance.__repr__.<locals>.<genexpr>z5<Twilio.Assistants.V1.AssistantsKnowledgeInstance {}>joinr%   itemsrC   r'   contextr*   r*   r+   __repr__}      
z$AssistantsKnowledgeInstance.__repr__N)r,   r-   )r,   r   )__name__
__module____qualname____doc__r   r   strr   r   r"   propertyr0   r3   r7   boolr:   r<   rO   __classcell__r*   r*   r(   r+   r      s&    
!

				r   c                       sp   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defddZ  ZS )r-   r   r   r   c                    s0   t  | ||d| _djdi | j| _dS )z
        Initialize the AssistantsKnowledgeContext

        :param version: Version that contains the resource
        :param assistant_id: The assistant ID.
        :param id: The knowledge ID.
        r    z)/Assistants/{assistant_id}/Knowledge/{id}Nr*   r!   r"   r%   rC   _uri)r'   r   r   r   r(   r*   r+   r"      s
   z#AssistantsKnowledgeContext.__init__r,   c                 C   s<   t i }| jjd| j|d}t| j|| jd | jd dS )r2   POSTmethoduridatar   r   r    r   ofr.   r3   r[   r   r%   r'   r`   r   r*   r*   r+   r3      s   
z!AssistantsKnowledgeContext.createc                    sD   t i }| jjd| j|dI dH }t| j|| jd | jd dS )r6   r\   r]   Nr   r   r    r   rb   r.   r7   r[   r   r%   rc   r*   r*   r+   r7      s   
z'AssistantsKnowledgeContext.create_asyncc                 C   s   t i }| jjd| j|dS )r9   DELETEr^   r_   headers)r   rb   r.   r:   r[   r'   rg   r*   r*   r+   r:      s   
z!AssistantsKnowledgeContext.deletec                    s&   t i }| jjd| j|dI dH S )r;   re   rf   N)r   rb   r.   r<   r[   rh   r*   r*   r+   r<      s
   
z'AssistantsKnowledgeContext.delete_asyncc                 C   r=   )r>   r?   c                 s   r@   rA   rB   rD   r*   r*   r+   rH      rI   z6AssistantsKnowledgeContext.__repr__.<locals>.<genexpr>z4<Twilio.Assistants.V1.AssistantsKnowledgeContext {}>rJ   rM   r*   r*   r+   rO      rP   z#AssistantsKnowledgeContext.__repr__)rR   rS   rT   r   rV   r"   r   r3   r7   rX   r:   r<   rO   rY   r*   r*   r(   r+   r-      s    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 )AssistantsKnowledgePager   r,   c                 C   s   t | j|| jd dS )zy
        Build an instance of AssistantsKnowledgeInstance

        :param payload: Payload response from the API
        r   r   )r   r.   r%   )r'   r   r*   r*   r+   get_instance      z$AssistantsKnowledgePage.get_instancec                 C      dS )r>   z.<Twilio.Assistants.V1.AssistantsKnowledgePage>r*   r/   r*   r*   r+   rO         z AssistantsKnowledgePage.__repr__N)	rR   rS   rT   r   rV   r   r   rk   rO   r*   r*   r*   r+   ri      s    
ri   c                	       s  e Zd Zdedef fddZdefddZdefdd	Z	
	
d'de	e
 de	e
 dee fddZ	
	
d'de	e
 de	e
 dee fddZ	
	
d'de	e
 de	e
 dee fddZ	
	
d'de	e
 de	e
 dee fddZejejej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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 )(AssistantsKnowledgeListr   r   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the AssistantsKnowledgeList

        :param version: Version that contains the resource
        :param assistant_id: The assistant ID.

        r   z$/Assistants/{assistant_id}/KnowledgeNr*   rZ   )r'   r   r   r(   r*   r+   r"      s   z AssistantsKnowledgeList.__init__r,   c                 C   s8   t ddi}| jjd| j|d}t| j|| jd dS )r2   Content-Type!application/x-www-form-urlencodedr\   rf   r   rj   ra   r'   rg   r   r*   r*   r+   r3     s
   zAssistantsKnowledgeList.createc                    s@   t ddi}| jjd| j|dI dH }t| j|| jd dS )z
        Asynchronously create the AssistantsKnowledgeInstance


        :returns: The created AssistantsKnowledgeInstance
        rp   rq   r\   rf   Nr   rj   rd   rr   r*   r*   r+   r7     s   z$AssistantsKnowledgeList.create_asyncNlimit	page_sizec                 C   s0   | j ||}| j|d d}| j ||d S )ai  
        Streams AssistantsKnowledgeInstance 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 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
        rt   rt   rs   )r.   read_limitspagestreamr'   rs   rt   limitsrw   r*   r*   r+   rx   -  s   zAssistantsKnowledgeList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )ax  
        Asynchronously streams AssistantsKnowledgeInstance 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 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
        rt   ru   Nrs   )r.   rv   
page_asyncstream_asyncry   r*   r*   r+   r|   F  s   z$AssistantsKnowledgeList.stream_asyncc                 C   s   t | j||dS )a  
        Lists AssistantsKnowledgeInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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
        rs   rt   )listrx   r'   rs   rt   r*   r*   r+   r~   _  s   zAssistantsKnowledgeList.listc                    s&   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists AssistantsKnowledgeInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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 rQ   r*   )rE   recordr*   r*   r+   
<listcomp>  s
    z6AssistantsKnowledgeList.list_async.<locals>.<listcomp>r}   N)r|   r   r*   r*   r+   
list_asyncy  s   
z"AssistantsKnowledgeList.list_async
page_tokenpage_numberc                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| jS )a  
        Retrieve a single page of AssistantsKnowledgeInstance records from the API.
        Request is executed immediately

        :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 AssistantsKnowledgeInstance
        	PageTokenr   PageSizerp   rq   application/jsonAcceptGETr^   r_   paramsrg   )r   rb   r.   rw   r[   ri   r%   r'   r   r   rt   r`   rg   responser*   r*   r+   rw     s   
zAssistantsKnowledgeList.pagec                    sV   t |||d}t ddi}d|d< | jjd| j||dI dH }t| j|| jS )	a  
        Asynchronously retrieve a single page of AssistantsKnowledgeInstance records from the API.
        Request is executed immediately

        :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 AssistantsKnowledgeInstance
        r   rp   rq   r   r   r   r   N)r   rb   r.   r{   r[   ri   r%   r   r*   r*   r+   r{     s   
z"AssistantsKnowledgeList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )a  
        Retrieve a specific page of AssistantsKnowledgeInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AssistantsKnowledgeInstance
        r   )r.   domaintwiliorequestri   r%   r'   r   r   r*   r*   r+   get_page  s   	z AssistantsKnowledgeList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of AssistantsKnowledgeInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AssistantsKnowledgeInstance
        r   N)r.   r   r   request_asyncri   r%   r   r*   r*   r+   get_page_async  s   	z&AssistantsKnowledgeList.get_page_asyncr   c                 C      t | j| jd |dS z_
        Constructs a AssistantsKnowledgeContext

        :param id: The knowledge ID.
        r   r    r-   r.   r%   r'   r   r*   r*   r+   r#     rl   zAssistantsKnowledgeList.getc                 C   r   r   r   r   r*   r*   r+   __call__  rl   z AssistantsKnowledgeList.__call__c                 C   rm   )r>   z.<Twilio.Assistants.V1.AssistantsKnowledgeList>r*   r/   r*   r*   r+   rO     rn   z AssistantsKnowledgeList.__repr__)NN) rR   rS   rT   r   rV   r"   r   r3   r7   r   intr   rx   r	   r|   r   r~   r   r   unsetr   objectri   rw   r{   r   r   r-   r#   r   rO   rY   r*   r*   r(   r+   ro      s    







#



!

ro   N)rU   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-   ri   ro   r*   r*   r*   r+   <module>   s    $n]