o
    f>hR                     @   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dedeeef dee f fddZ	e
dd
dZdefddZdefddZdddZdddZejfdeeef dd fddZejfdeeef dd fddZdef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|p5| ji| _d | _d S )Nr   account_sidfriendly_namedate_createddate_updatedurl)super__init__getr   r   r   r
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ `/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/accounts/v1/credential/public_key.pyr   #   s   

zPublicKeyInstance.__init__returnPublicKeyContextc                 C   s&   | j du 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   
   | j  S )l
        Deletes the PublicKeyInstance


        :returns: True if delete succeeds, False otherwise
        )r*   deleter)   r#   r#   r$   r-   G      
zPublicKeyInstance.deletec                       | 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$   r1   P      zPublicKeyInstance.delete_asyncc                 C   r+   )_
        Fetch the PublicKeyInstance


        :returns: The fetched PublicKeyInstance
        )r*   fetchr)   r#   r#   r$   r4   Y   r.   zPublicKeyInstance.fetchc                    r/   )y
        Asynchronous coroutine to fetch the PublicKeyInstance


        :returns: The fetched PublicKeyInstance
        N)r*   fetch_asyncr)   r#   r#   r$   r6   b   r2   zPublicKeyInstance.fetch_asyncr   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$   r9   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
        r8   N)r*   update_asyncr:   r#   r#   r$   r<   y   s   
zPublicKeyInstance.update_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>       z-PublicKeyInstance.__repr__.<locals>.<genexpr>z)<Twilio.Accounts.V1.PublicKeyInstance {}>joinr   itemsrC   r    contextr#   r#   r$   __repr__      
zPublicKeyInstance.__repr__N)r%   r&   )r%   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr*   boolr-   r1   r4   r6   r   unsetr   objectr9   r<   rO   __classcell__r#   r#   r!   r$   r      s:    

	
	
	




r   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e	fd
dZ
de	fddZejfdeeef de	fddZejfdeeef de	fddZdefddZ  ZS )r&   r   r   c                    s.   t  | d|i| _djdi | 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}Nr#   )r   r   r   rC   _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-   r\   r    ra   r#   r#   r$   r-      s   
zPublicKeyContext.deletec                    s&   t i }| jjd| j|dI dH S )r0   r]   r^   N)r   rb   r(   r1   r\   rc   r#   r#   r$   r1      s
   
zPublicKeyContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r3   application/jsonAcceptGETr^   r   r'   )r   rb   r(   r4   r\   r   r   r    ra   r   r#   r#   r$   r4      s   
zPublicKeyContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r5   rd   re   rf   r^   Nr   r'   )r   rb   r(   r6   r\   r   r   rg   r#   r#   r$   r6      s   
zPublicKeyContext.fetch_asyncr   c                 C   sT   t d|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r7   FriendlyName!application/x-www-form-urlencodedContent-Typerd   re   POSTr_   r`   datara   r   r'   )r   rb   r(   r9   r\   r   r   r    r   rm   ra   r   r#   r#   r$   r9      s   

zPublicKeyContext.updatec                    s\   t d|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r;   rh   ri   rj   rd   re   rk   rl   Nr   r'   )r   rb   r(   r<   r\   r   r   rn   r#   r#   r$   r<     s   

zPublicKeyContext.update_asyncc                 C   r=   )r>   r?   c                 s   r@   rA   rB   rD   r#   r#   r$   rH   $  rI   z,PublicKeyContext.__repr__.<locals>.<genexpr>z(<Twilio.Accounts.V1.PublicKeyContext {}>rJ   rM   r#   r#   r$   rO     rP   zPublicKeyContext.__repr__)rR   rS   rT   r   rV   r   rX   r-   r1   r   r4   r6   r   rY   r   rZ   r9   r<   rO   r[   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 )PublicKeyPager   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_instancec                 C      dS )r>   z"<Twilio.Accounts.V1.PublicKeyPage>r#   r)   r#   r#   r$   rO   2     zPublicKeyPage.__repr__N)	rR   rS   rT   r   rV   r   r   rp   rO   r#   r#   r#   r$   ro   (  s    ro   c                	       s   e Zd Zdef fddZejejfdedeee	f deee	f de
fdd	Zejejfdedeee	f deee	f 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 )*PublicKeyListr   c                    s   t  | d| _dS )zk
        Initialize the PublicKeyList

        :param version: Version that contains the resource

        z/Credentials/PublicKeysN)r   r   r\   )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
        	PublicKeyrh   
AccountSidrj   ri   rd   re   rk   rl   )r   rb   r(   creater\   r   r    rt   r   r   rm   ra   r   r#   r#   r$   rx   H  s   
zPublicKeyList.createc                    sZ   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
        ru   rj   ri   rd   re   rk   rl   N)r   rb   r(   create_asyncr\   r   ry   r#   r#   r$   rz   k  s   
zPublicKeyList.create_asyncNlimit	page_sizec                 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
        r|   r|   r{   )r(   read_limitspagestreamr    r{   r|   limitsr   r#   r#   r$   r     s   zPublicKeyList.streamc                    s8   | 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
        r|   r}   Nr{   )r(   r~   
page_asyncstream_asyncr   r#   r#   r$   r     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
        r{   r|   )listr   r    r{   r|   r#   r#   r$   r     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 rQ   r#   )rE   recordr#   r#   r$   
<listcomp>  s
    z,PublicKeyList.list_async.<locals>.<listcomp>r   N)r   r   r#   r#   r$   
list_async  s   
zPublicKeyList.list_async
page_tokenpage_numberc                 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
        	PageTokenr   PageSizerj   ri   rd   re   rf   r_   r`   paramsra   )r   rb   r(   r   r\   ro   r    r   r   r|   rm   ra   responser#   r#   r$   r     s   
zPublicKeyList.pagec                    sR   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   rj   ri   rd   re   rf   r   N)r   rb   r(   r   r\   ro   r   r#   r#   r$   r     s   
zPublicKeyList.page_async
target_urlc                 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
        rf   )r(   domaintwiliorequestro   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
        rf   N)r(   r   r   request_asyncro   r   r#   r#   r$   get_page_asyncC  s   	zPublicKeyList.get_page_asyncr   c                 C      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     zPublicKeyList.getc                 C   r   r   r   r   r#   r#   r$   __call__W  r   zPublicKeyList.__call__c                 C   rq   )r>   z"<Twilio.Accounts.V1.PublicKeyList>r#   r)   r#   r#   r$   rO   _  rr   zPublicKeyList.__repr__)NN) rR   rS   rT   r   r   r   rY   rV   r   rZ   r   rx   rz   r   intr   r   r	   r   r   r   r   ro   r   r   r   r   r&   r   r   rO   r[   r#   r#   r!   r$   rs   ;  s    


&


%







#



!rs   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&   ro   rs   r#   r#   r#   r$   <module>   s    $x 