o
    eG:                     @   s   d 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	 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z fddZdddZdddZejejejfdd	Zd
d Z	ejejejejejejfddZ
dd Zdd Zdd Z  ZS )CredentialListc                    s.   t t| | i | _djdi | j| _dS )a  
        Initialize the CredentialList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialList
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialList
        z/CredentialsN )superr   __init__	_solutionformat_uri)selfversion	__class__r	   Y/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/ip_messaging/v2/credential.pyr      s   	zCredentialList.__init__Nc                 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 int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.ip_messaging.v2.credential.CredentialInstance]
        	page_size)r   limit)_versionread_limitspagestream)r   r   r   limitsr   r	   r	   r   r   "   s   zCredentialList.streamc                 C   s   t | j||dS )ah  
        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 int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.ip_messaging.v2.credential.CredentialInstance]
        )r   r   )listr   )r   r   r   r	   r	   r   r   9   s   zCredentialList.listc                 C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of CredentialInstance records from the API.
        Request is executed immediately

        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialPage
        )	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   CredentialPager   )r   
page_tokenpage_numberr   dataresponser	   r	   r   r   K   s   zCredentialList.pagec                 C   s"   | j jjd|}t| j || jS )aC  
        Retrieve a specific page of CredentialInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialPage
        r   )r   domaintwiliorequestr#   r   )r   
target_urlr'   r	   r	   r   get_page^   s
   

zCredentialList.get_pagec           
   
   C   s:   t |||||||d}| jjd| j|d}	t| j|	S )a  
        Create the CredentialInstance

        :param CredentialInstance.PushService type: The type
        :param unicode friendly_name: The friendly_name
        :param unicode certificate: The certificate
        :param unicode private_key: The private_key
        :param bool sandbox: The sandbox
        :param unicode api_key: The api_key
        :param unicode secret: The secret

        :returns: The created CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        )TypeFriendlyNameCertificate
PrivateKeySandboxApiKeySecretPOSTr   r    r&   )r   r"   r   creater   CredentialInstance)
r   typefriendly_namecertificateprivate_keysandboxapi_keysecretr&   payloadr	   r	   r   r6   o   s   
zCredentialList.createc                 C      t | j|dS z
        Constructs a CredentialContext

        :param sid: The sid

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialContext
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialContext
        sidCredentialContextr   r   rC   r	   r	   r   get      	zCredentialList.getc                 C   r@   rA   rD   rF   r	   r	   r   __call__   rH   zCredentialList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z&<Twilio.IpMessaging.V2.CredentialList>r	   r   r	   r	   r   __repr__      zCredentialList.__repr__)NN)__name__
__module____qualname__r   r   r   r   unsetr   r,   r6   rG   rI   rM   __classcell__r	   r	   r   r   r      s    



r   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r#   c                    s   t t| || || _dS )a:  
        Initialize the CredentialPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialPage
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialPage
        N)r
   r#   r   r   )r   r   r'   solutionr   r	   r   r      s   

zCredentialPage.__init__c                 C   s   t | j|S )a  
        Build an instance of CredentialInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        )r7   r   r   r?   r	   r	   r   get_instance   s   	zCredentialPage.get_instancec                 C   rJ   )rK   z&<Twilio.IpMessaging.V2.CredentialPage>r	   rL   r	   r	   r   rM      rN   zCredentialPage.__repr__)rO   rP   rQ   r   rV   rM   rS   r	   r	   r   r   r#      s    r#   c                       sV   e Zd Z fddZdd ZejejejejejejfddZdd Zd	d
 Z	  Z
S )rE   c                    s2   t t| | d|i| _djdi | j| _dS )a'  
        Initialize the CredentialContext

        :param Version version: Version that contains the resource
        :param sid: The sid

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialContext
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialContext
        rC   z/Credentials/{sid}Nr	   )r
   rE   r   r   r   r   )r   r   rC   r   r	   r   r      s   

