a
    !fT                     @   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 - 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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   g/var/www/html/python-backend/venv/lib/python3.9/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
   iso8601_datetimer    r!   r"   	_solution_context)selfr   r   r   	__class__r   r   r$   +   s     
zCredentialInstance.__init__CredentialContextreturnc                 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(   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>       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   rV   __classcell__r   r   r*   r   r      sT    			





 





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 i | 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   | j jd| jdS )r3   DELETEmethoduri)r0   r4   r]   r1   r   r   r   r4      s    zCredentialContext.deletec                    s   | j jd| jdI dH S )r5   r^   r_   N)r0   r6   r]   r1   r   r   r   r6      s    zCredentialContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r7   GETr_   r   r/   )r0   r8   r]   r   r'   r)   r   r   r   r   r8      s    zCredentialContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r9   rb   r_   Nr   r/   )r0   r:   r]   r   r'   rc   r   r   r   r:      s    zCredentialContext.fetch_asyncr;   c           	   	   C   sB   t ||||||d}| jjd| j|d}t| j|| jd dS )r@   FriendlyNameCertificate
PrivateKeySandboxApiKeySecretPOSTr`   ra   datar   r/   )r   ofr0   rB   r]   r   r'   	r)   r   r<   r=   r   r>   r?   rm   r   r   r   r   rB   	  s    zCredentialContext.updatec           	   	      sH   t ||||||d}| jjd| j|dI dH }t| j|| jd dS )rD   rd   rk   rl   Nr   r/   )r   rn   r0   rE   r]   r   r'   ro   r   r   r   rE   1  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   _  rP   z-CredentialContext.__repr__.<locals>.<genexpr>z,<Twilio.IpMessaging.V2.CredentialContext {}>rQ   rT   r   r   r   rV   Y  s    zCredentialContext.__repr__)r   r   r   r   rX   r$   rZ   r4   r6   r   r8   r:   r   r[   r   rW   rB   rE   rV   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   rc   r   r   r   get_instanced  s    zCredentialPage.get_instancer-   c                 C   s   dS )rF   z&<Twilio.IpMessaging.V2.CredentialPage>r   r1   r   r   r   rV   l  s    zCredentialPage.__repr__N)	r   r   r   r   rX   r   r   rq   rV   r   r   r   r   rp   c  s   rp   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$   v  s    zCredentialList.__init__r   )r   r   r<   r=   r   r>   r?   r.   c           
   
   C   s:   t |||||||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
        Typere   rf   rg   rh   ri   rj   rk   rl   )r   rn   r0   creater]   r   
r)   r   r   r<   r=   r   r>   r?   rm   r   r   r   r   ru     s     zCredentialList.createc           
   
      s@   t |||||||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
        rs   rk   rl   N)r   rn   r0   create_asyncr]   r   rv   r   r   r   rw     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
        ry   ry   rx   )r0   read_limitspagestreamr)   rx   ry   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
        ry   rz   Nrx   )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
        rx   ry   )listr}   r)   rx   ry   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>6  s   z-CredentialList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async#  s    
zCredentialList.list_async)
page_tokenpage_numberry   r.   c                 C   s2   t |||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PageSizerb   r`   ra   params)r   rn   r0   r|   r]   rp   r)   r   r   ry   rm   responser   r   r   r|   >  s    zCredentialList.pagec                    s8   t |||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   rb   r   N)r   rn   r0   r   r]   rp   r   r   r   r   r   Y  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
        rb   )r0   domaintwiliorequestrp   r)   r   r   r   r   r   get_pagev  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
        rb   N)r0   r   r   Zrequest_asyncrp   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   rV     s    zCredentialList.__repr__)NN)NN)NN)NN)!r   r   r   r   r$   r   r[   r   rX   rW   rZ   r   ru   rw   r   intr   r}   r	   r   r   r   r   rp   r|   r   r   r   r,   r%   r   rV   r\   r   r   r*   r   rr   u  s   





.





-        





rr   N)__doc__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,   rp   rr   r   r   r   r   <module>   s   $ " )