U
    ^g%iY                     @   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                	       sd  e Zd ZG dd de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ej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eef eeef d dddZejej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eef eeef d dddZedddZ  ZS )CredentialInstancec                   @   s   e Zd ZdZdZdZdS )CredentialInstance.PushServiceZgcmZapnZfcmN)__name__
__module____qualname__ZGCMZAPNZFCM r   r   e/var/www/html/api-medvista/venv/lib/python3.8/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|p| 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
   Ziso8601_datetimer!   r"   r#   	_solution_context)selfr   r   r   	__class__r   r   r%   +   s"     zCredentialInstance.__init__CredentialContext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: CredentialContext for this CredentialInstance
        Nr   r   )r(   r,   _versionr'   r)   r   r   r   _proxyB   s    
zCredentialInstance._proxyc                 C   s
   | j  S )m
        Deletes the CredentialInstance


        :returns: True if delete succeeds, False otherwise
        )r2   deleter1   r   r   r   r4   Q   s    zCredentialInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the CredentialInstance


        :returns: True if delete succeeds, False otherwise
        N)r2   delete_asyncr1   r   r   r   r6   Z   s    zCredentialInstance.delete_asyncc                 C   s
   | j  S )a
        Fetch the CredentialInstance


        :returns: The fetched CredentialInstance
        )r2   fetchr1   r   r   r   r8   c   s    zCredentialInstance.fetchc                    s   | j  I dH S ){
        Asynchronous coroutine to fetch the CredentialInstance


        :returns: The fetched CredentialInstance
        N)r2   fetch_asyncr1   r   r   r   r:   l   s    zCredentialInstance.fetch_asyncr   certificateprivate_keyr    api_keysecretr.   c                 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   r<   r=   r    r>   r?   )r2   updater)   r   r<   r=   r    r>   r?   r   r   r   rB   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
        rA   N)r2   update_asyncrC   r   r   r   rE      s    zCredentialInstance.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.CredentialInstance.__repr__.<locals>.<genexpr>z-<Twilio.IpMessaging.V2.CredentialInstance {}>joinr'   itemsrJ   r)   contextr   r   r   __repr__   s    zCredentialInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r%   propertyr2   boolr4   r6   r8   r:   r   unsetr   rB   rE   rU   __classcell__r   r   r*   r   r      sX     
 			





 





r   c                	       s2  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ej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eef eeef e	dddZejej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ee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 CredentialContext

        :param version: Version that contains the resource
        :param sid:
        r   z/Credentials/{sid}N)r$   r%   r'   rJ   _uri)r)   r   r   r*   r   r   r%      s
     zCredentialContext.__init__r-   c                 C   s   t i }| jjd| j|dS )r3   DELETEmethoduriheaders)r   ofr0   r4   r\   r)   ra   r   r   r   r4      s    
zCredentialContext.deletec                    s$   t i }| jjd| j|dI dH S )r5   r]   r^   N)r   rb   r0   r6   r\   rc   r   r   r   r6      s    
  zCredentialContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r7   application/jsonAcceptGETr^   r   r/   )r   rb   r0   r8   r\   r   r'   r)   ra   r   r   r   r   r8      s    
zCredentialContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r9   rd   re   rf   r^   Nr   r/   )r   rb   r0   r:   r\   r   r'   rg   r   r   r   r:      s    
  zCredentialContext.fetch_asyncr;   c           
   	   C   sd   t |||t|||d}t i }d|d< d|d< | jjd| j||d}	t| j|	| jd d	S )
