o
    ˷e                      @   s<   d Z ddlmZ ddlmZ ddlmZ G dd deZdS )z
The List Member Notes API endpoint

Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/notes/
Schema: https://api.mailchimp.com/schema/3.0/Lists/Members/Notes/Instance.json
    )unicode_literals)BaseApi)check_subscriber_hashc                       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 )ListMemberNotesz;
    Retrieve recent notes for a specific list member.
    c                    s2   t t| j|i | d| _d| _d| _d| _dS )z)
        Initialize the endpoint
        listsN)superr   __init__endpointlist_idsubscriber_hashnote_id)selfargskwargs	__class__ Z/var/www/ideatree/venv/lib/python3.10/site-packages/mailchimp3/entities/listmembernotes.pyr      s
   
zListMemberNotes.__init__c                 C   s`   t |}|| _|| _d|vrtd| jj| |d|d|d}|dur+|d | _|S d| _|S )u  
        Add a new note for a specific subscriber.

        The documentation lists only the note request body parameter so it is
        being documented and error-checked as if it were required based on the
        description of the method.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "note": string*
        }
        note%The list member note must have a notemembersnotesurldataNid)r   r
   r   KeyError
_mc_client_post_build_pathr   )r   r
   r   r   responser   r   r   create   s   
zListMemberNotes.createFc              	   K   s`   t |}|| _|| _d| _|r| jdd| |d|di|S | jjdd| |d|di|S )uu  
        Get recent notes for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :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'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer
        Nr   r   r   r   )r   r
   r   r   _iterater   r   _get)r   r
   r   get_allqueryparamsr   r   r   all=   s    "zListMemberNotes.allc              
   K   s>   t |}|| _|| _|| _| jjdd| |d|d|i|S )u  
        Get a specific note for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param note_id: The id for the note.
        :type note_id: :py:class:`str`
        :param queryparams: The query string parameters
        queryparams['fields'] = []
        queryparams['exclude_fields'] = []
        r   r   r   Nr   )r   r
   r   r   r   r#   r   )r   r
   r   r   r%   r   r   r   getX   s   
zListMemberNotes.getc                 C   sH   t |}|| _|| _|| _d|vrtd| jj| |d|d||dS )u  
        Update a specific note for a specific list member.

        The documentation lists only the note request body parameter so it is
        being documented and error-checked as if it were required based on the
        description of the method.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param note_id: The id for the note.
        :type note_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "note": string*
        }
        r   r   r   r   r   )r   r
   r   r   r   r   _patchr   )r   r
   r   r   r   r   r   r   updateq   s   zListMemberNotes.updatec                 C   s6   t |}|| _|| _|| _| jj| |d|d|dS )u  
        Delete a specific note for a specific list member.

        :param list_id: The unique id for the list.
        :type list_id: :py:class:`str`
        :param subscriber_hash: The MD5 hash of the lowercase version of the
          list member’s email address.
        :type subscriber_hash: :py:class:`str`
        :param note_id: The id for the note.
        :type note_id: :py:class:`str`
        r   r   )r   )r   r
   r   r   r   _deleter   )r   r
   r   r   r   r   r   delete   s
   zListMemberNotes.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   mailchimp3.helpersr   r   r   r   r   r   <module>   s
   