o
    eA                     @   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ejejejejejej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
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.conversations.v1.credential.CredentialList
        :rtype: twilio.rest.conversations.v1.credential.CredentialList
        z/CredentialsN )superr   __init__	_solutionformat_uri)selfversion	__class__r	   Z/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/credential.pyr      s   	zCredentialList.__init__c           
   
   C   s:   t |||||||d}| jjd| j|d}	t| j|	S )a  
        Create the CredentialInstance

        :param CredentialInstance.PushType type: The type of push-notification service the credential is for.
        :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] The 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 API key for the project that was obtained from the Google Developer console for your GCM Service application credential.
        :param unicode secret: [FCM only] The Server key of your project from Firebase console.

        :returns: The created CredentialInstance
        :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
        TypeFriendlyNameCertificate
PrivateKeySandboxApiKeySecretPOSTmethoduridata)r   of_versioncreater   CredentialInstance
r   typefriendly_namecertificateprivate_keysandboxapi_keysecretr    payloadr	   r	   r   r#   "   s   
zCredentialList.createNc                 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.conversations.v1.credential.CredentialInstance]
        	page_size)r.   limit)r"   read_limitspagestream)r   r/   r.   limitsr1   r	   r	   r   r2   A   s   zCredentialList.streamc                 C   s   t | j||dS )ai  
        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.conversations.v1.credential.CredentialInstance]
        )r/   r.   )listr2   )r   r/   r.   r	   r	   r   r4   X   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.conversations.v1.credential.CredentialPage
        )	PageTokenr   PageSizeGET)r   r   params)r   r!   r"   r1   r   CredentialPager   )r   
page_tokenpage_numberr.   r    responser	   r	   r   r1   j   s   zCredentialList.pagec                 C   s"   | j jjd|}t| j || jS )aD  
        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.conversations.v1.credential.CredentialPage
        r7   )r"   domaintwiliorequestr9   r   )r   
target_urlr<   r	   r	   r   get_page}   s
   

zCredentialList.get_pagec                 C      t | j|dS a  
        Constructs a CredentialContext

        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.conversations.v1.credential.CredentialContext
        :rtype: twilio.rest.conversations.v1.credential.CredentialContext
        sidCredentialContextr"   r   rE   r	   r	   r   get      	zCredentialList.getc                 C   rB   rC   rF   rH   r	   r	   r   __call__   rJ   zCredentialList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z(<Twilio.Conversations.V1.CredentialList>r	   r   r	   r	   r   __repr__      zCredentialList.__repr__)NN)__name__
__module____qualname__r   r   unsetr#   r2   r4   r1   rA   rI   rK   rO   __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 )r9   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.conversations.v1.credential.CredentialPage
        :rtype: twilio.rest.conversations.v1.credential.CredentialPage
        N)r
   r9   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.conversations.v1.credential.CredentialInstance
        :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
        )r$   r"   r   r-   r	   r	   r   get_instance   s   	zCredentialPage.get_instancec                 C   rL   )rM   z(<Twilio.Conversations.V1.CredentialPage>r	   rN   r	   r	   r   rO      rP   zCredentialPage.__repr__)rQ   rR   rS   r   rX   rO   rU   r	   r	   r   r   r9      s    r9   c                       sZ   e Zd Z fddZej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 )rG   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: A 34 character string that uniquely identifies this resource.

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

zCredentialContext.__init__c           
   
   C   sD   t |||||||d}| jjd| j|d}	t| j|	| jd dS )  
        Update the CredentialInstance

        :param CredentialInstance.PushType type: The type of push-notification service the credential is for.
        :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] The 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 API key for the project that was obtained from the Google Developer console for your GCM Service application credential.
        :param unicode secret: [FCM only] The Server key of your project from Firebase console.

        :returns: The updated CredentialInstance
        :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
        r   r   r   rE   rD   )r   r!   r"   updater   r$   r   r%   r	   r	   r   rZ      s   
