o
    f>hY                     @   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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 - Ip_messaging
    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	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       sx  e Zd ZG dd de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ejejejejejfdeeef deeef deeef deeef deeef deeef d	d fddZejejejejejejfdeeef deeef deeef deeef deeef deeef d	d fddZd	efdd Z  ZS )$CredentialInstancec                   @   s   e Zd ZdZdZdZdS )CredentialInstance.PushServicegcmapnfcmN)__name__
__module____qualname__GCMAPNFCM r   r   Y/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/ip_messaging/v2/credential.pyPushService   s    r   Nversionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _|d| _d|pA| ji| _d | _d S )	Nr"   account_sidfriendly_nametypesandboxdate_createddate_updatedurl)super__init__getr"   r#   r$   r%   r&   r
   iso8601_datetimer'   r(   r)   	_solution_context)selfr    r!   r"   	__class__r   r   r+   +   s    

zCredentialInstance.__init__returnCredentialContextc                 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: CredentialContext for this CredentialInstance
        Nr"   r"   )r/   r4   _versionr.   r0   r   r   r   _proxyB   s   
zCredentialInstance._proxyc                 C   
   | j  S )m
        Deletes the CredentialInstance


        :returns: True if delete succeeds, False otherwise
        )r8   deleter7   r   r   r   r;   Q      
zCredentialInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the CredentialInstance


        :returns: True if delete succeeds, False otherwise
        N)r8   delete_asyncr7   r   r   r   r?   Z      zCredentialInstance.delete_asyncc                 C   r9   )a
        Fetch the CredentialInstance


        :returns: The fetched CredentialInstance
        )r8   fetchr7   r   r   r   rB   c   r<   zCredentialInstance.fetchc                    r=   ){
        Asynchronous coroutine to fetch the CredentialInstance


        :returns: The fetched CredentialInstance
        N)r8   fetch_asyncr7   r   r   r   rD   l   r@   zCredentialInstance.fetch_asyncr$   certificateprivate_keyr&   api_keysecretc                 C   s   | j j||||||dS )
        Update the CredentialInstance

        :param friendly_name:
        :param certificate:
        :param private_key:
        :param sandbox:
        :param api_key:
        :param secret:

        :returns: The updated CredentialInstance
        r$   rE   rF   r&   rG   rH   )r8   updater0   r$   rE   rF   r&   rG   rH   r   r   r   rK   u   s   zCredentialInstance.updatec                    s    | j j||||||dI dH S )  
        Asynchronous coroutine to update the CredentialInstance

        :param friendly_name:
        :param certificate:
        :param private_key:
        :param sandbox:
        :param api_key:
        :param secret:

        :returns: The updated CredentialInstance
        rJ   N)r8   update_asyncrL   r   r   r   rN      s   zCredentialInstance.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.CredentialInstance.__repr__.<locals>.<genexpr>z-<Twilio.IpMessaging.V2.CredentialInstance {}>joinr.   itemsrU   r0   contextr   r   r   __repr__      
zCredentialInstance.__repr__N)r3   r4   )r3   r   )r   r   r   objectr   r   r   strr   r   r+   propertyr8   boolr;   r?   rB   rD   r   unsetr   rK   rN   ra   __classcell__r   r   r1   r   r      sx    
	
	
	






 






r   c                       sL  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ejejejejejfdeeef deeef deee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ejejejfdeeef deeef deeef deeef deeef deeef de	fddZdefddZ  ZS )r4   r    r"   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the CredentialContext

        :param version: Version that contains the resource
        :param sid:
        r"   z/Credentials/{sid}Nr   )r*   r+   r.   rU   _uri)r0   r    r"   r1   r   r   r+      s   zCredentialContext.__init__r3   c                 C   s   t i }| jjd| j|dS )r:   DELETEmethoduriheaders)r   ofr6   r;   rj   r0   ro   r   r   r   r;      s   
zCredentialContext.deletec                    s&   t i }| jjd| j|dI dH S )r>   rk   rl   N)r   rp   r6   r?   rj   rq   r   r   r   r?      s
   
zCredentialContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )rA   application/jsonAcceptGETrl   r"   r5   )r   rp   r6   rB   rj   r   r.   r0   ro   r!   r   r   r   rB      s   
zCredentialContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )rC   rr   rs   rt   rl   Nr"   r5   )r   rp   r6   rD   rj   r   r.   ru   r   r   r   rD      s   
zCredentialContext.fetch_asyncr$   rE   rF   r&   rG   rH   c           
   	   C   sd   t |||t|||d}t i }d|d< d|d< | jjd| j||d}	t| j|	| jd d	S )
rI   FriendlyNameCertificate
PrivateKeySandboxApiKeySecret!application/x-www-form-urlencodedContent-Typerr   rs   POSTrm   rn   dataro   r"   r5   )	r   rp   r   boolean_to_stringr6   rK   rj   r   r.   
r0   r$   rE   rF   r&   rG   rH   r   ro   r!   r   r   r   rK     s    


zCredentialContext.updatec           
   	      sl   t |||t|||d}t i }d|d< d|d< | jjd| j||dI dH }	t| j|	| jd	 d
S )rM   rv   r}   r~   rr   rs   r   r   Nr"   r5   )	r   rp   r   r   r6   rN   rj   r   r.   r   r   r   r   rN   <  s"   


