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 Campaign Feedback API endpoint

Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/feedback/
Schema: https://api.mailchimp.com/schema/3.0/Campaigns/Feedback/Instance.json
    )unicode_literals)BaseApic                       sJ   e Zd ZdZ fddZdd ZdddZd	d
 Zdd Zdd Z	  Z
S )CampaignFeedbacku   
    Post comments, reply to team feedback, and send test emails while you’re
    working together on a MailChimp campaign.
    c                    s,   t t| j|i | d| _d| _d| _dS )z)
        Initialize the endpoint
        	campaignsN)superr   __init__endpointcampaign_idfeedback_id)selfargskwargs	__class__ [/var/www/ideatree/venv/lib/python3.10/site-packages/mailchimp3/entities/campaignfeedback.pyr      s   
zCampaignFeedback.__init__c                 K   sV   || _ d|vrtd| jjd| |d|d|}|dur&|d | _|S d| _|S )a  
        Add feedback on a specific campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "message": string*
        }
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        message)The campaign feedback must have a messagefeedbackurldataNr
   r   )r	   KeyError
_mc_client_post_build_pathr
   )r   r	   r   queryparamsresponser   r   r   create   s    
zCampaignFeedback.createFc                 K   sJ   || _ d| _|r| jdd| |di|S | jjdd| |di|S )u  
        Get team feedback while you’re working together on a MailChimp
        campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :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'] = []
        Nr   r   r   )r	   r
   _iterater   r   _get)r   r	   get_allr   r   r   r   all6   s
   zCampaignFeedback.allc                 K   s,   || _ || _| jjdd| |d|i|S )a  
        Get a specific feedback message from a campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param feedback_id: The unique id for the feedback message.
        :type feedback_id: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        r   r   Nr   )r	   r
   r   r    r   )r   r	   r
   r   r   r   r   getK   s    zCampaignFeedback.getc                 C   s6   || _ || _d|vrtd| jj| |d||dS )a  
        Update a specific feedback message for a campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param feedback_id: The unique id for the feedback message.
        :type feedback_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "message": string*
        }
        r   r   r   r   )r	   r
   r   r   _patchr   )r   r	   r
   r   r   r   r   update\   s
   zCampaignFeedback.updatec                 C   s$   || _ || _| jj| |d|dS )a  
        Remove a specific feedback message for a campaign.

        :param campaign_id: The unique id for the campaign.
        :type campaign_id: :py:class:`str`
        :param feedback_id: The unique id for the feedback message.
        :type feedback_id: :py:class:`str`
        r   )r   )r	   r
   r   _deleter   )r   r	   r
   r   r   r   deleteq   s   	zCampaignFeedback.delete)F)__name__
__module____qualname____doc__r   r   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   