o
    ˷e	                     @   s0   d Z ddlmZ ddlmZ G dd deZdS )z
The Authorized Apps endpoint

Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/authorized-apps/
Schema: http://api.mailchimp.com/schema/3.0/AuthorizedApps/Instance.json
    )unicode_literals)BaseApic                       s:   e Zd ZdZ fddZdd ZdddZd	d
 Z  ZS )AuthorizedAppszn
    Manage registered, connected apps for your MailChimp account with the
    Authorized Apps endpoints.
    c                    s&   t t| j|i | d| _d| _dS )z)
        Initialize the endpoint
        zauthorized-appsN)superr   __init__endpointapp_id)selfargskwargs	__class__ Y/var/www/ideatree/venv/lib/python3.10/site-packages/mailchimp3/entities/authorizedapps.pyr      s   
zAuthorizedApps.__init__c                 C   s:   d| _ d|vrtdd|vrtd| jj|  |dS )a"  
        Retrieve OAuth2-based credentials to associate API calls with your
        application.

        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "client_id": string*,
            "client_secret": string*
        }
        N	client_idz(The authorized app must have a client_idclient_secretz,The authorized app must have a client_secret)urldata)r   KeyError
_mc_client_post_build_path)r	   r   r   r   r   create   s   zAuthorizedApps.createFc                 K   s<   d| _ |r| jdd|  i|S | jjdd|  i|S )u  
        Get a list of an account’s registered, connected applications.

        :param get_all: Should the query get all results
        :type get_all: :py:class:`bool`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer
        Nr   r   )r   _iterater   r   _get)r	   get_allqueryparamsr   r   r   all/   s   zAuthorizedApps.allc                 K   s"   || _ | jjdd| |i|S )aD  
        Get information about a specific authorized application

        :param app_id: The unique id for the connected authorized application
        :type app_id: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        r   Nr   )r   r   r   r   )r	   r   r   r   r   r   getB   s   
zAuthorizedApps.get)F)	__name__
__module____qualname____doc__r   r   r   r   __classcell__r   r   r   r   r      s    	
r   N)r"   
__future__r   mailchimp3.baseapir   r   r   r   r   r   <module>   s   