o
    ˷eS                     @   s0   d Z ddlmZ ddlmZ G dd deZdS )a  
The E-commerce Store Product Images API endpoint

Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/products/images/
Schema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Products/Images/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 )StoreProductImagesz>
    A Product Image represents a specific product image.
    c                    s2   t t| j|i | d| _d| _d| _d| _dS )z)
        Initialize the endpoint
        zecommerce/storesN)superr   __init__endpointstore_id
product_idimage_id)selfargskwargs	__class__ ]/var/www/ideatree/venv/lib/python3.10/site-packages/mailchimp3/entities/storeproductimages.pyr      s
   
zStoreProductImages.__init__c                 C   sh   || _ || _d|vrtdd|vrtd| jj| |d|d|d}|dur/|d | _|S d| _|S )	a  
        Add a new image to the product.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param product_id: The id for the product of a store.
        :type product_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        data = {
            "id": string*,
            "url": string*
        }
        idz!The product image must have an idtitlez!The product image must have a urlproductsimagesurldataN)r   r	   KeyError
_mc_client_post_build_pathr
   )r   r   r	   r   responser   r   r   create   s   
zStoreProductImages.createFc              	   K   sX   || _ || _d| _|r| jdd| |d|di|S | jjdd| |d|di|S )u+  
        Get information about a product’s images.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param product_id: The id for the product of a store.
        :type product_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'] = []
        queryparams['count'] = integer
        queryparams['offset'] = integer
        Nr   r   r   r   )r   r	   r
   _iterater   r   r   )r   r   r	   get_allqueryparamsr   r   r   all9   s    "zStoreProductImages.allc              
   K   s6   || _ || _|| _| jjdd| |d|d|i|S )a  
        Get information about a specific product image.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param product_id: The id for the product of a store.
        :type product_id: :py:class:`str`
        :param image_id: The id for the product image.
        :type image_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   getR   s   
zStoreProductImages.getc                 C   s0   || _ || _|| _| jj| |d|d||dS )a  
        Update a product image.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param product_id: The id for the product of a store.
        :type product_id: :py:class:`str`
        :param image_id: The id for the product image.
        :type image_id: :py:class:`str`
        :param data: The request body parameters
        :type data: :py:class:`dict`
        r   r   r   )r   r	   r
   r   _patchr   )r   r   r	   r
   r   r   r   r   updatei   s   zStoreProductImages.updatec                 C   s.   || _ || _|| _| jj| |d|d|dS )a@  
        Delete a product image.

        :param store_id: The store id.
        :type store_id: :py:class:`str`
        :param product_id: The id for the product of a store.
        :type product_id: :py:class:`str`
        :param image_id: The id for the product image.
        :type image_id: :py:class:`str`
        r   r   )r   )r   r	   r
   r   _deleter   )r   r   r	   r
   r   r   r   delete   s   zStoreProductImages.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   