[
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nvenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*,cover\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/\n\n# PyCharm project files\n.idea\n\n# vscode\n.vscode\n\n# sonarlint\n.sonarlint\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Charles TISSIER\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "README.md",
    "content": "[![mailchimp3 v3.0.21 on PyPi](https://img.shields.io/pypi/v/mailchimp3.svg)](https://pypi.python.org/pypi/mailchimp3)\n![MIT license](https://img.shields.io/badge/licence-MIT-blue.svg)\n![Stable](https://img.shields.io/badge/status-stable-green.svg)\n\n# python-mailchimp-api\n\nA straightforward python client for v3 of MailChimp API using\nrequests >= 2.7.0.\n\n## Getting Started\n\n### Installation\n\nThis client is hosted at PyPi under the name `mailchimp3`, to install\nit, simply run\n\n`pip install mailchimp3`\n\n### Upgrading from v2.x\n\nThe order of arguments for initializing the Mailchimp API has been\nreversed starting in 2.1.0 as the username is an optional argument for\nbasic auth. Please reverse the order of your arguments or remove the\nusername argument entirely. The name of the authentication argument has\nalso changed from `mc_secret` to `mc_api`.\n\n### Upgrading from v1.x\n\nThe installation procedure for 2.x is the same as before, however\nthere are a massive number of changes to the naming conventions within\nthis wrapper and the way in which certain methods are called. Please\nread the documentation below carefully for information on the new\nstructure and expanded functionality. With this release, all documented\nendpoints are implemented and all endpoint methods are available.\n\n### History\n\nUp to date with [changelog](http://developer.mailchimp.com/documentation/mailchimp/guides/changelog/)\nfeatures listed through 3/03/2017.\n\n### Initialization\n\nGrab `YOUR_API_KEY` from your mailchimp account (Account > Extra > Api\nKeys). `YOUR_USERNAME` is the one you use to log in on the website and\nis optional.\n\n    from mailchimp3 import MailChimp\n\n    client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')\n\n### OAuth Support\n\nIn addition to HTTP Basic Authentication, MailChimp supports\nauthentication through OAuth2. Information on obtaining the proper\naccess key can be found\n[here](http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/).\n\n### Pagination\n\nSimply add `count` and `offset` arguments in your function. The count is how\nmany records to return, the offset is how many records to skip. For endpoints\nthat allow the pagination parameters, the all() method has an additional boolean\n`get_all` argument that will loop through all records until the API no longer\nreturns any to get all records without manually performing an additional query.\nBy default, count is 10 and offset is 0 for all endpoints that support it. The\n`get_all` parameter on the all() method on any endpoint defaults to false, which\nfollows the values that are provided in the call, and using `get_all=True` will\nignore the provided offset to ensure that all records are returned. When using\nget_all, the count will be 500 unless otherwise specified. It is strongly\nrecommended to avoid small values for `count` to fetch large numbers of records\nbecause this will flood the system. A large `count` size should not impact calls\nwhich are expected to return a very small number of records, and should improve\nperformance for calls where fetching 500 records would only provide a fraction\nby preventing the delay of making a huge number of requests.\n\n    client.lists.members.all('123456', count=100, offset=0)\n\n### Fields\n\nMany endpoints allow you to select which fields will be returned out of\nall available fields (for example, only the email_address of a member).\nSimply add `fields` arguments in your function. The following only\ndisplay email_address and id for each member in list 123456:\n\n    client.lists.members.all('123456', get_all=True, fields=\"members.email_address,members.id\")\n\n### Examples\n\n    # returns all the lists (only name and id)\n    client.lists.all(get_all=True, fields=\"lists.name,lists.id\")\n\n    # returns all members inside list '123456'\n    client.lists.members.all('123456', get_all=True)\n\n    # return the first 100 member's email addresses for the list with id 123456\n    client.lists.members.all('123456', count=100, offset=0, fields=\"members.email_address\")\n\n    # returns the list matching id '123456'\n    client.lists.get('123456')\n\n    # add John Doe with email john.doe@example.com to list matching id '123456'\n    client.lists.members.create('123456', {\n        'email_address': 'john.doe@example.com',\n        'status': 'subscribed',\n        'merge_fields': {\n            'FNAME': 'John',\n            'LNAME': 'Doe',\n        },\n    })\n\n    # returns all the campaigns\n    client.campaigns.all(get_all=True)\n\n    # You can also disable at runtime with the optional ``enabled`` parameter.\n    # Every API call will return None\n    client = MailChimp('YOUR SECRET KEY', enabled=False)\n\n    # You are encouraged to specify a value in seconds for the ``timeout``\n    # parameter to avoid hanging requests.\n    client = MailChimp('YOUR SECRET KEY', timeout=10.0)\n\n    # You are encouraged to specify a User-Agent for requests to the MailChimp\n    # API. Headers can be specified using the ``request_headers`` parameter.\n    headers = requests.utils.default_headers()\n    headers['User-Agent'] = 'Example (example@example.com)'\n    client = MailChimp('YOUR SECRET KEY', request_headers=headers)\n\n## API Structure\n\nAll endpoints follow the structure listed in the official MailChimp API\nv3 documentation. The structure will be listed below and then the\nindividual methods available after.\n\n    MailChimp\n    +- Root\n    +- Authorized Apps\n    +- Automations\n    |  +- Actions\n    |  +- Emails\n    |  |  +- Actions\n    |  |  +- Queues\n    |  +- Removed Subscribers\n    +- Batch Operations\n    +- Batch Webhooks\n    +- Campaign Folders\n    +- Campaigns\n    |  +- Actions\n    |  +- Content\n    |  +- Feedback\n    |  +- Send Checklist\n    +- Conversations\n    |  +- Messages\n    +- Customer Journeys\n    +- Stores\n    |  +- Carts\n    |  |  +- Lines\n    |  +- Customers\n    |  +- Orders\n    |  |  +- Lines\n    |  +- Products\n    |     +- Images\n    |     +- Variants\n    |  +- Promo Rules\n    |     +- Promo Codes\n    +- File Manager Files\n    +- File Manager Folders\n    +- Landing Pages\n    |  +- Actions\n    |  +- Content\n    +- Lists\n    |  +- Abuse Reports\n    |  +- Activity\n    |  +- Clients\n    |  +- Growth History\n    |  +- Interest Categories\n    |  |  +- Interests\n    |  +- Members\n    |  |  +- Activity\n    |  |  +- Events\n    |  |  +- Goals\n    |  |  +- Notes\n    |  |  +- Tags\n    |  +- Merge Fields\n    |  +- Segments\n    |  |  +- Segment Members\n    |  +- Signup Forms\n    |  +- Twitter Lead Generation Carts\n    |  +- Webhooks\n    +- Ping\n    +- Reports\n    |  +- Campaign Abuse\n    |  +- Campaign Advice\n    |  +- Campaign Open reports\n    |  +- Click Reports\n    |  |  +- Members\n    |  +- Domain Performance\n    |  +- EepURL Reports\n    |  +- Email Activity\n    |  +- Google Analytics\n    |  +- Location\n    |  +- Sent To\n    |  +- Sub-Reports\n    |  +- Unsubscribes\n    +- Search Campaigns\n    +- Search Members\n    +- Template Folders\n    +- Templates\n       +- Default Content\n\n## API Endpoints\n\nBelow is the list of all endpoints and the methods that can be called\nagainst them. Any endpoint that has a method that takes an ID argument\n(for example the app_id in the authorized_apps endpoint or the\nsubscriber_hash in the list members endpoints) will record all IDs\npassed as well as those generated by methods that will only ever return\na single result such as the create() method present on some endpoints.\nThese stored attributes are only available at the level that they were\npassed or created at and must be passed again to interact with a lower\nor higher level such as accessing a list and then a member. The below\ncode assumes that you have initialized the MailChimp class as listed\nabove with the name `client`.\n\n### Root\n\n#### Root\n\n    client.root.get()\n\n### Authorized Apps\n\n#### Authorized Apps\n\n    client.authorized_apps.create(data={})\n    client.authorized_apps.all(get_all=False)\n    client.authorized_apps.get(app_id='')\n\n### Automations\n\n#### Automations\n\n    client.automations.all(get_all=False)\n    client.automations.get(workflow_id='')\n\n#### Automation Actions\n\n    client.automations.actions.pause(workflow_id='')\n    client.automations.actions.start(workflow_id='')\n\n#### Automation Emails\n\n    client.automations.emails.all(workflow_id='')\n    client.automations.emails.get(workflow_id='', email_id='')\n\n#### Automation Email Actions\n\n    client.automations.emails.actions.pause(workflow_id='', email_id='')\n    client.automations.emails.actions.start(workflow_id='', email_id='')\n\n#### Automation Email Queues\n\n    client.automations.emails.queues.create(workflow_id='', email_id='', data={})\n    client.automations.emails.queues.all(workflow_id='', email_id='')\n    client.automations.emails.queues.get(workflow_id='', email_id='', subscriber_hash='')\n\n#### Automation Removed Subscribers\n\n    client.automations.removed_subscribers.create(workflow_id='', data={})\n    client.automations.removed_subscribers.all(workflow_id='')\n\n### Batch Operations\n\n#### Batch Operations\n\n    client.batch_operations.create(data={})\n    client.batch_operations.all(get_all=False)\n    client.batch_operations.get(batch_id='')\n    client.batch_operations.delete(batch_id='')\n\n### Batch Webhooks\n\n#### Batch Webhooks\n\n    client.batch_webhooks.create(data={})\n    client.batch_webhooks.all(get_all=False)\n    client.batch_webhooks.get(batch_webhook_id='')\n    client.batch_webhooks.update(batch_webhook_id='', data={})\n    client.batch_webhooks.delete(batch_webhook_id='')\n\n### Campaigns\n\n#### Folders\n\n    client.campaign_folders.create(data={})\n    client.campaign_folders.all(get_all=False)\n    client.campaign_folders.get(folder_id='')\n    client.campaign_folders.update(folder_id='', data={})\n    client.campaign_folders.delete(folder_id='')\n\n#### Campaigns\n\n    client.campaigns.create(data={})\n    client.campaigns.all(get_all=False)\n    client.campaigns.get(campaign_id='')\n    client.campaigns.update(campaign_id='')\n    client.campaigns.delete(campaign_id='')\n\n#### Campaign Actions\n\n    client.campaigns.actions.cancel(campaign_id='')\n    client.campaigns.actions.pause(campaign_id='')\n    client.campaigns.actions.replicate(campaign_id='')\n    client.campaigns.actions.resume(campaign_id='')\n    client.campaigns.actions.schedule(campaign_id='', data={})\n    client.campaigns.actions.send(campaign_id='')\n    client.campaigns.actions.resend(campaign_id='')\n    client.campaigns.actions.test(campaign_id='', data={})\n    client.campaigns.actions.unschedule(campaign_id='')\n\n#### Campaign Content\n\n    client.campaigns.content.get(campaign_id='')\n    client.campaigns.content.update(campaign_id='', data={})\n\n#### Campaign Feedback\n\n    client.campaigns.feedback.create(campaign_id='', data={})\n    client.campaigns.feedback.all(campaign_id='', get_all=False)\n    client.campaigns.feedback.get(campaign_id='', feedback_id='')\n    client.campaigns.feedback.update(campaign_id='', feedback_id='', data={})\n    client.campaigns.feedback.delete(campaign_id='', feedback_id='')\n\n#### Campaign Send Checklist\n\n    client.campaigns.send_checklist.get(campaign_id='')\n\n### Conversations\n\n#### Conversations\n\n    client.conversations.all(get_all=False)\n    client.conversations.get(conversation_id='')\n\n#### Conversation Messages\n\n    client.conversations.messages.create(conversation_id='', data={})\n    client.conversations.messages.all(conversation_id='')\n    client.conversations.messages.get(conversation_id='', message_id='')\n\n### Customer Journeys\n\n#### Customer Journeys\n\n    client.customer_journeys.trigger(journey_id='', step_id='', data={})\n\n### E-Commerce\n\n#### Stores\n\n    client.stores.create(data={})\n    client.stores.all(get_all=False)\n    client.stores.get(store_id='')\n    client.stores.update(store_id='', data={})\n    client.stores.delete(store_id='')\n\n#### Store Carts\n\n    client.stores.carts.create(store_id='', data={})\n    client.stores.carts.all(store_id='', get_all=False)\n    client.stores.carts.get(store_id='', cart_id='')\n    client.stores.carts.update(store_id='', cart_id='', data={})\n    client.stores.carts.delete(store_id='', cart_id='')\n\n#### Store Cart Lines\n\n    client.stores.carts.lines.create(store_id='', cart_id='', data={})\n    client.stores.carts.lines.all(store_id='', cart_id='', get_all=False)\n    client.stores.carts.lines.get(store_id='', cart_id='', line_id='')\n    client.stores.carts.lines.update(store_id='', cart_id='', line_id='', data={})\n    client.stores.carts.lines.delete(store_id='', cart_id='', line_id='')\n\n#### Store Customers\n\n    client.stores.customers.create(store_id='', data={})\n    client.stores.customers.all(store_id='', get_all=False)\n    client.stores.customers.get(store_id='', customer_id='')\n    client.stores.customers.update(store_id='', customer_id='', data={})\n    client.stores.customers.create_or_update(store_id='', customer_id='', data={})\n    client.stores.customers.delete(store_id='', customer_id='')\n\n#### Store Orders\n\n    client.stores.orders.create(store_id='', data={})\n    client.stores.orders.all(store_id='', get_all=False)\n    client.stores.orders.get(store_id='', order_id='')\n    client.stores.orders.update(store_id='', order_id='', data={})\n    client.stores.orders.delete(store_id='', order_id='')\n\n#### Store Order Lines\n\n    client.stores.orders.lines.create(store_id='', order_id='', data={})\n    client.stores.orders.lines.all(store_id='', order_id='', get_all=False)\n    client.stores.orders.lines.get(store_id='', order_id='', line_id='')\n    client.stores.orders.lines.update(store_id='', order_id='', line_id='', data={})\n    client.stores.orders.lines.delete(store_id='', order_id='', line_id='')\n\n#### Store Products\n\n    client.stores.products.create(store_id='', data={})\n    client.stores.products.all(store_id='', get_all=False)\n    client.stores.products.get(store_id='', product_id='')\n    client.stores.products.update(store_id='', product_id='')\n    client.stores.products.delete(store_id='', product_id='')\n\n#### Store Product Images\n\n    client.stores.products.images.create(store_id='', product_id='', data={})\n    client.stores.products.images.all(store_id='', product_id='', get_all=False)\n    client.stores.products.images.get(store_id='', product_id='', image_id='')\n    client.stores.products.images.update(store_id='', product_id='', image_id='', data={})\n    client.stores.products.images.delete(store_id='', product_id='', image_id='')\n\n#### Store Product Variants\n\n    client.stores.products.variants.create(store_id='', product_id='', data={})\n    client.stores.products.variants.all(store_id='', product_id='', get_all=False)\n    client.stores.products.variants.get(store_id='', product_id='', variant_id='')\n    client.stores.products.variants.update(store_id='', product_id='', variant_id='', data={})\n    client.stores.products.variants.create_or_update(store_id='', product_id='', variant_id='', data={})\n    client.stores.products.variants.delete(store_id='', product_id='', variant_id='')\n\n### File Manager\n\n#### Files\n\n    client.files.create(data={})\n    client.files.all(get_all=False)\n    client.files.get(file_id='')\n    client.files.update(file_id='', data={})\n    client.files.delete(file_id='')\n\n#### Folders\n\n    client.folders.create(data={})\n    client.folders.all(get_all=False)\n    client.folders.get(folder_id='')\n    client.folders.update(folder_id='', data={})\n    client.folders.delete(folder_id='')\n\n### Landing Pages\n\n#### Landing Pages\n\n    client.landing_pages.create(data={})\n    client.landing_pages.all()\n    client.landing_pages.all(fields='')\n    client.landing_pages.get(page_id='')\n    client.landing_pages.update(page_id='', data={})\n    client.landing_pages.delete(page_id='')\n   \n#### Landing Pages Actions\n\n    client.landing_pages.actions.publish(page_id='')\n    client.landing_pages.actions.unpublish(page_id='')\n   \n#### Landing Pages Content\n\n    client.landing_pages.content.get(page_id='')\n\n### Lists\n\n#### Lists\n\n    client.lists.create(data={})\n    client.lists.update_members(list_id='', data={})\n    client.lists.all(get_all=False)\n    client.lists.get(list_id='')\n    client.lists.update(list_id='', data={})\n    client.lists.delete(list_id='')\n\n#### List Abuse Reports\n\n    client.lists.abuse_reports.all(list_id='', get_all=False)\n    client.lists.abuse_reports.get(list_id='', report_id='')\n\n#### List Activity\n\n    client.lists.activity.all(list_id='', subscriber_hash='')\n    client.lists.activity.feed(list_id='', subscriber_hash='')\n\n#### List Clients\n\n    client.lists.clients.all(list_id='')\n\n#### List Growth History\n\n    client.lists.growth_history.all(list_id='', get_all=False)\n    client.lists.growth_history.get(list_id='', month='')\n\n#### List Interest Categories\n\n    client.lists.interest_categories.create(list_id='', data={})\n    client.lists.interest_categories.all(list_id='', get_all=False)\n    client.lists.interest_categories.get(list_id='', category_id='')\n    client.lists.interest_categories.update(list_id='', category_id='', data={})\n    client.lists.interest_categories.delete(list_id='', category_id='')\n\n#### List Interest Category Interests\n\n    client.lists.interest_categories.interests.create(list_id='', category_id='', data={})\n    client.lists.interest_categories.interests.all(list_id='', category_id='', get_all=False)\n    client.lists.interest_categories.interests.get(list_id='', category_id='', interest_id='')\n    client.lists.interest_categories.interests.update(list_id='', category_id='', interest_id='', data={})\n    client.lists.interest_categories.interests.delete(list_id='', category_id='', interest_id='')\n\n#### List Members\n\n    client.lists.members.create(list_id='', data={})\n    client.lists.members.all(list_id='', get_all=False)\n    client.lists.members.get(list_id='', subscriber_hash='')\n    client.lists.members.update(list_id='', subscriber_hash='', data={})\n    client.lists.members.create_or_update(list_id='', subscriber_hash='', data={})\n    client.lists.members.delete(list_id='', subscriber_hash='')\n    client.lists.members.delete_permanent(list_id='', subscriber_hash='')\n\n#### List Member Activity\n\n    client.lists.members.activity.all(list_id='', subscriber_hash='')\n\n#### List Member Events\n\n    client.lists.members.events.create(list_id='', subscriber_hash='', data={})\n    client.lists.members.events.all(list_id='', subscriber_hash='', get_all=False)\n\n#### List Member Goals\n\n    client.lists.members.goals.all(list_id='', subscriber_hash='')\n\n#### List Member Notes\n\n    client.lists.members.notes.create(list_id='', subscriber_hash='', data={})\n    client.lists.members.notes.all(list_id='', subscriber_hash='', get_all=False)\n    client.lists.members.notes.get(list_id='', subscriber_hash='', note_id='')\n    client.lists.members.notes.update(list_id='', subscriber_hash='', note_id='', data={})\n    client.lists.members.notes.delete(list_id='', subscriber_hash='', note_id='')\n\n#### List Member Tags\n\n    client.lists.members.tags.update(list_id='', subscriber_hash='', data={})\n    client.lists.members.tags.all(list_id='', subscriber_hash='')\n\n#### List Merge Fields\n\n    client.lists.merge_fields.create(list_id='', data={})\n    client.lists.merge_fields.all(list_id='', get_all=False)\n    client.lists.merge_fields.get(list_id='', merge_id='')\n    client.lists.merge_fields.update(list_id='', merge_id='', data={})\n    client.lists.merge_fields.delete(list_id='', merge_id='')\n\n#### List Segments\n\n    client.lists.segments.create(list_id='', data={})\n    client.lists.segments.all(list_id='', get_all=False)\n    client.lists.segments.get(list_id='', segment_id='')\n    client.lists.segments.update(list_id='', segment_id='', data={})\n    client.lists.segments.update_members(list_id='', segment_id='', data={})\n    client.lists.segments.delete(list_id='', segment_id='')\n\n#### List Segment Members\n\n    client.lists.segments.members.create(list_id='', segment_id='', data={})\n    client.lists.segments.members.all(list_id='', segment_id='', get_all=False)\n    client.lists.segments.members.delete(list_id='', segment_id='', subscriber_hash='')\n\n#### List Signup Forms\n\n    client.lists.signup_forms.create(list_id='', data={})\n    client.lists.signup_forms.all(list_id='')\n\n#### List Webhooks\n\n    client.lists.webhooks.create(list_id='', data={})\n    client.lists.webhooks.all(list_id='')\n    client.lists.webhooks.get(list_id='', webhook_id='')\n    client.lists.webhooks.update(list_id='', webhook_id='', data={})\n    client.lists.webhooks.delete(list_id='', webhook_id='')\n\n### Reports\n\n#### Reports\n\n    client.reports.all(get_all=False)\n    client.reports.get(campaign_id='')\n\n#### Campaign Abuse Reports\n\n    client.reports.abuse_reports.all(campaign_id='')\n    client.reports.abuse_reports.get(campaign_id='', report_id='')\n\n#### Campaign Advice\n\n    client.reports.advice.all(campaign_id='')\n\n#### Click Details Report\n\n    client.reports.click_details.all(campaign_id='', get_all=False)\n    client.reports.click_details.get(campaign_id='', link_id='')\n\n#### Click Details Report Members\n\n    client.reports.click_details.members.all(campaign_id='', link_id='', get_all=False)\n    client.reports.click_details.members.get(campaign_id='', link_id='', subscriber_hash='')\n\n#### Domain Performance Reports\n\n    client.reports.domain_performance.all(campaign_id='')\n\n#### EepURL Reports\n\n    client.reports.eepurl.all(camnpaign_id='')\n\n#### Email Activity Reports\n\n    client.reports.email_activity.all(campaign_id='', get_all=False)\n    client.reports.email_activity.get(campaign_id='', subscriber_hash='')\n\n#### Locations Report\n\n    client.reports.locations.all(campaign_id='', get_all=False)\n\n#### Sent To Reports\n\n    client.reports.sent_to.all(campaign_id='', get_all=False)\n    client.reports.sent_to.get(campaign_id='', subscriber_hash='')\n\n#### Sub-Reports\n\n    client.reports.subreports.all(campaign_id='')\n\n#### Unsubscribes\n\n    client.reports.unsubscribes.all(campaign_id='', get_all=False)\n    client.reports.unsubscribes.get(campaign_id='', subscriber_hash='')\n\n### Search\n\n#### Campaigns\n\n    client.search_campaigns.get()\n\n#### Members\n\n    client.search_members.get()\n\n### Templates\n\n#### Folders\n\n    client.template_folders.create(data={})\n    client.template_folders.all(get_all=False)\n    client.template_folders.get(folder_id='')\n    client.template_folders.update(folder_id='', data={})\n    client.template_folders.delete(folder_id='')\n\n#### Templates\n\n    client.templates.create(data={})\n    client.templates.all(get_all=False)\n    client.templates.get(template_id='')\n    client.templates.update(template_id='', data={})\n    client.templates.delete(template_id='')\n\n#### Default Content\n\n    client.templates.default_content.all(template_id='')\n\n## Logging\n\nThe MailChimp client will log request/response detail into the mailchimp3.client\nlogging namespace. Consider the following snippet to get started with logging:\n\n```python\nimport logging\nfh = logging.FileHandler('/path/to/some/log.log')\nlogger = logging.getLogger('mailchimp3.client')\nlogger.addHandler(fh)\n\n# use the client normally\nclient.lists.all(**{'fields': 'lists.date_created'})\n```\n\nrequest/response detail will be appended into /path/to/some/log.log:\n```\nGET Request: https://us15.api.mailchimp.com/3.0/lists?fields=lists.date_created\nGET Response: 200 {\"lists\":[{\"date_created\":\"2017-05-10T13:53:05+00:00\"},{\"date_created\":\"2017-08-22T20:27:56+00:00\"},{\"date_created\":\"2017-05-12T21:22:15+00:00\"},{\"date_created\":\"2017-04-27T17:42:04+00:00\"},{\"date_created\":\"2017-05-10T14:14:49+00:00\"},{\"date_created\":\"2017-05-10T13:52:37+00:00\"},{\"date_created\":\"2017-05-10T13:51:40+00:00\"}]}\n```\n\nCheck the [docs](https://docs.python.org/2/library/logging.html) for more detail on the Python logging package.\n\n## Support\n\nIf you are having issues, please let us know or submit a pull request.\n\n## License\n\nThe project is licensed under the MIT License.\n"
  },
  {
    "path": "README.rst",
    "content": "|mailchimp3 v3.0.21 on PyPi| |MIT license| |Stable|\n\npython-mailchimp-api\n====================\n\nA straightforward python client for v3 of MailChimp API using requests\n>= 2.7.0.\n\nGetting Started\n---------------\n\nInstallation\n~~~~~~~~~~~~\n\nThis client is hosted at PyPi under the name ``mailchimp3``, to install\nit, simply run\n\n``pip install mailchimp3``\n\nUpgrading from v2.x\n~~~~~~~~~~~~~~~~~~~\n\nThe order of arguments for initializing the Mailchimp API has been\nreversed starting in 2.1.0 as the username is an optional argument for\nbasic auth. Please reverse the order of your arguments or remove the\nusername argument entirely. The name of the authentication argument has\nalso changed from ``mc_secret`` to ``mc_api``.\n\nUpgrading from v1.x\n~~~~~~~~~~~~~~~~~~~\n\nThe installation procedure for 2.x is the same as before, however there\nare a massive number of changes to the naming conventions within this\nwrapper and the way in which certain methods are called. Please read the\ndocumentation below carefully for information on the new structure and\nexpanded functionality. With this release, all documented endpoints are\nimplemented and all endpoint methods are available.\n\nHistory\n~~~~~~~\n\nUp to date with\n`changelog <http://developer.mailchimp.com/documentation/mailchimp/guides/changelog/>`__\nfeatures listed through 3/03/2017.\n\nInitialization\n~~~~~~~~~~~~~~\n\nGrab ``YOUR_API_KEY`` from your mailchimp account (Account > Extra > Api\nKeys). ``YOUR_USERNAME`` is the one you use to log in on the website and\nis optional.\n\n::\n\n   from mailchimp3 import MailChimp\n\n   client = MailChimp(mc_api='YOUR_API_KEY', mc_user='YOUR_USERNAME')\n\nOAuth Support\n~~~~~~~~~~~~~\n\nIn addition to HTTP Basic Authentication, MailChimp supports\nauthentication through OAuth2. Information on obtaining the proper\naccess key can be found\n`here <http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/>`__.\n\nPagination\n~~~~~~~~~~\n\nSimply add ``count`` and ``offset`` arguments in your function. The\ncount is how many records to return, the offset is how many records to\nskip. For endpoints that allow the pagination parameters, the all()\nmethod has an additional boolean ``get_all`` argument that will loop\nthrough all records until the API no longer returns any to get all\nrecords without manually performing an additional query. By default,\ncount is 10 and offset is 0 for all endpoints that support it. The\n``get_all`` parameter on the all() method on any endpoint defaults to\nfalse, which follows the values that are provided in the call, and using\n``get_all=True`` will ignore the provided offset to ensure that all\nrecords are returned. When using get_all, the count will be 500 unless\notherwise specified. It is strongly recommended to avoid small values\nfor ``count`` to fetch large numbers of records because this will flood\nthe system. A large ``count`` size should not impact calls which are\nexpected to return a very small number of records, and should improve\nperformance for calls where fetching 500 records would only provide a\nfraction by preventing the delay of making a huge number of requests.\n\n::\n\n   client.lists.members.all('123456', count=100, offset=0)\n\nFields\n~~~~~~\n\nMany endpoints allow you to select which fields will be returned out of\nall available fields (for example, only the email_address of a member).\nSimply add ``fields`` arguments in your function. The following only\ndisplay email_address and id for each member in list 123456:\n\n::\n\n   client.lists.members.all('123456', get_all=True, fields=\"members.email_address,members.id\")\n\nExamples\n~~~~~~~~\n\n::\n\n   # returns all the lists (only name and id)\n   client.lists.all(get_all=True, fields=\"lists.name,lists.id\")\n\n   # returns all members inside list '123456'\n   client.lists.members.all('123456', get_all=True)\n\n   # return the first 100 member's email addresses for the list with id 123456\n   client.lists.members.all('123456', count=100, offset=0, fields=\"members.email_address\")\n\n   # returns the list matching id '123456'\n   client.lists.get('123456')\n\n   # add John Doe with email john.doe@example.com to list matching id '123456'\n   client.lists.members.create('123456', {\n       'email_address': 'john.doe@example.com',\n       'status': 'subscribed',\n       'merge_fields': {\n           'FNAME': 'John',\n           'LNAME': 'Doe',\n       },\n   })\n\n   # returns all the campaigns\n   client.campaigns.all(get_all=True)\n\n   # You can also disable at runtime with the optional ``enabled`` parameter.\n   # Every API call will return None\n   client = MailChimp('YOUR SECRET KEY', enabled=False)\n\n   # You are encouraged to specify a value in seconds for the ``timeout``\n   # parameter to avoid hanging requests.\n   client = MailChimp('YOUR SECRET KEY', timeout=10.0)\n\n   # You are encouraged to specify a User-Agent for requests to the MailChimp\n   # API. Headers can be specified using the ``request_headers`` parameter.\n   headers = requests.utils.default_headers()\n   headers['User-Agent'] = 'Example (example@example.com)'\n   client = MailChimp('YOUR SECRET KEY', request_headers=headers)\n\nAPI Structure\n-------------\n\nAll endpoints follow the structure listed in the official MailChimp API\nv3 documentation. The structure will be listed below and then the\nindividual methods available after.\n\n::\n\n   MailChimp\n   +- Root\n   +- Authorized Apps\n   +- Automations\n   |  +- Actions\n   |  +- Emails\n   |  |  +- Actions\n   |  |  +- Queues\n   |  +- Removed Subscribers\n   +- Batch Operations\n   +- Batch Webhooks\n   +- Campaign Folders\n   +- Campaigns\n   |  +- Actions\n   |  +- Content\n   |  +- Feedback\n   |  +- Send Checklist\n   +- Conversations\n   |  +- Messages\n   +- Customer Journeys\n   +- Stores\n   |  +- Carts\n   |  |  +- Lines\n   |  +- Customers\n   |  +- Orders\n   |  |  +- Lines\n   |  +- Products\n   |     +- Images\n   |     +- Variants\n   |  +- Promo Rules\n   |     +- Promo Codes\n   +- File Manager Files\n   +- File Manager Folders\n   +- Landing Pages\n   |  +- Actions\n   |  +- Content\n   +- Lists\n   |  +- Abuse Reports\n   |  +- Activity\n   |  +- Clients\n   |  +- Growth History\n   |  +- Interest Categories\n   |  |  +- Interests\n   |  +- Members\n   |  |  +- Activity\n   |  |  +- Events\n   |  |  +- Goals\n   |  |  +- Notes\n   |  |  +- Tags\n   |  +- Merge Fields\n   |  +- Segments\n   |  |  +- Segment Members\n   |  +- Signup Forms\n   |  +- Twitter Lead Generation Carts\n   |  +- Webhooks\n   +- Ping\n   +- Reports\n   |  +- Campaign Abuse\n   |  +- Campaign Advice\n   |  +- Campaign Open reports\n   |  +- Click Reports\n   |  |  +- Members\n   |  +- Domain Performance\n   |  +- EepURL Reports\n   |  +- Email Activity\n   |  +- Google Analytics\n   |  +- Location\n   |  +- Sent To\n   |  +- Sub-Reports\n   |  +- Unsubscribes\n   +- Search Campaigns\n   +- Search Members\n   +- Template Folders\n   +- Templates\n      +- Default Content\n\nAPI Endpoints\n-------------\n\nBelow is the list of all endpoints and the methods that can be called\nagainst them. Any endpoint that has a method that takes an ID argument\n(for example the app_id in the authorized_apps endpoint or the\nsubscriber_hash in the list members endpoints) will record all IDs\npassed as well as those generated by methods that will only ever return\na single result such as the create() method present on some endpoints.\nThese stored attributes are only available at the level that they were\npassed or created at and must be passed again to interact with a lower\nor higher level such as accessing a list and then a member. The below\ncode assumes that you have initialized the MailChimp class as listed\nabove with the name ``client``.\n\nRoot\n~~~~\n\n.. _root-1:\n\nRoot\n^^^^\n\n::\n\n   client.root.get()\n\nAuthorized Apps\n~~~~~~~~~~~~~~~\n\n.. _authorized-apps-1:\n\nAuthorized Apps\n^^^^^^^^^^^^^^^\n\n::\n\n   client.authorized_apps.create(data={})\n   client.authorized_apps.all(get_all=False)\n   client.authorized_apps.get(app_id='')\n\nAutomations\n~~~~~~~~~~~\n\n.. _automations-1:\n\nAutomations\n^^^^^^^^^^^\n\n::\n\n   client.automations.all(get_all=False)\n   client.automations.get(workflow_id='')\n\nAutomation Actions\n^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.automations.actions.pause(workflow_id='')\n   client.automations.actions.start(workflow_id='')\n\nAutomation Emails\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.automations.emails.all(workflow_id='')\n   client.automations.emails.get(workflow_id='', email_id='')\n\nAutomation Email Actions\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.automations.emails.actions.pause(workflow_id='', email_id='')\n   client.automations.emails.actions.start(workflow_id='', email_id='')\n\nAutomation Email Queues\n^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.automations.emails.queues.create(workflow_id='', email_id='', data={})\n   client.automations.emails.queues.all(workflow_id='', email_id='')\n   client.automations.emails.queues.get(workflow_id='', email_id='', subscriber_hash='')\n\nAutomation Removed Subscribers\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.automations.removed_subscribers.create(workflow_id='', data={})\n   client.automations.removed_subscribers.all(workflow_id='')\n\nBatch Operations\n~~~~~~~~~~~~~~~~\n\n.. _batch-operations-1:\n\nBatch Operations\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.batch_operations.create(data={})\n   client.batch_operations.all(get_all=False)\n   client.batch_operations.get(batch_id='')\n   client.batch_operations.delete(batch_id='')\n\nBatch Webhooks\n~~~~~~~~~~~~~~\n\n.. _batch-webhooks-1:\n\nBatch Webhooks\n^^^^^^^^^^^^^^\n\n::\n\n   client.batch_webhooks.create(data={})\n   client.batch_webhooks.all(get_all=False)\n   client.batch_webhooks.get(batch_webhook_id='')\n   client.batch_webhooks.update(batch_webhook_id='', data={})\n   client.batch_webhooks.delete(batch_webhook_id='')\n\nCampaigns\n~~~~~~~~~\n\nFolders\n^^^^^^^\n\n::\n\n   client.campaign_folders.create(data={})\n   client.campaign_folders.all(get_all=False)\n   client.campaign_folders.get(folder_id='')\n   client.campaign_folders.update(folder_id='', data={})\n   client.campaign_folders.delete(folder_id='')\n\n.. _campaigns-1:\n\nCampaigns\n^^^^^^^^^\n\n::\n\n   client.campaigns.create(data={})\n   client.campaigns.all(get_all=False)\n   client.campaigns.get(campaign_id='')\n   client.campaigns.update(campaign_id='')\n   client.campaigns.delete(campaign_id='')\n\nCampaign Actions\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.campaigns.actions.cancel(campaign_id='')\n   client.campaigns.actions.pause(campaign_id='')\n   client.campaigns.actions.replicate(campaign_id='')\n   client.campaigns.actions.resume(campaign_id='')\n   client.campaigns.actions.schedule(campaign_id='', data={})\n   client.campaigns.actions.send(campaign_id='')\n   client.campaigns.actions.resend(campaign_id='')\n   client.campaigns.actions.test(campaign_id='', data={})\n   client.campaigns.actions.unschedule(campaign_id='')\n\nCampaign Content\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.campaigns.content.get(campaign_id='')\n   client.campaigns.content.update(campaign_id='', data={})\n\nCampaign Feedback\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.campaigns.feedback.create(campaign_id='', data={})\n   client.campaigns.feedback.all(campaign_id='', get_all=False)\n   client.campaigns.feedback.get(campaign_id='', feedback_id='')\n   client.campaigns.feedback.update(campaign_id='', feedback_id='', data={})\n   client.campaigns.feedback.delete(campaign_id='', feedback_id='')\n\nCampaign Send Checklist\n^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.campaigns.send_checklist.get(campaign_id='')\n\nConversations\n~~~~~~~~~~~~~\n\n.. _conversations-1:\n\nConversations\n^^^^^^^^^^^^^\n\n::\n\n   client.conversations.all(get_all=False)\n   client.conversations.get(conversation_id='')\n\nConversation Messages\n^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.conversations.messages.create(conversation_id='', data={})\n   client.conversations.messages.all(conversation_id='')\n   client.conversations.messages.get(conversation_id='', message_id='')\n\nCustomer Journeys\n~~~~~~~~~~~~~~~~~\n\n.. _customer-journeys-1:\n\nCustomer Journeys\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.customer_journeys.trigger(journey_id='', step_id='', data={})\n\nE-Commerce\n~~~~~~~~~~\n\nStores\n^^^^^^\n\n::\n\n   client.stores.create(data={})\n   client.stores.all(get_all=False)\n   client.stores.get(store_id='')\n   client.stores.update(store_id='', data={})\n   client.stores.delete(store_id='')\n\nStore Carts\n^^^^^^^^^^^\n\n::\n\n   client.stores.carts.create(store_id='', data={})\n   client.stores.carts.all(store_id='', get_all=False)\n   client.stores.carts.get(store_id='', cart_id='')\n   client.stores.carts.update(store_id='', cart_id='', data={})\n   client.stores.carts.delete(store_id='', cart_id='')\n\nStore Cart Lines\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.stores.carts.lines.create(store_id='', cart_id='', data={})\n   client.stores.carts.lines.all(store_id='', cart_id='', get_all=False)\n   client.stores.carts.lines.get(store_id='', cart_id='', line_id='')\n   client.stores.carts.lines.update(store_id='', cart_id='', line_id='', data={})\n   client.stores.carts.lines.delete(store_id='', cart_id='', line_id='')\n\nStore Customers\n^^^^^^^^^^^^^^^\n\n::\n\n   client.stores.customers.create(store_id='', data={})\n   client.stores.customers.all(store_id='', get_all=False)\n   client.stores.customers.get(store_id='', customer_id='')\n   client.stores.customers.update(store_id='', customer_id='', data={})\n   client.stores.customers.create_or_update(store_id='', customer_id='', data={})\n   client.stores.customers.delete(store_id='', customer_id='')\n\nStore Orders\n^^^^^^^^^^^^\n\n::\n\n   client.stores.orders.create(store_id='', data={})\n   client.stores.orders.all(store_id='', get_all=False)\n   client.stores.orders.get(store_id='', order_id='')\n   client.stores.orders.update(store_id='', order_id='', data={})\n   client.stores.orders.delete(store_id='', order_id='')\n\nStore Order Lines\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.stores.orders.lines.create(store_id='', order_id='', data={})\n   client.stores.orders.lines.all(store_id='', order_id='', get_all=False)\n   client.stores.orders.lines.get(store_id='', order_id='', line_id='')\n   client.stores.orders.lines.update(store_id='', order_id='', line_id='', data={})\n   client.stores.orders.lines.delete(store_id='', order_id='', line_id='')\n\nStore Products\n^^^^^^^^^^^^^^\n\n::\n\n   client.stores.products.create(store_id='', data={})\n   client.stores.products.all(store_id='', get_all=False)\n   client.stores.products.get(store_id='', product_id='')\n   client.stores.products.update(store_id='', product_id='')\n   client.stores.products.delete(store_id='', product_id='')\n\nStore Product Images\n^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.stores.products.images.create(store_id='', product_id='', data={})\n   client.stores.products.images.all(store_id='', product_id='', get_all=False)\n   client.stores.products.images.get(store_id='', product_id='', image_id='')\n   client.stores.products.images.update(store_id='', product_id='', image_id='', data={})\n   client.stores.products.images.delete(store_id='', product_id='', image_id='')\n\nStore Product Variants\n^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.stores.products.variants.create(store_id='', product_id='', data={})\n   client.stores.products.variants.all(store_id='', product_id='', get_all=False)\n   client.stores.products.variants.get(store_id='', product_id='', variant_id='')\n   client.stores.products.variants.update(store_id='', product_id='', variant_id='', data={})\n   client.stores.products.variants.create_or_update(store_id='', product_id='', variant_id='', data={})\n   client.stores.products.variants.delete(store_id='', product_id='', variant_id='')\n\nFile Manager\n~~~~~~~~~~~~\n\nFiles\n^^^^^\n\n::\n\n   client.files.create(data={})\n   client.files.all(get_all=False)\n   client.files.get(file_id='')\n   client.files.update(file_id='', data={})\n   client.files.delete(file_id='')\n\n.. _folders-1:\n\nFolders\n^^^^^^^\n\n::\n\n   client.folders.create(data={})\n   client.folders.all(get_all=False)\n   client.folders.get(folder_id='')\n   client.folders.update(folder_id='', data={})\n   client.folders.delete(folder_id='')\n\nLanding Pages\n~~~~~~~~~~~~~\n\n.. _landing-pages-1:\n\nLanding Pages\n^^^^^^^^^^^^^\n\n::\n\n   client.landing_pages.create(data={})\n   client.landing_pages.all()\n   client.landing_pages.all(fields='')\n   client.landing_pages.get(page_id='')\n   client.landing_pages.update(page_id='', data={})\n   client.landing_pages.delete(page_id='')\n\nLanding Pages Actions\n^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.landing_pages.actions.publish(page_id='')\n   client.landing_pages.actions.unpublish(page_id='')\n\nLanding Pages Content\n^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.landing_pages.content.get(page_id='')\n\nLists\n~~~~~\n\n.. _lists-1:\n\nLists\n^^^^^\n\n::\n\n   client.lists.create(data={})\n   client.lists.update_members(list_id='', data={})\n   client.lists.all(get_all=False)\n   client.lists.get(list_id='')\n   client.lists.update(list_id='', data={})\n   client.lists.delete(list_id='')\n\nList Abuse Reports\n^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.abuse_reports.all(list_id='', get_all=False)\n   client.lists.abuse_reports.get(list_id='', report_id='')\n\nList Activity\n^^^^^^^^^^^^^\n\n::\n\n   client.lists.activity.all(list_id='', subscriber_hash='')\n   client.lists.activity.feed(list_id='', subscriber_hash='')\n\nList Clients\n^^^^^^^^^^^^\n\n::\n\n   client.lists.clients.all(list_id='')\n\nList Growth History\n^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.growth_history.all(list_id='', get_all=False)\n   client.lists.growth_history.get(list_id='', month='')\n\nList Interest Categories\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.interest_categories.create(list_id='', data={})\n   client.lists.interest_categories.all(list_id='', get_all=False)\n   client.lists.interest_categories.get(list_id='', category_id='')\n   client.lists.interest_categories.update(list_id='', category_id='', data={})\n   client.lists.interest_categories.delete(list_id='', category_id='')\n\nList Interest Category Interests\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.interest_categories.interests.create(list_id='', category_id='', data={})\n   client.lists.interest_categories.interests.all(list_id='', category_id='', get_all=False)\n   client.lists.interest_categories.interests.get(list_id='', category_id='', interest_id='')\n   client.lists.interest_categories.interests.update(list_id='', category_id='', interest_id='', data={})\n   client.lists.interest_categories.interests.delete(list_id='', category_id='', interest_id='')\n\nList Members\n^^^^^^^^^^^^\n\n::\n\n   client.lists.members.create(list_id='', data={})\n   client.lists.members.all(list_id='', get_all=False)\n   client.lists.members.get(list_id='', subscriber_hash='')\n   client.lists.members.update(list_id='', subscriber_hash='', data={})\n   client.lists.members.create_or_update(list_id='', subscriber_hash='', data={})\n   client.lists.members.delete(list_id='', subscriber_hash='')\n   client.lists.members.delete_permanent(list_id='', subscriber_hash='')\n\nList Member Activity\n^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.members.activity.all(list_id='', subscriber_hash='')\n\nList Member Events\n^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.members.events.create(list_id='', subscriber_hash='', data={})\n   client.lists.members.events.all(list_id='', subscriber_hash='', get_all=False)\n\nList Member Goals\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.members.goals.all(list_id='', subscriber_hash='')\n\nList Member Notes\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.members.notes.create(list_id='', subscriber_hash='', data={})\n   client.lists.members.notes.all(list_id='', subscriber_hash='', get_all=False)\n   client.lists.members.notes.get(list_id='', subscriber_hash='', note_id='')\n   client.lists.members.notes.update(list_id='', subscriber_hash='', note_id='', data={})\n   client.lists.members.notes.delete(list_id='', subscriber_hash='', note_id='')\n\nList Member Tags\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.members.tags.update(list_id='', subscriber_hash='', data={})\n   client.lists.members.tags.all(list_id='', subscriber_hash='')\n\nList Merge Fields\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.merge_fields.create(list_id='', data={})\n   client.lists.merge_fields.all(list_id='', get_all=False)\n   client.lists.merge_fields.get(list_id='', merge_id='')\n   client.lists.merge_fields.update(list_id='', merge_id='', data={})\n   client.lists.merge_fields.delete(list_id='', merge_id='')\n\nList Segments\n^^^^^^^^^^^^^\n\n::\n\n   client.lists.segments.create(list_id='', data={})\n   client.lists.segments.all(list_id='', get_all=False)\n   client.lists.segments.get(list_id='', segment_id='')\n   client.lists.segments.update(list_id='', segment_id='', data={})\n   client.lists.segments.update_members(list_id='', segment_id='', data={})\n   client.lists.segments.delete(list_id='', segment_id='')\n\nList Segment Members\n^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.segments.members.create(list_id='', segment_id='', data={})\n   client.lists.segments.members.all(list_id='', segment_id='', get_all=False)\n   client.lists.segments.members.delete(list_id='', segment_id='', subscriber_hash='')\n\nList Signup Forms\n^^^^^^^^^^^^^^^^^\n\n::\n\n   client.lists.signup_forms.create(list_id='', data={})\n   client.lists.signup_forms.all(list_id='')\n\nList Webhooks\n^^^^^^^^^^^^^\n\n::\n\n   client.lists.webhooks.create(list_id='', data={})\n   client.lists.webhooks.all(list_id='')\n   client.lists.webhooks.get(list_id='', webhook_id='')\n   client.lists.webhooks.update(list_id='', webhook_id='', data={})\n   client.lists.webhooks.delete(list_id='', webhook_id='')\n\nReports\n~~~~~~~\n\n.. _reports-1:\n\nReports\n^^^^^^^\n\n::\n\n   client.reports.all(get_all=False)\n   client.reports.get(campaign_id='')\n\nCampaign Abuse Reports\n^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.abuse_reports.all(campaign_id='')\n   client.reports.abuse_reports.get(campaign_id='', report_id='')\n\nCampaign Advice\n^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.advice.all(campaign_id='')\n\nClick Details Report\n^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.click_details.all(campaign_id='', get_all=False)\n   client.reports.click_details.get(campaign_id='', link_id='')\n\nClick Details Report Members\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.click_details.members.all(campaign_id='', link_id='', get_all=False)\n   client.reports.click_details.members.get(campaign_id='', link_id='', subscriber_hash='')\n\nDomain Performance Reports\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.domain_performance.all(campaign_id='')\n\nEepURL Reports\n^^^^^^^^^^^^^^\n\n::\n\n   client.reports.eepurl.all(camnpaign_id='')\n\nEmail Activity Reports\n^^^^^^^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.email_activity.all(campaign_id='', get_all=False)\n   client.reports.email_activity.get(campaign_id='', subscriber_hash='')\n\nLocations Report\n^^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.locations.all(campaign_id='', get_all=False)\n\nSent To Reports\n^^^^^^^^^^^^^^^\n\n::\n\n   client.reports.sent_to.all(campaign_id='', get_all=False)\n   client.reports.sent_to.get(campaign_id='', subscriber_hash='')\n\nSub-Reports\n^^^^^^^^^^^\n\n::\n\n   client.reports.subreports.all(campaign_id='')\n\nUnsubscribes\n^^^^^^^^^^^^\n\n::\n\n   client.reports.unsubscribes.all(campaign_id='', get_all=False)\n   client.reports.unsubscribes.get(campaign_id='', subscriber_hash='')\n\nSearch\n~~~~~~\n\n.. _campaigns-2:\n\nCampaigns\n^^^^^^^^^\n\n::\n\n   client.search_campaigns.get()\n\nMembers\n^^^^^^^\n\n::\n\n   client.search_members.get()\n\nTemplates\n~~~~~~~~~\n\n.. _folders-2:\n\nFolders\n^^^^^^^\n\n::\n\n   client.template_folders.create(data={})\n   client.template_folders.all(get_all=False)\n   client.template_folders.get(folder_id='')\n   client.template_folders.update(folder_id='', data={})\n   client.template_folders.delete(folder_id='')\n\n.. _templates-1:\n\nTemplates\n^^^^^^^^^\n\n::\n\n   client.templates.create(data={})\n   client.templates.all(get_all=False)\n   client.templates.get(template_id='')\n   client.templates.update(template_id='', data={})\n   client.templates.delete(template_id='')\n\nDefault Content\n^^^^^^^^^^^^^^^\n\n::\n\n   client.templates.default_content.all(template_id='')\n\nLogging\n-------\n\nThe MailChimp client will log request/response detail into the\nmailchimp3.client logging namespace. Consider the following snippet to\nget started with logging:\n\n.. code:: python\n\n   import logging\n   fh = logging.FileHandler('/path/to/some/log.log')\n   logger = logging.getLogger('mailchimp3.client')\n   logger.addHandler(fh)\n\n   # use the client normally\n   client.lists.all(**{'fields': 'lists.date_created'})\n\nrequest/response detail will be appended into /path/to/some/log.log:\n\n::\n\n   GET Request: https://us15.api.mailchimp.com/3.0/lists?fields=lists.date_created\n   GET Response: 200 {\"lists\":[{\"date_created\":\"2017-05-10T13:53:05+00:00\"},{\"date_created\":\"2017-08-22T20:27:56+00:00\"},{\"date_created\":\"2017-05-12T21:22:15+00:00\"},{\"date_created\":\"2017-04-27T17:42:04+00:00\"},{\"date_created\":\"2017-05-10T14:14:49+00:00\"},{\"date_created\":\"2017-05-10T13:52:37+00:00\"},{\"date_created\":\"2017-05-10T13:51:40+00:00\"}]}\n\nCheck the `docs <https://docs.python.org/2/library/logging.html>`__ for\nmore detail on the Python logging package.\n\nSupport\n-------\n\nIf you are having issues, please let us know or submit a pull request.\n\nLicense\n-------\n\nThe project is licensed under the MIT License.\n\n.. |mailchimp3 v3.0.21 on PyPi| image:: https://img.shields.io/pypi/v/mailchimp3.svg\n   :target: https://pypi.python.org/pypi/mailchimp3\n.. |MIT license| image:: https://img.shields.io/badge/licence-MIT-blue.svg\n.. |Stable| image:: https://img.shields.io/badge/status-stable-green.svg\n"
  },
  {
    "path": "mailchimp3/__init__.py",
    "content": "# coding=utf-8\n\"\"\"\nMailchimp v3 Api SDK\n\nDocumentation at http://developer.mailchimp.com/documentation/mailchimp/reference/overview/\n\"\"\"\n# API Client\nfrom mailchimp3.mailchimpclient import MailChimpClient\n# API Root\nfrom mailchimp3.entities.root import Root\n# Authorized Apps\nfrom mailchimp3.entities.authorizedapps import AuthorizedApps\n# Automations\nfrom mailchimp3.entities.automations import Automations\nfrom mailchimp3.entities.automationactions import AutomationActions\nfrom mailchimp3.entities.automationemails import AutomationEmails\nfrom mailchimp3.entities.automationemailactions import AutomationEmailActions\nfrom mailchimp3.entities.automationemailqueues import AutomationEmailQueues\nfrom mailchimp3.entities.automationremovedsubscribers import AutomationRemovedSubscribers\n# Batch Operations\nfrom mailchimp3.entities.batchoperations import BatchOperations\n# Batch Webhooks\nfrom mailchimp3.entities.batchwebhooks import BatchWebhooks\n# Campaign Folders\nfrom mailchimp3.entities.campaignfolders import CampaignFolders\n# Campaigns\nfrom mailchimp3.entities.campaigns import Campaigns\nfrom mailchimp3.entities.campaignactions import CampaignActions\nfrom mailchimp3.entities.campaigncontent import CampaignContent\nfrom mailchimp3.entities.campaignfeedback import CampaignFeedback\nfrom mailchimp3.entities.campaignsendchecklist import CampaignSendChecklist\n# Conversations\nfrom mailchimp3.entities.conversations import Conversations\nfrom mailchimp3.entities.conversationmessages import ConversationMessages\n# Customer Journeys\nfrom mailchimp3.entities.customerjourney import CustomerJourney\n# E-commerce Stores\nfrom mailchimp3.entities.stores import Stores\nfrom mailchimp3.entities.storecarts import StoreCarts\nfrom mailchimp3.entities.storecartlines import StoreCartLines\nfrom mailchimp3.entities.storecustomers import StoreCustomers\nfrom mailchimp3.entities.storeorders import StoreOrders\nfrom mailchimp3.entities.storeorderlines import StoreOrderLines\nfrom mailchimp3.entities.storeproducts import StoreProducts\nfrom mailchimp3.entities.storeproductimages import StoreProductImages\nfrom mailchimp3.entities.storeproductvariants import StoreProductVariants\nfrom mailchimp3.entities.storepromorules import StorePromoRules\nfrom mailchimp3.entities.storepromocodes import StorePromoCodes\n# File Manager Files\nfrom mailchimp3.entities.filemanagerfiles import FileManagerFiles\n# File Manager Folders\nfrom mailchimp3.entities.filemanagerfolders import FileManagerFolders\n# Landinge Pages\nfrom mailchimp3.entities.landingpages import LandingPages\nfrom mailchimp3.entities.landingpageaction import LandingPageAction\nfrom mailchimp3.entities.landingpagecontent import LandingPageContent\n# Lists\nfrom mailchimp3.entities.lists import Lists\nfrom mailchimp3.entities.listabusereports import ListAbuseReports\nfrom mailchimp3.entities.listactivity import ListActivity\nfrom mailchimp3.entities.listclients import ListClients\nfrom mailchimp3.entities.listgrowthhistory import ListGrowthHistory\nfrom mailchimp3.entities.listinterestcategories import ListInterestCategories\nfrom mailchimp3.entities.listinterestcategoryinterest import ListInterestCategoryInterest\nfrom mailchimp3.entities.listmembers import ListMembers\nfrom mailchimp3.entities.listmemberactivity import ListMemberActivity\nfrom mailchimp3.entities.listmemberevents import ListMemberEvents\nfrom mailchimp3.entities.listmembergoals import ListMemberGoals\nfrom mailchimp3.entities.listmembernotes import ListMemberNotes\nfrom mailchimp3.entities.listmembertags import ListMemberTags\nfrom mailchimp3.entities.listmergefields import ListMergeFields\nfrom mailchimp3.entities.listsegments import ListSegments\nfrom mailchimp3.entities.listsegmentmembers import ListSegmentMembers\nfrom mailchimp3.entities.listsignupforms import ListSignupForms\nfrom mailchimp3.entities.listwebhooks import ListWebhooks\n\n# ping\nfrom mailchimp3.entities.ping import Ping\n\n# Reports\nfrom mailchimp3.entities.reports import Reports\nfrom mailchimp3.entities.reportcampaignabusereports import ReportCampaignAbuseReports\nfrom mailchimp3.entities.reportcampaignadvice import ReportCampaignAdvice\nfrom mailchimp3.entities.reportclickdetailreports import ReportClickDetailReports\nfrom mailchimp3.entities.reportclickdetailmembers import ReportClickDetailMembers\nfrom mailchimp3.entities.reportdomainperformance import ReportDomainPerformance\nfrom mailchimp3.entities.reporteepurl import ReportEepURL\nfrom mailchimp3.entities.reportemailactivity import ReportEmailActivity\nfrom mailchimp3.entities.reportlocations import ReportLocations\nfrom mailchimp3.entities.reportsentto import ReportSentTo\nfrom mailchimp3.entities.reportsubreports import ReportSubReports\nfrom mailchimp3.entities.reportunsubscribes import ReportUnsubscribes\nfrom mailchimp3.entities.reportopendetails import ReportOpenDetails\nfrom mailchimp3.entities.reportgoogleanalytics import ReportGoogleAnalytics\n\n# Search Campaigns\nfrom mailchimp3.entities.searchcampaigns import SearchCampaigns\n# Search Members\nfrom mailchimp3.entities.searchmembers import SearchMembers\n# Template Folders\nfrom mailchimp3.entities.templatefolders import TemplateFolders\n# Templates\nfrom mailchimp3.entities.templates import Templates\nfrom mailchimp3.entities.templatedefaultcontent import TemplateDefaultContent\n\n\nclass MailChimp(MailChimpClient):\n    \"\"\"\n    MailChimp class to communicate with the v3 API\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the class with your api_key and user_id and attach all of\n        the endpoints\n        \"\"\"\n        super(MailChimp, self).__init__(*args, **kwargs)\n        # API Root\n        self.root = self.api_root = Root(self)\n        # Authorized Apps\n        self.authorized_apps = AuthorizedApps(self)\n        # Automations - Paid feature\n        self.automations = Automations(self)\n        self.automations.actions = AutomationActions(self)\n        self.automations.emails = AutomationEmails(self)\n        self.automations.emails.actions = AutomationEmailActions(self)\n        self.automations.emails.queues = AutomationEmailQueues(self)\n        self.automations.removed_subscribers = AutomationRemovedSubscribers(self)\n        # Batch Operations\n        self.batches = self.batch_operations = BatchOperations(self)\n        # Batch Webhooks\n        self.batch_webhooks = BatchWebhooks(self)\n        # Campaign Folders\n        self.campaign_folders = CampaignFolders(self)\n        # Campaigns\n        self.campaigns = Campaigns(self)\n        self.campaigns.actions = CampaignActions(self)\n        self.campaigns.content = CampaignContent(self)\n        self.campaigns.feedback = CampaignFeedback(self)\n        self.campaigns.send_checklist = CampaignSendChecklist(self)\n        # Conversations - Paid feature\n        self.conversations = Conversations(self)\n        self.conversations.messages = ConversationMessages(self)\n        # Customer Journey\n        self.journeys = self.customer_journeys = CustomerJourney(self)\n        # E-commerce Stores\n        self.stores = self.ecommerce = Stores(self)\n        self.stores.carts = StoreCarts(self)\n        self.stores.carts.lines = StoreCartLines(self)\n        self.stores.customers = StoreCustomers(self)\n        self.stores.orders = StoreOrders(self)\n        self.stores.orders.lines = StoreOrderLines(self)\n        self.stores.products = StoreProducts(self)\n        self.stores.products.images = StoreProductImages(self)\n        self.stores.products.variants = StoreProductVariants(self)\n        self.stores.promo_rules = StorePromoRules(self)\n        self.stores.promo_codes = StorePromoCodes(self)\n        # File Manager Files\n        self.files = FileManagerFiles(self)\n        # File Manager Folders\n        self.folders = FileManagerFolders(self)\n        # Landinge Pages\n        self.landing_pages = LandingPages(self)\n        self.landing_pages.actions = LandingPageAction(self)\n        self.landing_pages.content = LandingPageContent(self)\n        # Lists\n        self.lists = Lists(self)\n        self.lists.abuse_reports = ListAbuseReports(self)\n        self.lists.activity = ListActivity(self)\n        self.lists.clients = ListClients(self)\n        self.lists.growth_history = ListGrowthHistory(self)\n        self.lists.interest_categories = ListInterestCategories(self)\n        self.lists.interest_categories.interests = ListInterestCategoryInterest(self)\n        self.lists.members = ListMembers(self)\n        self.lists.members.activity = ListMemberActivity(self)\n        self.lists.members.events = ListMemberEvents(self)\n        self.lists.members.goals = ListMemberGoals(self)\n        self.lists.members.notes = ListMemberNotes(self)\n        self.lists.members.tags = ListMemberTags(self)\n        self.lists.merge_fields = ListMergeFields(self)\n        self.lists.segments = ListSegments(self)\n        self.lists.segments.members = ListSegmentMembers(self)\n        self.lists.signup_forms = ListSignupForms(self)\n        self.lists.webhooks = ListWebhooks(self)\n        # Ping\n        self.ping = Ping(self)\n        # Reports\n        self.reports = Reports(self)\n        self.reports.abuse_reports = ReportCampaignAbuseReports(self)\n        self.reports.advice = ReportCampaignAdvice(self)\n        self.reports.click_details = ReportClickDetailReports(self)\n        self.reports.click_details.members = ReportClickDetailMembers(self)\n        self.reports.domain_performance = ReportDomainPerformance(self)\n        self.reports.eepurl = ReportEepURL(self)\n        self.reports.email_activity = ReportEmailActivity(self)\n        self.reports.locations = ReportLocations(self)\n        self.reports.sent_to = ReportSentTo(self)\n        self.reports.subreports = ReportSubReports(self)\n        self.reports.unsubscribes = ReportUnsubscribes(self)\n        self.reports.open_details = ReportOpenDetails(self)\n        self.reports.google_analytics = ReportGoogleAnalytics(self)\n        # Search Campaigns\n        self.search_campaigns = SearchCampaigns(self)\n        # Search Members\n        self.search_members = SearchMembers(self)\n        # Template Folders\n        self.template_folders = TemplateFolders(self)\n        # Templates\n        self.templates = Templates(self)\n        self.templates.default_content = TemplateDefaultContent(self)\n"
  },
  {
    "path": "mailchimp3/baseapi.py",
    "content": "# coding=utf-8\n\"\"\"\nThe base API object that allows constructions of various endpoint paths\n\"\"\"\nfrom __future__ import unicode_literals\nfrom itertools import chain\n\nfrom mailchimp3.helpers import merge_results\n\n\nclass BaseApi(object):\n    \"\"\"\n    Simple class to buid path for entities\n    \"\"\"\n\n    def __init__(self, mc_client):\n        \"\"\"\n        Initialize the class with you user_id and secret_key\n\n        :param mc_client: The mailchimp client connection\n        :type mc_client: :mod:`mailchimp3.mailchimpclient.MailChimpClient`\n        \"\"\"\n        super(BaseApi, self).__init__()\n        self._mc_client = mc_client\n        self.endpoint = ''\n\n    def _build_path(self, *args):\n        \"\"\"\n        Build path with endpoint and args\n\n        :param args: Tokens in the endpoint URL\n        :type args: :py:class:`unicode`\n        \"\"\"\n        return '/'.join(chain((self.endpoint,), map(str, args)))\n\n    def _iterate(self, url, **queryparams):\n        \"\"\"\n        Iterate over all pages for the given url. Feed in the result of self._build_path as the url.\n\n        :param url: The url of the endpoint\n        :type url: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        # fields as a query string parameter should be a string with\n        # comma-separated substring values to pass along to\n        # self._mc_client._get(). It should also contain total_items whenever\n        # the parameter is employed, which is forced here.\n        if not self._mc_client.enabled:\n            return\n        if 'fields' in queryparams:\n            if 'total_items' not in queryparams['fields'].split(','):\n                queryparams['fields'] += ',total_items'\n        # Remove offset if provided in queryparams to avoid 'multiple values\n        # for keyword argument' TypeError\n        queryparams.pop(\"offset\", None)\n\n        # Fetch results from mailchimp, up to first count. If count is not\n        # provided, return a count of 500. The maximum value supported by the\n        # api is 1000, but such a large request can cause 504 errors. See:\n        # https://github.com/VingtCinq/python-mailchimp/pull/207\n        count = queryparams.pop(\"count\", 500)\n        result = self._mc_client._get(url=url, offset=0, count=count, **queryparams)\n        total = result['total_items']\n        # Fetch further results if necessary\n        if total > count:\n            for offset in range(1, int(total / count) + 1):\n                result = merge_results(result, self._mc_client._get(\n                    url=url,\n                    offset=int(offset * count),\n                    count=count,\n                    **queryparams\n                ))\n            return result\n        else:  # Further results not necessary\n            return result\n"
  },
  {
    "path": "mailchimp3/entities/__init__.py",
    "content": ""
  },
  {
    "path": "mailchimp3/entities/authorizedapps.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Authorized Apps endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/authorized-apps/\nSchema: http://api.mailchimp.com/schema/3.0/AuthorizedApps/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass AuthorizedApps(BaseApi):\n    \"\"\"\n    Manage registered, connected apps for your MailChimp account with the\n    Authorized Apps endpoints.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AuthorizedApps, self).__init__(*args, **kwargs)\n        self.endpoint = 'authorized-apps'\n        self.app_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Retrieve OAuth2-based credentials to associate API calls with your\n        application.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"client_id\": string*,\n            \"client_secret\": string*\n        }\n        \"\"\"\n        self.app_id = None\n        if 'client_id' not in data:\n            raise KeyError('The authorized app must have a client_id')\n        if 'client_secret' not in data:\n            raise KeyError('The authorized app must have a client_secret')\n        return self._mc_client._post(url=self._build_path(), data=data)\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of an account’s registered, connected applications.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.app_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, app_id, **queryparams):\n        \"\"\"\n        Get information about a specific authorized application\n\n        :param app_id: The unique id for the connected authorized application\n        :type app_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.app_id = app_id\n        return self._mc_client._get(url=self._build_path(app_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/automationactions.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automations API endpoint actions\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass AutomationActions(BaseApi):\n    \"\"\"\n    Actions for the Automations endpoint.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AutomationActions, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n\n\n    # Paid feature\n    def pause(self, workflow_id):\n        \"\"\"\n        Pause all emails in a specific Automation workflow.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        return self._mc_client._post(url=self._build_path(workflow_id, 'actions/pause-all-emails'))\n\n\n    # Paid feature\n    def start(self, workflow_id):\n        \"\"\"\n        Start all emails in an Automation workflow.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        return self._mc_client._post(url=self._build_path(workflow_id, 'actions/start-all-emails'))\n"
  },
  {
    "path": "mailchimp3/entities/automationemailactions.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automation Emails endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass AutomationEmailActions(BaseApi):\n    \"\"\"\n    Manage individual emails in an Automation workflow.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AutomationEmailActions, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n        self.email_id = None\n\n\n    # Paid feature\n    def pause(self, workflow_id, email_id):\n        \"\"\"\n        Pause an automated email.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        return self._mc_client._post(url=self._build_path(workflow_id, 'emails', email_id, 'actions/pause'))\n\n\n    # Paid feature\n    def start(self, workflow_id, email_id):\n        \"\"\"\n        Start an automated email.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        return self._mc_client._post(url=self._build_path(workflow_id, 'emails', email_id, 'actions/start'))\n\n    #Paid feature\n    def delete(self, workflow_id, email_id):\n        \"\"\"\n        Removes an individual Automation workflow email.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        \"\"\"\n\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        return self._mc_client._delete(url=self._build_path(workflow_id, 'emails', email_id))\n\n\n"
  },
  {
    "path": "mailchimp3/entities/automationemailqueues.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automation Email Queue endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/queue/\nSchema: https://api.mailchimp.com/schema/3.0/Automations/Emails/Queue/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email, check_subscriber_hash\n\n\nclass AutomationEmailQueues(BaseApi):\n    \"\"\"\n    Manage list member queues for Automation emails.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AutomationEmailQueues, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n        self.email_id = None\n        self.subscriber_hash = None\n\n    # Paid feature\n    def create(self, workflow_id, email_id, data):\n        \"\"\"\n        Manually add a subscriber to a workflow, bypassing the default trigger\n        settings. You can also use this endpoint to trigger a series of\n        automated emails in an API 3.0 workflow type or add subscribers to an\n        automated email queue that uses the API request delay type.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*\n        }\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        if 'email_address' not in data:\n            raise KeyError('The automation email queue must have an email_address')\n        check_email(data['email_address'])\n        response = self._mc_client._post(\n            url=self._build_path(workflow_id, 'emails', email_id, 'queue'),\n            data=data\n        )\n        if response is not None:\n            self.subscriber_hash = response['id']\n        else:\n            self.subscriber_hash = None\n        return response\n\n\n    # Paid feature\n    def all(self, workflow_id, email_id):\n        \"\"\"\n        Get information about an Automation email queue.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        self.subscriber_hash = None\n        return self._mc_client._get(url=self._build_path(workflow_id, 'emails', email_id, 'queue'))\n\n\n    # Paid feature\n    def get(self, workflow_id, email_id, subscriber_hash):\n        \"\"\"\n        Get information about a specific subscriber in an Automation email\n        queue.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(workflow_id, 'emails', email_id, 'queue', subscriber_hash))\n\n"
  },
  {
    "path": "mailchimp3/entities/automationemails.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automation Emails endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/emails/\nSchema: https://api.mailchimp.com/schema/3.0/Automations/Emails/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.automationemailactions import AutomationEmailActions\nfrom mailchimp3.entities.automationemailqueues import AutomationEmailQueues\n\n\nclass AutomationEmails(BaseApi):\n    \"\"\"\n    Manage individual emails in an Automation workflow.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AutomationEmails, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n        self.email_id = None\n        self.actions = AutomationEmailActions(self)\n        self.queues = AutomationEmailQueues(self)\n\n\n    # Paid feature\n    def all(self, workflow_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a summary of the emails in an Automation workflow.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: the query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(workflow_id, 'emails'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(workflow_id, 'emails'), **queryparams)\n\n\n    # Paid feature\n    def get(self, workflow_id, email_id):\n        \"\"\"\n        Get information about an individual Automation workflow email.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param email_id: The unique id for the Automation workflow email.\n        :type email_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        self.email_id = email_id\n        return self._mc_client._get(url=self._build_path(workflow_id, 'emails', email_id))\n"
  },
  {
    "path": "mailchimp3/entities/automationremovedsubscribers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automation Removed Subscribers endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/removed-subscribers/\nSchema: https://api.mailchimp.com/schema/3.0/Automations/RemovedSubscribers/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email\n\nclass AutomationRemovedSubscribers(BaseApi):\n    \"\"\"\n    Remove subscribers from an Automation workflow.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(AutomationRemovedSubscribers, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n\n\n    # Paid feature\n    def create(self, workflow_id, data):\n        \"\"\"\n        Remove a subscriber from a specific Automation workflow. You can\n        remove a subscriber at any point in an Automation workflow, regardless\n        of how many emails they’ve been sent from that workflow. Once they’re\n        removed, they can never be added back to the same workflow.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*\n        }\n        \"\"\"\n        self.workflow_id = workflow_id\n        if 'email_address' not in data:\n            raise KeyError('The automation removed subscriber must have an email_address')\n        check_email(data['email_address'])\n        return self._mc_client._post(url=self._build_path(workflow_id, 'removed-subscribers'), data=data)\n\n\n    # Paid feature\n    def all(self, workflow_id):\n        \"\"\"\n        Get information about subscribers who were removed from an Automation\n        workflow.\n\n        :param workflow_id: The unique id for the Automation workflow.\n        :type workflow_id: :py:class:`str`\n        \"\"\"\n        self.workflow_id = workflow_id\n        return self._mc_client._get(url=self._build_path(workflow_id, 'removed-subscribers'))\n\n"
  },
  {
    "path": "mailchimp3/entities/automations.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Automations API endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/automations/\nSchema: https://api.mailchimp.com/schema/3.0/Automations/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.automationactions import AutomationActions\nfrom mailchimp3.entities.automationemails import AutomationEmails\nfrom mailchimp3.entities.automationremovedsubscribers import AutomationRemovedSubscribers\n\n\nclass Automations(BaseApi):\n    \"\"\"\n    Automation is a paid feature that lets you build a series of triggered\n    emails that are sent to subscribers over a set period of time. Use the\n    Automation API calls to manage Automation workflows, emails, and queues.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Automations, self).__init__(*args, **kwargs)\n        self.endpoint = 'automations'\n        self.workflow_id = None\n        self.actions = AutomationActions(self)\n        self.emails = AutomationEmails(self)\n        self.removed_subscribers = AutomationRemovedSubscribers(self)\n\n\n    # Paid feature\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a summary of an account’s Automations.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: the query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.workflow_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    # Paid feature\n    def get(self, workflow_id, **queryparams):\n        \"\"\"\n        Get a summary of an individual Automation workflow’s settings and\n        content. The trigger_settings object returns information for the first\n        email in the workflow.\n\n        :param workflow_id: The unique id for the Automation workflow\n        :type workflow_id: :py:class:`str`\n        :param queryparams: the query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.workflow_id = workflow_id\n        return self._mc_client._get(url=self._build_path(workflow_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/batchoperations.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Batch Operations API Endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/batches/\nSchema: https://api.mailchimp.com/schema/3.0/Batches/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass BatchOperations(BaseApi):\n    \"\"\"\n    Use batch operations to complete multiple operations with a single call.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(BatchOperations, self).__init__(*args, **kwargs)\n        self.endpoint = 'batches'\n        self.batch_id = None\n        self.operation_status = None\n\n\n    def create(self, data):\n        \"\"\"\n        Begin processing a batch operations request.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"operations\": array*\n            [\n                {\n                    \"method\": string* (Must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", or \"DELETE\")\n                    \"path\": string*,\n                }\n            ]\n        }\n        \"\"\"\n        if 'operations' not in data:\n            raise KeyError('The batch must have operations')\n        for op in data['operations']:\n            if 'method' not in op:\n                raise KeyError('The batch operation must have a method')\n            if op['method'] not in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']:\n                raise ValueError('The batch operation method must be one of \"GET\", \"POST\", \"PUT\", \"PATCH\", '\n                                 'or \"DELETE\", not {0}'.format(op['method']))\n            if 'path' not in op:\n                raise KeyError('The batch operation must have a path')\n        return self._mc_client._post(url=self._build_path(), data=data)\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a summary of batch requests that have been made.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.batch_id = None\n        self.operation_status = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, batch_id, **queryparams):\n        \"\"\"\n        Get the status of a batch request.\n\n        :param batch_id: The unique id for the batch operation.\n        :type batch_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.batch_id = batch_id\n        self.operation_status = None\n        return self._mc_client._get(url=self._build_path(batch_id), **queryparams)\n\n\n    def delete(self, batch_id):\n        \"\"\"\n        Stops a batch request from running. Since only one batch request is\n        run at a time, this can be used to cancel a long running request. The\n        results of any completed operations will not be available after this\n        call.\n\n        :param batch_id: The unique id for the batch operation.\n        :type batch_id: :py:class:`str`\n        \"\"\"\n        self.batch_id = batch_id\n        self.operation_status = None\n        return self._mc_client._delete(url=self._build_path(batch_id))\n"
  },
  {
    "path": "mailchimp3/entities/batchwebhooks.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Batch Webhooks API Endpoint\n\nDocumentation: https://developer.mailchimp.com/documentation/mailchimp/reference/batch-webhooks/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass BatchWebhooks(BaseApi):\n    \"\"\"\n    Manage webhooks for batch operations.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(BatchWebhooks, self).__init__(*args, **kwargs)\n        self.endpoint = 'batch-webhooks'\n        self.batch_webhook_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Configure a webhook that will fire whenever any batch request\n        completes processing.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"url\": string*\n        }\n        \"\"\"\n        if 'url' not in data:\n            raise KeyError('The batch webhook must have a valid url')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.batch_webhook_id = response['id']\n        else:\n            self.batch_webhook_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get all webhooks that have been configured for batches.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.batch_webhook_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, batch_webhook_id, **queryparams):\n        \"\"\"\n        Get information about a specific batch webhook.\n\n        :param batch_webhook_id: The unique id for the batch webhook.\n        :type batch_webhook_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.batch_webhook_id = batch_webhook_id\n        return self._mc_client._get(url=self._build_path(batch_webhook_id), **queryparams)\n\n\n    def update(self, batch_webhook_id, data):\n        \"\"\"\n        Update a webhook that will fire whenever any batch request completes\n        processing.\n\n        :param batch_webhook_id: The unique id for the batch webhook.\n        :type batch_webhook_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"url\": string*\n        }\n        \"\"\"\n        self.batch_webhook_id = batch_webhook_id\n        if 'url' not in data:\n            raise KeyError('The batch webhook must have a valid url')\n        return self._mc_client._patch(url=self._build_path(batch_webhook_id), data=data)\n\n\n    def delete(self, batch_webhook_id):\n        \"\"\"\n        Remove a batch webhook. Webhooks will no longer be sent to the given\n        URL.\n\n        :param batch_webhook_id: The unique id for the batch webhook.\n        :type batch_webhook_id: :py:class:`str`\n        \"\"\"\n        self.batch_webhook_id = batch_webhook_id\n        return self._mc_client._delete(url=self._build_path(batch_webhook_id))\n"
  },
  {
    "path": "mailchimp3/entities/campaignactions.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaigns API actions endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/\nSchema: https://api.mailchimp.com/schema/3.0/CampaignFolders/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom datetime import timedelta\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email\n\n\nclass CampaignActions(BaseApi):\n    \"\"\"\n    Campaigns are how you send emails to your MailChimp list. Use the\n    Campaigns API calls to manage campaigns in your MailChimp account.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CampaignActions, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaigns'\n        self.campaign_id = None\n\n\n    # Pro feature\n    def cancel(self, campaign_id):\n        \"\"\"\n        Cancel a Regular or Plain-Text Campaign after you send, before all of\n        your recipients receive it. This feature is included with MailChimp\n        Pro.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/cancel-send'))\n\n\n    def pause(self, campaign_id):\n        \"\"\"\n        Pause an RSS-Driven campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/pause'))\n\n\n    def replicate(self, campaign_id):\n        \"\"\"\n        Replicate a campaign in saved or send status.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/replicate'))\n\n\n    def resume(self, campaign_id):\n        \"\"\"\n        Resume an RSS-Driven campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/resume'))\n\n\n    def schedule(self, campaign_id, data):\n        \"\"\"\n        Schedule a campaign for delivery. If you’re using Multivariate\n        Campaigns to test send times or sending RSS Campaigns, use the send\n        action instead.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"schedule_time\": datetime* (A UTC timezone datetime that ends on the quarter hour [:00, :15, :30, or :45])\n        }\n        \"\"\"\n        if not data['schedule_time']:\n            raise ValueError('You must supply a schedule_time')\n        else:\n            if data['schedule_time'].tzinfo is None:\n                raise ValueError('The schedule_time must be in UTC')\n            else:\n                if data['schedule_time'].tzinfo.utcoffset(None) != timedelta(0):\n                    raise ValueError('The schedule_time must be in UTC')\n        if data['schedule_time'].minute not in [0, 15, 30, 45]:\n            raise ValueError('The schedule_time must end on the quarter hour (00, 15, 30, 45)')\n        data['schedule_time'] = data['schedule_time'].strftime('%Y-%m-%dT%H:%M:00+00:00')\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/schedule'), data=data)\n\n\n    def send(self, campaign_id):\n        \"\"\"\n        Send a MailChimp campaign. For RSS Campaigns, the campaign will send\n        according to its schedule. All other campaigns will send immediately.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/send'))\n\n\n    def resend(self, campaign_id):\n        \"\"\"\n        Creates a Resend to Non-Openers version of this campaign. We will also\n        check if this campaign meets the criteria for Resend to Non-Openers\n        campaigns.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/create-resend'))\n\n\n    def test(self, campaign_id, data):\n        \"\"\"\n        Send a test email.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"test_emails\": array*,\n            \"send_type\": string* (Must be one of \"html\" or \"plaintext\")\n        }\n        \"\"\"\n        for email in data['test_emails']:\n            check_email(email)\n        if data['send_type'] not in ['html', 'plaintext']:\n            raise ValueError('The send_type must be either \"html\" or \"plaintext\"')\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/test'), data=data)\n\n\n    def unschedule(self, campaign_id):\n        \"\"\"\n        Unschedule a scheduled campaign that hasn’t started sending.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._post(url=self._build_path(campaign_id, 'actions/unschedule'))\n"
  },
  {
    "path": "mailchimp3/entities/campaigncontent.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Content API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/content/\nSchema: https://api.mailchimp.com/schema/3.0/Campaigns/Content/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass CampaignContent(BaseApi):\n    \"\"\"\n    Manage the HTML, plain-text, and template content for your MailChimp\n    campaigns.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CampaignContent, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaigns'\n        self.campaign_id = None\n\n\n    def get(self, campaign_id, **queryparams):\n        \"\"\"\n        Get the the HTML and plain-text content for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'content'), **queryparams)\n\n\n    def update(self, campaign_id, data):\n        \"\"\"\n        Set the content for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._put(url=self._build_path(campaign_id, 'content'), data=data)\n"
  },
  {
    "path": "mailchimp3/entities/campaignfeedback.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Feedback API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/feedback/\nSchema: https://api.mailchimp.com/schema/3.0/Campaigns/Feedback/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass CampaignFeedback(BaseApi):\n    \"\"\"\n    Post comments, reply to team feedback, and send test emails while you’re\n    working together on a MailChimp campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CampaignFeedback, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaigns'\n        self.campaign_id = None\n        self.feedback_id = None\n\n\n    def create(self, campaign_id, data, **queryparams):\n        \"\"\"\n        Add feedback on a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"message\": string*\n        }\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        if 'message' not in data:\n            raise KeyError('The campaign feedback must have a message')\n        response = self._mc_client._post(url=self._build_path(campaign_id, 'feedback'), data=data, **queryparams)\n        if response is not None:\n            self.feedback_id = response['feedback_id']\n        else:\n            self.feedback_id = None\n        return response\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get team feedback while you’re working together on a MailChimp\n        campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.feedback_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'feedback'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'feedback'), **queryparams)\n\n\n    def get(self, campaign_id, feedback_id, **queryparams):\n        \"\"\"\n        Get a specific feedback message from a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param feedback_id: The unique id for the feedback message.\n        :type feedback_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.feedback_id = feedback_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'feedback', feedback_id), **queryparams)\n\n\n    def update(self, campaign_id, feedback_id, data):\n        \"\"\"\n        Update a specific feedback message for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param feedback_id: The unique id for the feedback message.\n        :type feedback_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"message\": string*\n        }\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.feedback_id = feedback_id\n        if 'message' not in data:\n            raise KeyError('The campaign feedback must have a message')\n        return self._mc_client._patch(url=self._build_path(campaign_id, 'feedback', feedback_id), data=data)\n\n\n    def delete(self, campaign_id, feedback_id):\n        \"\"\"\n        Remove a specific feedback message for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param feedback_id: The unique id for the feedback message.\n        :type feedback_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.feedback_id = feedback_id\n        return self._mc_client._delete(url=self._build_path(campaign_id, 'feedback', feedback_id))\n"
  },
  {
    "path": "mailchimp3/entities/campaignfolders.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Folders API endpoints\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaign-folders/\nSchema: https://api.mailchimp.com/schema/3.0/CampaignFolders/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass CampaignFolders(BaseApi):\n    \"\"\"\n    Organize your campaigns using folders.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CampaignFolders, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaign-folders'\n        self.folder_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new campaign folder.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The campaign folder must have a name')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.folder_id = response['id']\n        else:\n            self.folder_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get all folders used to organize campaigns.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.folder_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, folder_id, **queryparams):\n        \"\"\"\n        Get information about a specific folder used to organize campaigns.\n\n        :param folder_id: The unique id for the campaign folder.\n        :type folder_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._get(url=self._build_path(folder_id), **queryparams)\n\n\n    def update(self, folder_id, data):\n        \"\"\"\n        Update a specific folder used to organize campaigns.\n\n        :param folder_id: The unique id for the campaign folder.\n        :type folder_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.folder_id = folder_id\n        if 'name' not in data:\n            raise KeyError('The campaign folder must have a name')\n        return self._mc_client._patch(url=self._build_path(folder_id), data=data)\n\n\n    def delete(self, folder_id):\n        \"\"\"\n        Delete a specific campaign folder, and mark all the campaigns in the\n        folder as ‘unfiled’.\n\n        :param folder_id: The unique id for the campaign folder.\n        :type folder_id: :py:class:`str`\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._delete(url=self._build_path(folder_id))\n"
  },
  {
    "path": "mailchimp3/entities/campaigns.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaigns API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/\nSchema: https://api.mailchimp.com/schema/3.0/Campaigns/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.campaignactions import CampaignActions\nfrom mailchimp3.entities.campaigncontent import CampaignContent\nfrom mailchimp3.entities.campaignfeedback import CampaignFeedback\nfrom mailchimp3.entities.campaignsendchecklist import CampaignSendChecklist\nfrom mailchimp3.helpers import check_email\n\n\nclass Campaigns(BaseApi):\n    \"\"\"\n    Campaigns are how you send emails to your MailChimp list. Use the\n    Campaigns API calls to manage campaigns in your MailChimp account.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Campaigns, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaigns'\n        self.campaign_id = None\n        self.actions = CampaignActions(self)\n        self.content = CampaignContent(self)\n        self.feedback = CampaignFeedback(self)\n        self.send_checklist = CampaignSendChecklist(self)\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new MailChimp campaign.\n\n        The ValueError raised by an invalid type in data does not mention\n        'absplit' as a potential value because the documentation indicates\n        that the absplit type has been deprecated.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"recipients\": object*\n            {\n                \"list_id\": string*\n            },\n            \"variate_settings\": object* (Required if type is \"variate\")\n            {\n                \"subject_lines\": string* (can be empty if subject_line in settings)\n                \"from_names\": string* (can be empty if from_name in settings)\n                \"reply_to_addresses\": string* (can be empty if reply_to in settings)\n                \"winner_criteria\": string* (Must be one of \"opens\", \"clicks\", \"total_revenue\", or \"manual\")\n            },\n            \"rss_opts\": object* (Required if type is \"rss\")\n            {\n                \"feed_url\": string*,\n                \"frequency\": string* (Must be one of \"daily\", \"weekly\", or \"monthly\")\n            },\n            \"type\": string* (Must be one of \"regular\", \"plaintext\", \"rss\", \"variate\", or \"absplit\")\n        }\n        \"\"\"\n        if 'recipients' not in data:\n            raise KeyError('The campaign must have recipients')\n        if 'list_id' not in data['recipients']:\n            raise KeyError('The campaign recipients must have a list_id')\n        if 'reply_to' in data.get('settings', {}):\n            check_email(data['settings']['reply_to'])\n        if 'type' not in data:\n            raise KeyError('The campaign must have a type')\n        if not data['type'] in ['regular', 'plaintext', 'rss', 'variate', 'abspilt']:\n            raise ValueError('The campaign type must be one of \"regular\", \"plaintext\", \"rss\", or \"variate\"')\n        if data['type'] == 'variate':\n            if 'variate_settings' not in data:\n                raise KeyError('The variate campaign must have variate_settings')\n            if 'winner_criteria' not in data['variate_settings']:\n                raise KeyError('The campaign variate_settings must have a winner_criteria')\n            if data['variate_settings']['winner_criteria'] not in ['opens', 'clicks', 'total_revenue', 'manual']:\n                raise ValueError('The campaign variate_settings '\n                                 'winner_criteria must be one of \"opens\", \"clicks\", \"total_revenue\", or \"manual\"')\n            if 'subject_lines' not in data['variate_settings'] and 'subject_line' not in data.get('settings'):\n                raise KeyError('The campaign variate_settings must have a subject_lines')\n            if 'from_names' not in data['variate_settings'] and 'from_name' not in data.get('settings'):\n                raise KeyError('The campaign variate_settings must have a from_names')\n            if 'reply_to_addresses' not in data['variate_settings'] and 'reply_to' not in data.get('settings'):\n                raise KeyError('The campaign variate_settings must have a reply_to_addresses')\n        if data['type'] == 'rss':\n            if 'rss_opts' not in data:\n                raise KeyError('The rss campaign must have rss_opts')\n            if 'feed_url' not in data['rss_opts']:\n                raise KeyError('The campaign rss_opts must have a feed_url')\n            if not data['rss_opts']['frequency'] in ['daily', 'weekly', 'monthly']:\n                raise ValueError('The rss_opts frequency must be one of \"daily\", \"weekly\", or \"monthly\"')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.campaign_id = response['id']\n        else:\n            self.campaign_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get all campaigns in an account.\n\n        .. note::\n            The before_create_time, since_create_time, before_send_time, and\n            since_send_time queryparams expect times to be listed in the ISO\n            8601 format in UTC (ex. 2015-10-21T15:41:36+00:00).\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = []\n        queryparams['status'] = []\n        queryparams['before_send_time'] = string\n        queryparams['since_send_time'] = string\n        queryparams['before_create_time'] = string\n        queryparams['since_create_time'] = string\n        queryparams['list_id'] = string\n        queryparams['folder_id'] = string\n        queryparams['sort_field'] = string\n        queryparams['sort_dir'] = string\n        \"\"\"\n        self.campaign_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, campaign_id, **queryparams):\n        \"\"\"\n        Get information about a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['sort_field'] = string\n        queryparams['create_time'] = string\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id), **queryparams)\n\n\n    def update(self, campaign_id, data):\n        \"\"\"\n        Update some or all of the settings for a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"settings\": object*\n            {\n                \"subject_line\": string*,\n                \"from_name\": string*,\n                \"reply_to\": string*\n            },\n        }\n        \"\"\"\n        self.campaign_id = campaign_id\n        if 'settings' not in data:\n            raise KeyError('The campaign must have settings')\n        if 'subject_line' not in data['settings']:\n            raise KeyError('The campaign settings must have a subject_line')\n        if 'from_name' not in data['settings']:\n            raise KeyError('The campaign settings must have a from_name')\n        if 'reply_to' not in data['settings']:\n            raise KeyError('The campaign settings must have a reply_to')\n        check_email(data['settings']['reply_to'])\n        return self._mc_client._patch(url=self._build_path(campaign_id), data=data)\n\n\n    def delete(self, campaign_id):\n        \"\"\"\n        Remove a campaign from your MailChimp account.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._delete(url=self._build_path(campaign_id))\n"
  },
  {
    "path": "mailchimp3/entities/campaignsendchecklist.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Send Checklist API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/campaigns/send-checklist/\nSchema: https://api.mailchimp.com/schema/3.0/Campaigns/Checklist/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass CampaignSendChecklist(BaseApi):\n    \"\"\"\n    Review the send checklist for your campaign, and resolve any issues before\n    sending.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CampaignSendChecklist, self).__init__(*args, **kwargs)\n        self.endpoint = 'campaigns'\n        self.campaign_id = None\n\n\n    def get(self, campaign_id, **queryparams):\n        \"\"\"\n        Review the send checklist for a campaign, and resolve any issues\n        before sending.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'send-checklist'), **queryparams)\n\n"
  },
  {
    "path": "mailchimp3/entities/conversationmessages.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Conversation Messages API endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/conversations/messages/\nSchema: https://api.mailchimp.com/schema/3.0/Conversations/Messages/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email\n\n\nclass ConversationMessages(BaseApi):\n    \"\"\"\n    Manage messages in a specific campaign conversation.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ConversationMessages, self).__init__(*args, **kwargs)\n        self.endpoint = 'conversations'\n        self.conversation_id = None\n        self.message_id = None\n\n\n    # Paid feature\n    def create(self, conversation_id, data):\n        \"\"\"\n        Post a new message to a conversation.\n\n        :param conversation_id: The unique id for the conversation.\n        :type conversation_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"from_email\": string*,\n            \"read\": boolean*\n        }\n        \"\"\"\n        self.conversation_id = conversation_id\n        if 'from_email' not in data:\n            raise KeyError('The conversation message must have a from_email')\n        check_email(data['from_email'])\n        if 'read' not in data:\n            raise KeyError('The conversation message must have a read')\n        if data['read'] not in [True, False]:\n            raise TypeError('The conversation message read must be True or False')\n        response =  self._mc_client._post(url=self._build_path(conversation_id, 'messages'), data=data)\n        if response is not None:\n            self.message_id = response['id']\n        else:\n            self.message_id = None\n        return response\n\n\n    # Paid feature\n    def all(self, conversation_id, **queryparams):\n        \"\"\"\n        Get messages from a specific conversation.\n\n        This endpoint does not currently support count and offset, preventing\n        it from having the get_all parameter that most all() methods have\n\n        :param conversation_id: The unique id for the conversation.\n        :type conversation_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = p[\n        queryparams['is_read'] = string\n        queryparams['before_timestamp'] = string\n        queryparams['since_timestamp'] = string\n        \"\"\"\n        self.conversation_id = conversation_id\n        self.message_id = None\n        return self._mc_client._get(url=self._build_path(conversation_id, 'messages'), **queryparams)\n\n\n    # Paid feature\n    def get(self, conversation_id, message_id, **queryparams):\n        \"\"\"\n        Get an individual message in a conversation.\n\n        :param conversation_id: The unique id for the conversation.\n        :type conversation_id: :py:class:`str`\n        :param message_id: The unique id for the conversation message.\n        :type message_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.conversation_id = conversation_id\n        self.message_id = message_id\n        return self._mc_client._get(url=self._build_path(conversation_id, 'messages', message_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/conversations.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Conversations API endpoint\n\nNote: This is a paid feature\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/conversations/\nSchema: https://api.mailchimp.com/schema/3.0/Conversations/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.conversationmessages import ConversationMessages\n\n\nclass Conversations(BaseApi):\n    \"\"\"\n    Conversation tracking is a paid feature that lets you view subscribers’\n    replies to your campaigns in your MailChimp account.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Conversations, self).__init__(*args, **kwargs)\n        self.endpoint = 'conversations'\n        self.conversation_id = None\n        self.messages = ConversationMessages(self)\n\n\n    # Paid feature\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of conversations for the account.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['has_unread_messages'] = string\n        queryparams['list_id'] = string\n        queryparams['campaign_id'] = string\n        \"\"\"\n        self.conversation_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    # Paid feature\n    def get(self, conversation_id, **queryparams):\n        \"\"\"\n        Get details about an individual conversation.\n\n        :param conversation_id: The unique id for the conversation.\n        :type conversation_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.conversation_id = conversation_id\n        return self._mc_client._get(url=self._build_path(conversation_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/customerjourney.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Customer Journey API endpoint\n\nDocumentation: https://mailchimp.com/developer/marketing/api/customer-journeys-journeys-steps-actions/\nSchema: https://us1.api.mailchimp.com/schema/3.0/Paths/CustomerJourneys/Journeys/Steps/Actions/Trigger.json\n\"\"\"\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email\n\n\nclass CustomerJourney(BaseApi):\n    \"\"\"\n    Manage specific customer journeys in your Mailchimp account.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(CustomerJourney, self).__init__(*args, **kwargs)\n        self.endpoint = 'customer-journeys'\n        self.journey_id = None\n        self.step_id = None\n\n    def trigger(self, journey_id, step_id, data):\n        \"\"\"\n        Trigger a step in a customer journey.\n\n        :param journey_id: The unique id for the Customer Journey\n        :type journey_id: :py:class:`str`\n        :param step_id: The unique id for the step within the customer journey\n        :type step_id: :py:class:`str`\n        :type data: :py:class:`dict`\n        data = {\n            \"email\": string*,\n        }\n        \"\"\"\n        self.journey_id = journey_id\n        self.step_id = step_id\n        if 'email_address' not in data:\n            raise KeyError('The automation email queue must have an email_address')\n\n        check_email(data['email_address'])\n        response = self._mc_client._post(\n            url=self._build_path(\"journeys\", journey_id, 'steps', step_id, 'actions', \"trigger\"),\n            data=data\n        )\n\n        return response\n"
  },
  {
    "path": "mailchimp3/entities/filemanagerfiles.py",
    "content": "# coding=utf-8\n\"\"\"\nThe File Manager Files API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/file-manager/files/\nSchema: https://api.mailchimp.com/schema/3.0/FileManager/Files/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass FileManagerFiles(BaseApi):\n    \"\"\"\n    Manage specific files in the File Manager for your MailChimp account. The\n    File Manager is a place to store images, documents, and other files you\n    include or link to in your campaigns, templates, or signup forms.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(FileManagerFiles, self).__init__(*args, **kwargs)\n        self.endpoint = 'file-manager/files'\n        self.file_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Upload a new image or file to the File Manager.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"file_data\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The file must have a name')\n        if 'file_data' not in data:\n            raise KeyError('The file must have file_data')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.file_id = response['id']\n        else:\n            self.file_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of available images and files stored in the File Manager for the account.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = string\n        queryparams['created_by'] = string\n        queryparams['before_created_at'] = string\n        queryparams['since_created_at'] = string\n        queryparams['sort_field'] = string\n        queryparams['sort_dir'] = string\n        \"\"\"\n        self.file_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, file_id, **queryparams):\n        \"\"\"\n        Get information about a specific file in the File Manager.\n\n        :param file_id: The unique id for the File Manager file.\n        :type file_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.file_id = file_id\n        return self._mc_client._get(url=self._build_path(file_id), **queryparams)\n\n\n    def update(self, file_id, data):\n        \"\"\"\n        Update a file in the File Manager.\n\n        :param file_id: The unique id for the File Manager file.\n        :type file_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"file_data\": string*\n        }\n        \"\"\"\n        self.file_id = file_id\n        if 'name' not in data:\n            raise KeyError('The file must have a name')\n        if 'file_data' not in data:\n            raise KeyError('The file must have file_data')\n        return self._mc_client._patch(url=self._build_path(file_id), data=data)\n\n\n    def delete(self, file_id):\n        \"\"\"\n        Remove a specific file from the File Manager.\n\n        :param file_id: The unique id for the File Manager file.\n        :type file_id: :py:class:`str`\n        \"\"\"\n        self.file_id = file_id\n        return self._mc_client._delete(url=self._build_path(file_id))\n"
  },
  {
    "path": "mailchimp3/entities/filemanagerfolders.py",
    "content": "# coding=utf-8\n\"\"\"\nThe File Manager Folders API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/file-manager/folders/\nSchema: https://api.mailchimp.com/schema/3.0/FileManager/Folders/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass FileManagerFolders(BaseApi):\n    \"\"\"\n    Manage specific folders in the File Manager for your MailChimp account.\n    The File Manager is a place to store images, documents, and other files\n    you include or link to in your campaigns, templates, or signup forms.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(FileManagerFolders, self).__init__(*args, **kwargs)\n        self.endpoint = 'file-manager/folders'\n        self.folder_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new folder in the File Manager.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The folder must have a name')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.folder_id = response['id']\n        else:\n            self.folder_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of all folders in the File Manager.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['created_by'] = string\n        queryparams['before_created_at'] = string\n        queryparams['since_created_at'] = string\n        \"\"\"\n        self.folder_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, folder_id, **queryparams):\n        \"\"\"\n        Get information about a specific folder in the File Manager.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._get(url=self._build_path(folder_id), **queryparams)\n\n\n    def update(self, folder_id, data):\n        \"\"\"\n        Update a specific File Manager file.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.folder_id = folder_id\n        if 'name' not in data:\n            raise KeyError('The folder must have a name')\n        return self._mc_client._patch(url=self._build_path(folder_id), data=data)\n\n\n    def delete(self, folder_id):\n        \"\"\"\n        Delete a specific folder in the File Manager.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._delete(url=self._build_path(folder_id))\n\n\n"
  },
  {
    "path": "mailchimp3/entities/landingpageaction.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Landinge Page actions API endpoint\n\nDocumentation: https://mailchimp.com/developer/reference/landing-pages/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass LandingPageAction(BaseApi):\n    \"\"\"\n    Manage your Landing Pages, including publishing and unpublishing.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(LandingPageAction, self).__init__(*args, **kwargs)\n        self.endpoint = 'landing-pages'\n        self.page_id = None\n\n\n    def publish(self, page_id):\n        \"\"\"\n        Publish a landing page that is in draft, unpublished, or has been\n        previously published and edited.\n\n        :param page_id: The unique id for the page.\n        :type page_id: :py:class:`str`\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._post(url=self._build_path(page_id, 'actions/publish'))\n\n\n    def unpublish(self, page_id):\n        \"\"\"\n        Unpublish a landing page that is in draft or has been published.\n\n        :param page_id: The unique id for the page.\n        :type page_id: :py:class:`str`\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._post(url=self._build_path(page_id, 'actions/unpublish'))\n"
  },
  {
    "path": "mailchimp3/entities/landingpagecontent.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Landing Page Content API endpoint\n\nDocumentation: https://mailchimp.com/developer/reference/landing-pages/landing-pages_content/\nSchema: https://api.mailchimp.com/schema/3.0/Definitions/LandingPages/Content/Response.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass LandingPageContent(BaseApi):\n    \"\"\"\n    The HTML content for your Mailchimp landing pages.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(LandingPageContent, self).__init__(*args, **kwargs)\n        self.endpoint = 'landing-pages'\n        self.page_id = None\n\n\n    def get(self, page_id, **queryparams):\n        \"\"\"\n        Get the the HTML for your landing page.\n\n        :param page_id: The unique id for the page.\n        :type page_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._get(url=self._build_path(page_id, 'content'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/landingpages.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Landing Pages API endpoint\n\nDocumentation: https://mailchimp.com/developer/reference/landing-pages/\nSchema: https://api.mailchimp.com/schema/3.0/LandingPages/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.landingpageaction import LandingPageAction\nfrom mailchimp3.entities.landingpagecontent import LandingPageContent\n\n\nclass LandingPages(BaseApi):\n    \"\"\"\n    Manage your Landing Pages, including publishing and unpublishing.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(LandingPages, self).__init__(*args, **kwargs)\n        self.endpoint = 'landing-pages'\n        self.page_id = None\n        self.content = LandingPageContent(self)\n        self.actions = LandingPageAction(self)\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new Landing Page.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"list_id\": string*,\n        }\n        \"\"\"\n        if 'list_id' not in data:\n            raise KeyError('The landing page must have a list_id')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.page_id = response['id']\n        else:\n            self.page_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get all landinge pages.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['sort_field'] = string\n        queryparams['sort_dir'] = string\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        \"\"\"\n        self.page_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, page_id, **queryparams):\n        \"\"\"\n        Get information about a specific page.\n\n        :param page_id: The unique id for the page.\n        :type page_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._get(url=self._build_path(page_id), **queryparams)\n\n\n    def update(self, page_id, data):\n        \"\"\"\n        Update a landing page.\n\n        :param page_id: The unique id for the landing page.\n        :type page_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._patch(url=self._build_path(page_id), data=data)\n\n\n    def delete(self, page_id):\n        \"\"\"\n        Remove a landing page from your MailChimp account.\n\n        :param page_id: The unique id for the landing page.\n        :type page_id: :py:class:`str`\n        \"\"\"\n        self.page_id = page_id\n        return self._mc_client._delete(url=self._build_path(page_id))\n"
  },
  {
    "path": "mailchimp3/entities/listabusereports.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Abuse Reports API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/abuse-reports/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Abuse/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListAbuseReports(BaseApi):\n    \"\"\"\n    Manage abuse complaints for a specific list. An abuse complaint occurs\n    when your recipient reports an email as spam in their mail program.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListAbuseReports, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.report_id = None\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get all abuse reports for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.list_id = list_id\n        self.report_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'abuse-reports'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'abuse-reports'), **queryparams)\n\n\n    def get(self, list_id, report_id, **queryparams):\n        \"\"\"\n        Get details about a specific abuse report.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param report_id: The id for the abuse report.\n        :type report_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.list_id = list_id\n        self.report_id = report_id\n        return self._mc_client._get(url=self._build_path(list_id, 'abuse-reports', report_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listactivity.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Activity API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/activity/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Activity/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListActivity(BaseApi):\n    \"\"\"\n    Get recent daily, aggregated activity stats for your list. For example,\n    view unsubscribes, signups, total emails sent, opens, clicks, and more,\n    for up to 180 days.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListActivity, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n\n\n    def all(self, list_id, **queryparams):\n        \"\"\"\n        Get up to the previous 180 days of daily detailed aggregated activity\n        stats for a list, not including Automation activity.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        return self._mc_client._get(url=self._build_path(list_id, 'activity'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listclients.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Clients API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/clients/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Clients/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListClients(BaseApi):\n    \"\"\"\n    Get information about the most popular email clients for subscribers in a\n    specific MailChimp list.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListClients, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n\n\n    def all(self, list_id, **queryparams):\n        \"\"\"\n        Get a list of the top email clients based on user-agent strings.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        return self._mc_client._get(url=self._build_path(list_id, 'clients'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listgrowthhistory.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Growth History API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/growth-history/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Growth/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListGrowthHistory(BaseApi):\n    \"\"\"\n    View a summary of the month-by-month growth activity for a specific list.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListGrowthHistory, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.month = None\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a month-by-month summary of a specific list’s growth activity.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.list_id = list_id\n        self.month = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'growth-history'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'growth-history'), **queryparams)\n\n\n    def get(self, list_id, month, **queryparams):\n        \"\"\"\n        Get a summary of a specific list’s growth activity for a specific month and year.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param month: A specific month of list growth history.\n        :type month: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        self.month = month\n        return self._mc_client._get(url=self._build_path(list_id, 'growth-history', month), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listinterestcategories.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Interest Categories API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/interest-categories/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/InterestCategories/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.listinterestcategoryinterest import ListInterestCategoryInterest\n\n\nclass ListInterestCategories(BaseApi):\n    \"\"\"\n    Manage interest categories for a specific list. Interest categories\n    organize interests, which are used to group subscribers based on their\n    preferences. These correspond to ‘group titles’ in the MailChimp\n    application.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListInterestCategories, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.category_id = None\n        self.interests = ListInterestCategoryInterest(self)\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Create a new interest category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"title\": string*,\n            \"type\": string* (Must be one of 'checkboxes', 'dropdown', 'radio', or 'hidden')\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'title' not in data:\n            raise KeyError('The list interest category must have a title')\n        if 'type' not in data:\n            raise KeyError('The list interest category must have a type')\n        if data['type'] not in ['checkboxes', 'dropdown', 'radio', 'hidden']:\n            raise ValueError('The list interest category type must be one of \"checkboxes\", \"dropdown\", \"radio\", or '\n                             '\"hidden\"')\n        response = self._mc_client._post(url=self._build_path(list_id, 'interest-categories'), data=data)\n        if response is not None:\n            self.category_id = response['id']\n        else:\n            self.category_id = None\n        return response\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a list’s interest categories.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = string\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'interest-categories'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'interest-categories'), **queryparams)\n\n\n    def get(self, list_id, category_id, **queryparams):\n        \"\"\"\n        Get information about a specific interest category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        return self._mc_client._get(url=self._build_path(list_id, 'interest-categories', category_id), **queryparams)\n\n\n    def update(self, list_id, category_id, data):\n        \"\"\"\n        Update a specific interest category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"title\": string*,\n            \"type\": string* (Must be one of 'checkboxes', 'dropdown', 'radio', or 'hidden')\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        if 'title' not in data:\n            raise KeyError('The list interest category must have a title')\n        if 'type' not in data:\n            raise KeyError('The list interest category must have a type')\n        if data['type'] not in ['checkboxes', 'dropdown', 'radio', 'hidden']:\n            raise ValueError('The list interest category type must be one of \"checkboxes\", \"dropdown\", \"radio\", or '\n                             '\"hidden\"')\n        return self._mc_client._patch(url=self._build_path(list_id, 'interest-categories', category_id), data=data)\n\n\n    def delete(self, list_id, category_id):\n        \"\"\"\n        Delete a specific interest category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        return self._mc_client._delete(url=self._build_path(list_id, 'interest-categories', category_id))\n"
  },
  {
    "path": "mailchimp3/entities/listinterestcategoryinterest.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Interest Category Interests API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/interest-categories/interests/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Interests/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListInterestCategoryInterest(BaseApi):\n    \"\"\"\n    Manage interests for a specific MailChimp list. Assign subscribers to\n    interests to group them together. Interests are referred to as ‘group\n    names’ in the MailChimp application.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListInterestCategoryInterest, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.category_id = None\n        self.interest_id = None\n\n\n    def create(self, list_id, category_id, data):\n        \"\"\"\n        Create a new interest or ‘group name’ for a specific category.\n\n        The documentation lists only the name request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        if 'name' not in data:\n            raise KeyError('The list interest category interest must have a name')\n        response =  self._mc_client._post(\n            url=self._build_path(list_id, 'interest-categories', category_id, 'interests'),\n            data=data\n        )\n        if response is not None:\n            self.interest_id = response['id']\n        else:\n            self.interest_id = None\n        return response\n\n\n    def all(self, list_id, category_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of this category’s interests.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        self.interest_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'interest-categories', category_id, 'interests'), **queryparams)\n        else:\n            return self._mc_client._get(\n                url=self._build_path(list_id, 'interest-categories', category_id, 'interests'),\n                **queryparams\n            )\n\n\n    def get(self, list_id, category_id, interest_id, **queryparams):\n        \"\"\"\n        Get interests or ‘group names’ for a specific category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param interest_id: The specific interest or ‘group name’.\n        :type interest_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        self.interest_id = interest_id\n        return self._mc_client._get(\n            url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id),\n            **queryparams\n        )\n\n\n    def update(self, list_id, category_id, interest_id, data):\n        \"\"\"\n        Update interests or ‘group names’ for a specific category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param interest_id: The specific interest or ‘group name’.\n        :type interest_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        self.interest_id = interest_id\n        if 'name' not in data:\n            raise KeyError('The list interest category interest must have a name')\n        return self._mc_client._patch(\n            url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id),\n            data=data\n        )\n\n\n    def delete(self, list_id, category_id, interest_id):\n        \"\"\"\n        Delete interests or group names in a specific category.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param category_id: The unique id for the interest category.\n        :type category_id: :py:class:`str`\n        :param interest_id: The specific interest or ‘group name’.\n        :type interest_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.category_id = category_id\n        self.interest_id = interest_id\n        return self._mc_client._delete(\n            url=self._build_path(list_id, 'interest-categories', category_id, 'interests', interest_id)\n        )\n"
  },
  {
    "path": "mailchimp3/entities/listmemberactivity.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Member Activity API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/activity/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Activity/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ListMemberActivity(BaseApi):\n    \"\"\"\n    Get details about subscribers’ recent activity.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMemberActivity, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, list_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get the last 50 events of a member’s activity on a specific list,\n        including opens, clicks, and unsubscribes.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'activity'), **queryparams)\n    \n    def feed(self, list_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get the last 10 events of a member’s activity on a specific list,\n        including opens, clicks, and unsubscribes. \n        With count parameter, get as many past events as you would like.\n        Returns many more fields not accessible by all endpoint.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'activity-feed'), **queryparams)\n\n"
  },
  {
    "path": "mailchimp3/entities/listmemberevents.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Member Events API endpoint\n\nDocumentation: https://mailchimp.com/developer/reference/lists/list-members/list-member-events/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ListMemberEvents(BaseApi):\n    \"\"\"\n    Use the Events endpoint to collect website or in-app actions and trigger targeted automations.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMemberEvents, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n\n    def create(self, list_id, subscriber_hash, data):\n        \"\"\"\n        Add an event for a list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*, (Must be 2-30 characters in length)\n        }\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        if 'name' not in data:\n            raise KeyError('The list member events must have a name')\n        if len(data['name']) < 2 or len(data['name']) > 30:\n            raise ValueError('The list member events name must be 2-30 in length')\n        return self._mc_client._post(url=self._build_path(list_id, 'members', subscriber_hash, 'events'), data=data)\n\n    def all(self, list_id, subscriber_hash, get_all=False, **queryparams):\n        \"\"\"\n        Get events for a contact\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'members', subscriber_hash, 'events'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'events'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listmembergoals.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Member Goals API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/goals/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Goals/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ListMemberGoals(BaseApi):\n    \"\"\"\n    Get information about recent goal events for a specific list member.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMemberGoals, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, list_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get the last 50 Goal events for a member on a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'goals'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listmembernotes.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Member Notes API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/notes/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Notes/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ListMemberNotes(BaseApi):\n    \"\"\"\n    Retrieve recent notes for a specific list member.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMemberNotes, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n        self.note_id = None\n\n\n    def create(self, list_id, subscriber_hash, data):\n        \"\"\"\n        Add a new note for a specific subscriber.\n\n        The documentation lists only the note request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"note\": string*\n        }\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        if 'note' not in data:\n            raise KeyError('The list member note must have a note')\n        response = self._mc_client._post(url=self._build_path(list_id, 'members', subscriber_hash, 'notes'), data=data)\n        if response is not None:\n            self.note_id = response['id']\n        else:\n            self.note_id = None\n        return response\n\n\n    def all(self, list_id, subscriber_hash, get_all=False, **queryparams):\n        \"\"\"\n        Get recent notes for a specific list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        self.note_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'members', subscriber_hash, 'notes'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'notes'), **queryparams)\n\n\n    def get(self, list_id, subscriber_hash, note_id, **queryparams):\n        \"\"\"\n        Get a specific note for a specific list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param note_id: The id for the note.\n        :type note_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        self.note_id = note_id\n        return self._mc_client._get(\n            url=self._build_path(list_id, 'members', subscriber_hash, 'notes', note_id),\n            **queryparams\n        )\n\n\n    def update(self, list_id, subscriber_hash, note_id, data):\n        \"\"\"\n        Update a specific note for a specific list member.\n\n        The documentation lists only the note request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param note_id: The id for the note.\n        :type note_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"note\": string*\n        }\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        self.note_id = note_id\n        if 'note' not in data:\n            raise KeyError('The list member note must have a note')\n        return self._mc_client._patch(\n            url=self._build_path(list_id, 'members', subscriber_hash, 'notes', note_id),\n            data=data\n        )\n\n\n    def delete(self, list_id, subscriber_hash, note_id):\n        \"\"\"\n        Delete a specific note for a specific list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param note_id: The id for the note.\n        :type note_id: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        self.note_id = note_id\n        return self._mc_client._delete(url=self._build_path(list_id, 'members', subscriber_hash, 'notes', note_id))\n"
  },
  {
    "path": "mailchimp3/entities/listmembers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Members API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.listmemberactivity import ListMemberActivity\nfrom mailchimp3.entities.listmemberevents import ListMemberEvents\nfrom mailchimp3.entities.listmembergoals import ListMemberGoals\nfrom mailchimp3.entities.listmembernotes import ListMemberNotes\nfrom mailchimp3.helpers import check_email, check_subscriber_hash\n\n\nclass ListMembers(BaseApi):\n    \"\"\"\n    Manage members of a specific MailChimp list, including currently\n    subscribed, unsubscribed, and bounced members.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMembers, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n        self.activity = ListMemberActivity(self)\n        self.events = ListMemberEvents(self)\n        self.goals = ListMemberGoals(self)\n        self.notes = ListMemberNotes(self)\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Add a new member to the list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"status\": string*, (Must be one of 'subscribed', 'unsubscribed', 'cleaned',\n                'pending', or 'transactional')\n            \"email_address\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'status' not in data:\n            raise KeyError('The list member must have a status')\n        if data['status'] not in ['subscribed', 'unsubscribed', 'cleaned', 'pending', 'transactional']:\n            raise ValueError('The list member status must be one of \"subscribed\", \"unsubscribed\", \"cleaned\", '\n                             '\"pending\", or \"transactional\"')\n        if 'email_address' not in data:\n            raise KeyError('The list member must have an email_address')\n        check_email(data['email_address'])\n        response = self._mc_client._post(url=self._build_path(list_id, 'members'), data=data)\n        if response is not None:\n            self.subscriber_hash = response['id']\n        else:\n            self.subscriber_hash = None\n        return response\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about members in a specific MailChimp list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['email_type'] = string\n        queryparams['status'] = string\n        queryparams['before_timestamp_opt'] = string\n        queryparams['since_timestamp_opt'] = string\n        queryparams['before_last_changed'] = string\n        queryparams['since_last_changed'] = string\n        queryparams['unique_email_id'] = string\n        queryparams['vip_only'] = boolean\n        queryparams['interest_category_id'] = string\n        queryparams['interest_ids'] = string\n        queryparams['interest_match'] = string\n        \"\"\"\n        self.list_id = list_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'members'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'members'), **queryparams)\n\n\n    def get(self, list_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get information about a specific list member, including a currently\n        subscribed, unsubscribed, or bounced member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n            list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash), **queryparams)\n\n\n    def update(self, list_id, subscriber_hash, data):\n        \"\"\"\n        Update information for a specific list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n            list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._patch(url=self._build_path(list_id, 'members', subscriber_hash), data=data)\n\n\n    def create_or_update(self, list_id, subscriber_hash, data):\n        \"\"\"\n        Add or update a list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n            list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*,\n            \"status_if_new\": string* (Must be one of 'subscribed',\n                'unsubscribed', 'cleaned', 'pending', or 'transactional')\n        }\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        if 'email_address' not in data:\n            raise KeyError('The list member must have an email_address')\n        check_email(data['email_address'])\n        if 'status_if_new' not in data:\n            raise KeyError('The list member must have a status_if_new')\n        if data['status_if_new'] not in ['subscribed', 'unsubscribed', 'cleaned', 'pending', 'transactional']:\n            raise ValueError('The list member status_if_new must be one of \"subscribed\", \"unsubscribed\", \"cleaned\", '\n                             '\"pending\", or \"transactional\"')\n        return self._mc_client._put(url=self._build_path(list_id, 'members', subscriber_hash), data=data)\n\n\n    def delete(self, list_id, subscriber_hash):\n        \"\"\"\n        Delete a member from a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._delete(url=self._build_path(list_id, 'members', subscriber_hash))\n\n    def delete_permanent(self, list_id, subscriber_hash):\n        \"\"\"\n        Delete permanently a member from a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._post(url=self._build_path(list_id, 'members', subscriber_hash, 'actions', 'delete-permanent'))\n"
  },
  {
    "path": "mailchimp3/entities/listmembertags.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Member Tags API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/tags/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Tags/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ListMemberTags(BaseApi):\n    \"\"\"\n    Retrieve tags for a specific list member.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMemberTags, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.subscriber_hash = None\n\n\n    def update(self, list_id, subscriber_hash, data):\n        \"\"\"\n        Update tags for a specific subscriber.\n\n        The documentation lists only the tags request body parameter so it is\n        being documented and error-checked as if it were required based on the\n        description of the method.\n\n        The data list needs to include a \"status\" key. This determines if the\n        tag should be added or removed from the user:\n\n        data = {\n            'tags': [\n                {'name': 'foo', 'status': 'active'},\n                {'name': 'bar', 'status': 'inactive'}\n            ]\n        }\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"tags\": list*\n        }\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        if 'tags' not in data:\n            raise KeyError('The list member tags must have a tag')\n        response = self._mc_client._post(url=self._build_path(list_id, 'members', subscriber_hash, 'tags'), data=data)\n        return response\n\n\n    def all(self, list_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get all tags for a specific list member.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(list_id, 'members', subscriber_hash, 'tags'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/listmergefields.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Merge Fields API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/merge-fields/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/MergeFields/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListMergeFields(BaseApi):\n    \"\"\"\n    Manage merge fields (formerly merge vars) for a specific list.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListMergeFields, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.merge_id = None\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Add a new merge field for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"type\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'name' not in data:\n            raise KeyError('The list merge field must have a name')\n        if 'type' not in data:\n            raise KeyError('The list merge field must have a type')\n        response = self._mc_client._post(url=self._build_path(list_id, 'merge-fields'), data=data)\n        if response is not None:\n            self.merge_id = response['merge_id']\n        else:\n            self.merge_id = None\n        return response\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of all merge fields (formerly merge vars) for a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = string\n        queryparams['required'] = boolean\n        \"\"\"\n        self.list_id = list_id\n        self.merge_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'merge-fields'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'merge-fields'), **queryparams)\n\n\n    def get(self, list_id, merge_id):\n        \"\"\"\n        Get information about a specific merge field in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param merge_id: The id for the merge field.\n        :type merge_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.merge_id = merge_id\n        return self._mc_client._get(url=self._build_path(list_id, 'merge-fields', merge_id))\n\n\n    def update(self, list_id, merge_id, data):\n        \"\"\"\n        Update a specific merge field in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param merge_id: The id for the merge field.\n        :type merge_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.merge_id = merge_id\n        if 'name' not in data:\n            raise KeyError('The list merge field must have a name')\n        return self._mc_client._patch(url=self._build_path(list_id, 'merge-fields', merge_id), data=data)\n\n\n    def delete(self, list_id, merge_id):\n        \"\"\"\n        Delete a specific merge field in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param merge_id: The id for the merge field.\n        :type merge_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.merge_id = merge_id\n        return self._mc_client._delete(url=self._build_path(list_id, 'merge-fields', merge_id))\n"
  },
  {
    "path": "mailchimp3/entities/lists.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Lists API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.listabusereports import ListAbuseReports\nfrom mailchimp3.entities.listactivity import ListActivity\nfrom mailchimp3.entities.listclients import ListClients\nfrom mailchimp3.entities.listgrowthhistory import ListGrowthHistory\nfrom mailchimp3.entities.listinterestcategories import ListInterestCategories\nfrom mailchimp3.entities.listmembers import ListMembers\nfrom mailchimp3.entities.listmergefields import ListMergeFields\nfrom mailchimp3.entities.listsegments import ListSegments\nfrom mailchimp3.entities.listsignupforms import ListSignupForms\nfrom mailchimp3.entities.listwebhooks import ListWebhooks\nfrom mailchimp3.helpers import check_email\n\n\nclass Lists(BaseApi):\n    \"\"\"\n    A MailChimp list is a powerful and flexible tool that helps you manage your contacts.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Lists, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.abuse_reports = ListAbuseReports(self)\n        self.activity = ListActivity(self)\n        self.clients = ListClients(self)\n        self.growth_history = ListGrowthHistory(self)\n        self.interest_categories = ListInterestCategories(self)\n        self.members = ListMembers(self)\n        self.merge_fields = ListMergeFields(self)\n        self.segments = ListSegments(self)\n        self.signup_forms = ListSignupForms(self)\n        self.webhooks = ListWebhooks(self)\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new list in your MailChimp account.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The list must have a name')\n        if 'contact' not in data:\n            raise KeyError('The list must have a contact')\n        if 'company' not in data['contact']:\n            raise KeyError('The list contact must have a company')\n        if 'address1' not in data['contact']:\n            raise KeyError('The list contact must have a address1')\n        if 'city' not in data['contact']:\n            raise KeyError('The list contact must have a city')\n        if 'state' not in data['contact']:\n            raise KeyError('The list contact must have a state')\n        if 'zip' not in data['contact']:\n            raise KeyError('The list contact must have a zip')\n        if 'country' not in data['contact']:\n            raise KeyError('The list contact must have a country')\n        if 'permission_reminder' not in data:\n            raise KeyError('The list must have a permission_reminder')\n        if 'campaign_defaults' not in data:\n            raise KeyError('The list must have a campaign_defaults')\n        if 'from_name' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_name')\n        if 'from_email' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_email')\n        check_email(data['campaign_defaults']['from_email'])\n        if 'subject' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a subject')\n        if 'language' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a language')\n        if 'email_type_option' not in data:\n            raise KeyError('The list must have an email_type_option')\n        if data['email_type_option'] not in [True, False]:\n            raise TypeError('The list email_type_option must be True or False')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.list_id = response['id']\n        else:\n            self.list_id = None\n        return response\n\n\n    def update_members(self, list_id, data):\n        \"\"\"\n        Batch subscribe or unsubscribe list members.\n\n        Only the members array is required in the request body parameters.\n        Within the members array, each member requires an email_address\n        and either a status or status_if_new. The update_existing parameter\n        will also be considered required to help prevent accidental updates\n        to existing members and will default to false if not present.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"members\": array*\n            [\n                {\n                    \"email_address\": string*,\n                    \"status\": string* (Must be one of 'subscribed', 'unsubscribed', 'cleaned', or 'pending'),\n                    \"status_if_new\": string* (Must be one of 'subscribed', 'unsubscribed', 'cleaned', or 'pending')\n                }\n            ],\n            \"update_existing\": boolean*\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'members' not in data:\n            raise KeyError('The update must have at least one member')\n        else:\n            if not len(data['members']) <= 500:\n                raise ValueError('You may only batch sub/unsub 500 members at a time')\n        for member in data['members']:\n            if 'email_address' not in member:\n                raise KeyError('Each list member must have an email_address')\n            check_email(member['email_address'])\n            if 'status' not in member and 'status_if_new' not in member:\n                raise KeyError('Each list member must have either a status or a status_if_new')\n            valid_statuses = ['subscribed', 'unsubscribed', 'cleaned', 'pending']\n            if 'status' in member and member['status'] not in valid_statuses:\n                raise ValueError('The list member status must be one of \"subscribed\", \"unsubscribed\", \"cleaned\", or '\n                                 '\"pending\"')\n            if 'status_if_new' in member and member['status_if_new'] not in valid_statuses:\n                raise ValueError('The list member status_if_new must be one of \"subscribed\", \"unsubscribed\", '\n                                 '\"cleaned\", or \"pending\"')\n        if 'update_existing' not in data:\n            data['update_existing'] = False\n        return self._mc_client._post(url=self._build_path(list_id), data=data)\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get information about all lists in the account.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['before_date_created'] = string\n        queryparams['since_date_created'] = string\n        queryparams['before_campaign_last_sent'] = string\n        queryparams['since_campaign_last_sent'] = string\n        queryparams['email'] = string\n        queryparams['sort_field'] = string (Must be 'date_created')\n        queryparams['sort_dir'] = string (Must be one of 'ASC' or 'DESC')\n        \"\"\"\n        self.list_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, list_id, **queryparams):\n        \"\"\"\n        Get information about a specific list in your MailChimp account.\n        Results include list members who have signed up but haven’t confirmed\n        their subscription yet and unsubscribed or cleaned.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        return self._mc_client._get(url=self._build_path(list_id), **queryparams)\n\n\n    def update(self, list_id, data):\n        \"\"\"\n        Update the settings for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"contact\": object*\n            {\n                \"company\": string*,\n                \"address1\": string*,\n                \"city\": string*,\n                \"state\": string*,\n                \"zip\": string*,\n                \"country\": string*\n            },\n            \"permission_reminder\": string*,\n            \"campaign_defaults\": object*\n            {\n                \"from_name\": string*,\n                \"from_email\": string*,\n                \"subject\": string*,\n                \"language\": string*\n            },\n            \"email_type_option\": boolean\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'name' not in data:\n            raise KeyError('The list must have a name')\n        if 'contact' not in data:\n            raise KeyError('The list must have a contact')\n        if 'company' not in data['contact']:\n            raise KeyError('The list contact must have a company')\n        if 'address1' not in data['contact']:\n            raise KeyError('The list contact must have a address1')\n        if 'city' not in data['contact']:\n            raise KeyError('The list contact must have a city')\n        if 'state' not in data['contact']:\n            raise KeyError('The list contact must have a state')\n        if 'zip' not in data['contact']:\n            raise KeyError('The list contact must have a zip')\n        if 'country' not in data['contact']:\n            raise KeyError('The list contact must have a country')\n        if 'permission_reminder' not in data:\n            raise KeyError('The list must have a permission_reminder')\n        if 'campaign_defaults' not in data:\n            raise KeyError('The list must have a campaign_defaults')\n        if 'from_name' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_name')\n        if 'from_email' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a from_email')\n        check_email(data['campaign_defaults']['from_email'])\n        if 'subject' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a subject')\n        if 'language' not in data['campaign_defaults']:\n            raise KeyError('The list campaign_defaults must have a language')\n        if 'email_type_option' not in data:\n            raise KeyError('The list must have an email_type_option')\n        if data['email_type_option'] not in [True, False]:\n            raise TypeError('The list email_type_option must be True or False')\n        return self._mc_client._patch(url=self._build_path(list_id), data=data)\n\n\n    def delete(self, list_id):\n        \"\"\"\n        Delete a list from your MailChimp account. If you delete a list,\n        you’ll lose the list history—including subscriber activity,\n        unsubscribes, complaints, and bounces. You’ll also lose subscribers’\n        email addresses, unless you exported and backed up your list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        return self._mc_client._delete(url=self._build_path(list_id))\n\n"
  },
  {
    "path": "mailchimp3/entities/listsegmentmembers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Segment Members API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/members/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email, check_subscriber_hash\n\n\nclass ListSegmentMembers(BaseApi):\n    \"\"\"\n    Manage list members in a saved segment.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListSegmentMembers, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.segment_id = None\n        self.subscriber_hash = None\n\n\n    def create(self, list_id, segment_id, data):\n        \"\"\"\n        Add a member to a static segment.\n\n        The documentation does not currently elaborate on the path or request\n        body parameters. Looking at the example provided, it will be assumed\n        that email_address and status are required request body parameters and\n        they are documented and error-checked as such.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"email_address\": string*,\n            \"status\": string* (Must be one of 'subscribed', 'unsubscribed', 'cleaned', or 'pending')\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        if 'email_address' not in data:\n            raise KeyError('The list segment member must have an email_address')\n        check_email(data['email_address'])\n        if 'status' not in data:\n            raise KeyError('The list segment member must have a status')\n        if data['status'] not in ['subscribed', 'unsubscribed', 'cleaned', 'pending']:\n            raise ValueError('The list segment member status must be one of \"subscribed\", \"unsubscribed\", \"cleaned\" or'\n                             '\"pending\"')\n        response = self._mc_client._post(url=self._build_path(list_id, 'segments', segment_id, 'members'), data=data)\n        if response is not None:\n            self.subscriber_hash = response['id']\n        else:\n            self.subscriber_hash = None\n        return response\n\n\n    def all(self, list_id, segment_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about members in a saved segment.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'segments', segment_id, 'members'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'segments', segment_id, 'members'), **queryparams)\n\n\n    def delete(self, list_id, segment_id, subscriber_hash):\n        \"\"\"\n        Remove a member from the specified static segment.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.list_id = list_id\n        self.segment_id = segment_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._delete(\n            url=self._build_path(list_id, 'segments', segment_id, 'members', subscriber_hash)\n        )\n"
  },
  {
    "path": "mailchimp3/entities/listsegments.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Segments API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/segments/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Segments/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.listsegmentmembers import ListSegmentMembers\n\n\nclass ListSegments(BaseApi):\n    \"\"\"\n    Manage segments for a specific MailChimp list. A segment is a section of\n    your list that includes only those subscribers who share specific common\n    field information.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListSegments, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.segment_id = None\n        self.members = ListSegmentMembers(self)\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Create a new segment in a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'name' not in data:\n            raise KeyError('The list segment must have a name')\n        response = self._mc_client._post(url=self._build_path(list_id, 'segments'), data=data)\n        if response is not None:\n            self.segment_id = response['id']\n        else:\n            self.segment_id = None\n        return response\n\n\n    def all(self, list_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about all available segments for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = string\n        queryparams['before_created_at'] = string\n        queryparams['since_created_at'] = string\n        queryparams['before_updated_at'] = string\n        queryparams['since_updated_at'] = string\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(list_id, 'segments'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(list_id, 'segments'), **queryparams)\n\n\n    def get(self, list_id, segment_id, **queryparams):\n        \"\"\"\n        Get information about a specific segment.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        return self._mc_client._get(url=self._build_path(list_id, 'segments', segment_id), **queryparams)\n\n\n    def update(self, list_id, segment_id, data):\n        \"\"\"\n        Update a specific segment in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        if 'name' not in data:\n            raise KeyError('The list segment must have a name')\n        return self._mc_client._patch(url=self._build_path(list_id, 'segments', segment_id), data=data)\n\n\n    def update_members(self, list_id, segment_id, data):\n        \"\"\"\n        Batch add/remove list members to static segment.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"members_to_add\": array,\n            \"members_to_remove\": array\n        }\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        return self._mc_client._post(url=self._build_path(list_id, 'segments', segment_id), data=data)\n\n\n    def delete(self, list_id, segment_id):\n        \"\"\"\n        Delete a specific segment in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param segment_id: The unique id for the segment.\n        :type segment_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.segment_id = segment_id\n        return self._mc_client._delete(url=self._build_path(list_id, 'segments', segment_id))\n"
  },
  {
    "path": "mailchimp3/entities/listsignupforms.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Signup Forms API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/signup-forms/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/SignupForms/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ListSignupForms(BaseApi):\n    \"\"\"\n    Manage list signup forms.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListSignupForms, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Create a customized list signup form.\n\n        No fields are listed as required in the documentation and the\n        description of the method does not indicate any required fields\n        either.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.list_id = list_id\n        response = self._mc_client._post(url=self._build_path(list_id, 'signup-forms'), data=data)\n        return response\n\n\n    def all(self, list_id):\n        \"\"\"\n        Get signup forms for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        return self._mc_client._get(url=self._build_path(list_id, 'signup-forms'))\n"
  },
  {
    "path": "mailchimp3/entities/listwebhooks.py",
    "content": "# coding=utf-8\n\"\"\"\nThe List Webhooks API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/webhooks/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Webhooks/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_url\n\n\nclass ListWebhooks(BaseApi):\n    \"\"\"\n    Manage webhooks for a specific MailChimp list.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ListWebhooks, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n        self.list_id = None\n        self.webhook_id = None\n\n\n    def create(self, list_id, data):\n        \"\"\"\n        Create a new webhook for a specific list.\n\n        The documentation does not include any required request body\n        parameters but the url parameter is being listed here as a required\n        parameter in documentation and error-checking based on the description\n        of the method\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"url\": string*\n        }\n        \"\"\"\n        self.list_id = list_id\n        if 'url' not in data:\n            raise KeyError('The list webhook must have a url')\n        check_url(data['url'])\n        response = self._mc_client._post(url=self._build_path(list_id, 'webhooks'), data=data)\n        if response is not None:\n            self.webhook_id = response['id']\n        else:\n            self.webhook_id = None\n        return response\n\n\n    def all(self, list_id):\n        \"\"\"\n        Get information about all webhooks for a specific list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.webhook_id = None\n        return self._mc_client._get(url=self._build_path(list_id, 'webhooks'))\n\n\n    def get(self, list_id, webhook_id):\n        \"\"\"\n        Get information about a specific webhook.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param webhook_id: The unique id for the webhook.\n        :type webhook_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.webhook_id = webhook_id\n        return self._mc_client._get(url=self._build_path(list_id, 'webhooks', webhook_id))\n\n\n    def update(self, list_id, webhook_id, data):\n        \"\"\"\n        Update the settings for an existing webhook.\n\n        :param list_id: The unique id for the list\n        :type list_id: :py:class:`str`\n        :param webhook_id: The unique id for the webhook\n        :type webhook_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.webhook_id = webhook_id\n        return self._mc_client._patch(url=self._build_path(list_id, 'webhooks', webhook_id), data=data)\n\n\n    def delete(self, list_id, webhook_id):\n        \"\"\"\n        Delete a specific webhook in a list.\n\n        :param list_id: The unique id for the list.\n        :type list_id: :py:class:`str`\n        :param webhook_id: The unique id for the webhook.\n        :type webhook_id: :py:class:`str`\n        \"\"\"\n        self.list_id = list_id\n        self.webhook_id = webhook_id\n        return self._mc_client._delete(url=self._build_path(list_id, 'webhooks', webhook_id))\n"
  },
  {
    "path": "mailchimp3/entities/ping.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Google Analytics API Endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ping\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\nclass Ping(BaseApi):\n    \"\"\"\n    A health check endpoint for MailChimp API 3.0.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Ping, self).__init__(*args, **kwargs)\n        self.endpoint = 'ping'\n\n    def get(self):\n        \"\"\"\n        A health check for the API that won’t return any account-specific information.\n        \"\"\"\n        return self._mc_client._get(url=self._build_path())\n"
  },
  {
    "path": "mailchimp3/entities/reportcampaignabusereports.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Abuse Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/abuse-reports/\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportCampaignAbuseReports(BaseApi):\n    \"\"\"\n    Get information about campaign abuse complaints.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportCampaignAbuseReports, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.report_id = None\n\n\n    def all(self, campaign_id, **queryparams):\n        \"\"\"\n        Get a list of abuse complaints for a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.report_id = None\n        return self._mc_client._get(url=self._build_path(campaign_id, 'abuse-reports'), **queryparams)\n\n\n    def get(self, campaign_id, report_id, **queryparams):\n        \"\"\"\n        Get information about a specific abuse report for a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param report_id: The id for the abuse report.\n        :type report_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.report_id = report_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'abuse-reports', report_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportcampaignadvice.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Campaign Advice Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/advice/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Advice/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportCampaignAdvice(BaseApi):\n    \"\"\"\n    Get recent feedback based on a campaign’s statistics.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportCampaignAdvice, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, **queryparams):\n        \"\"\"\n        Get feedback based on a campaign’s statistics. Advice feedback is\n        based on campaign stats like opens, clicks, unsubscribes, bounces, and\n        more.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'advice'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportclickdetailmembers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Click Detail Report Members API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/click-details/members/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/ClickDetails/Members/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ReportClickDetailMembers(BaseApi):\n    \"\"\"\n    Get information about specific subscribers who clicked on links in a\n    campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportClickDetailMembers, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.link_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, campaign_id, link_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about list members who clicked on a specific link in a\n        campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param link_id: The id for the link.\n        :type link_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.link_id = link_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'click-details', link_id, 'members'), **queryparams)\n        else:\n            return self._mc_client._get(\n                url=self._build_path(campaign_id, 'click-details', link_id, 'members'),\n                **queryparams\n            )\n\n\n    def get(self, campaign_id, link_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get information about a specific subscriber who clicked a link in a\n        specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param link_id: The id for the link.\n        :type link_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.campaign_id = campaign_id\n        self.link_id = link_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(\n            url=self._build_path(campaign_id, 'click-details', link_id, 'members', subscriber_hash),\n            **queryparams\n        )\n"
  },
  {
    "path": "mailchimp3/entities/reportclickdetailreports.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Click Details Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/click-details/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/ClickDetails/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.reportclickdetailmembers import ReportClickDetailMembers\n\n\nclass ReportClickDetailReports(BaseApi):\n    \"\"\"\n    Get detailed information about links clicked in campaigns.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportClickDetailReports, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.link_id = None\n        self.members = ReportClickDetailMembers(self)\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about clicks on specific links in your MailChimp\n        campaigns.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.link_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'click-details'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'click-details'), **queryparams)\n\n\n    def get(self, campaign_id, link_id, **queryparams):\n        \"\"\"\n        Get click details for a specific link in a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param link_id: The id for the link.\n        :type link_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.link_id = link_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'click-details', link_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportdomainperformance.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Domain Performance Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/domain-performance/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/DomainPerformance/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportDomainPerformance(BaseApi):\n    \"\"\"\n    Get statistics for the top-performing domains from a campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportDomainPerformance, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, **queryparams):\n        \"\"\"\n        Get statistics for the top-performing email domains in a campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'domain-performance'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reporteepurl.py",
    "content": "# coding=utf-8\n\"\"\"\nThe EepURL Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/eepurl/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Eepurl/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportEepURL(BaseApi):\n    \"\"\"\n    Get a summary of social activity for the campaign, tracked by EepURL.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportEepURL, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, **queryparams):\n        \"\"\"\n        Get a summary of social activity for the campaign, tracked by EepURL.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'eepurl'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportemailactivity.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Email Activity Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/email-activity/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/EmailActivity/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ReportEmailActivity(BaseApi):\n    \"\"\"\n    Get list member activity for a specific campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportEmailActivity, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of member’s subscriber activity in a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'email-activity'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'email-activity'), **queryparams)\n\n\n    def get(self, campaign_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get a specific list member’s activity in a campaign including opens,\n        clicks, and bounces.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.campaign_id = campaign_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(\n            url=self._build_path(campaign_id, 'email-activity', subscriber_hash),\n            **queryparams\n        )\n"
  },
  {
    "path": "mailchimp3/entities/reportgoogleanalytics.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Google Analytics API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/google-analytics/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/GoogleAnalytics/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\nclass ReportGoogleAnalytics(BaseApi):\n    \"\"\"\n    Get top open locations for a specific campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportGoogleAnalytics, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.profile_id = None\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get a summary of Google Analytics reports for a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams:  The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'google-analytics'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'google-analytics'), **queryparams)\n\n    def get(self, campaign_id, profile_id, **queryparams):\n        \"\"\"\n        Get information about a specific Google Analytics report for a campaign.\n\n        :param campaign_id: The unique id for the campaign\n        :type campaign_id: :py:class:`str`\n        :param profile_id: The Google Analytics View ID\n        :type campaign_id: :py:class:`str`\n        :param queryparams:\n        :param queryparams:  The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.profile_id = profile_id\n\n        return self._mc_client._get(url=self._build_path(campaign_id, 'google-analytics', profile_id), **queryparams)\n\n\n\n"
  },
  {
    "path": "mailchimp3/entities/reportlocations.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Location Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/locations/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Locations/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportLocations(BaseApi):\n    \"\"\"\n    Get top open locations for a specific campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportLocations, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get top open locations for a specific campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'locations'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'locations'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportopendetails.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Location Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/open-details/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/OpenDetails/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\nclass OpenDetails(BaseApi):\n    \"\"\"\n    Get a detailed report about any emails in a specific campaign that were opened by the recipient.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(OpenDetails, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, get_all=False,  **queryparams):\n        \"\"\"\n        Get detailed information about any campaign emails that were opened by a list member.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['since'] = str\n        \"\"\"\n        self.campaign_id = campaign_id\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'open-details'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'open-details'), **queryparams)\n\n\nclass ReportOpenDetails(OpenDetails):\n    \"\"\"\n    Clone OpenDetails class as ReportOpenDetails for naming consistency\n    \"\"\"\n    pass"
  },
  {
    "path": "mailchimp3/entities/reports.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Reports API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.reportcampaignabusereports import ReportCampaignAbuseReports\nfrom mailchimp3.entities.reportcampaignadvice import ReportCampaignAdvice\nfrom mailchimp3.entities.reportclickdetailreports import ReportClickDetailReports\nfrom mailchimp3.entities.reportdomainperformance import ReportDomainPerformance\nfrom mailchimp3.entities.reporteepurl import ReportEepURL\nfrom mailchimp3.entities.reportemailactivity import ReportEmailActivity\nfrom mailchimp3.entities.reportlocations import ReportLocations\nfrom mailchimp3.entities.reportsentto import ReportSentTo\nfrom mailchimp3.entities.reportsubreports import ReportSubReports\nfrom mailchimp3.entities.reportunsubscribes import ReportUnsubscribes\n\n\nclass Reports(BaseApi):\n    \"\"\"\n    Manage campaign reports for your MailChimp account. All Reports endpoints\n    are read-only. MailChimp’s campaign and Automation reports analyze clicks,\n    opens, subscribers’ social activity, e-commerce data, and more.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Reports, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.abuse_reports = ReportCampaignAbuseReports(self)\n        self.advice = ReportCampaignAdvice(self)\n        self.click_details = ReportClickDetailReports(self)\n        self.domain_performance = ReportDomainPerformance(self)\n        self.eepurl = ReportEepURL(self)\n        self.email_activity = ReportEmailActivity(self)\n        self.locations = ReportLocations(self)\n        self.sent_to = ReportSentTo(self)\n        self.subreports = ReportSubReports(self)\n        self.unsubscribes = ReportUnsubscribes(self)\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get campaign reports.\n\n        .. note::\n            The before_send_time and since_send_time queryparams expect times\n            to be listed in the ISO 8601 format in UTC (ex.\n            2015-10-21T15:41:36+00:00).\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['type'] = []\n        queryparams['before_send_time'] = string\n        queryparams['since_send_time'] = string\n        \"\"\"\n        self.campaign_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, campaign_id, **queryparams):\n        \"\"\"\n        Get report details for a specific sent campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportsentto.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Sent To Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/sent-to/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/SentTo/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ReportSentTo(BaseApi):\n    \"\"\"\n    Get details about campaign recipients.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportSentTo, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about campaign recipients.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'sent-to'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'sent-to'), **queryparams)\n\n\n    def get(self, campaign_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get information about a specific campaign recipient.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.campaign_id = campaign_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(campaign_id, 'sent-to', subscriber_hash), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportsubreports.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Sub-Reports Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/sub-reports/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Sub/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass ReportSubReports(BaseApi):\n    \"\"\"\n    A list of reports for child campaigns of a specific parent campaign. For\n    example, use this endpoint to view Multivariate, RSS, and A/B Testing\n    Campaign reports.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(ReportSubReports, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n\n\n    def all(self, campaign_id, **queryparams):\n        \"\"\"\n        Get a list of reports with child campaigns for a specific parent\n        campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.campaign_id = campaign_id\n        return self._mc_client._get(url=self._build_path(campaign_id, 'sub-reports'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/reportunsubscribes.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Unsubscribes Report API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/reports/unsubscribed/\nSchema: https://api.mailchimp.com/schema/3.0/Reports/Unsubs/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_subscriber_hash\n\n\nclass ReportUnsubscribes(BaseApi):\n    \"\"\"\n    Get information about list members who unsubscribed from a specific campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        super(ReportUnsubscribes, self).__init__(*args, **kwargs)\n        self.endpoint = 'reports'\n        self.campaign_id = None\n        self.subscriber_hash = None\n\n\n    def all(self, campaign_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about members who have unsubscribed from a specific\n        campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.campaign_id = campaign_id\n        self.subscriber_hash = None\n        if get_all:\n            return self._iterate(url=self._build_path(campaign_id, 'unsubscribed'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(campaign_id, 'unsubscribed'), **queryparams)\n\n\n    def get(self, campaign_id, subscriber_hash, **queryparams):\n        \"\"\"\n        Get information about a specific list member who unsubscribed from a\n        campaign.\n\n        :param campaign_id: The unique id for the campaign.\n        :type campaign_id: :py:class:`str`\n        :param subscriber_hash: The MD5 hash of the lowercase version of the\n          list member’s email address.\n        :type subscriber_hash: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        subscriber_hash = check_subscriber_hash(subscriber_hash)\n        self.campaign_id = campaign_id\n        self.subscriber_hash = subscriber_hash\n        return self._mc_client._get(url=self._build_path(campaign_id, 'unsubscribed', subscriber_hash), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/root.py",
    "content": "# coding=utf-8\n\"\"\"\nThe API Root endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/root/\nSchema: https://api.mailchimp.com/schema/3.0/Root.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass Root(BaseApi):\n    \"\"\"\n    The API root resource links to all other resources available in the API.\n    Calling the root directory also returns details about the MailChimp user\n    account.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Root, self).__init__(*args, **kwargs)\n        self.endpoint = ''\n\n\n    def get(self, **queryparams):\n        \"\"\"\n        Get links to all other resources available in the API.\n\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        return self._mc_client._get(url=self._build_path(), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/searchcampaigns.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Search Members API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/search-campaigns/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Collection.json\nAdditional Data: http://kb.mailchimp.com/accounts/management/search-for-subscribers-and-campaigns-in-your-account\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass SearchCampaigns(BaseApi):\n    \"\"\"\n    Search all of an account’s campaigns for the specified query terms.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(SearchCampaigns, self).__init__(*args, **kwargs)\n        self.endpoint = 'search-campaigns'\n\n\n    def get(self, **queryparams):\n        \"\"\"\n        Search all campaigns for the specified query terms.\n\n        :param queryparams: The query string parameters\n        queryparams['fields'] = array\n        queryparams['exclude_fields'] = array\n        queryparams['query'] = string\n        queryparams['snip_start'] = string\n        queryparams['snip_end'] = string\n        queryparams['offset'] = integer\n        \"\"\"\n        return self._mc_client._get(url=self._build_path(), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/searchmembers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Search Members API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/search-members/\nSchema: https://api.mailchimp.com/schema/3.0/Lists/Members/Collection.json\nAdditional Data: http://kb.mailchimp.com/accounts/management/search-for-subscribers-and-campaigns-in-your-account\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass SearchMembers(BaseApi):\n    \"\"\"\n    Manage campaign reports for your MailChimp account. All Reports endpoints\n    are read-only. MailChimp’s campaign and Automation reports analyze clicks,\n    opens, subscribers’ social activity, e-commerce data, and more.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(SearchMembers, self).__init__(*args, **kwargs)\n        self.endpoint = 'search-members'\n        self.list_id = None\n\n\n    def get(self, **queryparams):\n        \"\"\"\n        Search for list members. This search can be restricted to a specific\n        list, or can be used to search across all lists in an account.\n\n        :param queryparams: The query string parameters\n        queryparams['fields'] = array\n        queryparams['exclude_fields'] = array\n        queryparams['query'] = string\n        queryparams['list_id'] = string\n        queryparams['offset'] = integer\n        \"\"\"\n        if 'list_id' in queryparams:\n            self.list_id = queryparams['list_id']\n        else:\n            self.list_id = None\n        return self._mc_client._get(url=self._build_path(), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/segments.py",
    "content": "from __future__ import unicode_literals\nfrom ..baseapi import BaseApi\n\n\nclass Segments(BaseApi):\n\n    def __init__(self, *args, **kwargs):\n        super(Segments, self).__init__(*args, **kwargs)\n        self.endpoint = 'lists'\n\n    def all(self, list_id, **queryparams):\n        \"\"\"\n        returns the first 10 segments for a specific list.\n        \"\"\"\n        return self._mc_client._get(url=self._build_path(list_id, 'segments'), **queryparams)\n\n    def get(self, list_id, segment_id):\n        \"\"\"\n        returns the specified list segment.\n        \"\"\"\n        return self._mc_client._get(url=self._build_path(list_id, 'segments', segment_id))\n\n    def update(self, list_id, segment_id, data):\n        \"\"\"\n        updates an existing list segment.\n        \"\"\"\n        return self._mc_client._patch(url=self._build_path(list_id, 'segments', segment_id), data=data)\n\n    def delete(self, list_id, segment_id):\n        \"\"\"\n        removes an existing list segment from the list. This cannot be undone.\n        \"\"\"\n        return self._mc_client._delete(url=self._build_path(list_id, 'segments', segment_id))\n\n    def create(self, list_id, data):\n        \"\"\"\n        adds a new segment to the list.\n        \"\"\"\n        return self._mc_client._post(url=self._build_path(list_id, 'segments'), data=data)\n"
  },
  {
    "path": "mailchimp3/entities/storecartlines.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Cart Lines endpoint API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/carts/lines/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Carts/Lines/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass StoreCartLines(BaseApi):\n    \"\"\"\n    Each Cart contains one or more Cart Lines, which represent a specific\n    Product Variant that a Customer has added to their shopping cart.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreCartLines, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.cart_id = None\n        self.line_id = None\n\n\n    def create(self, store_id, cart_id, data):\n        \"\"\"\n        Add a new line item to an existing cart.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"product_id\": string*,\n            \"product_variant_id\": string*,\n            \"quantity\": integer*,\n            \"price\": number*\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        if 'id' not in data:\n            raise KeyError('The cart line must have an id')\n        if 'product_id' not in data:\n            raise KeyError('The cart line must have a product_id')\n        if 'product_variant_id' not in data:\n            raise KeyError('The cart line must have a product_variant_id')\n        if 'quantity' not in data:\n            raise KeyError('The cart line must have a quantity')\n        if 'price' not in data:\n            raise KeyError('The cart line must have a price')\n        response = self._mc_client._post(url=self._build_path(store_id, 'carts', cart_id, 'lines'), data=data)\n        if response is not None:\n            self.line_id = response['id']\n        else:\n            self.line_id = None\n        return response\n\n\n    def all(self, store_id, cart_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a cart’s line items.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        self.line_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'carts', cart_id, 'lines'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'carts', cart_id, 'lines'), **queryparams)\n\n\n    def get(self, store_id, cart_id, line_id, **queryparams):\n        \"\"\"\n        Get information about a specific cart line item.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        self.line_id = line_id\n        return self._mc_client._get(url=self._build_path(store_id, 'carts', cart_id, 'lines', line_id), **queryparams)\n\n\n    def update(self, store_id, cart_id, line_id, data):\n        \"\"\"\n        Update a specific cart line item.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        self.line_id = line_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'carts', cart_id, 'lines', line_id), data=data)\n\n\n    def delete(self, store_id, cart_id, line_id):\n        \"\"\"\n        Delete a cart.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        self.line_id = line_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'carts', cart_id, 'lines', line_id))\n"
  },
  {
    "path": "mailchimp3/entities/storecarts.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Carts endpoint API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/carts/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Carts/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.storecartlines import StoreCartLines\n\n\nclass StoreCarts(BaseApi):\n    \"\"\"\n    Use Carts to represent unfinished e-commerce transactions. This can be\n    used to create an Abandoned Cart workflow, or to save a consumer’s\n    shopping cart pending a successful Order.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreCarts, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.cart_id = None\n        self.lines = StoreCartLines(self)\n\n\n    def create(self, store_id, data):\n        \"\"\"\n        Add a new cart to a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"customer\": object*\n            {\n                \"id\": string*\n            },\n            \"currency_code\": string*,\n            \"order_total\": number*,\n            \"lines\": array*\n            [\n                {\n                    \"id\": string*,\n                    \"product_id\": string*,\n                    \"product_variant_id\": string*,\n                    \"quantity\": integer*,\n                    \"price\": number*\n                }\n            ]\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The cart must have an id')\n        if 'customer' not in data:\n            raise KeyError('The cart must have a customer')\n        if 'id' not in data['customer']:\n            raise KeyError('The cart customer must have an id')\n        if 'currency_code' not in data:\n            raise KeyError('The cart must have a currency_code')\n        if not re.match(r\"^[A-Z]{3}$\", data['currency_code']):\n            raise ValueError('The currency_code must be a valid 3-letter ISO 4217 currency code')\n        if 'order_total' not in data:\n            raise KeyError('The cart must have an order_total')\n        if 'lines' not in data:\n            raise KeyError('The cart must have at least one cart line')\n        for line in data['lines']:\n            if 'id' not in line:\n                raise KeyError('Each cart line must have an id')\n            if 'product_id' not in line:\n                raise KeyError('Each cart line must have a product_id')\n            if 'product_variant_id' not in line:\n                raise KeyError('Each cart line must have a product_variant_id')\n            if 'quantity' not in line:\n                raise KeyError('Each cart line must have a quantity')\n            if 'price' not in line:\n                raise KeyError('Each cart line must have a price')\n        response = self._mc_client._post(url=self._build_path(store_id, 'carts'), data=data)\n        if response is not None:\n            self.cart_id = response['id']\n        else:\n            self.cart_id = None\n        return response\n\n\n    def all(self, store_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s carts.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'carts'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'carts'), **queryparams)\n\n\n    def get(self, store_id, cart_id, **queryparams):\n        \"\"\"\n        Get information about a specific cart.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        return self._mc_client._get(url=self._build_path(store_id, 'carts', cart_id), **queryparams)\n\n\n    def update(self, store_id, cart_id, data):\n        \"\"\"\n        Update a specific cart.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'carts', cart_id), data=data)\n\n\n    def delete(self, store_id, cart_id):\n        \"\"\"\n        Delete a cart.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param cart_id: The id for the cart.\n        :type cart_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.cart_id = cart_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'carts', cart_id))\n"
  },
  {
    "path": "mailchimp3/entities/storecustomers.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Customers API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/customers/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Customers/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.helpers import check_email\n\n\nclass StoreCustomers(BaseApi):\n    \"\"\"\n    Add Customers to your Store to track their orders and to view E-Commerce\n    Data for your MailChimp lists and campaigns. Each Customer is connected to\n    a MailChimp list member, so adding a Customer can also add or update a\n    list member.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreCustomers, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.customer_id = None\n\n\n    def create(self, store_id, data):\n        \"\"\"\n        Add a new customer to a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"email_address\": string*,\n            \"opt_in_status\": boolean*\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The store customer must have an id')\n        if 'email_address' not in data:\n            raise KeyError('The store customer must have an email_address')\n        check_email(data['email_address'])\n        if 'opt_in_status' not in data:\n            raise KeyError('The store customer must have an opt_in_status')\n        if data['opt_in_status'] not in [True, False]:\n            raise TypeError('The opt_in_status must be True or False')\n        response = self._mc_client._post(url=self._build_path(store_id, 'customers'), data=data)\n        if response is not None:\n            self.customer_id = response['id']\n        else:\n            self.customer_id = None\n        return response\n\n\n    def all(self, store_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s customers.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['email_address'] = string\n        \"\"\"\n        self.store_id = store_id\n        self.customer_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'customers'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'customers'), **queryparams)\n\n\n    def get(self, store_id, customer_id, **queryparams):\n        \"\"\"\n        Get information about a specific customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.customer_id = customer_id\n        return self._mc_client._get(url=self._build_path(store_id, 'customers', customer_id), **queryparams)\n\n\n    def update(self, store_id, customer_id, data):\n        \"\"\"\n        Update a customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.customer_id = customer_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'customers', customer_id), data=data)\n\n\n    def create_or_update(self, store_id, customer_id, data):\n        \"\"\"\n        Add or update a customer.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"email_address\": string*,\n            \"opt_in_status\": boolean\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.customer_id = customer_id\n        if 'id' not in data:\n            raise KeyError('The store customer must have an id')\n        if 'email_address' not in data:\n            raise KeyError('Each store customer must have an email_address')\n        check_email(data['email_address'])\n        if 'opt_in_status' not in data:\n            raise KeyError('The store customer must have an opt_in_status')\n        if data['opt_in_status'] not in [True, False]:\n            raise TypeError('The opt_in_status must be True or False')\n        return self._mc_client._put(url=self._build_path(store_id, 'customers', customer_id), data=data)\n\n\n    def delete(self, store_id, customer_id):\n        \"\"\"\n        Delete a customer from a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param customer_id: The id for the customer of a store.\n        :type customer_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.customer_id = customer_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'customers', customer_id))\n"
  },
  {
    "path": "mailchimp3/entities/storeorderlines.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Orders endpoint API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/orders/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Customers/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass StoreOrderLines(BaseApi):\n    \"\"\"\n    Each Order contains one or more Order Lines, which represent a specific\n    Product Variant that a Customer purchases.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreOrderLines, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.order_id = None\n        self.line_id = None\n\n\n    def create(self, store_id, order_id, data):\n        \"\"\"\n        Add a new line item to an existing order.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"product_id\": string*,\n            \"product_variant_id\": string*,\n            \"quantity\": integer*,\n            \"price\": number*\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        if 'id' not in data:\n            raise KeyError('The order line must have an id')\n        if 'product_id' not in data:\n            raise KeyError('The order line must have a product_id')\n        if 'product_variant_id' not in data:\n            raise KeyError('The order line must have a product_variant_id')\n        if 'quantity' not in data:\n            raise KeyError('The order line must have a quantity')\n        if 'price' not in data:\n            raise KeyError('The order line must have a price')\n        response = self._mc_client._post(url=self._build_path(store_id, 'orders', order_id, 'lines'))\n        if response is not None:\n            self.line_id = response['id']\n        else:\n            self.line_id = None\n        return response\n\n\n    def all(self, store_id, order_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about an order’s line items.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        self.line_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'orders', order_id, 'lines'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'orders', order_id, 'lines'), **queryparams)\n\n\n    def get(self, store_id, order_id, line_id, **queryparams):\n        \"\"\"\n        Get information about a specific order line item.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        self.line_id = line_id\n        return self._mc_client._get(url=self._build_path(store_id, 'orders', order_id, 'lines', line_id), **queryparams)\n\n\n    def update(self, store_id, order_id, line_id, data):\n        \"\"\"\n        Update a specific order line item.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        self.line_id = line_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'orders', order_id, 'lines', line_id), data=data)\n\n\n    def delete(self, store_id, order_id, line_id):\n        \"\"\"\n        Delete a specific order line item.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param line_id: The id for the line item of a cart.\n        :type line_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        self.line_id = line_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'orders', order_id, 'lines', line_id))\n"
  },
  {
    "path": "mailchimp3/entities/storeorders.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Orders endpoint API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/orders/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Customers/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.storeorderlines import StoreOrderLines\n\n\nclass StoreOrders(BaseApi):\n    \"\"\"\n    Orders represent successful e-commerce transactions, and this data can be\n    used to provide more detailed campaign reports, track sales, and\n    personalize emails to your targeted consumers, and view other e-commerce\n    data in your MailChimp account.\n\n    .. note::\n        If a financial_status or fulfillment_status value is provided when\n        creating or updating an order, it will trigger a notification email if\n        they have been designed and enabled in your account. The following sets\n        of statuses trigger the following notification types:\n\n        financial_status = 'paid' -> Order Invoice\n        financial_status = 'pending' -> Order Confirmation\n        financial_status = 'refunded' -> Refund Confirmation\n        financial_status = 'cancelled' -> Cancellation Confirmation\n        fulfillment_status = 'shipped' -> Shipping Confirmation\n\n        The current list of notification types and triggers can be found at\n        http://developer.mailchimp.com/documentation/mailchimp/guides/getting-started-with-ecommerce/#order-notifications\n        and should be consulted in the event of any changes\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreOrders, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.order_id = None\n        self.lines = StoreOrderLines(self)\n\n\n    def create(self, store_id, data):\n        \"\"\"\n        Add a new order to a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"customer\": object*\n            {\n                \"'id\": string*\n            },\n            \"curency_code\": string*,\n            \"order_total\": number*,\n            \"lines\": array*\n            [\n                {\n                    \"id\": string*,\n                    \"product_id\": string*,\n                    \"product_variant_id\": string*,\n                    \"quantity\": integer*,\n                    \"price\": number*\n                }\n            ]\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The order must have an id')\n        if 'customer' not in data:\n            raise KeyError('The order must have a customer')\n        if 'id' not in data['customer']:\n            raise KeyError('The order customer must have an id')\n        if 'currency_code' not in data:\n            raise KeyError('The order must have a currency_code')\n        if not re.match(r\"^[A-Z]{3}$\", data['currency_code']):\n            raise ValueError('The currency_code must be a valid 3-letter ISO 4217 currency code')\n        if 'order_total' not in data:\n            raise KeyError('The order must have an order_total')\n        if 'lines' not in data:\n            raise KeyError('The order must have at least one order line')\n        for line in data['lines']:\n            if 'id' not in line:\n                raise KeyError('Each order line must have an id')\n            if 'product_id' not in line:\n                raise KeyError('Each order line must have a product_id')\n            if 'product_variant_id' not in line:\n                raise KeyError('Each order line must have a product_variant_id')\n            if 'quantity' not in line:\n                raise KeyError('Each order line must have a quantity')\n            if 'price' not in line:\n                raise KeyError('Each order line must have a price')\n        response = self._mc_client._post(url=self._build_path(store_id, 'orders'), data=data)\n        if response is not None:\n            self.order_id = response['id']\n        else:\n            self.order_id = None\n        return response\n\n\n    def all(self, store_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s orders.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['customer_id'] = string\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'orders'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'orders'), **queryparams)\n\n\n    def get(self, store_id, order_id, **queryparams):\n        \"\"\"\n        Get information about a specific order.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        return self._mc_client._get(url=self._build_path(store_id, 'orders', order_id), **queryparams)\n\n\n    def update(self, store_id, order_id, data):\n        \"\"\"\n        Update a specific order.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'orders', order_id), data=data)\n\n\n    def delete(self, store_id, order_id):\n        \"\"\"\n        Delete an order.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param order_id: The id for the order in a store.\n        :type order_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.order_id = order_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'orders', order_id))\n"
  },
  {
    "path": "mailchimp3/entities/storeproductimages.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Product Images API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/products/images/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Products/Images/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass StoreProductImages(BaseApi):\n    \"\"\"\n    A Product Image represents a specific product image.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreProductImages, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.product_id = None\n        self.image_id = None\n\n\n    def create(self, store_id, product_id, data):\n        \"\"\"\n        Add a new image to the product.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"url\": string*\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        if 'id' not in data:\n            raise KeyError('The product image must have an id')\n        if 'title' not in data:\n            raise KeyError('The product image must have a url')\n        response = self._mc_client._post(url=self._build_path(store_id, 'products', product_id, 'images'), data=data)\n        if response is not None:\n            self.image_id = response['id']\n        else:\n            self.image_id = None\n        return response\n\n\n    def all(self, store_id, product_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a product’s images.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.image_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'products', product_id, 'images'), **queryparams)\n        else:\n            return self._mc_client._post(url=self._build_path(store_id, 'products', product_id, 'images'), **queryparams)\n\n\n    def get(self, store_id, product_id, image_id, **queryparams):\n        \"\"\"\n        Get information about a specific product image.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param image_id: The id for the product image.\n        :type image_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.image_id = image_id\n        return self._mc_client._post(\n            url=self._build_path(store_id, 'products', product_id, 'images', image_id),\n            **queryparams\n        )\n\n\n    def update(self, store_id, product_id, image_id, data):\n        \"\"\"\n        Update a product image.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param image_id: The id for the product image.\n        :type image_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.image_id = image_id\n        return self._mc_client._patch(\n            url=self._build_path(store_id, 'products', product_id, 'images', image_id),\n            data=data\n        )\n\n\n    def delete(self, store_id, product_id, image_id):\n        \"\"\"\n        Delete a product image.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param image_id: The id for the product image.\n        :type image_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.image_id = image_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'products', product_id, 'images', image_id))\n"
  },
  {
    "path": "mailchimp3/entities/storeproducts.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Products API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/products/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Products/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.storeproductimages import StoreProductImages\nfrom mailchimp3.entities.storeproductvariants import StoreProductVariants\n\n\nclass StoreProducts(BaseApi):\n    \"\"\"\n    E-commerce items for sale in your store need to be created as Products so\n    you can add the items to a Cart or an Order. Each Product requires at\n    least one Product Variant.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreProducts, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.product_id = None\n        self.images = StoreProductImages(self)\n        self.variants = StoreProductVariants(self)\n\n\n    def create(self, store_id, data):\n        \"\"\"\n        Add a new product to a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"title\": string*,\n            \"variants\": array*\n            [\n                {\n                    \"id\": string*,\n                    \"title\": string*\n                }\n            ]\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The product must have an id')\n        if 'title' not in data:\n            raise KeyError('The product must have a title')\n        if 'variants' not in data:\n            raise KeyError('The product must have at least one variant')\n        for variant in data['variants']:\n            if 'id' not in variant:\n                raise KeyError('Each product variant must have an id')\n            if 'title' not in variant:\n                raise KeyError('Each product variant must have a title')\n        response = self._mc_client._post(url=self._build_path(store_id, 'products'), data=data)\n        if response is not None:\n            self.product_id = response['id']\n        else:\n            self.product_id = None\n        return response\n\n\n    def all(self, store_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s products.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'products'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'products'), **queryparams)\n\n\n    def get(self, store_id, product_id, **queryparams):\n        \"\"\"\n        Get information about a specific product.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        return self._mc_client._get(url=self._build_path(store_id, 'products', product_id), **queryparams)\n\n\n    def update(self, store_id, product_id, data):\n        \"\"\"\n        Update a product.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        return self._mc_client._patch(\n            url=self._build_path(store_id, 'products', product_id),\n            data=data\n        )\n\n\n    def delete(self, store_id, product_id):\n        \"\"\"\n        Delete a product.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'products', product_id))\n"
  },
  {
    "path": "mailchimp3/entities/storeproductvariants.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Store Product Variants API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/products/variants/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Products/Variants/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass StoreProductVariants(BaseApi):\n    \"\"\"\n    A Product Variant represents a specific item for purchase, and is\n    contained within a parent Product. At least one Product Variant is\n    required for each Product.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(StoreProductVariants, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.product_id = None\n        self.variant_id = None\n\n\n    def create(self, store_id, product_id, data):\n        \"\"\"\n        Add a new variant to the product.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"title\": string*\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        if 'id' not in data:\n            raise KeyError('The product variant must have an id')\n        if 'title' not in data:\n            raise KeyError('The product variant must have a title')\n        response = self._mc_client._post(url=self._build_path(store_id, 'products', product_id, 'variants'), data=data)\n        if response is not None:\n            self.variant_id = response['id']\n        else:\n            self.variant_id = None\n        return response\n\n\n    def all(self, store_id, product_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a product’s variants.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.variant_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'products', product_id, 'variants'), **queryparams)\n        else:\n            return self._mc_client._get(\n                url=self._build_path(store_id, 'products', product_id, 'variants'),\n                **queryparams\n            )\n\n\n    def get(self, store_id, product_id, variant_id, **queryparams):\n        \"\"\"\n        Get information about a specific product variant.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param variant_id: The id for the product variant.\n        :type variant_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.variant_id = variant_id\n        return self._mc_client._get(\n            url=self._build_path(store_id, 'products', product_id, 'variants', variant_id),\n            **queryparams\n        )\n\n\n    def update(self, store_id, product_id, variant_id, data):\n        \"\"\"\n        Update a product variant.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param variant_id: The id for the product variant.\n        :type variant_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.variant_id = variant_id\n        return self._mc_client._patch(\n            url=self._build_path(store_id, 'products', product_id, 'variants', variant_id),\n            data=data\n        )\n\n\n    def create_or_update(self, store_id, product_id, variant_id, data):\n        \"\"\"\n        Add or update a product variant.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param variant_id: The id for the product variant.\n        :type variant_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"title\": string*\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.variant_id = variant_id\n        if 'id' not in data:\n             raise KeyError('The product variant must have an id')\n        if 'title' not in data:\n            raise KeyError('The product variant must have a title')\n        return self._mc_client._put(\n            url=self._build_path(store_id, 'products', product_id, 'variants', variant_id),\n            data=data\n        )\n\n\n    def delete(self, store_id, product_id, variant_id):\n        \"\"\"\n        Delete a product variant.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param product_id: The id for the product of a store.\n        :type product_id: :py:class:`str`\n        :param variant_id: The id for the product variant.\n        :type variant_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        self.product_id = product_id\n        self.variant_id = variant_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'products', product_id, 'variants', variant_id))\n"
  },
  {
    "path": "mailchimp3/entities/storepromocodes.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Stores Promo CodesAPI endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/promo-rules\n\"\"\"\nfrom __future__ import unicode_literals\nfrom mailchimp3.baseapi import BaseApi\n\nclass StorePromoCodes(BaseApi):\n    \"\"\"\n        Promo Promo codes can be created for a given promo rule. All the promo codes under a promo rule share the\n        generic information defined for that rule like the amount, type, expiration date etc.\n        \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the Endpoint\n        :param args:\n        :param kwargs:\n        \"\"\"\n        super(StorePromoCodes, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n\n    def create(self, store_id, promo_rule_id, data):\n        \"\"\"\n        Add a new promo code to a store.\n\n        :param store_id: The store id\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict'\n        data = {\n            \"id\": string*,\n            \"code\": string*,\n            \"redemption_url\": string*,\n            \"usage_count\": string,\n            \"enabled\": boolean,\n            \"created_at_foreign\": string,\n            \"updated_at_foreign\": string,\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The promo code must have an id')\n        if 'code' not in data:\n            raise KeyError('This promo code must have a code')\n        if 'redemption_url' not in data:\n            raise KeyError('This promo code must have a redemption url')\n        response = self._mc_client._post(url=self._build_path(store_id, 'promo-rules', promo_rule_id, 'promo-codes'), data=data)\n\n        if response is not None:\n            return response\n\n    def all(self, store_id, promo_rule_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s promo codes.\n\n        :param store_id: The store's id\n        :type store_id: `str`\n        :param promo_rule_id: The store promo rule id\n        :type store_id: `str`\n        :param get_all:\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id=store_id\n        self.promo_rule_id=promo_rule_id\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'promo-rules', promo_rule_id, 'promo-codes'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'promo-rule', promo_rule_id), **queryparams)\n\n    def get(self, store_id, promo_rule_id, promo_code_id, **queryparams):\n        \"\"\"\n                Get information about a specific promo code.\n\n                :param store_id: The store's id\n                :type store_id: `string`\n                :param queryparams: The query string parameters\n                queryparams['fields'] = []\n                queryparams['exclude_fields'] = []\n                queryparams['count'] = integer\n                queryparams['offset'] = integer\n                \"\"\"\n        self.store_id = store_id\n        self.promo_rule_id = promo_rule_id\n        self.promo_code_id = promo_code_id\n        return self._mc_client._get(url=self._build_path(store_id, 'promo-rules', promo_rule_id, 'promo-codes', promo_code_id), **queryparams)\n\n\n    def update(self, store_id, promo_rule_id, promo_code_id, data):\n        \"\"\"\n        Update a promo code\n\n        :param store_id: The store id\n        :type :py:class:`str`\n        :param promo_rule_id: The id for the promo rule of a store.\n        :type :py:class:`str`\n        :param promo_code_id: The id for the promo code of a store.\n        :type :py:class:`str`\n        :param data:\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string,\n            \"title\": string,\n            \"description\": string,\n            \"starts_at\": string,\n            \"ends_at\": string,\n            \"amount\": number,\n            \"type\": string,\n            \"target\": string,\n            \"enabled\": boolean,\n            \"created_at_foreign\": string,\n            \"updated_at_foreign\": string,\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.promo_rule_id = promo_rule_id\n        self.promo_code_id = promo_code_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'promo-rules', promo_rule_id, 'promo-codes', promo_code_id), data=data)\n\n    def delete(self, store_id, promo_rule_id, promo_code_id):\n        \"\"\"\n        Delete a promo code\n        :param store_id: The store id\n        :type :py:class:`str`\n        :param promo_rule_id: The id for the promo rule of a store.\n        :type :py:class:`str`\n        :param promo_code_id: The id for the promo code of a store.\n        :type :py:class:`str`\n        \"\"\"\n        self.store_id=store_id\n        self.promo_rule_id=promo_rule_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'promo-rules', promo_rule_id, 'promo-codes', promo_code_id))"
  },
  {
    "path": "mailchimp3/entities/storepromorules.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Stores Promo Rules API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/promo-rules\n\"\"\"\nfrom __future__ import unicode_literals\nfrom mailchimp3.baseapi import BaseApi\n\nclass StorePromoRules(BaseApi):\n    \"\"\"\n    Promo Rules help you create promo codes for your campaigns. Promo Rules define generic information about promo\n    codes like expiration time, start time, amount of discount being offered etc\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the Endpoint\n        :param args:\n        :param kwargs:\n        \"\"\"\n        super(StorePromoRules, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n\n    def create(self, store_id, data):\n        \"\"\"\n        Add new promo rule to a store\n\n        :param store_id: The store id\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict'\n        data = {\n            \"id\": string*,\n            \"title\": string,\n            \"description\": string*,\n            \"starts_at\": string,\n            \"ends_at\": string,\n            \"amount\": number*,\n            \"type\": string*,\n            \"target\": string*,\n            \"enabled\": boolean,\n            \"created_at_foreign\": string,\n            \"updated_at_foreign\": string,\n        }\n        \"\"\"\n        self.store_id = store_id\n        if 'id' not in data:\n            raise KeyError('The promo rule must have an id')\n        if 'description' not in data:\n            raise KeyError('This promo rule must have a description')\n        if 'amount' not in data:\n            raise KeyError('This promo rule must have an amount')\n        if 'target' not in data:\n            raise KeyError('This promo rule must apply to a target (example per_item, total, or shipping')\n        response = self._mc_client._post(url=self._build_path(store_id, 'promo-rules'), data=data)\n\n        if response is not None:\n            return response\n\n    def all(self, store_id, get_all=False, **queryparams):\n        \"\"\"\n        Get information about a store’s promo rules.\n\n        :param store_id: The store's id\n        :type store_id: `str`\n        :param get_all:\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = store_id\n        if get_all:\n            return self._iterate(url=self._build_path(store_id, 'promo-rules'), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(store_id, 'promo-rules'), **queryparams)\n\n    def get(self, store_id, promo_rule_id, **queryparams):\n        \"\"\"\n                Get information about a specific promo rule.\n\n                :param store_id: The store's id\n                :type store_id: `string`\n                :param queryparams: The query string parameters\n                queryparams['fields'] = []\n                queryparams['exclude_fields'] = []\n                queryparams['count'] = integer\n                queryparams['offset'] = integer\n                \"\"\"\n        self.store_id = store_id\n        self.promo_rule_id = promo_rule_id\n        return self._mc_client._get(url=self._build_path(store_id, 'promo-rules', promo_rule_id), **queryparams)\n\n\n    def update(self, store_id, promo_rule_id, data):\n        \"\"\"\n        Update a promo rule\n\n        :param store_id: The store id\n        :type :py:class:`str`\n        :param promo_rule_id: The id for the promo rule of a store.\n        :type :py:class:`str`\n        :param data:\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string,\n            \"title\": string,\n            \"description\": string,\n            \"starts_at\": string,\n            \"ends_at\": string,\n            \"amount\": number,\n            \"type\": string,\n            \"target\": string,\n            \"enabled\": boolean,\n            \"created_at_foreign\": string,\n            \"updated_at_foreign\": string,\n        }\n        \"\"\"\n        self.store_id = store_id\n        self.promo_rule_id = promo_rule_id\n        return self._mc_client._patch(url=self._build_path(store_id, 'promo-rules', promo_rule_id), data=data)\n\n    def delete(self, store_id, promo_rule_id):\n        \"\"\"\n        Delete a promo rule\n        :param store_id: The store id\n        :type :py:class:`str`\n        :param promo_rule_id: The id for the promo rule of a store.\n        :type :py:class:`str`\n        \"\"\"\n        self.store_id=store_id\n        self.promo_rule_id=promo_rule_id\n        return self._mc_client._delete(url=self._build_path(store_id, 'promo-rules', promo_rule_id))"
  },
  {
    "path": "mailchimp3/entities/stores.py",
    "content": "# coding=utf-8\n\"\"\"\nThe E-commerce Stores API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/\nSchema: https://api.mailchimp.com/schema/3.0/Ecommerce/Stores/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nimport re\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.storecarts import StoreCarts\nfrom mailchimp3.entities.storecustomers import StoreCustomers\nfrom mailchimp3.entities.storeorders import StoreOrders\nfrom mailchimp3.entities.storeproducts import StoreProducts\n\n\nclass Stores(BaseApi):\n    \"\"\"\n    Connect your E-commerce Store to MailChimp to take advantage of powerful\n    reporting and personalization features and to learn more about your\n    customers.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Stores, self).__init__(*args, **kwargs)\n        self.endpoint = 'ecommerce/stores'\n        self.store_id = None\n        self.carts = StoreCarts(self)\n        self.customers = StoreCustomers(self)\n        self.orders = StoreOrders(self)\n        self.products = StoreProducts(self)\n\n    def create(self, data):\n        \"\"\"\n        Add a new store to your MailChimp account.\n\n        Error checking on the currency code verifies that it is in the correct\n        three-letter, all-caps format as specified by ISO 4217 but does not\n        check that it is a valid code as the list of valid codes changes over\n        time.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"id\": string*,\n            \"list_id\": string*,\n            \"name\": string*,\n            \"currency_code\": string*\n        }\n        \"\"\"\n        if 'id' not in data:\n            raise KeyError('The store must have an id')\n        if 'list_id' not in data:\n            raise KeyError('The store must have a list_id')\n        if 'name' not in data:\n            raise KeyError('The store must have a name')\n        if 'currency_code' not in data:\n            raise KeyError('The store must have a currency_code')\n        if not re.match(r\"^[A-Z]{3}$\", data['currency_code']):\n            raise ValueError('The currency_code must be a valid 3-letter ISO 4217 currency code')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.store_id = response['id']\n        else:\n            self.store_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get information about all stores in the account.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.store_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, store_id, **queryparams):\n        \"\"\"\n        Get information about a specific store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.store_id = store_id\n        return self._mc_client._get(url=self._build_path(store_id), **queryparams)\n\n\n    def update(self, store_id, data):\n        \"\"\"\n        Update a store.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        \"\"\"\n        self.store_id = store_id\n        return self._mc_client._patch(url=self._build_path(store_id), data=data)\n\n\n    def delete(self, store_id):\n        \"\"\"\n        Delete a store. Deleting a store will also delete any associated\n        subresources, including Customers, Orders, Products, and Carts.\n\n        :param store_id: The store id.\n        :type store_id: :py:class:`str`\n        \"\"\"\n        self.store_id = store_id\n        return self._mc_client._delete(url=self._build_path(store_id))\n"
  },
  {
    "path": "mailchimp3/entities/templatedefaultcontent.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Template Default Content API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/templates/default-content/\nSchema: https://api.mailchimp.com/schema/3.0/Templates/Defaultcontent/Collection.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass TemplateDefaultContent(BaseApi):\n    \"\"\"\n    Manage the default content for a MailChimp template.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(TemplateDefaultContent, self).__init__(*args, **kwargs)\n        self.endpoint = 'templates'\n        self.template_id = None\n\n\n    def all(self, template_id, **queryparams):\n        \"\"\"\n        Get the sections that you can edit in a template, including each\n        section’s default content.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.template_id = template_id\n        return self._mc_client._get(url=self._build_path(template_id, 'default-content'), **queryparams)\n"
  },
  {
    "path": "mailchimp3/entities/templatefolders.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Template Folders API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/template-folders/\nSchema: https://api.mailchimp.com/schema/3.0/TemplateFolders/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\n\n\nclass TemplateFolders(BaseApi):\n    \"\"\"\n    Organize your templates using folders.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(TemplateFolders, self).__init__(*args, **kwargs)\n        self.endpoint = 'template-folders'\n        self.folder_id = None\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new template folder.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The template folder must have a name')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.folder_id = response['id']\n        else:\n            self.folder_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get all folders used to organize templates.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        \"\"\"\n        self.folder_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, folder_id, **queryparams):\n        \"\"\"\n        Get information about a specific folder used to organize templates.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._get(url=self._build_path(folder_id), **queryparams)\n\n\n    def update(self, folder_id, data):\n        \"\"\"\n        Update a specific folder used to organize templates.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The template folder must have a name')\n        self.folder_id = folder_id\n        return self._mc_client._patch(url=self._build_path(folder_id), data=data)\n\n\n    def delete(self, folder_id):\n        \"\"\"\n        Delete a specific template folder, and mark all the templates in the\n        folder as ‘unfiled’.\n\n        :param folder_id: The unique id for the File Manager folder.\n        :type folder_id: :py:class:`str`\n        \"\"\"\n        self.folder_id = folder_id\n        return self._mc_client._delete(url=self._build_path(folder_id))\n\n\n"
  },
  {
    "path": "mailchimp3/entities/templates.py",
    "content": "# coding=utf-8\n\"\"\"\nThe Templates API endpoint\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/reference/templates/\nSchema: https://api.mailchimp.com/schema/3.0/Templates/Instance.json\n\"\"\"\nfrom __future__ import unicode_literals\n\nfrom mailchimp3.baseapi import BaseApi\nfrom mailchimp3.entities.templatedefaultcontent import TemplateDefaultContent\n\n\nclass Templates(BaseApi):\n    \"\"\"\n    Manage your MailChimp templates. A template is an HTML file used to create\n    the layout and basic design for a campaign.\n    \"\"\"\n    def __init__(self, *args, **kwargs):\n        \"\"\"\n        Initialize the endpoint\n        \"\"\"\n        super(Templates, self).__init__(*args, **kwargs)\n        self.endpoint = 'templates'\n        self.template_id = None\n        self.default_content = TemplateDefaultContent(self)\n\n\n    def create(self, data):\n        \"\"\"\n        Create a new template for the account. Only Classic templates are\n        supported.\n\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"html\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The template must have a name')\n        if 'html' not in data:\n            raise KeyError('The template must have html')\n        response = self._mc_client._post(url=self._build_path(), data=data)\n        if response is not None:\n            self.template_id = response['id']\n        else:\n            self.template_id = None\n        return response\n\n\n    def all(self, get_all=False, **queryparams):\n        \"\"\"\n        Get a list of an account’s available templates.\n\n        :param get_all: Should the query get all results\n        :type get_all: :py:class:`bool`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        queryparams['count'] = integer\n        queryparams['offset'] = integer\n        queryparams['created_by'] = string\n        queryparams['before_created_at'] = string\n        queryparams['since_created_at'] = string\n        queryparams['type'] = string\n        queryparams['folder_id'] = string\n        \"\"\"\n        self.template_id = None\n        if get_all:\n            return self._iterate(url=self._build_path(), **queryparams)\n        else:\n            return self._mc_client._get(url=self._build_path(), **queryparams)\n\n\n    def get(self, template_id, **queryparams):\n        \"\"\"\n        Get information about a specific template.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        :param queryparams: The query string parameters\n        queryparams['fields'] = []\n        queryparams['exclude_fields'] = []\n        \"\"\"\n        self.template_id = template_id\n        return self._mc_client._get(url=self._build_path(template_id), **queryparams)\n\n\n    def update(self, template_id, data):\n        \"\"\"\n        Update the name, HTML, or folder_id of an existing template.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:class:`dict`\n        data = {\n            \"name\": string*,\n            \"html\": string*\n        }\n        \"\"\"\n        if 'name' not in data:\n            raise KeyError('The template must have a name')\n        if 'html' not in data:\n            raise KeyError('The template must have html')\n        self.template_id = template_id\n        return self._mc_client._patch(url=self._build_path(template_id), data=data)\n\n\n    def delete(self, template_id):\n        \"\"\"\n        Delete a specific template.\n\n        :param template_id: The unique id for the template.\n        :type template_id: :py:class:`str`\n        \"\"\"\n        self.template_id = template_id\n        return self._mc_client._delete(url=self._build_path(template_id))\n"
  },
  {
    "path": "mailchimp3/helpers.py",
    "content": "# coding=utf-8\n\"\"\"\nHelper functions to perform simple tasks for multiple areas of the API\n\"\"\"\nimport hashlib\nimport re\n\nHTTP_METHOD_ACTION_MATCHING = {\n    'get': 'GET',\n    'create': 'POST',\n    'update': 'PATCH',\n    'create_or_update': 'PUT',\n    'delete': 'DELETE'\n}\n\n\ndef get_subscriber_hash(member_email):\n    \"\"\"\n    The MD5 hash of the lowercase version of the list member's email.\n    Used as subscriber_hash\n\n    :param member_email: The member's email address\n    :type member_email: :py:class:`str`\n    :returns: The MD5 hash in hex\n    :rtype: :py:class:`str`\n    \"\"\"\n    check_email(member_email)\n    member_email = member_email.lower().encode()\n    m = hashlib.md5(member_email)\n    return m.hexdigest()\n\n\ndef check_subscriber_hash(potential_hash):\n    \"\"\"\n    Check the passed value to see if it matches a 32 character hex number that\n    MD5 generates as output, or compute that value assuming that the input is\n    an email address.\n\n    :param potential_hash: A value to be passed to any of the endpoints that\n    expect an MD5 of an email address\n    :type potential_hash: :py:class:`str`\n    :returns: A valid MD5 hash in hex\n    :rtype: :py:class:`str`\n    \"\"\"\n    if re.match(r\"^[0-9a-f]{32}$\", potential_hash):\n        return potential_hash\n    else:\n        return get_subscriber_hash(potential_hash)\n\n\ndef check_email(email):\n    \"\"\"\n    Function that verifies that the string passed is a valid email address.\n\n    Regex for email validation based on MailChimp limits:\n    http://kb.mailchimp.com/accounts/management/international-characters-in-mailchimp\n\n    :param email: The potential email address\n    :type email: :py:class:`str`\n    :return: Nothing\n    \"\"\"\n    if not re.match(r\".+@.+\\..+\", email):\n        raise ValueError('String passed is not a valid email address')\n    return\n\n\ndef check_url(url):\n    \"\"\"\n    Function that verifies that the string passed is a valid url.\n\n    Original regex author Diego Perini (http://www.iport.it)\n    regex ported to Python by adamrofer (https://github.com/adamrofer)\n    Used under MIT license.\n\n    :param url:\n    :return: Nothing\n    \"\"\"\n    URL_REGEX = re.compile(\n    u\"^\"\n    u\"(?:(?:https?|ftp)://)\"\n    u\"(?:\\\\S+(?::\\\\S*)?@)?\"\n    u\"(?:\"\n    u\"(?!(?:10|127)(?:\\\\.\\\\d{1,3}){3})\"\n    u\"(?!(?:169\\\\.254|192\\\\.168)(?:\\\\.\\\\d{1,3}){2})\"\n    u\"(?!172\\\\.(?:1[6-9]|2\\\\d|3[0-1])(?:\\\\.\\\\d{1,3}){2})\"\n    u\"(?:[1-9]\\\\d?|1\\\\d\\\\d|2[01]\\\\d|22[0-3])\"\n    u\"(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}\"\n    u\"(?:\\\\.(?:[1-9]\\\\d?|1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]))\"\n    u\"|\"\n    u\"(?:(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9]+)\"\n    u\"(?:\\\\.(?:[a-z\\u00a1-\\uffff0-9]-?)*[a-z\\u00a1-\\uffff0-9]+)*\"\n    u\"(?:\\\\.(?:[a-z\\u00a1-\\uffff]{2,}))\"\n    u\")\"\n    u\"(?::\\\\d{2,5})?\"\n    u\"(?:/\\\\S*)?\"\n    u\"$\"\n    , re.UNICODE)\n    if not re.match(URL_REGEX, url):\n        raise ValueError('String passed is not a valid url')\n    return\n\n\ndef merge_results(x, y):\n    \"\"\"\n    Given two dicts, x and y, merge them into a new dict as a shallow copy.\n\n    The result only differs from `x.update(y)` in the way that it handles list\n    values when both x and y have list values for the same key. In which case\n    the returned dictionary, z, has a value according to:\n      z[key] = x[key] + z[key]\n\n    :param x: The first dictionary\n    :type x: :py:class:`dict`\n    :param y: The second dictionary\n    :type y: :py:class:`dict`\n    :returns: The merged dictionary\n    :rtype: :py:class:`dict`\n    \"\"\"\n    z = x.copy()\n    for key, value in y.items():\n        if isinstance(value, list) and isinstance(z.get(key), list):\n            z[key] += value\n        else:\n            z[key] = value\n    return z\n"
  },
  {
    "path": "mailchimp3/mailchimpclient.py",
    "content": "# coding=utf-8\n\"\"\"\nMailchimp v3 Api SDK\n\nDocumentation: http://developer.mailchimp.com/documentation/mailchimp/\n\"\"\"\nfrom __future__ import unicode_literals\nimport functools\nimport re\n\n\nimport requests\nfrom requests.auth import HTTPBasicAuth\n# Handle library reorganisation Python 2 > Python 3.\ntry:\n    from urllib.parse import urljoin\n    from urllib.parse import urlencode\nexcept ImportError:\n    from urlparse import urljoin\n    from urllib import urlencode\n\nimport logging\n\n_logger = logging.getLogger('mailchimp3.client')\n\n\ndef _enabled_or_noop(fn):\n    @functools.wraps(fn)\n    def wrapper(self, *args, **kwargs):\n        if self.enabled:\n            return fn(self, *args, **kwargs)\n    return wrapper\n\n\nclass MailChimpError(Exception):\n    pass\n\n\ndef _raise_response_error(r):\n    \"\"\"\n    Return a MailChimpError to which we pass:\n        - the response object\n        - the response's JSON data if found.\n    \"\"\"\n    error_data = {\"response\": r}\n    try:\n        json_data = r.json()\n    except ValueError:\n        # in case of a 500 error, the response might not be a JSON\n        pass\n    else:\n        error_data.update(json_data)\n    raise MailChimpError(error_data)\n\n\nclass MailChimpClient(object):\n    \"\"\"\n    MailChimp class to communicate with the v3 API\n    \"\"\"\n    def __init__(self, mc_api=None, mc_user='python-mailchimp', access_token=None, enabled=True, timeout=None,\n                 request_hooks=None, request_headers=None):\n        \"\"\"\n        Initialize the class with your optional user_id and required api_key.\n\n        If `enabled` is not True, these methods become no-ops. This is\n        particularly useful for testing or disabling with configuration.\n\n        :param mc_api: Mailchimp API key\n        :type mc_api: :py:class:`str`\n        :param mc_user: Mailchimp user id\n        :type mc_user: :py:class:`str`\n        :param access_token: The OAuth access token\n        :type access_token: :py:class:`str`\n        :param enabled: Whether the API should execute any requests\n        :type enabled: :py:class:`bool`\n        :param timeout: (optional) How long to wait for the server to send\n            data before giving up, as a float, or a :ref:`(connect timeout,\n            read timeout) <timeouts>` tuple.\n        :type timeout: float or tuple\n        :param request_hooks: (optional) Hooks for :py:func:`requests.requests`.\n        :type request_hooks: :py:class:`dict`\n        :param request_headers: (optional) Headers for\n            :py:func:`requests.requests`.\n        :type request_headers: :py:class:`dict`\n        \"\"\"\n        super(MailChimpClient, self).__init__()\n        self.enabled = enabled\n        self.timeout = timeout\n        if access_token:\n            self.auth = MailChimpOAuth(access_token)\n            self.base_url = self.auth.get_base_url() + '/3.0/'\n        elif mc_api:\n            if not re.match(r\"^[0-9a-f]{32}$\", mc_api.split('-')[0]):\n                raise ValueError('The API key that you have entered is not valid, did you enter a username by mistake?\\n'\n                                 'The order of arguments for API key and username has reversed in 2.1.0')\n            self.auth = HTTPBasicAuth(mc_user, mc_api)\n            datacenter = mc_api.split('-').pop()\n            self.base_url = 'https://{0}.api.mailchimp.com/3.0/'.format(datacenter)\n        else:\n            raise Exception('You must provide an OAuth access token or API key')\n        self.request_headers = request_headers or requests.utils.default_headers()\n        self.request_hooks = request_hooks or requests.hooks.default_hooks()\n\n\n    def _make_request(self, **kwargs):\n        _logger.info(u'{method} Request: {url}'.format(**kwargs))\n        if kwargs.get('json'):\n            _logger.info('PAYLOAD: {json}'.format(**kwargs))\n\n        response = requests.request(**kwargs)\n\n        _logger.info(u'{method} Response: {status}'\\\n            .format(method=kwargs['method'], status=response.status_code))\n\n        return response\n\n\n    @_enabled_or_noop\n    def _post(self, url, data=None):\n        \"\"\"\n        Handle authenticated POST requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:data:`none` or :py:class:`dict`\n        :returns: The JSON output from the API or an error message\n        \"\"\"\n        url = urljoin(self.base_url, url)\n        try:\n            r = self._make_request(**dict(\n                method='POST',\n                url=url,\n                json=data,\n                auth=self.auth,\n                timeout=self.timeout,\n                hooks=self.request_hooks,\n                headers=self.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if r.status_code >= 400:\n                _raise_response_error(r)\n\n            if r.status_code == 204:\n                return None\n            return r.json()\n\n\n    @_enabled_or_noop\n    def _get(self, url, **queryparams):\n        \"\"\"\n        Handle authenticated GET requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param queryparams: The query string parameters\n        :returns: The JSON output from the API\n        \"\"\"\n        url = urljoin(self.base_url, url)\n        if len(queryparams):\n            url += '?' + urlencode(queryparams)\n        try:\n            r = self._make_request(**dict(\n                method='GET',\n                url=url,\n                auth=self.auth,\n                timeout=self.timeout,\n                hooks=self.request_hooks,\n                headers=self.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if r.status_code >= 400:\n                _raise_response_error(r)\n            return r.json()\n\n\n    @_enabled_or_noop\n    def _delete(self, url):\n        \"\"\"\n        Handle authenticated DELETE requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :returns: The JSON output from the API\n        \"\"\"\n        url = urljoin(self.base_url, url)\n        try:\n            r = self._make_request(**dict(\n                method='DELETE',\n                url=url,\n                auth=self.auth,\n                timeout=self.timeout,\n                hooks=self.request_hooks,\n                headers=self.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if r.status_code >= 400:\n                _raise_response_error(r)\n            if r.status_code == 204:\n                return\n            return r.json()\n\n\n    @_enabled_or_noop\n    def _patch(self, url, data=None):\n        \"\"\"\n        Handle authenticated PATCH requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:data:`none` or :py:class:`dict`\n        :returns: The JSON output from the API\n        \"\"\"\n        url = urljoin(self.base_url, url)\n        try:\n            r = self._make_request(**dict(\n                method='PATCH',\n                url=url,\n                json=data,\n                auth=self.auth,\n                timeout=self.timeout,\n                hooks=self.request_hooks,\n                headers=self.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if r.status_code >= 400:\n                _raise_response_error(r)\n            return r.json()\n\n\n    @_enabled_or_noop\n    def _put(self, url, data=None):\n        \"\"\"\n        Handle authenticated PUT requests\n\n        :param url: The url for the endpoint including path parameters\n        :type url: :py:class:`str`\n        :param data: The request body parameters\n        :type data: :py:data:`none` or :py:class:`dict`\n        :returns: The JSON output from the API\n        \"\"\"\n        url = urljoin(self.base_url, url)\n        try:\n            r = self._make_request(**dict(\n                method='PUT',\n                url=url,\n                json=data,\n                auth=self.auth,\n                timeout=self.timeout,\n                hooks=self.request_hooks,\n                headers=self.request_headers\n            ))\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            if r.status_code >= 400:\n                _raise_response_error(r)\n            return r.json()\n\n\nclass MailChimpOAuth(requests.auth.AuthBase):\n    \"\"\"\n    Authentication class for authentication with OAuth2. Acquiring an OAuth2\n    for MailChimp can be done by following the instructions in the\n    documentation found at\n    http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-oauth2/\n    \"\"\"\n    def __init__(self, access_token):\n        \"\"\"\n        Initialize the OAuth and save the access token\n\n        :param access_token: The access token provided by OAuth authentication\n        :type access_token: :py:class:`str`\n        \"\"\"\n        self._access_token = access_token\n\n\n    def __call__(self, r):\n        \"\"\"\n        Authorize with the access token provided in __init__\n        \"\"\"\n        r.headers['Authorization'] = 'OAuth ' + self._access_token\n        return r\n\n\n    def get_metadata(self):\n        \"\"\"\n        Get the metadata returned after authentication\n        \"\"\"\n        try:\n            r = requests.get('https://login.mailchimp.com/oauth2/metadata', auth=self)\n        except requests.exceptions.RequestException as e:\n            raise e\n        else:\n            r.raise_for_status()\n            output = r.json()\n            if 'error' in output:\n                raise requests.exceptions.RequestException(output['error'])\n            return output\n\n\n    def get_base_url(self):\n        \"\"\"\n        Get the base_url from the authentication metadata\n        \"\"\"\n        try:\n            return self.get_metadata()['api_endpoint']\n        except requests.exceptions.RequestException:\n            raise\n"
  },
  {
    "path": "setup.cfg",
    "content": "[bdist_wheel]\nuniversal = 1\n"
  },
  {
    "path": "setup.py",
    "content": "#!/usr/bin/env python\nimport os\nfrom setuptools import setup, find_packages\n\n\nREADME = os.path.join(os.path.dirname(__file__), 'README.rst')\n\n# When running tests using tox, README.md is not found\ntry:\n    with open(README) as file:\n        long_description = file.read()\nexcept Exception:\n    long_description = ''\n\n\nsetup(\n    name='mailchimp3',\n    version='3.0.21',\n    description='A python client for v3 of MailChimp API',\n    long_description=long_description,\n    url='https://github.com/charlesthk/python-mailchimp',\n    author='Charles TISSIER',\n    author_email='charles@vingtcinq.io',\n    license='MIT',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'Topic :: Software Development :: Libraries :: Python Modules',\n        'License :: OSI Approved :: MIT License',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.1',\n        'Programming Language :: Python :: 3.2',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Programming Language :: Python :: 3.9',\n        'Programming Language :: Python :: 3.10',\n        'Programming Language :: Python :: 3.11',\n    ],\n    keywords='mailchimp api v3 client wrapper',\n    packages=find_packages(),\n    install_requires=['requests>=2.7.0'],\n    # test_suite='tests',\n)\n"
  },
  {
    "path": "test.py",
    "content": "# coding=utf-8\n\"\"\"\nSome basic tests to verify that the wrapper is working\n\"\"\"\nfrom mailchimp3 import MailChimp\n\n\nclient = MailChimp('MAILCHIMP_USER', 'MAILCHIMP_SECRET')\n\nprint client.lists.all(fields=\"lists.name,lists.id\")\n\nprint client.authorized_apps.all(get_all=False)\n\nprint client.automations.all(get_all=True)\n"
  }
]