a
    !fEF                     @   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 - Api
    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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 )KeyInstancea  
    :ivar sid: The unique string that that we created to identify the Key resource.
    :ivar friendly_name: The string that you assigned to describe the resource.
    :ivar date_created: The date and time in GMT that 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 that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    N)versionpayloadaccount_sidsidc                    sd   t  | |d| _|d| _t|d| _t|d| _||pR| jd| _	d | _
d S )Nr   friendly_namedate_createddate_updatedr   r   )super__init__getr   r   r
   Zrfc2822_datetimer   r   	_solution_context)selfr   r   r   r   	__class__ b/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/api/v2010/account/key.pyr   #   s    zKeyInstance.__init__
KeyContext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: KeyContext for this KeyInstance
        Nr   r   r   )r   r$   _versionr   r   r"   r"   r#   _proxy;   s    
zKeyInstance._proxyc                 C   s
   | j  S )f
        Deletes the KeyInstance


        :returns: True if delete succeeds, False otherwise
        )r)   deleter(   r"   r"   r#   r+   K   s    zKeyInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the KeyInstance


        :returns: True if delete succeeds, False otherwise
        N)r)   delete_asyncr(   r"   r"   r#   r-   T   s    zKeyInstance.delete_asyncc                 C   s
   | j  S )S
        Fetch the KeyInstance


        :returns: The fetched KeyInstance
        )r)   fetchr(   r"   r"   r#   r/   ]   s    zKeyInstance.fetchc                    s   | j  I dH S )m
        Asynchronous coroutine to fetch the KeyInstance


        :returns: The fetched KeyInstance
        N)r)   fetch_asyncr(   r"   r"   r#   r1   f   s    zKeyInstance.fetch_asyncr   r&   c                 C   s   | j j|dS )
        Update the KeyInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.

        :returns: The updated KeyInstance
        r   )r)   updater   r   r"   r"   r#   r5   o   s    zKeyInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the KeyInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.

        :returns: The updated KeyInstance
        r4   N)r)   update_asyncr6   r"   r"   r#   r8   {   s    
zKeyInstance.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'KeyInstance.__repr__.<locals>.<genexpr>z!<Twilio.Api.V2010.KeyInstance {}>joinr   itemsr=   r   contextr"   r"   r#   __repr__   s    zKeyInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr)   boolr+   r-   r/   r1   r   unsetr   objectr5   r8   rI   __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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   r   c                    s0   t  | ||d| _djf i | j| _dS )aW  
        Initialize the KeyContext

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to update.
        :param sid: The Twilio-provided string that uniquely identifies the Key resource to update.
        r   z'/Accounts/{account_sid}/Keys/{sid}.jsonNr   r   r   r=   _uri)r   r   r   r   r    r"   r#   r      s
    zKeyContext.__init__r%   c                 C   s   | j jd| jdS )r*   DELETEmethoduri)r'   r+   rU   r(   r"   r"   r#   r+      s    zKeyContext.deletec                    s   | j jd| jdI dH S )r,   rV   rW   N)r'   r-   rU   r(   r"   r"   r#   r-      s    zKeyContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r.   GETrW   r   r   r   )r'   r/   rU   r   r   r   r   r"   r"   r#   r/      s    zKeyContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )r0   rZ   rW   Nr   r   r   )r'   r1   rU   r   r   r[   r"   r"   r#   r1      s    zKeyContext.fetch_asyncr2   c                 C   s@   t d|i}| jjd| j|d}t| j|| jd | jd dS )r3   FriendlyNamePOSTrX   rY   datar   r   r   )r   ofr'   r5   rU   r   r   r   r   r_   r   r"   r"   r#   r5      s    zKeyContext.updatec                    sF   t d|i}| jjd| j|dI dH }t| j|| jd | jd dS )r7   r\   r]   r^   Nr   r   r   )r   r`   r'   r8   rU   r   r   ra   r"   r"   r#   r8      s    
zKeyContext.update_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   #  rC   z&KeyContext.__repr__.<locals>.<genexpr>z <Twilio.Api.V2010.KeyContext {}>rD   rG   r"   r"   r#   rI     s    zKeyContext.__repr__)rJ   rK   rL   r   rN   r   rP   r+   r-   r   r/   r1   r   rQ   r   rR   r5   r8   rI   rS   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 )KeyPage)r   r&   c                 C   s   t | j|| jd dS )zi
        Build an instance of KeyInstance

        :param payload: Payload response from the API
        r   )r   )r   r'   r   r[   r"   r"   r#   get_instance(  s    zKeyPage.get_instancer%   c                 C   s   dS )r9   z<Twilio.Api.V2010.KeyPage>r"   r(   r"   r"   r#   rI   2  s    zKeyPage.__repr__N)	rJ   rK   rL   r   rN   r   r   rc   rI   r"   r"   r"   r#   rb   '  s   
