o
    eA                     @   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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 )CredentialListk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                    s.   t t| | i | _djdi | j| _dS )z
        Initialize the CredentialList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.notify.v1.credential.CredentialList
        :rtype: twilio.rest.notify.v1.credential.CredentialList
        z/CredentialsN )superr   __init__	_solutionformat_uri)selfversion	__class__r
   S/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/notify/v1/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.notify.v1.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 )ab  
        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.notify.v1.credential.CredentialInstance]
        )r   r   )listr   )r   r   r   r
   r
   r   r   ;   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.notify.v1.credential.CredentialPage
        )	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   CredentialPager   )r   
page_tokenpage_numberr   dataresponser
   r
   r   r   M   s   zCredentialList.pagec                 C   s"   | j jjd|}t| j || jS )a=  
        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.notify.v1.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 )aP  
        Create the CredentialInstance

        :param CredentialInstance.PushService type: The Credential type
        :param unicode friendly_name: A string to describe the resource
        :param unicode certificate: [APN only] The URL-encoded representation of the certificate
        :param unicode private_key: [APN only] URL-encoded representation of the private key
        :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs
        :param unicode api_key: [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging
        :param unicode secret: [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging

        :returns: The created CredentialInstance
        :rtype: twilio.rest.notify.v1.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   r7   q   s   
zCredentialList.createc                 C      t | j|dS z
        Constructs a CredentialContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.notify.v1.credential.CredentialContext
        :rtype: twilio.rest.notify.v1.credential.CredentialContext
        sidCredentialContextr   r   rD   r
   r
   r   get      	zCredentialList.getc                 C   rA   rB   rE   rG   r
   r
   r   __call__   rI   zCredentialList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Notify.V1.CredentialList>r
   r   r
   r
   r   __repr__      zCredentialList.__repr__)NN)__name__
__module____qualname____doc__r   r   r   r   unsetr   r-   r7   rH   rJ   rN   __classcell__r
   r
   r   r   r      s     



r   c                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )r$   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.notify.v1.credential.CredentialPage
        :rtype: twilio.rest.notify.v1.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.notify.v1.credential.CredentialInstance
        :rtype: twilio.rest.notify.v1.credential.CredentialInstance
        )r8   r   r   r@   r
   r
   r   get_instance   s   	zCredentialPage.get_instancec                 C   rK   )rL   z!<Twilio.Notify.V1.CredentialPage>r
   rM   r
   r
   r   rN      rO   zCredentialPage.__repr__)rP   rQ   rR   rS   r   rX   rN   rU   r
   r
   r   r   r$      s
    r$   c                       sZ   e Zd 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 )rF   r	   c                    s2   t t| | d|i| _djdi | j| _dS )aB  
        Initialize the CredentialContext

        :param Version version: Version that contains the resource
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.notify.v1.credential.CredentialContext
        :rtype: twilio.rest.notify.v1.credential.CredentialContext
        rD   z/Credentials/{sid}Nr
   )r   rF   r   r   r   r   )r   r   rD   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.notify.v1.credential.CredentialInstance
        r   r    r!   rD   rC   )r   fetchr   r8   r   rW   r
   r
   r   r[      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: A string to describe the resource
        :param unicode certificate: [APN only] The URL-encoded representation of the certificate
        :param unicode private_key: [APN only] URL-encoded representation of the private key
        :param bool sandbox: [APN only] Whether to send the credential to sandbox APNs
        :param unicode api_key: [GCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging
        :param unicode secret: [FCM only] The `Server key` of your project from Firebase console under Settings / Cloud messaging

        :returns: The updated CredentialInstance
        :rtype: twilio.rest.notify.v1.credential.CredentialInstance
        )r/   r0   r1   r2   r3   r4   r5   r6   rD   rC   )r   r#   r   updater   r8   r   )	r   r:   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
        DELETErZ   )r   deleter   rM   r
   r
   r   r`     s   zCredentialContext.deletec                 C   $   d dd | j D }d|S )rL    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr
   r
   r   	<genexpr>$      z-CredentialContext.__repr__.<locals>.<genexpr>z'<Twilio.Notify.V1.CredentialContext {}>joinr   itemsr   r   contextr
   r
   r   rN        
zCredentialContext.__repr__)rP   rQ   rR   rS   r   r[   r   rT   r]   r`   rN   rU   r
   r
   r   r   rF      s    
	rF   c                       s   e Zd 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 )"r8   r	   c                   @   s   e Zd ZdZdZdZdS )zCredentialInstance.PushServicegcmapnfcmN)rP   rQ   rR   GCMAPNFCMr
   r
   r
   r   PushService,  s    rx   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.notify.v1.credential.CredentialInstance
        :rtype: twilio.rest.notify.v1.credential.CredentialInstance
        rD   account_sidr:   r9   r=   date_createddate_updatedurl)rD   ry   r:   r9   r=   rz   r{   r|   N)	r   r8   r   rH   r   iso8601_datetime_properties_contextr   )r   r   r@   rD   r   r
   r   r   1  s   zCredentialInstance.__init__c                 C   s&   | j du rt| j| jd d| _ | j S )a3  
        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.notify.v1.credential.CredentialContext
        NrD   rC   )r   rF   r   r   rM   r
   r
   r   _proxyJ  s   
	zCredentialInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rD   r~   rM   r
   r
   r   rD   W     
zCredentialInstance.sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        ry   r   rM   r
   r
   r   ry   _  r   zCredentialInstance.account_sidc                 C   r   )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r:   r   rM   r
   r
   r   r:   g  r   z CredentialInstance.friendly_namec                 C   r   )z}
        :returns: The Credential type, one of `gcm`, `fcm`, or `apn`
        :rtype: CredentialInstance.PushService
        r9   r   rM   r
   r
   r   r9   o  r   zCredentialInstance.typec                 C   r   )zm
        :returns: [APN only] Whether to send the credential to sandbox APNs
        :rtype: unicode
        r=   r   rM   r
   r
   r   r=   w  r   zCredentialInstance.sandboxc                 C   r   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        rz   r   rM   r
   r
   r   rz     r   zCredentialInstance.date_createdc                 C   r   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        r{   r   rM   r
   r
   r   r{     r   zCredentialInstance.date_updatedc                 C   r   )z_
        :returns: The absolute URL of the Credential resource
        :rtype: unicode
        r|   r   rM   r
   r
   r   r|     r   zCredentialInstance.urlc                 C   
   | j  S )rY   )r   r[   rM   r
   r
   r   r[        
zCredentialInstance.fetchc                 C   s   | j j||||||dS )r\   )r:   r;   r<   r=   r>   r?   )r   r]   )r   r:   r;   r<   r=   r>   r?   r
   r
   r   r]     s   zCredentialInstance.updatec                 C   r   )r^   )r   r`   rM   r
   r
   r   r`     r   zCredentialInstance.deletec                 C   ra   )rL   rb   c                 s   rc   rd   re   rf   r
   r
   r   rj     rk   z.CredentialInstance.__repr__.<locals>.<genexpr>z(<Twilio.Notify.V1.CredentialInstance {}>rl   ro   r
   r
   r   rN     rq   zCredentialInstance.__repr__)N)rP   rQ   rR   rS   objectrx   r   propertyr   rD   ry   r:   r9   r=   rz   r{   r|   r[   r   rT   r]   r`   rN   rU   r
   r
   r   r   r8   (  s:    








	
	r8   N)rS   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r$   rF   r8   r
   r
   r
   r   <module>   s     (P