o
    �¨Êh@  ã                   @   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 )ÚCredentialListú  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.chat.v2.credential.CredentialList
        :rtype: twilio.rest.chat.v2.credential.CredentialList
        z/CredentialsN© )Úsuperr   Ú__init__Ú	_solutionÚformatÚ_uri)ÚselfÚversion©Ú	__class__r
   úP/var/www/html/env/lib/python3.10/site-packages/twilio/rest/chat/v2/credential.pyr      s   	zCredentialList.__init__Nc                 C   s6   | j  ||¡}| j|d d�}| j  ||d |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.chat.v2.credential.CredentialInstance]
        Ú	page_size)r   ÚlimitÚ
page_limit)Ú_versionÚread_limitsÚpageÚstream)r   r   r   Úlimitsr   r
   r
   r   r   #   s   zCredentialList.streamc                 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 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.chat.v2.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.chat.v2.credential.CredentialPage
        )Ú	PageTokenr   ÚPageSizeÚGET©Úparams)r   Úofr   r   r   ÚCredentialPager   )r   Ú
page_tokenÚpage_numberr   r"   Úresponser
   r
   r   r   L   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.chat.v2.credential.CredentialPage
        r    )r   ÚdomainÚtwilioÚrequestr$   r   )r   Ú
target_urlr'   r
   r
   r   Úget_pagec   s
   

þzCredentialList.get_pagec           
   
   C   s:   t  |||||||dœ¡}| jjd| j|d�}	t| j|	ƒS )aŸ  
        Create a new CredentialInstance

        :param CredentialInstance.PushService type: Credential type, one of "gcm", "fcm", or "apn"
        :param unicode friendly_name: Friendly name for stored credential
        :param unicode certificate: [APN only] URL encoded representation of the certificate, e.
        :param unicode private_key: [APN only] URL encoded representation of the private key, e.
        :param bool sandbox: [APN only] use this credential for sending to production or sandbox APNs
        :param unicode api_key: [GCM only] This is the "API key" for project from Google Developer console for your GCM Service application credential
        :param unicode secret: [FCM only] This is the "Server key" of your project from Firebase console under Settings / Cloud messaging.

        :returns: Newly created CredentialInstance
        :rtype: twilio.rest.chat.v2.credential.CredentialInstance
        )ÚTypeÚFriendlyNameÚCertificateÚ
PrivateKeyÚSandboxÚApiKeyÚSecretÚPOST©Údata)r   r#   r   Úcreater   ÚCredentialInstance)
r   ÚtypeÚfriendly_nameÚcertificateÚprivate_keyÚsandboxÚapi_keyÚsecretr6   Úpayloadr
   r
   r   r7   t   s   ù
ýzCredentialList.createc                 C   ó   t | j|d�S ©zÒ
        Constructs a CredentialContext

        :param sid: The sid

        :returns: twilio.rest.chat.v2.credential.CredentialContext
        :rtype: twilio.rest.chat.v2.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.Chat.V2.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.chat.v2.credential.CredentialPage
        :rtype: twilio.rest.chat.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 )zü
        Build an instance of CredentialInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.chat.v2.credential.CredentialInstance
        :rtype: twilio.rest.chat.v2.credential.CredentialInstance
        )r8   r   )r   r@   r
   r
   r   Úget_instanceÉ   s   	zCredentialPage.get_instancec                 C   rK   )rL   z<Twilio.Chat.V2.CredentialPage>r
   rM   r
   r
   r   rN   Ô   rO   zCredentialPage.__repr__)rP   rQ   rR   rS   r   rW   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 )a  
        Initialize the CredentialContext

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

        :returns: twilio.rest.chat.v2.credential.CredentialContext
        :rtype: twilio.rest.chat.v2.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   s4   t  i ¡}| jjd| j|d�}t| j|| jd d�S )úœ
        Fetch a CredentialInstance

        :returns: Fetched CredentialInstance
        :rtype: twilio.rest.chat.v2.credential.CredentialInstance
        r    r!   rD   rC   )r   r#   r   Úfetchr   r8   r   )r   r"   r@   r
   r
   r   rY   ñ   s   