rb   c                       sf  e Zd Zeed f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 )$KeyList)r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the KeyList

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Key resources to read.

        r   z!/Accounts/{account_sid}/Keys.jsonNrT   )r   r   r   r    r"   r#   r   <  s    zKeyList.__init__N)limit	page_sizer&   c                 C   s0   | j ||}| j|d d}| j ||d S )aY  
        Streams KeyInstance 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
        rf   rf   re   )r'   read_limitspagestreamr   re   rf   Zlimitsri   r"   r"   r#   rj   L  s    zKeyList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ah  
        Asynchronously streams KeyInstance 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
        rf   rg   Nre   )r'   rh   
page_asyncstream_asyncrk   r"   r"   r#   rm   e  s    zKeyList.stream_asyncc                 C   s   t | j||dS )a  
        Lists KeyInstance 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
        re   rf   )listrj   r   re   rf   r"   r"   r#   ro   ~  s    zKeyList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists KeyInstance 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   z&KeyList.list_async.<locals>.<listcomp>rn   N)rm   rp   r"   r"   r#   
list_async  s    
zKeyList.list_async)
page_tokenpage_numberrf   r&   c                 C   s6   t |||d}| jjd| j|d}t| j|| jS )ak  
        Retrieve a single page of KeyInstance 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 KeyInstance
        Z	PageTokenr   ZPageSizerZ   rX   rY   params)r   r`   r'   ri   rU   rb   r   r   rt   ru   rf   r_   responser"   r"   r#   ri     s    zKeyList.pagec                    s<   t |||d}| jjd| j|dI dH }t| j|| jS )az  
        Asynchronously retrieve a single page of KeyInstance 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 KeyInstance
        rv   rZ   rw   N)r   r`   r'   rl   rU   rb   r   ry   r"   r"   r#   rl     s    zKeyList.page_async)
target_urlr&   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of KeyInstance records from the API.
        Request is executed immediately

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

        :returns: Page of KeyInstance
        rZ   )r'   domaintwiliorequestrb   r   r   r{   rz   r"   r"   r#   get_page  s    	zKeyList.get_pagec                    s(   | j jjd|I dH }t| j || jS )z
        Asynchronously retrieve a specific page of KeyInstance records from the API.
        Request is executed immediately

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

        :returns: Page of KeyInstance
        rZ   N)r'   r|   r}   Zrequest_asyncrb   r   r   r"   r"   r#   get_page_async  s    	zKeyList.get_page_async)r   r&   c                 C   s   t | j| jd |dS z
        Constructs a KeyContext

        :param sid: The Twilio-provided string that uniquely identifies the Key resource to update.
        r   r   r$   r'   r   r   r   r"   r"   r#   r     s    zKeyList.getc                 C   s   t | j| jd |dS r   r   r   r"   r"   r#   __call__  s    zKeyList.__call__r%   c                 C   s   dS )r9   z<Twilio.Api.V2010.KeyList>r"   r(   r"   r"   r#   rI     s    zKeyList.__repr__)NN)NN)NN)NN)rJ   rK   rL   r   rN   r   r   intr   r   rj   r	   rm   r   ro   rs   r   rQ   r   rR   rb   ri   rl   r   r   r$   r   r   rI   rS   r"   r"   r    r#   rd   ;  sh           







rd   N)rM   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$   rb   rd   r"   r"   r"   r#   <module>   s   $y 