U
    ^g%iR                     @   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 - Accounts
    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 )PublicKeyInstancea  
    :ivar sid: The unique string that that we created to identify the PublicKey resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Credential that the PublicKey resource belongs to.
    :ivar friendly_name: The string that you assigned to describe the 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 url: The URI for this resource, relative to `https://accounts.twilio.com`
    N)versionpayloadsidc                    sz   t  | |d| _|d| _|d| _t|d| _t|d| _	|d| _
d|pj| ji| _d | _d S )Nr   account_sidfriendly_namedate_createddate_updatedurl)super__init__getr   r   r   r
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ l/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/accounts/v1/credential/public_key.pyr   #   s     zPublicKeyInstance.__init__PublicKeyContext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: PublicKeyContext for this PublicKeyInstance
        Nr   r   )r   r$   _versionr   r   r"   r"   r#   _proxy8   s    
zPublicKeyInstance._proxyc                 C   s
   | j  S )l
        Deletes the PublicKeyInstance


        :returns: True if delete succeeds, False otherwise
        )r*   deleter)   r"   r"   r#   r,   G   s    zPublicKeyInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the PublicKeyInstance


        :returns: True if delete succeeds, False otherwise
        N)r*   delete_asyncr)   r"   r"   r#   r.   P   s    zPublicKeyInstance.delete_asyncc                 C   s
   | j  S )_
        Fetch the PublicKeyInstance


        :returns: The fetched PublicKeyInstance
        )r*   fetchr)   r"   r"   r#   r0   Y   s    zPublicKeyInstance.fetchc                    s   | j  I dH S )y
        Asynchronous coroutine to fetch the PublicKeyInstance


        :returns: The fetched PublicKeyInstance
        N)r*   fetch_asyncr)   r"   r"   r#   r2   b   s    zPublicKeyInstance.fetch_asyncr   r&   c                 C   s   | j j|dS )
        Update the PublicKeyInstance

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

        :returns: The updated PublicKeyInstance
        r   )r*   updater   r   r"   r"   r#   r6   k   s    
zPublicKeyInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the PublicKeyInstance

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

        :returns: The updated PublicKeyInstance
        r5   N)r*   update_asyncr7   r"   r"   r#   r9   y   s    
zPublicKeyInstance.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-PublicKeyInstance.__repr__.<locals>.<genexpr>z)<Twilio.Accounts.V1.PublicKeyInstance {}>joinr   itemsr>   r   contextr"   r"   r#   __repr__   s    zPublicKeyInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr*   boolr,   r.   r0   r2   r   unsetr   objectr6   r9   rI   __classcell__r"   r"   r    r#   r      s0   
  
 			


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 PublicKeyContext

        :param version: Version that contains the resource
        :param sid: The Twilio-provided string that uniquely identifies the PublicKey resource to update.
        r   z/Credentials/PublicKeys/{sid}N)r   r   r   r>   _uri)r   r   r   r    r"   r#   r      s
     zPublicKeyContext.__init__r%   c                 C   s   t i }| jjd| j|dS )r+   DELETEmethoduriheaders)r   ofr(   r,   rT   r   rY   r"   r"   r#   r,      s    
zPublicKeyContext.deletec                    s$   t i }| jjd| j|dI dH S )r-   rU   rV   N)r   rZ   r(   r.   rT   r[   r"   r"   r#   r.      s    
  zPublicKeyContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r/   application/jsonAcceptGETrV   r   r'   )r   rZ   r(   r0   rT   r   r   r   rY   r   r"   r"   r#   r0      s    
zPublicKeyContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r1   r\   r]   r^   rV   Nr   r'   )r   rZ   r(   r2   rT   r   r   r_   r"   r"   r#   r2      s    
  zPublicKeyContext.fetch_asyncr3   c                 C   sT   t d|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r4   FriendlyName!application/x-www-form-urlencodedContent-Typer\   r]   POSTrW   rX   datarY   r   r'   )r   rZ   r(   r6   rT   r   r   r   r   re   rY   r   r"   r"   r#   r6      s     
   zPublicKeyContext.updatec                    sZ   t d|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r8   r`   ra   rb   r\   r]   rc   rd   Nr   r'   )r   rZ   r(   r9   rT   r   r   rf   r"   r"   r#   r9     s     
   zPublicKeyContext.update_asyncc                 C   s$   d dd | j D }d|S )r:   r;   c                 s   s   | ]\}}d  ||V  qdS r<   r=   r?   r"   r"   r#   rC   $  s     z,PublicKeyContext.__repr__.<locals>.<genexpr>z(<Twilio.Accounts.V1.PublicKeyContext {}>rD   rG   r"   r"   r#   rI     s    zPublicKeyContext.__repr__)rJ   rK   rL   r   rN   r   rP   r,   r.   r   r0   r2   r   rQ   r   rR   r6   r9   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 )PublicKeyPage)r   r&   c                 C   s   t | j|S )zo
        Build an instance of PublicKeyInstance

        :param payload: Payload response from the API
        )r   r(   )r   r   r"   r"   r#   get_instance*  s    zPublicKeyPage.get_instancer%   c                 C   s   dS )r:   z"<Twilio.Accounts.V1.PublicKeyPage>r"   r)   r"   r"   r#   rI   2  s    zPublicKeyPage.__repr__N)	rJ   rK   rL   r   rN   r   r   rh   rI   r"   r"   r"   r#   rg   (  s   rg   c                       s  e Zd Zed fddZejejfeeee	f eee	f e
dddZejejfeeee	f eee	f 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 ))PublicKeyList)r   c                    s   t  | d| _dS )zk
        Initialize the PublicKeyList

        :param version: Version that contains the resource

        z/Credentials/PublicKeysN)r   r   rT   )r   r   r    r"   r#   r   =  s    zPublicKeyList.__init__)
public_keyr   r   r&   c                 C   sR   t |||d}t ddi}d|d< d|d< | jjd| j||d}t| j|S )a'  
        Create the PublicKeyInstance

        :param public_key: A URL encoded representation of the public key. For example, `-----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----`
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
        :param account_sid: The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request

        :returns: The created PublicKeyInstance
        Z	PublicKeyr`   Z