r@   FriendlyNameCertificate
PrivateKeySandboxApiKeySecret!application/x-www-form-urlencodedContent-Typerd   re   POSTr_   r`   datara   r   r/   )	r   rb   r   boolean_to_stringr0   rB   r\   r   r'   
r)   r   r<   r=   r    r>   r?   rs   ra   r   r   r   r   rB     s&    

   zCredentialContext.updatec           
   	      sj   t |||t|||d}t i }d|d< d|d< | jjd| j||dI dH }	t| j|	| jd	 d
S )rD   rh   ro   rp   rd   re   rq   rr   Nr   r/   )	r   rb   r   rt   r0   rE   r\   r   r'   ru   r   r   r   rE   <  s&    

   zCredentialContext.update_asyncc                 C   s$   d dd | j D }d|S )rF   rG   c                 s   s   | ]\}}d  ||V  qdS rH   rI   rK   r   r   r   rO   n  s     z-CredentialContext.__repr__.<locals>.<genexpr>z,<Twilio.IpMessaging.V2.CredentialContext {}>rP   rS   r   r   r   rU   h  s    zCredentialContext.__repr__)r   r   r   r   rW   r%   rY   r4   r6   r   r8   r:   r   rZ   r   rV   rB   rE   rU   r[   r   r   r*   r   r,      sH   





.





,r,   c                   @   s2   e Zd Zeeef edddZedddZdS )CredentialPage)r   r.   c                 C   s   t | j|S )zp
        Build an instance of CredentialInstance

        :param payload: Payload response from the API
        )r   r0   )r)   r   r   r   r   get_instancet  s    zCredentialPage.get_instancer-   c                 C   s   dS )rF   z&<Twilio.IpMessaging.V2.CredentialPage>r   r1   r   r   r   rU   |  s    zCredentialPage.__repr__N)	r   r   r   r   rW   r   r   rw   rU   r   r   r   r   rv   r  s   rv   c                
       s0  e Zd Zed fddZejejejejejejfdeee	f eee	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ejejfdeee	f eee	f eee	f ee
e	f 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 )*CredentialList)r   c                    s   t  | d| _dS )zl
        Initialize the CredentialList

        :param version: Version that contains the resource

        z/CredentialsN)r$   r%   r\   )r)   r   r*   r   r   r%     s    zCredentialList.__init__r   )r   r   r<   r=   r    r>   r?   r.   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
        Typeri   rj   rk   rl   rm   rn   rp   ro   rd   re   rq   rr   )r   rb   r   rt   r0   creater\   r   r)   r   r   r<   r=   r    r>   r?   rs   ra   r   r   r   r   r{     s(       zCredentialList.createc              
      sf   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
        ry   rp   ro   rd   re   rq   rr   N)r   rb   r   rt   r0   create_asyncr\   r   r|   r   r   r   r}     s(       zCredentialList.create_asyncN)limit	page_sizer.   c                 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~   )r0   read_limitspagestreamr)   r~   r   Zlimitsr   r   r   r   r     s    zCredentialList.streamc                    s6   | 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~   )r0   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   r)   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 )Nr   )rL   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_numberr   r.   c                 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
        Z	PageTokenr   ZPageSizerp   ro   rd   re   rf   r_   r`   paramsra   )r   rb   r0   r   r\   rv   r)   r   r   r   rs   ra   responser   r   r   r   W  s       zCredentialList.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 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   rp   ro   rd   re   rf   r   N)r   rb   r0   r   r\   rv   r   r   r   r   r   x  s       zCredentialList.page_async)
target_urlr.   c                 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
        rf   )r0   domaintwiliorequestrv   r)   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
        rf   N)r0   r   r   Zrequest_asyncrv   r   r   r   r   get_page_async  s    	zCredentialList.get_page_async)r   r.   c                 C   s   t | j|dS zE
        Constructs a CredentialContext

        :param sid:
        r/   r,   r0   r)   r   r   r   r   r&     s    zCredentialList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__  s    zCredentialList.__call__r-   c                 C   s   dS )rF   z&<Twilio.IpMessaging.V2.CredentialList>r   r1   r   r   r   rU     s    zCredentialList.__repr__)NN)NN)NN)NN)!r   r   r   r   r%   r   rZ   r   rW   rV   rY   r   r{   r}   r   intr   r   r	   r   r   r   r   rv   r   r   r   r   r,   r&   r   rU   r[   r   r   r*   r   rx     s   





2





1        


#


!rx   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   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,   rv   rx   r   r   r   r   <module>   s   $ # 8