zCredentialContext.update_asyncc                 C   rO   )rP   rQ   c                 s   rR   rS   rT   rV   r   r   r   rZ   n  r[   z-CredentialContext.__repr__.<locals>.<genexpr>z,<Twilio.IpMessaging.V2.CredentialContext {}>r\   r_   r   r   r   ra   h  rb   zCredentialContext.__repr__)r   r   r   r   re   r+   rg   r;   r?   r   rB   rD   r   rh   r   rd   rK   rN   ra   ri   r   r   r1   r   r4      sb    






.






,r4   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 )CredentialPager!   r3   c                 C   s   t | j|S )zp
        Build an instance of CredentialInstance

        :param payload: Payload response from the API
        )r   r6   )r0   r!   r   r   r   get_instancet  s   zCredentialPage.get_instancec                 C      dS )rP   z&<Twilio.IpMessaging.V2.CredentialPage>r   r7   r   r   r   ra   |     zCredentialPage.__repr__N)	r   r   r   r   re   r   r   r   ra   r   r   r   r   r   r  s    r   c                       s  e Zd Zdef fddZejejejejejejfdddeee	f deee	f deee	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ejejejfdddeee	f deee	f deee	f d	ee
e	f 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 )/CredentialListr    c                    s   t  | d| _dS )zl
        Initialize the CredentialList

        :param version: Version that contains the resource

        z/CredentialsN)r*   r+   rj   )r0   r    r1   r   r   r+     s   
zCredentialList.__init__r%   r   r$   rE   rF   r&   rG   rH   r3   c              
   C   s`   t ||||t|||d}t ddi}	d|	d< d|	d< | jjd| j||	d}
t| j|
S )a  
        Create the CredentialInstance

        :param type:
        :param friendly_name:
        :param certificate:
        :param private_key:
        :param sandbox:
        :param api_key:
        :param secret:

        :returns: The created CredentialInstance
        Typerw   rx   ry   rz   r{   r|   r~   r}   rr   rs   r   r   )r   rp   r   r   r6   createrj   r   r0   r%   r$   rE   rF   r&   rG   rH   r   ro   r!   r   r   r   r     s"   
zCredentialList.createc              
      sh   t ||||t|||d}t ddi}	d|	d< d|	d< | jjd| j||	dI dH }
t| j|
S )	a#  
        Asynchronously create the CredentialInstance

        :param type:
        :param friendly_name:
        :param certificate:
        :param private_key:
        :param sandbox:
        :param api_key:
        :param secret:

        :returns: The created CredentialInstance
        r   r~   r}   rr   rs   r   r   N)r   rp   r   r   r6   create_asyncrj   r   r   r   r   r   r     s$   
zCredentialList.create_asyncNlimit	page_sizec                 C   s0   | j ||}| j|d d}| j ||d S )a`  
        Streams CredentialInstance 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   )r6   read_limitspagestreamr0   r   r   limitsr   r   r   r   r     s   zCredentialList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )ao  
        Asynchronously streams CredentialInstance 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   )r6   r   
page_asyncstream_asyncr   r   r   r   r   	  s   zCredentialList.stream_asyncc                 C   s   t | j||dS )a  
        Lists CredentialInstance 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   r0   r   r   r   r   r   r   "  s   zCredentialList.listc                    s&   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists CredentialInstance 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 rc   r   )rW   recordr   r   r   
<listcomp>O  s
    z-CredentialList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async<  s   
zCredentialList.list_async
page_tokenpage_numberc                 C   sJ   t |||d}t ddi}d|d< | jjd| j||d}t| j|S )ay  
        Retrieve a single page of CredentialInstance 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 CredentialInstance
        	PageTokenr   PageSizer~   r}   rr   rs   rt   rm   rn   paramsro   )r   rp   r6   r   rj   r   r0   r   r   r   r   ro   responser   r   r   r   W  s   
zCredentialList.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 CredentialInstance 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 CredentialInstance
        r   r~   r}   rr   rs   rt   r   N)r   rp   r6   r   rj   r   r   r   r   r   r   x  s   
zCredentialList.page_async
target_urlc                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of CredentialInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CredentialInstance
        rt   )r6   domaintwiliorequestr   r0   r   r   r   r   r   get_page  s   	zCredentialList.get_pagec                    s&   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of CredentialInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CredentialInstance
        rt   N)r6   r   r   request_asyncr   r   r   r   r   get_page_async  s   	zCredentialList.get_page_asyncr"   c                 C      t | j|dS zE
        Constructs a CredentialContext

        :param sid:
        r5   r4   r6   r0   r"   r   r   r   r,        zCredentialList.getc                 C   r   r   r   r   r   r   r   __call__  r   zCredentialList.__call__c                 C   r   )rP   z&<Twilio.IpMessaging.V2.CredentialList>r   r7   r   r   r   ra     r   zCredentialList.__repr__)NN)!r   r   r   r   r+   r   rh   r   re   rd   rg   r   r   r   r   intr   r   r	   r   r   r   r   r   r   r   r   r   r4   r,   r   ra   ri   r   r   r1   r   r     s    





	
2





	
1







#



!r   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r4   r   r   r   r   r   r   <module>   s    $ # 8