U
    k7g]                     @   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 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feeef d dddZejfeeef d dddZedddZ  ZS )ToolInstancea  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource.
    :ivar description: The description of the tool.
    :ivar enabled: True if the tool is enabled.
    :ivar id: The tool ID.
    :ivar meta: The metadata related to method, url, input_schema to used with the Tool.
    :ivar name: The name of the tool.
    :ivar requires_auth: The authentication requirement for the tool.
    :ivar type: The type of the tool. ('WEBHOOK')
    :ivar url: The url of the tool resource.
    :ivar date_created: The date and time in GMT when the Tool 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 Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar policies: The Policies associated with the tool.
    N)versionpayloadidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _t|d
| _t|d| _|d| _d|p| ji| _d | _d S )Naccount_siddescriptionenabledr   metanamerequires_authtypeurldate_createddate_updatedpolicies)super__init__getr   r   r   r   r   r   r   r   r   r
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ B/tmp/pip-unpacked-wheel-qtbjxrb6/twilio/rest/assistants/v1/tool.pyr!   )   s*     zToolInstance.__init__ToolContextreturnc                 C   s&   | j dkr t| j| 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: ToolContext for this ToolInstance
        Nr   r   )r%   r+   _versionr$   r&   r)   r)   r*   _proxyD   s    
