U
    ^g%iI                     @   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eeeef eee d fddZ	e
dddd	Zd dd
dZd dddZedddZedddZed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| _||p| 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
   Ziso8601_datetimer   r   	_solution_context)selfr   r   r   r   	__class__ w/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/assistants/v1/assistant/assistants_knowledge.pyr"   (   s,    z$AssistantsKnowledgeInstance.__init__AssistantsKnowledgeContextreturnc                 C   s.   | j dk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   s
   | j  S )t
        Create the AssistantsKnowledgeInstance


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


        :returns: The created AssistantsKnowledgeInstance
        N)r0   create_asyncr/   r)   r)   r*   r4   b   s    z(AssistantsKnowledgeInstance.create_asyncc                 C   s
   | j  S )v
        Deletes the AssistantsKnowledgeInstance


        :returns: True if delete succeeds, False otherwise
        )r0   deleter/   r)   r)   r*   r6   k   s    z"AssistantsKnowledgeInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the AssistantsKnowledgeInstance


        :returns: True if delete succeeds, False otherwise
        N)r0   delete_asyncr/   r)   r)   r*   r8   t   s    z(AssistantsKnowledgeInstance.delete_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>   s     z7AssistantsKnowledgeInstance.__repr__.<locals>.<genexpr>z5<Twilio.Assistants.V1.AssistantsKnowledgeInstance {}>joinr$   itemsr=   r&   contextr)   r)   r*   __repr__}   s    z$AssistantsKnowledgeInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r"   propertyr0   r2   r4   boolr6   r8   rH   __classcell__r)   r)   r'   r*   r      s    
!				r   c                       sl   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dddZ  ZS )r+   )r   r   r   c                    s,   t  | ||d| _djf | 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}Nr!   r"   r$   r=   _uri)r&   r   r   r   r'   r)   r*   r"      s
    z#AssistantsKnowledgeContext.__init__r,   c                 C   sH   t i }t i }| jjd| j||d}t| j|| jd | jd dS )r1   POSTmethoduridataheadersr   r   r    r   ofr.   r2   rR   r   r$   r&   rW   rX   r   r)   r)   r*   r2      s    

   z!AssistantsKnowledgeContext.createc                    sN   t i }t i }| jjd| j||dI dH }t| j|| jd | jd dS )r3   rS   rT   Nr   r   r    r   rZ   r.   r4   rR   r   r$   r[   r)   r)   r*   r4      s    

   z'AssistantsKnowledgeContext.create_asyncc                 C   s   t i }| jjd| j|dS )r5   DELETErU   rV   rX   )r   rZ   r.   r6   rR   r&   rX   r)   r)   r*   r6      s    
z!AssistantsKnowledgeContext.deletec                    s$   t i }| jjd| j|dI dH S )r7   r]   r^   N)r   rZ   r.   r8   rR   r_   r)   r)   r*   r8      s    
  z'AssistantsKnowledgeContext.delete_asyncc                 C   s$   d dd | j D }d|S )r9   r:   c                 s   s   | ]\}}d  ||V  qdS r;   r<   r>   r)   r)   r*   rB      s     z6AssistantsKnowledgeContext.__repr__.<locals>.<genexpr>z4<Twilio.Assistants.V1.AssistantsKnowledgeContext {}>rC   rF   r)   r)   r*   rH      s    z#AssistantsKnowledgeContext.__repr__)rI   rJ   rK   r   rM   r"   r   r2   r4   rO   r6   r8   rH   rP   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 )AssistantsKnowledgePage)r   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   s
      z$AssistantsKnowledgePage.get_instancer,   c                 C   s   dS )r9   z.<Twilio.Assistants.V1.AssistantsKnowledgePage>r)   r/   r)   r)   r*   rH      s    z AssistantsKnowledgePage.__repr__N)	rI   rJ   rK   r   rM   r   r   rb   rH   r)   r)   r)   r*   r`      s   
r`   c                       s  e Zd Zeed fddZedddZedddZd$e	e
 e	e
 ee d
ddZd%e	e
 e	e
 ee d
ddZd&e	e
 e	e
 ee d
ddZd'e	e
 e	e
 ee d
ddZejejejf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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 )(AssistantsKnowledgeList)r   r   c                    s*   t  | d|i| _djf | 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}/KnowledgeNrQ   )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 )r1   Content-Type!application/x-www-form-urlencodedrS   r^   r   ra   rY   r&   rX   r   r)   r)   r*   r2     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
        rd   re   rS   r^   Nr   ra   r\   rf   r)   r)   r*   r4   !  s        z$AssistantsKnowledgeList.create_asyncN)limit	page_sizer-   c                 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
        rh   rh   rg   )r.   read_limitspagestreamr&   rg   rh   Zlimitsrk   r)   r)   r*   rl   3  s    zAssistantsKnowledgeList.streamc                    s6   | 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
        rh   ri   Nrg   )r.   rj   
page_asyncstream_asyncrm   r)   r)   r*   ro   L  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
        rg   rh   )listrl   r&   rg   rh   r)   r)   r*   rq   e  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 )Nr)   )r?   recordr)   r)   r*   
<listcomp>  s   z6AssistantsKnowledgeList.list_async.<locals>.<listcomp>rp   N)ro   rr   r)   r)   r*   
list_async  s    
z"AssistantsKnowledgeList.list_async)
page_tokenpage_numberrh   r-   c                 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
        Z	PageTokenr   ZPageSizerd   re   application/jsonAcceptGETrU   rV   paramsrX   )r   rZ   r.   rk   rR   r`   r$   r&   rv   rw   rh   rW   rX   responser)   r)   r*   rk     s       zAssistantsKnowledgeList.pagec                    sT   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
        rx   rd   re   ry   rz   r{   r|   N)r   rZ   r.   rn   rR   r`   r$   r~   r)   r)   r*   rn     s       z"AssistantsKnowledgeList.page_async)
target_urlr-   c                 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requestr`   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   Zrequest_asyncr`   r$   r   r)   r)   r*   get_page_async  s    	z&AssistantsKnowledgeList.get_page_async)r   r-   c                 C   s   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#     s
      zAssistantsKnowledgeList.getc                 C   s   t | j| jd |dS r   r   r   r)   r)   r*   __call__  s
      z AssistantsKnowledgeList.__call__c                 C   s   dS )r9   z.<Twilio.Assistants.V1.AssistantsKnowledgeList>r)   r/   r)   r)   r*   rH     s    z AssistantsKnowledgeList.__repr__)NN)NN)NN)NN) rI   rJ   rK   r   rM   r"   r   r2   r4   r   intr   rl   r	   ro   r   rq   ru   r   unsetr   objectr`   rk   rn   r   r   r+   r#   r   rH   rP   r)   r)   r'   r*   rc      sl           


#


!

rc   N)rL   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+   r`   rc   r)   r)   r)   r*   <module>   s   $nc