ýzCredentialContext.fetchc           	   	   C   sB   t  ||||||dœ¡}| jjd| j|d�}t| j|| jd d�S )á4  
        Update the CredentialInstance

        :param unicode friendly_name: Friendly name for stored credential
        :param unicode certificate: [APN only] URL encoded representation of the certificate, e.
        :param unicode private_key: [APN only] URL encoded representation of the private key, e.
        :param bool sandbox: [APN only] use this credential for sending to production or sandbox APNs
        :param unicode api_key: [GCM only] This is the "API key" for project from Google Developer console for your GCM Service application credential
        :param unicode secret: [FCM only] This is the "Server key" of your project from Firebase console under Settings / Cloud messaging.

        :returns: Updated CredentialInstance
        :rtype: twilio.rest.chat.v2.credential.CredentialInstance
        )r.   r/   r0   r1   r2   r3   r4   r5   rD   rC   )r   r#   r   Úupdater   r8   r   )	r   r:   r;   r<   r=   r>   r?   r6   r@   r
   r
   r   r[     s   ú	ýzCredentialContext.updatec                 C   s   | j  d| j¡S )ú�
        Deletes the CredentialInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        Údelete)r   r]   r   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>3  ó   € z-CredentialContext.__repr__.<locals>.<genexpr>z%<Twilio.Chat.V2.CredentialContext {}>©Újoinr   Úitemsr   ©r   Úcontextr
   r
   r   rN   ,  ó   
zCredentialContext.__repr__)rP   rQ   rR   rS   r   rY   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    ru   Nc              
      sr   t t| ƒ |¡ |d |d |d |d |d t |d ¡t |d ¡|d d	œ| _d
| _d|p4| jd i| _d
S )zº
        Initialize the CredentialInstance

        :returns: twilio.rest.chat.v2.credential.CredentialInstance
        :rtype: twilio.rest.chat.v2.credential.CredentialInstance
        rD   Úaccount_sidr:   r9   r=   Údate_createdÚdate_updatedÚurl)rD   rv   r:   r9   r=   rw   rx   ry   N)r   r8   r   r   Úiso8601_datetimeÚ_propertiesÚ_contextr   )r   r   r@   rD   r   r
   r   r   ?  s   øzCredentialInstance.__init__c                 C   s&   | j du rt| j| jd d�| _ | j S )a1  
        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.chat.v2.credential.CredentialContext
        NrD   rC   )r|   rF   r   r   rM   r
   r
   r   Ú_proxyX  s   
	zCredentialInstance._proxyc                 C   ó
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rD   ©r{   rM   r
   r
   r   rD   e  ó   
zCredentialInstance.sidc                 C   r~   )zo
        :returns: The unique id of the Account responsible for this resource.
        :rtype: unicode
        rv   r   rM   r
   r
   r   rv   m  r€   zCredentialInstance.account_sidc                 C   r~   )z]
        :returns: The human-readable name of this resource.
        :rtype: unicode
        r:   r   rM   r
   r
   r   r:   u  r€   z CredentialInstance.friendly_namec                 C   r~   )z¦
        :returns: Indicates which push notifications service this credential is for - either gcm, fcm, or apn
        :rtype: CredentialInstance.PushService
        r9   r   rM   r
   r
   r   r9   }  r€   zCredentialInstance.typec                 C   r~   )zz
        :returns: [APN only] true when this resource should use the sandbox APN service.
        :rtype: unicode
        r=   r   rM   r
   r
   r   r=   …  r€   zCredentialInstance.sandboxc                 C   r~   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        rw   r   rM   r
   r
   r   rw   �  r€   zCredentialInstance.date_createdc                 C   r~   )zb
        :returns: The date that this resource was last updated.
        :rtype: datetime
        rx   r   rM   r
   r
   r   rx   •  r€   zCredentialInstance.date_updatedc                 C   r~   )za
        :returns: An absolute URL for this credential resource.
        :rtype: unicode
        ry   r   rM   r
   r
   r   ry   �  r€   zCredentialInstance.urlc                 C   ó
   | j  ¡ S )rX   )r}   rY   rM   r
   r
   r   rY   ¥  ó   
zCredentialInstance.fetchc                 C   s   | j j||||||d�S )rZ   )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   r^   )rL   r_   c                 s   r`   ra   rb   rc   r
   r
   r   rg   ×  rh   z.CredentialInstance.__repr__.<locals>.<genexpr>z&<Twilio.Chat.V2.CredentialInstance {}>ri   rl   r
   r
   r   rN   Ð  rn   zCredentialInstance.__repr__)N)rP   rQ   rR   rS   Úobjectru   r   Úpropertyr}   rD   rv   r:   r9   r=   rw   rx   ry   rY   r   rT   r[   r]   rN   rU   r
   r
   r   r   r8   7  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    ''Y