zToolInstance._proxyc                 C   s
   | j  S )g
        Deletes the ToolInstance


        :returns: True if delete succeeds, False otherwise
        )r1   deleter0   r)   r)   r*   r3   S   s    zToolInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the ToolInstance


        :returns: True if delete succeeds, False otherwise
        N)r1   delete_asyncr0   r)   r)   r*   r5   \   s    zToolInstance.delete_asyncc                 C   s
   | j  S )U
        Fetch the ToolInstance


        :returns: The fetched ToolInstance
        )r1   fetchr0   r)   r)   r*   r7   e   s    zToolInstance.fetchc                    s   | j  I dH S )o
        Asynchronous coroutine to fetch the ToolInstance


        :returns: The fetched ToolInstance
        N)r1   fetch_asyncr0   r)   r)   r*   r9   n   s    zToolInstance.fetch_async)assistants_v1_service_update_tool_requestr-   c                 C   s   | j j|dS )
        Update the ToolInstance

        :param assistants_v1_service_update_tool_request:

        :returns: The updated ToolInstance
        r;   )r1   updater&   r;   r)   r)   r*   r>   w   s    zToolInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the ToolInstance

        :param assistants_v1_service_update_tool_request:

        :returns: The updated ToolInstance
        r=   N)r1   update_asyncr?   r)   r)   r*   rA      s    zToolInstance.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>   s     z(ToolInstance.__repr__.<locals>.<genexpr>z&<Twilio.Assistants.V1.ToolInstance {}>joinr$   itemsrF   r&   contextr)   r)   r*   __repr__   s    zToolInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r!   propertyr1   boolr3   r5   r7   r9   r   unsetr   $AssistantsV1ServiceUpdateToolRequestobjectr>   rA   rQ   __classcell__r)   r)   r'   r*   r      s8     
 			r   c                       s   e Zd Z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feeef e	dddZejfeeef e	dddZedddZ  ZS )r+   )r   r   c                    s*   t  | d|i| _djf | j| _dS )z{
        Initialize the ToolContext

        :param version: Version that contains the resource
        :param id:
        r   z/Tools/{id}N)r    r!   r$   rF   _uri)r&   r   r   r'   r)   r*   r!      s
     zToolContext.__init__r,   c                 C   s   | j jd| jdS )r2   DELETEmethoduri)r/   r3   r]   r0   r)   r)   r*   r3      s    zToolContext.deletec                    s   | j jd| jdI dH S )r4   r^   r_   N)r/   r5   r]   r0   r)   r)   r*   r5      s    zToolContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r6   GETr_   r   r.   )r/   r7   r]   r   r$   r&   r   r)   r)   r*   r7      s    zToolContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r8   rb   r_   Nr   r.   )r/   r9   r]   r   r$   rc   r)   r)   r*   r9      s    zToolContext.fetch_asyncr:   c                 C   sD   t i }t d|i}| jjd| j||d}t| j|| jd dS )r<   rZ   PUTr`   ra   dataheadersr   r.   )r   ofr/   r>   r]   r   r$   r&   r;   rf   rg   r   r)   r)   r*   r>      s    
    zToolContext.updatec                    sJ   t i }t d|i}| jjd| j||dI dH }t| j|| jd dS )r@   rZ   rd   re   Nr   r.   )r   rh   r/   rA   r]   r   r$   ri   r)   r)   r*   rA     s    
    zToolContext.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   ,  s     z'ToolContext.__repr__.<locals>.<genexpr>z%<Twilio.Assistants.V1.ToolContext {}>rL   rO   r)   r)   r*   rQ   &  s    zToolContext.__repr__)rR   rS   rT   r   rV   r!   rX   r3   r5   r   r7   r9   r   rY   r   rZ   r[   r>   rA   rQ   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 )ToolPage)r   r-   c                 C   s   t | j|S )zj
        Build an instance of ToolInstance

        :param payload: Payload response from the API
        )r   r/   rc   r)   r)   r*   get_instance2  s    zToolPage.get_instancer,   c                 C   s   dS )rB   z<Twilio.Assistants.V1.ToolPage>r)   r0   r)   r)   r*   rQ   :  s    zToolPage.__repr__N)	rR   rS   rT   r   rV   r   r   rk   rQ   r)   r)   r)   r*   rj   0  s   rj   c                       s  e Zd ZG dd deZG dd deZG dd deZed fdd	Zee	d
ddZ
ee	d
ddZejddfeeef ee ee ee	 dddZejddfeeef ee ee ee	 dddZejddfeeef ee ee ee	 dddZejddfeeef ee ee ee	 dddZ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dddZ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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 )+ToolListc                   @   s.   e Zd ZdZeeef dddZdd ZdS )z/ToolList.AssistantsV1ServiceCreatePolicyRequestz
        :ivar description: The description of the policy.
        :ivar id: The Policy ID.
        :ivar name: The name of the policy.
        :ivar policy_details:
        :ivar type: The description of the policy.
        r   c                 C   s@   | d| _| d| _| d| _| d| _| d| _d S )Nr   r   r   policy_detailsr   )r"   r   r   r   rn   r   rc   r)   r)   r*   r!   N  s    z8ToolList.AssistantsV1ServiceCreatePolicyRequest.__init__c                 C   s   | j | j| j| j| jdS )Nr   r   r   rn   r   ro   r0   r)   r)   r*   to_dictX  s    z7ToolList.AssistantsV1ServiceCreatePolicyRequest.to_dictN	rR   rS   rT   rU   r   rV   r   r!   rp   r)   r)   r)   r*   &AssistantsV1ServiceCreatePolicyRequestE  s   
rr   c                   @   s.   e Zd ZdZeeef dddZdd ZdS )z-ToolList.AssistantsV1ServiceCreateToolRequestaq  
        :ivar assistant_id: The Assistant ID.
        :ivar description: The description of the tool.
        :ivar enabled: True if the tool is enabled.
        :ivar meta: The metadata related to method, url, input_schema to used with the Tool.
        :ivar name: The name of the tool.
        :ivar policy:
        :ivar type: The description of the tool.
        rm   c                 C   sX   | d| _| d| _| d| _| d| _| d| _| d| _| d| _d S Nassistant_idr   r   r   r   policyr   r"   rt   r   r   r   r   ru   r   rc   r)   r)   r*   r!   l  s    z6ToolList.AssistantsV1ServiceCreateToolRequest.__init__c                 C   s&   | j | j| j| j| j| j | jdS N)rt   r   r   r   r   ru   r   rt   r   r   r   r   ru   rp   r   r0   r)   r)   r*   rp   x  s    z5ToolList.AssistantsV1ServiceCreateToolRequest.to_dictNrq   r)   r)   r)   r*   $AssistantsV1ServiceCreateToolRequesta  s   
ry   c                   @   s.   e Zd ZdZeeef dddZdd ZdS )z-ToolList.AssistantsV1ServiceUpdateToolRequestaj  
        :ivar assistant_id: The Assistant ID.
        :ivar description: The description of the tool.
        :ivar enabled: True if the tool is enabled.
        :ivar meta: The metadata related to method, url, input_schema to used with the Tool.
        :ivar name: The name of the tool.
        :ivar policy:
        :ivar type: The type of the tool.
        rm   c                 C   sX   | d| _| d| _| d| _| d| _| d| _| d| _| d| _d S rs   rv   rc   r)   r)   r*   r!     s    z6ToolList.AssistantsV1ServiceUpdateToolRequest.__init__c                 C   s&   | j | j| j| j| j| j | jdS rw   rx   r0   r)   r)   r*   rp     s    z5ToolList.AssistantsV1ServiceUpdateToolRequest.to_dictNrq   r)   r)   r)   r*   rZ     s   
rZ   )r   c                    s   t  | d| _dS )zf
        Initialize the ToolList

        :param version: Version that contains the resource

        z/ToolsN)r    r!   r]   )r&   r   r'   r)   r*   r!     s    zToolList.__init__))assistants_v1_service_create_tool_requestr-   c                 C   s@   |  }tddi}d|d< | jjd| j||d}t| j|S )z
        Create the ToolInstance

        :param assistants_v1_service_create_tool_request:

        :returns: The created ToolInstance
        Content-Type!application/x-www-form-urlencodedapplication/jsonPOSTre   )rp   r   rh   r/   creater]   r   r&   rz   rf   rg   r   r)   r)   r*   r     s       zToolList.createc                    sF   |  }tddi}d|d< | jjd| j||dI dH }t| j|S )z
        Asynchronously create the ToolInstance

        :param assistants_v1_service_create_tool_request:

        :returns: The created ToolInstance
        r{   r|   r}   r~   re   N)rp   r   rh   r/   create_asyncr]   r   r   r)   r)   r*   r     s       zToolList.create_asyncN)rt   limit	page_sizer-   c                 C   s2   | j ||}| j||d d}| j ||d S )a{  
        Streams ToolInstance 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 assistant_id:
        :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   rt   r   r   )r/   read_limitspagestreamr&   rt   r   r   Zlimitsr   r)   r)   r*   r     s    zToolList.streamc                    s8   | j ||}| j||d dI dH }| j ||d S )a  
        Asynchronously streams ToolInstance 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 assistant_id:
        :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   )r/   r   
page_asyncstream_asyncr   r)   r)   r*   r     s     zToolList.stream_asyncc                 C   s   t | j|||dS )a  
        Lists ToolInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str assistant_id:
        :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
        rt   r   r   )listr   r&   rt   r   r   r)   r)   r*   r     s    zToolList.listc                    s&   dd | j |||dI dH 2 I dH S )a'  
        Asynchronously lists ToolInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str assistant_id:
        :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>F  s   z'ToolList.list_async.<locals>.<listcomp>r   N)r   r   r)   r)   r*   
list_async1  s    
zToolList.list_async)rt   
page_tokenpage_numberr   r-   c                 C   s4   t ||||d}| jjd| j|d}t| j|S )a  
        Retrieve a single page of ToolInstance records from the API.
        Request is executed immediately

        :param assistant_id:
        :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 ToolInstance
        ZAssistantIdZ	PageTokenr   ZPageSizerb   r`   ra   params)r   rh   r/   r   r]   rj   r&   rt   r   r   r   rf   responser)   r)   r*   r   O  s    	zToolList.pagec                    s:   t ||||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of ToolInstance records from the API.
        Request is executed immediately

        :param assistant_id:
        :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 ToolInstance
        r   rb   r   N)r   rh   r/   r   r]   rj   r   r)   r)   r*   r   m  s    	  zToolList.page_async)