zCredentialContext.__init__c                 C   s(   | j jd| jd}t| j || jd dS )
        Fetch the CredentialInstance

        :returns: The fetched CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        r   r   r    rC   rB   )r   fetchr   r7   r   rU   r	   r	   r   rY      s   zCredentialContext.fetchc           	   	   C   sB   t ||||||d}| jjd| j|d}t| j|| jd dS )  
        Update the CredentialInstance

        :param unicode friendly_name: The friendly_name
        :param unicode certificate: The certificate
        :param unicode private_key: The private_key
        :param bool sandbox: The sandbox
        :param unicode api_key: The api_key
        :param unicode secret: The secret

        :returns: The updated CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        )r.   r/   r0   r1   r2   r3   r4   r5   rC   rB   )r   r"   r   updater   r7   r   )	r   r9   r:   r;   r<   r=   r>   r&   r?   r	   r	   r   r[      s   	zCredentialContext.updatec                 C   s   | j jd| jdS )
        Deletes the CredentialInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErX   )r   deleter   rL   r	   r	   r   r^     s   zCredentialContext.deletec                 C   $   d dd | j D }d|S )rK    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr	   r	   r   	<genexpr>      z-CredentialContext.__repr__.<locals>.<genexpr>z,<Twilio.IpMessaging.V2.CredentialContext {}>joinr   itemsr   r   contextr	   r	   r   rM        
zCredentialContext.__repr__)rO   rP   rQ   r   rY   r   rR   r[   r^   rM   rS   r	   r	   r   r   rE      s    
	rE   c                       s   e Zd ZG dd deZd  fdd	Zedd Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zdd ZejejejejejejfddZdd Zdd Z  ZS )!r7   c                   @   s   e Zd ZdZdZdZdS )zCredentialInstance.PushServicegcmapnfcmN)rO   rP   rQ   GCMAPNFCMr	   r	   r	   r   PushService$  s    rv   Nc                    s   t t| | |d|d|d|d|dt|dt|d|dd	| _d
| _d|p<| jd i| _d
S )z
        Initialize the CredentialInstance

        :returns: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialInstance
        rC   account_sidr9   r8   r<   date_createddate_updatedurl)rC   rw   r9   r8   r<   rx   ry   rz   N)	r
   r7   r   rG   r   iso8601_datetime_properties_contextr   )r   r   r?   rC   r   r	   r   r   )  s   zCredentialInstance.__init__c                 C   s&   | j du rt| j| jd d| _ | j S )a9  
        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
        :rtype: twilio.rest.ip_messaging.v2.credential.CredentialContext
        NrC   rB   )r}   rE   r   r   rL   r	   r	   r   _proxyB  s   
	zCredentialInstance._proxyc                 C   
   | j d S )z;
        :returns: The sid
        :rtype: unicode
        rC   r|   rL   r	   r	   r   rC   O     
zCredentialInstance.sidc                 C   r   )zC
        :returns: The account_sid
        :rtype: unicode
        rw   r   rL   r	   r	   r   rw   W  r   zCredentialInstance.account_sidc                 C   r   )zE
        :returns: The friendly_name
        :rtype: unicode
        r9   r   rL   r	   r	   r   r9   _  r   z CredentialInstance.friendly_namec                 C   r   )zS
        :returns: The type
        :rtype: CredentialInstance.PushService
        r8   r   rL   r	   r	   r   r8   g  r   zCredentialInstance.typec                 C   r   )z?
        :returns: The sandbox
        :rtype: unicode
        r<   r   rL   r	   r	   r   r<   o  r   zCredentialInstance.sandboxc                 C   r   )zE
        :returns: The date_created
        :rtype: datetime
        rx   r   rL   r	   r	   r   rx   w  r   zCredentialInstance.date_createdc                 C   r   )zE
        :returns: The date_updated
        :rtype: datetime
        ry   r   rL   r	   r	   r   ry     r   zCredentialInstance.date_updatedc                 C   r   )z;
        :returns: The url
        :rtype: unicode
        rz   r   rL   r	   r	   r   rz     r   zCredentialInstance.urlc                 C   
   | j  S )rW   )r~   rY   rL   r	   r	   r   rY        
zCredentialInstance.fetchc                 C   s   | j j||||||dS )rZ   )r9   r:   r;   r<   r=   r>   )r~   r[   )r   r9   r:   r;   r<   r=   r>   r	   r	   r   r[     s   zCredentialInstance.updatec                 C   r   )r\   )r~   r^   rL   r	   r	   r   r^     r   zCredentialInstance.deletec                 C   r_   )rK   r`   c                 s   ra   rb   rc   rd   r	   r	   r   rh     ri   z.CredentialInstance.__repr__.<locals>.<genexpr>z-<Twilio.IpMessaging.V2.CredentialInstance {}>rj   rm   r	   r	   r   rM     ro   zCredentialInstance.__repr__)N)rO   rP   rQ   objectrv   r   propertyr~   rC   rw   r9   r8   r<   rx   ry   rz   rY   r   rR   r[   r^   rM   rS   r	   r	   r   r   r7   "  s8    








	
	r7   N)__doc__twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r#   rE   r7   r	   r	   r	   r   <module>   s    &N