Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# coding=utf-8
"""
The Location Report API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/open-details/
Schema: https://api.mailchimp.com/schema/3.0/Reports/OpenDetails/Collection.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class OpenDetails(BaseApi):
"""
Get a detailed report about any emails in a specific campaign that were opened by the recipient.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(OpenDetails, self).__init__(*args, **kwargs)
self.endpoint = 'reports'
self.campaign_id = None
def all(self, campaign_id, get_all=False, **queryparams):
"""
Get detailed information about any campaign emails that were opened by a list member.
# coding=utf-8
"""
The Sent To Report API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/sent-to/
Schema: https://api.mailchimp.com/schema/3.0/Reports/SentTo/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
from mailchimp3.helpers import check_subscriber_hash
class ReportSentTo(BaseApi):
"""
Get details about campaign recipients.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(ReportSentTo, self).__init__(*args, **kwargs)
self.endpoint = 'reports'
self.campaign_id = None
self.subscriber_hash = None
def all(self, campaign_id, get_all=False, **queryparams):
"""
Get information about campaign recipients.
from __future__ import unicode_literals
from ..baseapi import BaseApi
class Message(BaseApi):
def __init__(self, *args, **kwargs):
super(Message, self).__init__(*args, **kwargs)
self.endpoint = 'conversations'
def all(self, conversation_id, **queryparams):
return self._mc_client._get(url=self._build_path(conversation_id, 'messages'), **queryparams)
def get(self, conversation_id, message_id):
return self._mc_client._get(url=self._build_path(conversation_id, 'messages', message_id))
def create(self, conversation_id, data):
return self._mc_client._post(url=self._build_path(conversation_id, 'messages'), data=data)
from __future__ import unicode_literals
from ..baseapi import BaseApi
class Category(BaseApi):
def __init__(self, *args, **kwargs):
super(Category, self).__init__(*args, **kwargs)
self.endpoint = 'lists'
def all(self, list_id, **queryparams):
"""
returns first 10 interest categories, or Group Titles, for a list.
"""
return self._mc_client._get(url=self._build_path(list_id, 'interest-categories'), **queryparams)
def create(self, list_id, data):
"""
creates a new interest categories, or Group Title.
"""
return self._mc_client._post(url=self._build_path(list_id, 'interest-categories'), data=data)
# coding=utf-8
"""
The E-commerce Stores Promo CodesAPI endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/promo-rules
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class StorePromoCodes(BaseApi):
"""
Promo Promo codes can be created for a given promo rule. All the promo codes under a promo rule share the
generic information defined for that rule like the amount, type, expiration date etc.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the Endpoint
:param args:
:param kwargs:
"""
super(StorePromoCodes, self).__init__(*args, **kwargs)
self.endpoint = 'ecommerce/stores'
self.store_id = None
def create(self, store_id, promo_rule_id, data):
"""
# coding=utf-8
"""
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
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class StoreProductImages(BaseApi):
"""
A Product Image represents a specific product image.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(StoreProductImages, self).__init__(*args, **kwargs)
self.endpoint = 'ecommerce/stores'
self.store_id = None
self.product_id = None
self.image_id = None
def create(self, store_id, product_id, data):
"""
# coding=utf-8
"""
The E-commerce Store Carts endpoint API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/carts/
Schema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Carts/Instance.json
"""
from __future__ import unicode_literals
import re
from mailchimp3.baseapi import BaseApi
from mailchimp3.entities.storecartlines import StoreCartLines
class StoreCarts(BaseApi):
"""
Use Carts to represent unfinished e-commerce transactions. This can be
used to create an Abandoned Cart workflow, or to save a consumer’s
shopping cart pending a successful Order.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(StoreCarts, self).__init__(*args, **kwargs)
self.endpoint = 'ecommerce/stores'
self.store_id = None
self.cart_id = None
self.lines = StoreCartLines(self)
from __future__ import unicode_literals
from ..baseapi import BaseApi
class ReportUnsubscribed(BaseApi):
"""
Reports Unsubscribed Collection
A list of unsubscribes for a specific campaign (for various reasons).
http://developer.mailchimp.com/documentation/mailchimp/http://kb.mailchimp.com/api/resources/reports/unsubscribes
"""
def __init__(self, *args, **kwargs):
super(ReportUnsubscribed, self).__init__(*args, **kwargs)
self.endpoint = 'reports'
def all(self, campaign_id, **queryparams):
"""
Returns report of all usubscribes a reason for a given campaign
"""
return self._mc_client._get(url=self._build_path(campaign_id, 'unsubscribed'), **queryparams)
# coding=utf-8
"""
The List Growth History API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/growth-history/
Schema: https://api.mailchimp.com/schema/3.0/Lists/Growth/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class ListGrowthHistory(BaseApi):
"""
View a summary of the month-by-month growth activity for a specific list.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(ListGrowthHistory, self).__init__(*args, **kwargs)
self.endpoint = 'lists'
self.list_id = None
self.month = None
def all(self, list_id, get_all=False, **queryparams):
"""
Get a month-by-month summary of a specific list’s growth activity.
# coding=utf-8
"""
The Search Members API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/search-campaigns/
Schema: https://api.mailchimp.com/schema/3.0/Lists/Members/Collection.json
Additional Data: http://kb.mailchimp.com/accounts/management/search-for-subscribers-and-campaigns-in-your-account
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
class SearchCampaigns(BaseApi):
"""
Search all of an account’s campaigns for the specified query terms.
"""
def __init__(self, *args, **kwargs):
"""
Initialize the endpoint
"""
super(SearchCampaigns, self).__init__(*args, **kwargs)
self.endpoint = 'search-campaigns'
def get(self, **queryparams):
"""
Search all campaigns for the specified query terms.
:param queryparams: The query string parameters