AccountSidrb   ra   r\   r]   rc   rd   )r   rZ   r(   createrT   r   r   rj   r   r   re   rY   r   r"   r"   r#   rl   H  s        zPublicKeyList.createc                    sX   t |||d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|S )	a6  
        Asynchronously create the PublicKeyInstance

        :param public_key: A URL encoded representation of the public key. For example, `-----BEGIN PUBLIC KEY-----MIIBIjANB.pa9xQIDAQAB-----END PUBLIC KEY-----`
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
        :param account_sid: The SID of the Subaccount that this Credential should be associated with. Must be a valid Subaccount of the account issuing the request

        :returns: The created PublicKeyInstance
        rk   rb   ra   r\   r]   rc   rd   N)r   rZ   r(   create_asyncrT   r   rm   r"   r"   r#   rn   k  s        zPublicKeyList.create_asyncN)limit	page_sizer&   c                 C   s0   | j ||}| j|d d}| j ||d S )a_  
        Streams PublicKeyInstance 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
        rp   rp   ro   )r(   read_limitspagestreamr   ro   rp   Zlimitsrs   r"   r"   r#   rt     s    zPublicKeyList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )an  
        Asynchronously streams PublicKeyInstance 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
        rp   rq   Nro   )r(   rr   
page_asyncstream_asyncru   r"   r"   r#   rw     s    zPublicKeyList.stream_asyncc                 C   s   t | j||dS )a  
        Lists PublicKeyInstance 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
        ro   rp   )listrt   r   ro   rp   r"   r"   r#   ry     s    zPublicKeyList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists PublicKeyInstance 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,PublicKeyList.list_async.<locals>.<listcomp>rx   N)rw   rz   r"   r"   r#   
list_async  s    
zPublicKeyList.list_async)
page_tokenpage_numberrp   r&   c                 C   sJ   t |||d}t ddi}d|d< | jjd| j||d}t| j|S )aw  
        Retrieve a single page of PublicKeyInstance 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 PublicKeyInstance
        Z	PageTokenr   ZPageSizerb   ra   r\   r]   r^   rW   rX   paramsrY   )r   rZ   r(   rs   rT   rg   r   r~   r   rp   re   rY   responser"   r"   r#   rs     s       zPublicKeyList.pagec                    sP   t |||d}t ddi}d|d< | jjd| j||dI dH }t| j|S )	a  
        Asynchronously retrieve a single page of PublicKeyInstance 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 PublicKeyInstance
        r   rb   ra   r\   r]   r^   r   N)r   rZ   r(   rv   rT   rg   r   r"   r"   r#   rv     s       zPublicKeyList.page_async)
target_urlr&   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of PublicKeyInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PublicKeyInstance
        r^   )r(   domaintwiliorequestrg   r   r   r   r"   r"   r#   get_page7  s    	zPublicKeyList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of PublicKeyInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PublicKeyInstance
        r^   N)r(   r   r   Zrequest_asyncrg   r   r"   r"   r#   get_page_asyncC  s    	zPublicKeyList.get_page_async)r   r&   c                 C   s   t | j|dS z
        Constructs a PublicKeyContext

        :param sid: The Twilio-provided string that uniquely identifies the PublicKey resource to update.
        r'   r$   r(   r   r   r"   r"   r#   r   O  s    zPublicKeyList.getc                 C   s   t | j|dS r   r   r   r"   r"   r#   __call__W  s    zPublicKeyList.__call__r%   c                 C   s   dS )r:   z"<Twilio.Accounts.V1.PublicKeyList>r"   r)   r"   r"   r#   rI   _  s    zPublicKeyList.__repr__)NN)NN)NN)NN) rJ   rK   rL   r   r   r   rQ   rN   r   rR   r   rl   rn   r   intr   rt   r	   rw   r   ry   r}   rg   rs   rv   r   r   r$   r   r   rI   rS   r"   r"   r    r#   ri   ;  s   

&

%        


#


!ri   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$   rg   ri   r"   r"   r"   r#   <module>   s   $x 