zCredentialContext.updatec                 C   s   | j jd| jdS )
        Deletes the CredentialInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr   r   )r"   deleter   rN   r	   r	   r   r^     s   zCredentialContext.deletec                 C   s(   | j jd| jd}t| j || jd dS )
        Fetch the CredentialInstance

        :returns: The fetched CredentialInstance
        :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
        r7   r]   rE   rD   )r"   fetchr   r$   r   rW   r	   r	   r   r`     s   zCredentialContext.fetchc                 C   $   d dd | j D }d|S )rM    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr	   r	   r   	<genexpr>       z-CredentialContext.__repr__.<locals>.<genexpr>z.<Twilio.Conversations.V1.CredentialContext {}>joinr   itemsr   r   contextr	   r	   r   rO        
zCredentialContext.__repr__)rQ   rR   rS   r   r   rT   rZ   r^   r`   rO   rU   r	   r	   r   r   rG      s    
	rG   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ej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 )!r$   c                   @   s   e Zd ZdZdZdZdS )zCredentialInstance.PushTypeapngcmfcmN)rQ   rR   rS   APNGCMFCMr	   r	   r	   r   PushType&  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.conversations.v1.credential.CredentialInstance
        :rtype: twilio.rest.conversations.v1.credential.CredentialInstance
        rE   account_sidr'   r&   r*   date_createddate_updatedurl)rE   ry   r'   r&   r*   rz   r{   r|   N)	r
   r$   r   rI   r   iso8601_datetime_properties_contextr   )r   r   r-   rE   r   r	   r   r   +  s   zCredentialInstance.__init__c                 C   s&   | j du rt| j| jd d| _ | j S )a:  
        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.conversations.v1.credential.CredentialContext
        NrE   rD   )r   rG   r"   r   rN   r	   r	   r   _proxyD  s   
	zCredentialInstance._proxyc                 C   
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rE   r~   rN   r	   r	   r   rE   Q     
zCredentialInstance.sidc                 C   r   )zq
        :returns: The unique ID of the Account responsible for this credential.
        :rtype: unicode
        ry   r   rN   r	   r	   r   ry   Y  r   zCredentialInstance.account_sidc                 C   r   )z_
        :returns: The human-readable name of this credential.
        :rtype: unicode
        r'   r   rN   r	   r	   r   r'   a  r   z CredentialInstance.friendly_namec                 C   r   )z
        :returns: The type of push-notification service the credential is for.
        :rtype: CredentialInstance.PushType
        r&   r   rN   r	   r	   r   r&   i  r   zCredentialInstance.typec                 C   r   )zn
        :returns: [APN only] Whether to send the credential to sandbox APNs.
        :rtype: unicode
        r*   r   rN   r	   r	   r   r*   q  r   zCredentialInstance.sandboxc                 C   r   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        rz   r   rN   r	   r	   r   rz   y  r   zCredentialInstance.date_createdc                 C   r   )zb
        :returns: The date that this resource was last updated.
        :rtype: datetime
        r{   r   rN   r	   r	   r   r{     r   zCredentialInstance.date_updatedc                 C   r   )zX
        :returns: An absolute URL for this credential.
        :rtype: unicode
        r|   r   rN   r	   r	   r   r|     r   zCredentialInstance.urlc              	   C   s   | j j|||||||dS )rY   )r&   r'   r(   r)   r*   r+   r,   )r   rZ   )r   r&   r'   r(   r)   r*   r+   r,   r	   r	   r   rZ     s   zCredentialInstance.updatec                 C   
   | j  S )r[   )r   r^   rN   r	   r	   r   r^        
zCredentialInstance.deletec                 C   r   )r_   )r   r`   rN   r	   r	   r   r`     r   zCredentialInstance.fetchc                 C   ra   )rM   rb   c                 s   rc   rd   re   rf   r	   r	   r   rj     rk   z.CredentialInstance.__repr__.<locals>.<genexpr>z/<Twilio.Conversations.V1.CredentialInstance {}>rl   ro   r	   r	   r   rO     rq   zCredentialInstance.__repr__)N)rQ   rR   rS   objectrx   r   propertyr   rE   ry   r'   r&   r*   rz   r{   r|   r   rT   rZ   r^   r`   rO   rU   r	   r	   r   r   r$   $  s8    









		r$   N)__doc__twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r9   rG   r$   r	   r	   r	   r   <module>   s    &P