target_urlr-   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of ToolInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ToolInstance
        rb   )r/   domaintwiliorequestrj   r&   r   r   r)   r)   r*   get_page  s    	zToolList.get_pagec                    s$   | j jjd|I dH }t| j |S )z
        Asynchronously retrieve a specific page of ToolInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ToolInstance
        rb   N)r/   r   r   Zrequest_asyncrj   r   r)   r)   r*   get_page_async  s    	zToolList.get_page_async)r   r-   c                 C   s   t | j|dS z>
        Constructs a ToolContext

        :param id:
        r.   r+   r/   r&   r   r)   r)   r*   r"     s    zToolList.getc                 C   s   t | j|dS r   r   r   r)   r)   r*   __call__  s    zToolList.__call__r,   c                 C   s   dS )rB   z<Twilio.Assistants.V1.ToolList>r)   r0   r)   r)   r*   rQ     s    zToolList.__repr__)#rR   rS   rT   r[   rr   ry   rZ   r   r!   r   r   r   r   rY   r   rV   r   intr   r   r	   r   r   r   r   rj   r   r   r   r   r+   r"   r   rQ   r\   r)   r)   r'   r*   rl   C  s   ""



 



 



 rl   N)rU   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+   rj   rl   r)   r)   r)   r*   <module>   s   $  