B
    `D                 @   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
      /       /
    )	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                   sf   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	dd Z
dd Zdd Z  ZS )ConnectAppListc                s.   t t| | d|i| _djf | j| _dS )aU  
        Initialize the ConnectAppList

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created the resource

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppList
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppList
        account_sidz(/Accounts/{account_sid}/ConnectApps.jsonN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ X/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/api/v2010/account/connect_app.pyr      s    

zConnectAppList.__init__Nc             C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams ConnectAppInstance 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.api.v2010.account.connect_app.ConnectAppInstance]
        	page_size)r   limit)_versionZread_limitspagestream)r   r   r   Zlimitsr   r   r   r   r   #   s    zConnectAppList.streamc             C   s   t | j||dS )ak  
        Lists ConnectAppInstance 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.api.v2010.account.connect_app.ConnectAppInstance]
        )r   r   )listr   )r   r   r   r   r   r   r   :   s    zConnectAppList.listc             C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of ConnectAppInstance 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 ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage
        )Z	PageTokenr   ZPageSizeGET)methoduriparams)r   ofr   r   r   ConnectAppPager   )r   Z
page_tokenZpage_numberr   dataresponser   r   r   r   L   s    zConnectAppList.pagec             C   s"   | j jjd|}t| j || jS )aF  
        Retrieve a specific page of ConnectAppInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage
        r   )r   domainZtwiliorequestr   r   )r   
target_urlr!   r   r   r   get_page_   s    

zConnectAppList.get_pagec             C   s   t | j| jd |dS )a  
        Constructs a ConnectAppContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        r	   )r	   sid)ConnectAppContextr   r   )r   r&   r   r   r   getp   s    	zConnectAppList.getc             C   s   t | j| jd |dS )a  
        Constructs a ConnectAppContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        r	   )r	   r&   )r'   r   r   )r   r&   r   r   r   __call__{   s    	zConnectAppList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Api.V2010.ConnectAppList>r   )r   r   r   r   __repr__   s    zConnectAppList.__repr__)NN)NN)__name__
__module____qualname__r   r   r   r   unsetr   r%   r(   r)   r*   __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 ConnectAppPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param account_sid: The SID of the Account that created the resource

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppPage
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppPage
        N)r
   r   r   r   )r   r   r!   Zsolution)r   r   r   r      s    zConnectAppPage.__init__c             C   s   t | j|| jd dS )a  
        Build an instance of ConnectAppInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        r	   )r	   )ConnectAppInstancer   r   )r   payloadr   r   r   get_instance   s    	zConnectAppPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Api.V2010.ConnectAppPage>r   )r   r   r   r   r*      s    zConnectAppPage.__repr__)r+   r,   r-   r   r2   r*   r/   r   r   )r   r   r      s   r   c                   s^   e Zd Z fddZdd ZejejejejejejejejfddZdd Zd	d
 Z	  Z
S )r'   c                s0   t t| | ||d| _djf | j| _dS )a  
        Initialize the ConnectAppContext

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created the resource to fetch
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        )r	   r&   z./Accounts/{account_sid}/ConnectApps/{sid}.jsonN)r
   r'   r   r   r   r   )r   r   r	   r&   )r   r   r   r      s    zConnectAppContext.__init__c             C   s0   | j jd| jd}t| j || jd | jd dS )z
        Fetch the ConnectAppInstance

        :returns: The fetched ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        r   )r   r   r	   r&   )r	   r&   )r   fetchr   r0   r   )r   r1   r   r   r   r3      s    zConnectAppContext.fetchc	             C   sZ   t |||||||t|dd d}	| jjd| j|	d}
t| j|
| jd | jd dS )	a  
        Update the ConnectAppInstance

        :param unicode authorize_redirect_url: The URL to redirect the user to after authorization
        :param unicode company_name: The company name to set for the Connect App
        :param unicode deauthorize_callback_method: The HTTP method to use when calling deauthorize_callback_url
        :param unicode deauthorize_callback_url: The URL to call to de-authorize the Connect App
        :param unicode description: A description of the Connect App
        :param unicode friendly_name: A string to describe the resource
        :param unicode homepage_url: A public URL where users can obtain more information
        :param ConnectAppInstance.Permission permissions: The set of permissions that your ConnectApp will request

        :returns: The updated ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        c             S   s   | S )Nr   )er   r   r   <lambda>       z*ConnectAppContext.update.<locals>.<lambda>)ZAuthorizeRedirectUrlZCompanyNameZDeauthorizeCallbackMethodZDeauthorizeCallbackUrlDescriptionZFriendlyNameZHomepageUrlZPermissionsPOST)r   r   r    r	   r&   )r	   r&   )	r   r   r   mapr   updater   r0   r   )r   authorize_redirect_urlcompany_namedeauthorize_callback_methoddeauthorize_callback_urldescriptionfriendly_namehomepage_urlpermissionsr    r1   r   r   r   r:      s    zConnectAppContext.updatec             C   s   | j jd| jdS )z
        Deletes the ConnectAppInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r   r   )r   deleter   )r   r   r   r   rD     s    zConnectAppContext.deletec             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
         c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   ).0kvr   r   r   	<genexpr>  s    z-ConnectAppContext.__repr__.<locals>.<genexpr>z'<Twilio.Api.V2010.ConnectAppContext {}>)joinr   itemsr   )r   contextr   r   r   r*     s    zConnectAppContext.__repr__)r+   r,   r-   r   r3   r   r.   r:   rD   r*   r/   r   r   )r   r   r'      s   $	r'   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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ejejfd d!Zd"d# Zd$d% Z  ZS )'r0   c               @   s   e Zd ZdZdZdS )zConnectAppInstance.Permissionzget-allzpost-allN)r+   r,   r-   ZGET_ALLZPOST_ALLr   r   r   r   
Permission  s   rM   Nc                s   t t| | |d|d|d|d|d|d|d|d|d	|d
|dd| _d| _||p| jd
 d| _dS )z
        Initialize the ConnectAppInstance

        :returns: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        r	   r;   r<   r=   r>   r?   r@   rA   rB   r&   r   )r	   r;   r<   r=   r>   r?   r@   rA   rB   r&   r   N)r	   r&   )r
   r0   r   r(   _properties_contextr   )r   r   r1   r	   r&   )r   r   r   r     s    zConnectAppInstance.__init__c             C   s.   | j dkr(t| j| jd | 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: ConnectAppContext for this ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppContext
        Nr	   r&   )r	   r&   )rO   r'   r   r   )r   r   r   r   _proxy8  s    	
zConnectAppInstance._proxyc             C   s
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r	   )rN   )r   r   r   r   r	   I  s    zConnectAppInstance.account_sidc             C   s
   | j d S )zg
        :returns: The URL to redirect the user to after authorization
        :rtype: unicode
        r;   )rN   )r   r   r   r   r;   Q  s    z)ConnectAppInstance.authorize_redirect_urlc             C   s
   | j d S )z\
        :returns: The company name set for the Connect App
        :rtype: unicode
        r<   )rN   )r   r   r   r   r<   Y  s    zConnectAppInstance.company_namec             C   s
   | j d S )zk
        :returns: The HTTP method we use to call deauthorize_callback_url
        :rtype: unicode
        r=   )rN   )r   r   r   r   r=   a  s    z.ConnectAppInstance.deauthorize_callback_methodc             C   s
   | j d S )zc
        :returns: The URL we call to de-authorize the Connect App
        :rtype: unicode
        r>   )rN   )r   r   r   r   r>   i  s    z+ConnectAppInstance.deauthorize_callback_urlc             C   s
   | j d S )zV
        :returns: The description of the Connect App
        :rtype: unicode
        r?   )rN   )r   r   r   r   r?   q  s    zConnectAppInstance.descriptionc             C   s
   | j d S )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r@   )rN   )r   r   r   r   r@   y  s    z ConnectAppInstance.friendly_namec             C   s
   | j d S )z]
        :returns: The URL users can obtain more information
        :rtype: unicode
        rA   )rN   )r   r   r   r   rA     s    zConnectAppInstance.homepage_urlc             C   s
   | j d S )z~
        :returns: The set of permissions that your ConnectApp requests
        :rtype: ConnectAppInstance.Permission
        rB   )rN   )r   r   r   r   rB     s    zConnectAppInstance.permissionsc             C   s
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r&   )rN   )r   r   r   r   r&     s    zConnectAppInstance.sidc             C   s
   | j d S )zq
        :returns: The URI of the resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r   )rN   )r   r   r   r   r     s    zConnectAppInstance.uric             C   s
   | j  S )z
        Fetch the ConnectAppInstance

        :returns: The fetched ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        )rP   r3   )r   r   r   r   r3     s    zConnectAppInstance.fetchc	       	   
   C   s   | j j||||||||dS )a  
        Update the ConnectAppInstance

        :param unicode authorize_redirect_url: The URL to redirect the user to after authorization
        :param unicode company_name: The company name to set for the Connect App
        :param unicode deauthorize_callback_method: The HTTP method to use when calling deauthorize_callback_url
        :param unicode deauthorize_callback_url: The URL to call to de-authorize the Connect App
        :param unicode description: A description of the Connect App
        :param unicode friendly_name: A string to describe the resource
        :param unicode homepage_url: A public URL where users can obtain more information
        :param ConnectAppInstance.Permission permissions: The set of permissions that your ConnectApp will request

        :returns: The updated ConnectAppInstance
        :rtype: twilio.rest.api.v2010.account.connect_app.ConnectAppInstance
        )r;   r<   r=   r>   r?   r@   rA   rB   )rP   r:   )	r   r;   r<   r=   r>   r?   r@   rA   rB   r   r   r   r:     s    zConnectAppInstance.updatec             C   s
   | j  S )z
        Deletes the ConnectAppInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rP   rD   )r   r   r   r   rD     s    zConnectAppInstance.deletec             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        rE   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )rF   rG   rH   r   r   r   rI     s    z.ConnectAppInstance.__repr__.<locals>.<genexpr>z(<Twilio.Api.V2010.ConnectAppInstance {}>)rJ   r   rK   r   )r   rL   r   r   r   r*     s    zConnectAppInstance.__repr__)N)r+   r,   r-   objectrM   r   propertyrP   r	   r;   r<   r=   r>   r?   r@   rA   rB   r&   r   r3   r   r.   r:   rD   r*   r/   r   r   )r   r   r0     s,   		r0   N)__doc__Ztwilio.baser   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.pager   r   r   r'   r0   r   r   r   r   <module>   s   '_