Showing preview only (904K chars total). Download the full file or copy to clipboard to get everything.
Repository: mailchimp/mailchimp-marketing-node
Branch: master
Commit: 7c1edd292e2d
Files: 36
Total size: 877.0 KB
Directory structure:
gitextract_oj9b8vdw/
├── .github/
│ └── PULL_REQUEST_TEMPLATE.md
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── git_push.sh
├── package.json
└── src/
├── ApiClient.js
├── api/
│ ├── AccountExportApi.js
│ ├── AccountExportsApi.js
│ ├── ActivityFeedApi.js
│ ├── AuthorizedAppsApi.js
│ ├── AutomationsApi.js
│ ├── BatchWebhooksApi.js
│ ├── BatchesApi.js
│ ├── CampaignFoldersApi.js
│ ├── CampaignsApi.js
│ ├── ConnectedSitesApi.js
│ ├── ConversationsApi.js
│ ├── CustomerJourneysApi.js
│ ├── EcommerceApi.js
│ ├── FacebookAdsApi.js
│ ├── FileManagerApi.js
│ ├── LandingPagesApi.js
│ ├── ListsApi.js
│ ├── PingApi.js
│ ├── ReportingApi.js
│ ├── ReportsApi.js
│ ├── RootApi.js
│ ├── SearchCampaignsApi.js
│ ├── SearchMembersApi.js
│ ├── SurveysApi.js
│ ├── TemplateFoldersApi.js
│ ├── TemplatesApi.js
│ └── VerifiedDomainsApi.js
└── index.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/PULL_REQUEST_TEMPLATE.md
================================================
Note: This repository is auto-generated, and does not accept pull requests.
To make changes or open issues for this SDK, use the [code generation repository](https://github.com/mailchimp/mailchimp-client-lib-codegen).
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- "6"
- "6.1"
- "5"
- "5.11"
================================================
FILE: CHANGELOG.md
================================================
# Changelog
## Transactional
### 1.0.48
* Allowing users to schedule messages (using messages/send, messages/send-template, messages/send-raw and messages/reschedule APIs) within a year from the date of scheduling.
### 1.0.46
* Added a little more granularity to the `set_timeout` method to the Client class in the Ruby SDK; now supports `read`, `write` and `connect` parameters, which will default to the `timeout` param if unspecified, or 300 seconds if `timeout` is unspecified.
### 1.0.45
* Added a `set_timeout` method to the Client class in the Ruby SDK
### 1.0.44
* Added a `set_timeout` method to the Client class in the Python SDK
### 1.0.43
* Added a `setTimeout` method to the Configuration class in the PHP SDK.
### 1.0.42
* Added a `setDefaultTimeoutMs` method to the node client. This allows users to override the default timeout for API requests, which is set to 5 minutes by default.
### 1.0.41
* Updated the "reject_reasons" response for /messages/send and /messages/send-template to correctly use "hard-bounce" and "soft-bounce" instead of the previously stated "hard_bounce" and "soft_bounce".
### 1.0.40
* Added the new /allowlists/ series of endpoints and the /exports/allowlist endpoint to the API reference
### 1.0.39
* Fixes the output directory for the Changelog for the php client library
### 1.0.38
* A change was made to `mailchimp-transactional-php` - the API client will now always return an `Exception`, instead of an `Exception` or a string, when the API returns an error. Having to parse the response as a string was found to be a bit clunky.
### 1.0.37
* Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
## Marketing
### 3.0.72
* Updated the `PATCH /automations/.../emails/.../` documentation to state the required `workflow_type`
### 3.0.70
* Added more granularity for the `timeout` field in the Ruby Marketing SDK; now supports `read_timeout`, `write_timeout` and `connect_timeout` fields which will default to the `timeout` value.
### 3.0.69
* Added handling for a `timeout` field in the config block passed to the client constructor in the Ruby Marketing SDK.
### 3.0.68
* Added handling for a `'timeout'` field in `set_config()` in the Python Marketing SDK.
### 3.0.67
* Added a `setTimeout()` method to the configuration class in the PHP Marketing SDK, to allow manually setting the timeout for Guzzle requests.
### 3.0.65
* Added a new API endpoint, `/3.0/account-exports`, allowing users to programatically export their account information
### 3.0.64
* Fixes the output directory for the Changelog for the php client library
### 3.0.63
* Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
================================================
FILE: LICENSE
================================================
Mailchimp Client Library License Agreement
IMPORTANT- PLEASE READ CAREFULLY BEFORE OPENING, INSTALLING, COPYING OR USING THE CLIENT LIBRARY. This Client Library License Agreement (“Agreement”) is a legal document by and between you (hereinafter referred to as “You” “Your” or “Licensee”) and The Rocket Science Group LLC (“Mailchimp”) (each a “Party” and collectively, “Parties”) for the client library, including any upgrades, modified versions, updates, additions, and copies of the foregoing, including the software and related documentation (the “Mailchimp Client Library”).
BY OPENING, INSTALLING, COPYING OR USING THE MAILCHIMP CLIENT LIBRARY OR ANY PORTION THEREOF, YOU AGREE TO ALL THE TERMS OF THIS AGREEMENT. IF YOU ARE AGREEING TO THIS AGREEMENT AS AN INDIVIDUAL, “YOU” “YOUR” AND “LICENSEE” REFERS TO YOU INDIVIDUALLY. IF YOU ARE AGREEING TO THIS AGREEMENT AS A REPRESENTATIVE OF A LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND THAT ENTITY AND “YOU” “YOUR” AND “LICENSEE” REFERS TO THAT LEGAL ENTITY AND ALL THE USERS ACCESSING THE SOFTWARE BY, THROUGH OR ON BEHALF OF THAT LEGAL ENTITY. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO NOT (AND ENSURE THAT YOUR END USERS DO NOT) OPEN, INSTALL, COPY OR USE THE MAILCHIMP CLIENT LIBRARY.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
“License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 10 of these Terms and Conditions for Use, Reproduction and Distribution.
“Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
“You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
“Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
“Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
“Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
“Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
“Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Mailchimp for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to Mailchimp or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Mailchimp for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
“Contributor” shall mean Mailchimp and any individual or Legal Entity on behalf of whom a Contribution has been received by Mailchimp and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
b) You must cause any modified files to carry prominent notices stating that You changed the files; and
c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
d) If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Any Contribution submitted for inclusion in the Work by You to Mailchimp shall be made under the terms and conditions of the Individual Contributor License Agreement or the Software Grant and Corporate Contributor License Agreement, as applicable.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of Mailchimp, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Export controls. The Mailchimp Client Library is subject to united states export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the Mailchimp Client Library. These laws include restrictions on destinations, end-users and end use.
8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
Copyright 2020, The Rocket Science Group LLC
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
You should include a copy of the License, typically in a file called LICENSE, in your work, and consider also including a NOTICE file.
To apply the License to specific files in your work, attach the following boilerplate declaration, with the fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Mailchimp Client Library License Agreement (the “License”); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either or express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
<p align="center">
<a href="https://mailchimp.com/developer/">
<img src="https://raw.githubusercontent.com/mailchimp/mailchimp-client-lib-codegen/main/resources/images/mcdev-banner.png" alt="Mailchimp Developer" width="100%" height="auto">
</a>
</p>
# Mailchimp Marketing – Node.js
The official Node.js client library for the Mailchimp Marketing API
## Installation
```
npm install @mailchimp/mailchimp_marketing
```
## Quick Start
```javascript
const mailchimp = require('@mailchimp/mailchimp_marketing');
mailchimp.setConfig({
apiKey: 'YOUR_API_KEY',
server: 'YOUR_SERVER_PREFIX',
});
async function callPing() {
const response = await mailchimp.ping.get();
console.log(response);
}
callPing();
```
## Authentication Methods
The client library can be configured to use either **Basic Auth** or **OAuth2**.
For either method, a server prefix should be passed in i.e. `us19`, in order for the client to determine to appropriate host url.
### Basic Auth
```javascript
mailchimp.setConfig({
apiKey: 'YOUR_API_KEY',
server: 'YOUR_SERVER_PREFIX',
});
```
### OAuth2
```javascript
mailchimp.setConfig({
accessToken: 'YOUR_ACCESS_TOKEN',
server: 'YOUR_SERVER_PREFIX',
});
```
## PRs and Issues
This repo is autogenerated from https://github.com/mailchimp/mailchimp-client-lib-codegen -- please submit PRs or issues there!
## API Endpoints
All URIs are relative to *https://server.api.mailchimp.com/3.0*
| Method | Endpoint |
| ---------- | -------- |
| **accountExport.getAccountExports** | /account-exports/{export_id} |
| **accountExports.listAccountExports** | /account-exports |
| **accountExports.createAccountExport** | /account-exports |
| **activityFeed.getChimpChatter** | /activity-feed/chimp-chatter |
| **authorizedApps.list** | /authorized-apps |
| **authorizedApps.get** | /authorized-apps/{app_id} |
| **automations.archive** | /automations/{workflow_id}/actions/archive |
| **automations.deleteWorkflowEmail** | /automations/{workflow_id}/emails/{workflow_email_id} |
| **automations.list** | /automations |
| **automations.get** | /automations/{workflow_id} |
| **automations.listAllWorkflowEmails** | /automations/{workflow_id}/emails |
| **automations.getWorkflowEmail** | /automations/{workflow_id}/emails/{workflow_email_id} |
| **automations.getWorkflowEmailSubscriberQueue** | /automations/{workflow_id}/emails/{workflow_email_id}/queue |
| **automations.getWorkflowEmailSubscriber** | /automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash} |
| **automations.listWorkflowEmailSubscribersRemoved** | /automations/{workflow_id}/removed-subscribers |
| **automations.getRemovedWorkflowEmailSubscriber** | /automations/{workflow_id}/removed-subscribers/{subscriber_hash} |
| **automations.updateWorkflowEmail** | /automations/{workflow_id}/emails/{workflow_email_id} |
| **automations.create** | /automations |
| **automations.pauseAllEmails** | /automations/{workflow_id}/actions/pause-all-emails |
| **automations.startAllEmails** | /automations/{workflow_id}/actions/start-all-emails |
| **automations.pauseWorkflowEmail** | /automations/{workflow_id}/emails/{workflow_email_id}/actions/pause |
| **automations.startWorkflowEmail** | /automations/{workflow_id}/emails/{workflow_email_id}/actions/start |
| **automations.addWorkflowEmailSubscriber** | /automations/{workflow_id}/emails/{workflow_email_id}/queue |
| **automations.removeWorkflowEmailSubscriber** | /automations/{workflow_id}/removed-subscribers |
| **batchWebhooks.remove** | /batch-webhooks/{batch_webhook_id} |
| **batchWebhooks.get** | /batch-webhooks/{batch_webhook_id} |
| **batchWebhooks.list** | /batch-webhooks |
| **batchWebhooks.update** | /batch-webhooks/{batch_webhook_id} |
| **batchWebhooks.create** | /batch-webhooks |
| **batches.deleteRequest** | /batches/{batch_id} |
| **batches.list** | /batches |
| **batches.status** | /batches/{batch_id} |
| **batches.start** | /batches |
| **campaignFolders.remove** | /campaign-folders/{folder_id} |
| **campaignFolders.list** | /campaign-folders |
| **campaignFolders.get** | /campaign-folders/{folder_id} |
| **campaignFolders.update** | /campaign-folders/{folder_id} |
| **campaignFolders.create** | /campaign-folders |
| **campaigns.remove** | /campaigns/{campaign_id} |
| **campaigns.deleteFeedbackMessage** | /campaigns/{campaign_id}/feedback/{feedback_id} |
| **campaigns.list** | /campaigns |
| **campaigns.get** | /campaigns/{campaign_id} |
| **campaigns.getContent** | /campaigns/{campaign_id}/content |
| **campaigns.getFeedback** | /campaigns/{campaign_id}/feedback |
| **campaigns.getFeedbackMessage** | /campaigns/{campaign_id}/feedback/{feedback_id} |
| **campaigns.getSendChecklist** | /campaigns/{campaign_id}/send-checklist |
| **campaigns.update** | /campaigns/{campaign_id} |
| **campaigns.updateFeedbackMessage** | /campaigns/{campaign_id}/feedback/{feedback_id} |
| **campaigns.create** | /campaigns |
| **campaigns.cancelSend** | /campaigns/{campaign_id}/actions/cancel-send |
| **campaigns.createResend** | /campaigns/{campaign_id}/actions/create-resend |
| **campaigns.pause** | /campaigns/{campaign_id}/actions/pause |
| **campaigns.replicate** | /campaigns/{campaign_id}/actions/replicate |
| **campaigns.resume** | /campaigns/{campaign_id}/actions/resume |
| **campaigns.schedule** | /campaigns/{campaign_id}/actions/schedule |
| **campaigns.send** | /campaigns/{campaign_id}/actions/send |
| **campaigns.sendTestEmail** | /campaigns/{campaign_id}/actions/test |
| **campaigns.unschedule** | /campaigns/{campaign_id}/actions/unschedule |
| **campaigns.addFeedback** | /campaigns/{campaign_id}/feedback |
| **campaigns.setContent** | /campaigns/{campaign_id}/content |
| **connectedSites.remove** | /connected-sites/{connected_site_id} |
| **connectedSites.list** | /connected-sites |
| **connectedSites.get** | /connected-sites/{connected_site_id} |
| **connectedSites.create** | /connected-sites |
| **connectedSites.verifyScriptInstallation** | /connected-sites/{connected_site_id}/actions/verify-script-installation |
| **conversations.list** | /conversations |
| **conversations.get** | /conversations/{conversation_id} |
| **conversations.getConversationMessages** | /conversations/{conversation_id}/messages |
| **conversations.getConversationMessage** | /conversations/{conversation_id}/messages/{message_id} |
| **customerJourneys.trigger** | /customer-journeys/journeys/{journey_id}/steps/{step_id}/actions/trigger |
| **ecommerce.deleteStore** | /ecommerce/stores/{store_id} |
| **ecommerce.deleteStoreCart** | /ecommerce/stores/{store_id}/carts/{cart_id} |
| **ecommerce.deleteCartLineItem** | /ecommerce/stores/{store_id}/carts/{cart_id}/lines/{line_id} |
| **ecommerce.deleteStoreCustomer** | /ecommerce/stores/{store_id}/customers/{customer_id} |
| **ecommerce.deleteOrder** | /ecommerce/stores/{store_id}/orders/{order_id} |
| **ecommerce.deleteOrderLineItem** | /ecommerce/stores/{store_id}/orders/{order_id}/lines/{line_id} |
| **ecommerce.deleteStoreProduct** | /ecommerce/stores/{store_id}/products/{product_id} |
| **ecommerce.deleteProductImage** | /ecommerce/stores/{store_id}/products/{product_id}/images/{image_id} |
| **ecommerce.deleteProductVariant** | /ecommerce/stores/{store_id}/products/{product_id}/variants/{variant_id} |
| **ecommerce.deletePromoCode** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes/{promo_code_id} |
| **ecommerce.deletePromoRule** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id} |
| **ecommerce.orders** | /ecommerce/orders |
| **ecommerce.stores** | /ecommerce/stores |
| **ecommerce.getStore** | /ecommerce/stores/{store_id} |
| **ecommerce.getStoreCarts** | /ecommerce/stores/{store_id}/carts |
| **ecommerce.getStoreCart** | /ecommerce/stores/{store_id}/carts/{cart_id} |
| **ecommerce.getAllCartLineItems** | /ecommerce/stores/{store_id}/carts/{cart_id}/lines |
| **ecommerce.getCartLineItem** | /ecommerce/stores/{store_id}/carts/{cart_id}/lines/{line_id} |
| **ecommerce.getAllStoreCustomers** | /ecommerce/stores/{store_id}/customers |
| **ecommerce.getStoreCustomer** | /ecommerce/stores/{store_id}/customers/{customer_id} |
| **ecommerce.getStoreOrders** | /ecommerce/stores/{store_id}/orders |
| **ecommerce.getOrder** | /ecommerce/stores/{store_id}/orders/{order_id} |
| **ecommerce.getAllOrderLineItems** | /ecommerce/stores/{store_id}/orders/{order_id}/lines |
| **ecommerce.getOrderLineItem** | /ecommerce/stores/{store_id}/orders/{order_id}/lines/{line_id} |
| **ecommerce.getAllStoreProducts** | /ecommerce/stores/{store_id}/products |
| **ecommerce.getStoreProduct** | /ecommerce/stores/{store_id}/products/{product_id} |
| **ecommerce.getProductImages** | /ecommerce/stores/{store_id}/products/{product_id}/images |
| **ecommerce.getProductImage** | /ecommerce/stores/{store_id}/products/{product_id}/images/{image_id} |
| **ecommerce.getProductVariants** | /ecommerce/stores/{store_id}/products/{product_id}/variants |
| **ecommerce.getProductVariant** | /ecommerce/stores/{store_id}/products/{product_id}/variants/{variant_id} |
| **ecommerce.getPromoCodes** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes |
| **ecommerce.getPromoCode** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes/{promo_code_id} |
| **ecommerce.listPromoRules** | /ecommerce/stores/{store_id}/promo-rules |
| **ecommerce.getPromoRule** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id} |
| **ecommerce.updateStore** | /ecommerce/stores/{store_id} |
| **ecommerce.updateStoreCart** | /ecommerce/stores/{store_id}/carts/{cart_id} |
| **ecommerce.updateCartLineItem** | /ecommerce/stores/{store_id}/carts/{cart_id}/lines/{line_id} |
| **ecommerce.updateStoreCustomer** | /ecommerce/stores/{store_id}/customers/{customer_id} |
| **ecommerce.updateOrder** | /ecommerce/stores/{store_id}/orders/{order_id} |
| **ecommerce.updateOrderLineItem** | /ecommerce/stores/{store_id}/orders/{order_id}/lines/{line_id} |
| **ecommerce.updateStoreProduct** | /ecommerce/stores/{store_id}/products/{product_id} |
| **ecommerce.updateProductImage** | /ecommerce/stores/{store_id}/products/{product_id}/images/{image_id} |
| **ecommerce.updateProductVariant** | /ecommerce/stores/{store_id}/products/{product_id}/variants/{variant_id} |
| **ecommerce.updatePromoCode** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes/{promo_code_id} |
| **ecommerce.updatePromoRule** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id} |
| **ecommerce.addStore** | /ecommerce/stores |
| **ecommerce.addStoreCart** | /ecommerce/stores/{store_id}/carts |
| **ecommerce.addCartLineItem** | /ecommerce/stores/{store_id}/carts/{cart_id}/lines |
| **ecommerce.addStoreCustomer** | /ecommerce/stores/{store_id}/customers |
| **ecommerce.addStoreOrder** | /ecommerce/stores/{store_id}/orders |
| **ecommerce.addOrderLineItem** | /ecommerce/stores/{store_id}/orders/{order_id}/lines |
| **ecommerce.addStoreProduct** | /ecommerce/stores/{store_id}/products |
| **ecommerce.addProductImage** | /ecommerce/stores/{store_id}/products/{product_id}/images |
| **ecommerce.addProductVariants** | /ecommerce/stores/{store_id}/products/{product_id}/variants |
| **ecommerce.addPromoCode** | /ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes |
| **ecommerce.addPromoRules** | /ecommerce/stores/{store_id}/promo-rules |
| **ecommerce.setStoreCustomer** | /ecommerce/stores/{store_id}/customers/{customer_id} |
| **ecommerce.addProductVariant** | /ecommerce/stores/{store_id}/products/{product_id}/variants/{variant_id} |
| **facebookAds.list** | /facebook-ads |
| **facebookAds.getAd** | /facebook-ads/{outreach_id} |
| **fileManager.deleteFile** | /file-manager/files/{file_id} |
| **fileManager.deleteFolder** | /file-manager/folders/{folder_id} |
| **fileManager.files** | /file-manager/files |
| **fileManager.getFile** | /file-manager/files/{file_id} |
| **fileManager.listFolders** | /file-manager/folders |
| **fileManager.getFolder** | /file-manager/folders/{folder_id} |
| **fileManager.updateFile** | /file-manager/files/{file_id} |
| **fileManager.updateFolder** | /file-manager/folders/{folder_id} |
| **fileManager.upload** | /file-manager/files |
| **fileManager.createFolder** | /file-manager/folders |
| **landingPages.deletePage** | /landing-pages/{page_id} |
| **landingPages.getAll** | /landing-pages |
| **landingPages.getPage** | /landing-pages/{page_id} |
| **landingPages.getPageContent** | /landing-pages/{page_id}/content |
| **landingPages.updatePage** | /landing-pages/{page_id} |
| **landingPages.create** | /landing-pages |
| **landingPages.publishPage** | /landing-pages/{page_id}/actions/publish |
| **landingPages.unpublishPage** | /landing-pages/{page_id}/actions/unpublish |
| **lists.deleteList** | /lists/{list_id} |
| **lists.deleteInterestCategory** | /lists/{list_id}/interest-categories/{interest_category_id} |
| **lists.deleteInterestCategoryInterest** | /lists/{list_id}/interest-categories/{interest_category_id}/interests/{interest_id} |
| **lists.deleteListMember** | /lists/{list_id}/members/{subscriber_hash} |
| **lists.deleteListMemberNote** | /lists/{list_id}/members/{subscriber_hash}/notes/{note_id} |
| **lists.deleteListMergeField** | /lists/{list_id}/merge-fields/{merge_id} |
| **lists.deleteSegment** | /lists/{list_id}/segments/{segment_id} |
| **lists.removeSegmentMember** | /lists/{list_id}/segments/{segment_id}/members/{subscriber_hash} |
| **lists.deleteListWebhook** | /lists/{list_id}/webhooks/{webhook_id} |
| **lists.getListMemberTags** | /lists/{list_id}/members/{subscriber_hash}/tags |
| **lists.getAllLists** | /lists |
| **lists.getList** | /lists/{list_id} |
| **lists.getListAbuseReports** | /lists/{list_id}/abuse-reports |
| **lists.getListAbuseReportDetails** | /lists/{list_id}/abuse-reports/{report_id} |
| **lists.getListRecentActivity** | /lists/{list_id}/activity |
| **lists.getListClients** | /lists/{list_id}/clients |
| **lists.getListGrowthHistory** | /lists/{list_id}/growth-history |
| **lists.getListGrowthHistoryByMonth** | /lists/{list_id}/growth-history/{month} |
| **lists.getListInterestCategories** | /lists/{list_id}/interest-categories |
| **lists.getInterestCategory** | /lists/{list_id}/interest-categories/{interest_category_id} |
| **lists.listInterestCategoryInterests** | /lists/{list_id}/interest-categories/{interest_category_id}/interests |
| **lists.getInterestCategoryInterest** | /lists/{list_id}/interest-categories/{interest_category_id}/interests/{interest_id} |
| **lists.getListLocations** | /lists/{list_id}/locations |
| **lists.getListMembersInfo** | /lists/{list_id}/members |
| **lists.getListMember** | /lists/{list_id}/members/{subscriber_hash} |
| **lists.getListMemberActivity** | /lists/{list_id}/members/{subscriber_hash}/activity |
| **lists.getListMemberActivityFeed** | /lists/{list_id}/members/{subscriber_hash}/activity-feed |
| **lists.getListMemberEvents** | /lists/{list_id}/members/{subscriber_hash}/events |
| **lists.getListMemberGoals** | /lists/{list_id}/members/{subscriber_hash}/goals |
| **lists.getListMemberNotes** | /lists/{list_id}/members/{subscriber_hash}/notes |
| **lists.getListMemberNote** | /lists/{list_id}/members/{subscriber_hash}/notes/{note_id} |
| **lists.getListMergeFields** | /lists/{list_id}/merge-fields |
| **lists.getListMergeField** | /lists/{list_id}/merge-fields/{merge_id} |
| **lists.getSegment** | /lists/{list_id}/segments/{segment_id} |
| **lists.getSegmentMembersList** | /lists/{list_id}/segments/{segment_id}/members |
| **lists.getListSignupForms** | /lists/{list_id}/signup-forms |
| **lists.getAllSurveysForList** | /lists/{list_id}/surveys |
| **lists.getSurvey** | /lists/{list_id}/surveys/{survey_id} |
| **lists.getListWebhooks** | /lists/{list_id}/webhooks |
| **lists.getListWebhook** | /lists/{list_id}/webhooks/{webhook_id} |
| **lists.updateList** | /lists/{list_id} |
| **lists.updateInterestCategory** | /lists/{list_id}/interest-categories/{interest_category_id} |
| **lists.updateInterestCategoryInterest** | /lists/{list_id}/interest-categories/{interest_category_id}/interests/{interest_id} |
| **lists.updateListMember** | /lists/{list_id}/members/{subscriber_hash} |
| **lists.updateListMemberNote** | /lists/{list_id}/members/{subscriber_hash}/notes/{note_id} |
| **lists.updateListMergeField** | /lists/{list_id}/merge-fields/{merge_id} |
| **lists.updateSegment** | /lists/{list_id}/segments/{segment_id} |
| **lists.updateListWebhook** | /lists/{list_id}/webhooks/{webhook_id} |
| **lists.createListMemberEvent** | /lists/{list_id}/members/{subscriber_hash}/events |
| **lists.updateListMemberTags** | /lists/{list_id}/members/{subscriber_hash}/tags |
| **lists.createList** | /lists |
| **lists.batchListMembers** | /lists/{list_id} |
| **lists.createListInterestCategory** | /lists/{list_id}/interest-categories |
| **lists.createInterestCategoryInterest** | /lists/{list_id}/interest-categories/{interest_category_id}/interests |
| **lists.addListMember** | /lists/{list_id}/members |
| **lists.deleteListMemberPermanent** | /lists/{list_id}/members/{subscriber_hash}/actions/delete-permanent |
| **lists.createListMemberNote** | /lists/{list_id}/members/{subscriber_hash}/notes |
| **lists.addListMergeField** | /lists/{list_id}/merge-fields |
| **lists.createSegment** | /lists/{list_id}/segments |
| **lists.batchSegmentMembers** | /lists/{list_id}/segments/{segment_id} |
| **lists.createSegmentMember** | /lists/{list_id}/segments/{segment_id}/members |
| **lists.updateListSignupForm** | /lists/{list_id}/signup-forms |
| **lists.createListWebhook** | /lists/{list_id}/webhooks |
| **lists.listSegments** | /lists/{list_id}/segments |
| **lists.setListMember** | /lists/{list_id}/members/{subscriber_hash} |
| **lists.tagSearch** | /lists/{list_id}/tag-search |
| **ping.get** | /ping |
| **reporting.getFacebookAdsReportAll** | /reporting/facebook-ads |
| **reporting.getFacebookAdReport** | /reporting/facebook-ads/{outreach_id} |
| **reporting.getFacebookAdProductActivityReport** | /reporting/facebook-ads/{outreach_id}/ecommerce-product-activity |
| **reporting.getLandingPageReportsAll** | /reporting/landing-pages |
| **reporting.getLandingPageReport** | /reporting/landing-pages/{outreach_id} |
| **reporting.getSurveyReportsAll** | /reporting/surveys |
| **reporting.getSurveyReport** | /reporting/surveys/{outreach_id} |
| **reporting.getSurveyQuestionReportsAll** | /reporting/surveys/{outreach_id}/questions |
| **reporting.getSurveyQuestionReport** | /reporting/surveys/{outreach_id}/questions/{question_id} |
| **reporting.getSurveyQuestionAnswers** | /reporting/surveys/{outreach_id}/questions/{question_id}/answers |
| **reporting.getSurveyResponsesAll** | /reporting/surveys/{outreach_id}/responses |
| **reporting.getSurveyResponse** | /reporting/surveys/{outreach_id}/responses/{response_id} |
| **reports.getAllCampaignReports** | /reports |
| **reports.getCampaignReport** | /reports/{campaign_id} |
| **reports.getCampaignAbuseReports** | /reports/{campaign_id}/abuse-reports |
| **reports.getCampaignAbuseReport** | /reports/{campaign_id}/abuse-reports/{report_id} |
| **reports.getCampaignAdvice** | /reports/{campaign_id}/advice |
| **reports.getCampaignClickDetails** | /reports/{campaign_id}/click-details |
| **reports.getCampaignClickDetailsForLink** | /reports/{campaign_id}/click-details/{link_id} |
| **reports.getSubscribersInfo** | /reports/{campaign_id}/click-details/{link_id}/members |
| **reports.getSubscriberInfo** | /reports/{campaign_id}/click-details/{link_id}/members/{subscriber_hash} |
| **reports.getDomainPerformanceForCampaign** | /reports/{campaign_id}/domain-performance |
| **reports.getEcommerceProductActivityForCampaign** | /reports/{campaign_id}/ecommerce-product-activity |
| **reports.getEepurlActivityForCampaign** | /reports/{campaign_id}/eepurl |
| **reports.getEmailActivityForCampaign** | /reports/{campaign_id}/email-activity |
| **reports.getEmailActivityForSubscriber** | /reports/{campaign_id}/email-activity/{subscriber_hash} |
| **reports.getLocationsForCampaign** | /reports/{campaign_id}/locations |
| **reports.getCampaignOpenDetails** | /reports/{campaign_id}/open-details |
| **reports.getSubscriberInfoForOpenedCampaign** | /reports/{campaign_id}/open-details/{subscriber_hash} |
| **reports.getCampaignRecipients** | /reports/{campaign_id}/sent-to |
| **reports.getCampaignRecipient** | /reports/{campaign_id}/sent-to/{subscriber_hash} |
| **reports.getSubReportsForCampaign** | /reports/{campaign_id}/sub-reports |
| **reports.getUnsubscribedListForCampaign** | /reports/{campaign_id}/unsubscribed |
| **reports.getUnsubscribedListMember** | /reports/{campaign_id}/unsubscribed/{subscriber_hash} |
| **root.getRoot** | / |
| **searchCampaigns.search** | /search-campaigns |
| **searchMembers.search** | /search-members |
| **Surveys.publishSurvey** | /lists/{list_id}/surveys/{survey_id}/actions/publish |
| **Surveys.unpublishSurvey** | /lists/{list_id}/surveys/{survey_id}/actions/unpublish |
| **templateFolders.remove** | /template-folders/{folder_id} |
| **templateFolders.list** | /template-folders |
| **templateFolders.get** | /template-folders/{folder_id} |
| **templateFolders.update** | /template-folders/{folder_id} |
| **templateFolders.create** | /template-folders |
| **templates.deleteTemplate** | /templates/{template_id} |
| **templates.list** | /templates |
| **templates.getTemplate** | /templates/{template_id} |
| **templates.getDefaultContentForTemplate** | /templates/{template_id}/default-content |
| **templates.updateTemplate** | /templates/{template_id} |
| **templates.create** | /templates |
| **verifiedDomains.createVerifiedDomain** | /verified-domains |
| **verifiedDomains.deleteDomain** | /verified-domains/{domain_name} |
| **verifiedDomains.getDomain** | /verified-domains/{domain_name} |
| **verifiedDomains.getVerifiedDomainsAll** | /verified-domains |
| **verifiedDomains.submitDomainVerification** | /verified-domains/{domain_name}/actions/verify |
## Additional Libraries
Mailchimp Marketing libraries are available in the following languages:
<div>
<a href="https://github.com/mailchimp/mailchimp-marketing-node">
<img src="https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/resources/images/lang_node.png?raw=true" width="44" height="44">
</a>
<a href="https://github.com/mailchimp/mailchimp-marketing-php">
<img src="https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/resources/images/lang_php.png?raw=true" width="44" height="44">
</a>
<a href="https://github.com/mailchimp/mailchimp-marketing-ruby">
<img src="https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/resources/images/lang_ruby.png?raw=true" width="44" height="44">
</a>
<a href="https://github.com/mailchimp/mailchimp-marketing-python">
<img src="https://github.com/mailchimp/mailchimp-client-lib-codegen/blob/main/resources/images/lang_python.png?raw=true" width="44" height="44">
</a>
</div>
================================================
FILE: git_push.sh
================================================
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'
================================================
FILE: package.json
================================================
{
"name": "@mailchimp/mailchimp_marketing",
"version": "3.0.80",
"description": "The official Node client library for the Mailchimp Marketing API",
"license": "Apache 2.0",
"main": "src/index.js",
"scripts": {
"test": "jest --setupFiles dotenv/config"
},
"browser": {
"fs": false
},
"dependencies": {
"superagent": "3.8.1",
"dotenv": "^8.2.0"
},
"devDependencies": {
"mocha": "~2.3.4",
"sinon": "1.17.3",
"jest": "^26.2.2"
},
"homepage": "https://github.com/mailchimp/mailchimp-marketing-node",
"repository": {
"type": "git",
"url": "git+https://github.com/mailchimp/mailchimp-marketing-node.git"
},
"bugs": {
"url": "https://github.com/mailchimp/mailchimp-client-lib-codegen/issues"
},
"keywords": [
"mailchimp",
"api",
"v3"
],
"engines": {
"node": ">=10.0.0"
}
}
================================================
FILE: src/ApiClient.js
================================================
/**
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.7
*
* Do not edit the class manually.
*
*/
var superagent = require('superagent');
var querystring = require('querystring');
var AccountExport = require('./api/AccountExportApi');
var AccountExports = require('./api/AccountExportsApi');
var ActivityFeed = require('./api/ActivityFeedApi');
var AuthorizedApps = require('./api/AuthorizedAppsApi');
var Automations = require('./api/AutomationsApi');
var BatchWebhooks = require('./api/BatchWebhooksApi');
var Batches = require('./api/BatchesApi');
var CampaignFolders = require('./api/CampaignFoldersApi');
var Campaigns = require('./api/CampaignsApi');
var ConnectedSites = require('./api/ConnectedSitesApi');
var Conversations = require('./api/ConversationsApi');
var CustomerJourneys = require('./api/CustomerJourneysApi');
var Ecommerce = require('./api/EcommerceApi');
var FacebookAds = require('./api/FacebookAdsApi');
var FileManager = require('./api/FileManagerApi');
var LandingPages = require('./api/LandingPagesApi');
var Lists = require('./api/ListsApi');
var Ping = require('./api/PingApi');
var Reporting = require('./api/ReportingApi');
var Reports = require('./api/ReportsApi');
var Root = require('./api/RootApi');
var SearchCampaigns = require('./api/SearchCampaignsApi');
var SearchMembers = require('./api/SearchMembersApi');
var Surveys = require('./api/SurveysApi');
var TemplateFolders = require('./api/TemplateFoldersApi');
var Templates = require('./api/TemplatesApi');
var VerifiedDomains = require('./api/VerifiedDomainsApi');
/**
* @module ApiClient
* @version 3.0.80
*/
/**
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
* application to use this class directly - the *Api and model classes provide the public API for the service. The
* contents of this file should be regarded as internal but are documented for completeness.
* @alias module:ApiClient
* @class
*/
var exports = function() {
/**
* The base URL against which to resolve every API call's (relative) path.
* @type {String}
* @default https://server.api.mailchimp.com/3.0
*/
this.basePath = 'https://server.api.mailchimp.com/3.0'.replace(/\/+$/, '');
/**
* The API configuration settings object
* @type {Object}
* @default {}
*/
this.config = {
apiKey: '',
accessToken: '',
server: 'invalid-server'
};
/**
* The default HTTP headers to be included for all API calls.
* @type {Array.<String>}
* @default {}
*/
this.defaultHeaders = {};
/**
* The default HTTP timeout for all API calls.
* @type {Number}
* @default 60000
*/
this.timeout = 120000;
/**
* If set to false an additional timestamp parameter is added to all API GET calls to
* prevent browser caching
* @type {Boolean}
* @default true
*/
this.cache = true;
/**
* If set to true, the client will save the cookies from each server
* response, and return them in the next request.
* @default false
*/
this.enableCookies = false;
/*
* Used to save and return cookies in a node.js (non-browser) setting,
* if this.enableCookies is set to true.
*/
if (typeof window === 'undefined') {
this.agent = new superagent.agent();
}
// API Routes
this.accountExport = new AccountExport(this);
this.accountExports = new AccountExports(this);
this.activityFeed = new ActivityFeed(this);
this.authorizedApps = new AuthorizedApps(this);
this.automations = new Automations(this);
this.batchWebhooks = new BatchWebhooks(this);
this.batches = new Batches(this);
this.campaignFolders = new CampaignFolders(this);
this.campaigns = new Campaigns(this);
this.connectedSites = new ConnectedSites(this);
this.conversations = new Conversations(this);
this.customerJourneys = new CustomerJourneys(this);
this.ecommerce = new Ecommerce(this);
this.facebookAds = new FacebookAds(this);
this.fileManager = new FileManager(this);
this.landingPages = new LandingPages(this);
this.lists = new Lists(this);
this.ping = new Ping(this);
this.reporting = new Reporting(this);
this.reports = new Reports(this);
this.root = new Root(this);
this.searchCampaigns = new SearchCampaigns(this);
this.searchMembers = new SearchMembers(this);
this.Surveys = new Surveys(this);
this.templateFolders = new TemplateFolders(this);
this.templates = new Templates(this);
this.verifiedDomains = new VerifiedDomains(this);
};
/**
* Sets the API configuration settings object.
* @param config {Object} The configuration object
*/
exports.prototype.setConfig = function(config = {}) {
var _this = this;
this.config = config;
};
/**
* Returns a string representation for an actual parameter.
* @param param The actual parameter.
* @returns {String} The string representation of <code>param</code>.
*/
exports.prototype.paramToString = function(param) {
if (param == undefined || param == null) {
return '';
}
if (param instanceof Date) {
return param.toJSON();
}
return param.toString();
};
/**
* Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
* NOTE: query parameters are not handled here.
* @param {String} path The path to append to the base URL.
* @param {Object} pathParams The parameter values to append.
* @returns {String} The encoded path with parameter values substituted.
*/
exports.prototype.buildUrl = function(path, pathParams) {
if (!path.match(/^\//)) {
path = '/' + path;
}
var url = this.basePath + path;
var _this = this;
url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) {
var value;
if (pathParams.hasOwnProperty(key)) {
value = _this.paramToString(pathParams[key]);
} else {
value = fullMatch;
}
return encodeURIComponent(value);
});
// Define the server
if (typeof this.config.server !== 'undefined') {
url = url.replace('server', this.config.server);
}
return url;
};
/**
* Checks whether the given content type represents JSON.<br>
* JSON content type examples:<br>
* <ul>
* <li>application/json</li>
* <li>application/json; charset=UTF8</li>
* <li>APPLICATION/JSON</li>
* </ul>
* @param {String} contentType The MIME content type to check.
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
*/
exports.prototype.isJsonMime = function(contentType) {
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
};
/**
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
* @param {Array.<String>} contentTypes
* @returns {String} The chosen content type, preferring JSON.
*/
exports.prototype.jsonPreferredMime = function(contentTypes) {
for (var i = 0; i < contentTypes.length; i++) {
if (this.isJsonMime(contentTypes[i])) {
return contentTypes[i];
}
}
return contentTypes[0];
};
/**
* Checks whether the given parameter value represents file-like content.
* @param param The parameter to check.
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
*/
exports.prototype.isFileParam = function(param) {
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
if (typeof require === 'function') {
var fs;
try {
fs = require('fs');
} catch (err) {}
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
return true;
}
}
// Buffer in Node.js
if (typeof Buffer === 'function' && param instanceof Buffer) {
return true;
}
// Blob in browser
if (typeof Blob === 'function' && param instanceof Blob) {
return true;
}
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
if (typeof File === 'function' && param instanceof File) {
return true;
}
return false;
};
/**
* Normalizes parameter values:
* <ul>
* <li>remove nils</li>
* <li>keep files and arrays</li>
* <li>format to string with `paramToString` for other cases</li>
* </ul>
* @param {Object.<String, Object>} params The parameters as object properties.
* @returns {Object.<String, Object>} normalized parameters.
*/
exports.prototype.normalizeParams = function(params) {
var newParams = {};
for (var key in params) {
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
var value = params[key];
if (this.isFileParam(value) || Array.isArray(value)) {
newParams[key] = value;
} else {
newParams[key] = this.paramToString(value);
}
}
}
return newParams;
};
/**
* Enumeration of collection format separator strategies.
* @enum {String}
* @readonly
*/
exports.CollectionFormatEnum = {
/**
* Comma-separated values. Value: <code>csv</code>
* @const
*/
CSV: ',',
/**
* Space-separated values. Value: <code>ssv</code>
* @const
*/
SSV: ' ',
/**
* Tab-separated values. Value: <code>tsv</code>
* @const
*/
TSV: '\t',
/**
* Pipe(|)-separated values. Value: <code>pipes</code>
* @const
*/
PIPES: '|',
/**
* Native array. Value: <code>multi</code>
* @const
*/
MULTI: 'multi'
};
/**
* Builds a string representation of an array-type actual parameter, according to the given collection format.
* @param {Array} param An array parameter.
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
*/
exports.prototype.buildCollectionParam = function buildCollectionParam(param, collectionFormat) {
if (param == null) {
return null;
}
switch (collectionFormat) {
case 'csv':
return param.map(this.paramToString).join(',');
case 'ssv':
return param.map(this.paramToString).join(' ');
case 'tsv':
return param.map(this.paramToString).join('\t');
case 'pipes':
return param.map(this.paramToString).join('|');
case 'multi':
// return the array directly as SuperAgent will handle it as expected
return param.map(this.paramToString);
default:
throw new Error('Unknown collection format: ' + collectionFormat);
}
};
/**
* Deserializes an HTTP response body into a value of the specified type.
* @param {Object} response A SuperAgent response object.
* @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
* all properties on <code>data<code> will be converted to this type.
* @returns A value of the specified type.
*/
exports.prototype.deserialize = function deserialize(response, returnType) {
if (response == null || returnType == null || response.status == 204) {
return null;
}
// Rely on SuperAgent for parsing response body.
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body;
if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
// SuperAgent does not always produce a body; use the unparsed response as a fallback
data = response.text;
}
return exports.convertToType(data, returnType);
};
/**
* Invokes the REST service using the supplied settings and parameters.
* @param {String} path The base URL to invoke.
* @param {String} httpMethod The HTTP method to use.
* @param {Object.<String, String>} pathParams A map of path parameters and their values.
* @param {Object.<String, Object>} queryParams A map of query parameters and their values.
* @param {Object.<String, Object>} headerParams A map of header parameters and their values.
* @param {Object.<String, Object>} formParams A map of form parameters and their values.
* @param {Object} bodyParam The value to pass as the request body.
* @param {Array.<String>} authNames An array of authentication type names.
* @param {Array.<String>} contentTypes An array of request MIME types.
* @param {Array.<String>} accepts An array of acceptable response MIME types.
* @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
* constructor for a complex type.
* @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
*/
exports.prototype.callApi = function callApi(path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
returnType) {
var _this = this;
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);
// Basic Authentication
if (this.config.apiKey !== undefined && this.config.apiKey !== '') {
request.auth('user', this.config.apiKey);
}
// OAuth Authentication
else if (this.config.accessToken !== undefined && this.config.accessToken !== '') {
request.set({'Authorization': 'Bearer ' + this.config.accessToken});
}
// set query parameters
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
queryParams['_'] = new Date().getTime();
}
request.query(this.normalizeParams(queryParams));
// set header parameters
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
// set request timeout
request.timeout(this.timeout);
var contentType = this.jsonPreferredMime(contentTypes);
if (contentType) {
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
if(contentType != 'multipart/form-data') {
request.type(contentType);
}
} else if (!HeaderUtils.caseInsensitiveGet(request.header, 'content-type')) {
request.type('application/json');
}
if (contentType === 'application/x-www-form-urlencoded') {
request.send(querystring.stringify(this.normalizeParams(formParams)));
} else if (contentType == 'multipart/form-data') {
var _formParams = this.normalizeParams(formParams);
for (var key in _formParams) {
if (_formParams.hasOwnProperty(key)) {
if (this.isFileParam(_formParams[key])) {
// file field
request.attach(key, _formParams[key]);
} else {
request.field(key, _formParams[key]);
}
}
}
} else if (bodyParam) {
request.send(bodyParam);
}
var accept = this.jsonPreferredMime(accepts);
if (accept) {
request.accept(accept);
}
if (returnType === 'Blob') {
request.responseType('blob');
} else if (returnType === 'String') {
request.responseType('string');
}
// Attach previously saved cookies, if enabled
if (this.enableCookies){
if (typeof window === 'undefined') {
this.agent.attachCookies(request);
}
else {
request.withCredentials();
}
}
return new Promise(function(resolve, reject) {
request.end(function(error, response) {
if (error) {
reject(error);
} else {
try {
var data = _this.deserialize(response, returnType);
if (_this.enableCookies && typeof window === 'undefined'){
_this.agent.saveCookies(response);
}
resolve({data: data, response: response});
} catch (err) {
reject(err);
}
}
});
});
};
/**
* Parses an ISO-8601 string representation of a date value.
* @param {String} str The date value as a string.
* @returns {Date} The parsed date object.
*/
exports.parseDate = function(str) {
return new Date(str.replace(/T/i, ' '));
};
/**
* Converts a value to the specified type.
* @param {(String|Object)} data The data to convert, as a string or object.
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
* all properties on <code>data<code> will be converted to this type.
* @returns An instance of the specified type or null or undefined if data is null or undefined.
*/
exports.convertToType = function(data, type) {
if (data === null || data === undefined)
return data
switch (type) {
case 'Boolean':
return Boolean(data);
case 'Integer':
return parseInt(data, 10);
case 'Number':
return parseFloat(data);
case 'String':
return String(data);
case 'Date':
return this.parseDate(String(data));
case 'Blob':
return data;
default:
if (type === Object) {
// generic object, return directly
return data;
} else if (typeof type === 'function') {
// for model type like: User
return type.constructFromObject(data);
} else if (Array.isArray(type)) {
// for array type like: ['String']
var itemType = type[0];
return data.map(function(item) {
return exports.convertToType(item, itemType);
});
} else if (typeof type === 'object') {
// for plain object type like: {'String': 'Integer'}
var keyType, valueType;
for (var k in type) {
if (type.hasOwnProperty(k)) {
keyType = k;
valueType = type[k];
break;
}
}
var result = {};
for (var k in data) {
if (data.hasOwnProperty(k)) {
var key = exports.convertToType(k, keyType);
var value = exports.convertToType(data[k], valueType);
result[key] = value;
}
}
return result;
} else {
// for unknown type, return the data directly
return data;
}
}
};
/**
* Constructs a new map or array model from REST data.
* @param data {Object|Array} The REST data.
* @param obj {Object|Array} The target object or array.
*/
exports.constructFromObject = function(data, obj, itemType) {
if (Array.isArray(data)) {
for (var i = 0; i < data.length; i++) {
if (data.hasOwnProperty(i))
obj[i] = exports.convertToType(data[i], itemType);
}
} else {
for (var k in data) {
if (data.hasOwnProperty(k))
obj[k] = exports.convertToType(data[k], itemType);
}
}
};
/**
* The default API client implementation.
* @type {module:ApiClient}
*/
exports.instance = new exports();
module.exports = exports;
================================================
FILE: src/api/AccountExportApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* AccountExport service.
* @module api/AccountExportApi
*/
/**
* Constructs a new AccountExportApi.
* @alias module:api/AccountExportApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Get account export info
* Get information about a specific account export.
* @param {String} exportId The unique id for the account export.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2001Exports} and HTTP response
*/
this.getAccountExportsWithHttpInfo = function(exportId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'exportId' is set
if (exportId === undefined || exportId === null) {
throw new Error("Missing the required parameter 'exportId' when calling ");
}
var pathParams = {
'export_id': exportId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/account-exports/{export_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get account export info
* Get information about a specific account export.
* @param {String} exportId The unique id for the account export.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2001Exports}
*/
this.getAccountExports = function(exportId, opts) {
return this.getAccountExportsWithHttpInfo(exportId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/AccountExportsApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* AccountExports service.
* @module api/AccountExportsApi
*/
/**
* Constructs a new AccountExportsApi.
* @alias module:api/AccountExportsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* List account exports
* Get a list of account exports for a given account.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2001} and HTTP response
*/
this.listAccountExportsWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/account-exports', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List account exports
* Get a list of account exports for a given account.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2001}
*/
this.listAccountExports = function(opts) {
return this.listAccountExportsWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add export
* Create a new account export in your Mailchimp account.
* @param {module:model/CreateAnAccountExport} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2001Exports} and HTTP response
*/
this.createAccountExportWithHttpInfo = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/account-exports', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Add export
* Create a new account export in your Mailchimp account.
* @param {module:model/CreateAnAccountExport} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2001Exports}
*/
this.createAccountExport = function(body) {
return this.createAccountExportWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/ActivityFeedApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* ActivityFeed service.
* @module api/ActivityFeedApi
*/
/**
* Constructs a new ActivityFeedApi.
* @alias module:api/ActivityFeedApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Get latest chimp chatter
* Return the Chimp Chatter for this account ordered by most recent.
* @param {Object} opts Optional parameters
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200} and HTTP response
*/
this.getChimpChatterWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/activity-feed/chimp-chatter', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get latest chimp chatter
* Return the Chimp Chatter for this account ordered by most recent.
* @param {Object} opts Optional parameters
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200}
*/
this.getChimpChatter = function(opts) {
return this.getChimpChatterWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/AuthorizedAppsApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* AuthorizedApps service.
* @module api/AuthorizedAppsApi
*/
/**
* Constructs a new AuthorizedAppsApi.
* @alias module:api/AuthorizedAppsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* List authorized apps
* Get a list of an account's registered, connected applications.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2002} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/authorized-apps', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List authorized apps
* Get a list of an account's registered, connected applications.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2002}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get authorized app info
* Get information about a specific authorized application.
* @param {String} appId The unique id for the connected authorized application.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2002Apps} and HTTP response
*/
this.getWithHttpInfo = function(appId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'appId' is set
if (appId === undefined || appId === null) {
throw new Error("Missing the required parameter 'appId' when calling ");
}
var pathParams = {
'app_id': appId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/authorized-apps/{app_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get authorized app info
* Get information about a specific authorized application.
* @param {String} appId The unique id for the connected authorized application.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2002Apps}
*/
this.get = function(appId, opts) {
return this.getWithHttpInfo(appId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/AutomationsApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* Automations service.
* @module api/AutomationsApi
*/
/**
* Constructs a new AutomationsApi.
* @alias module:api/AutomationsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Archive automation
* Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.archiveWithHttpInfo = function(workflowId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/actions/archive', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Archive automation
* Archiving will permanently end your automation and keep the report data. You’ll be able to replicate your archived automation, but you can’t restart it.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.archive = function(workflowId) {
return this.archiveWithHttpInfo(workflowId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete workflow email
* Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteWorkflowEmailWithHttpInfo = function(workflowId, workflowEmailId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete workflow email
* Removes an individual classic automation workflow email. Emails from certain workflow types, including the Abandoned Cart Email (abandonedCart) and Product Retargeting Email (abandonedBrowse) Workflows, cannot be deleted.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteWorkflowEmail = function(workflowId, workflowEmailId) {
return this.deleteWorkflowEmailWithHttpInfo(workflowId, workflowEmailId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List automations
* Get a summary of an account's classic automations.
* @param {Object} opts Optional parameters
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Date} opts.beforeCreateTime Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceCreateTime Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.beforeStartTime Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceStartTime Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {module:model/String} opts.status Restrict the results to automations with the specified status.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2003} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset']),
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'before_create_time': ( opts['beforeCreateTime'] ? opts['beforeCreateTime'] : opts['before_create_time']),
'since_create_time': ( opts['sinceCreateTime'] ? opts['sinceCreateTime'] : opts['since_create_time']),
'before_start_time': ( opts['beforeStartTime'] ? opts['beforeStartTime'] : opts['before_start_time']),
'since_start_time': ( opts['sinceStartTime'] ? opts['sinceStartTime'] : opts['since_start_time']),
'status': ( opts['status'] ? opts['status'] : opts['status'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List automations
* Get a summary of an account's classic automations.
* @param {Object} opts Optional parameters
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Date} opts.beforeCreateTime Restrict the response to automations created before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceCreateTime Restrict the response to automations created after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.beforeStartTime Restrict the response to automations started before this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceStartTime Restrict the response to automations started after this time. Uses the ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {module:model/String} opts.status Restrict the results to automations with the specified status.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2003}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get automation info
* Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AutomationWorkflow} and HTTP response
*/
this.getWithHttpInfo = function(workflowId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get automation info
* Get a summary of an individual classic automation workflow's settings and content. The `trigger_settings` object returns information for the first email in the workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AutomationWorkflow}
*/
this.get = function(workflowId, opts) {
return this.getWithHttpInfo(workflowId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List automated emails
* Get a summary of the emails in a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AutomationEmails} and HTTP response
*/
this.listAllWorkflowEmailsWithHttpInfo = function(workflowId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List automated emails
* Get a summary of the emails in a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AutomationEmails}
*/
this.listAllWorkflowEmails = function(workflowId) {
return this.listAllWorkflowEmailsWithHttpInfo(workflowId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get workflow email info
* Get information about an individual classic automation workflow email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AutomationWorkflowEmail} and HTTP response
*/
this.getWorkflowEmailWithHttpInfo = function(workflowId, workflowEmailId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get workflow email info
* Get information about an individual classic automation workflow email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AutomationWorkflowEmail}
*/
this.getWorkflowEmail = function(workflowId, workflowEmailId) {
return this.getWorkflowEmailWithHttpInfo(workflowId, workflowEmailId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List automated email subscribers
* Get information about a classic automation email queue.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2004} and HTTP response
*/
this.getWorkflowEmailSubscriberQueueWithHttpInfo = function(workflowId, workflowEmailId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List automated email subscribers
* Get information about a classic automation email queue.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2004}
*/
this.getWorkflowEmailSubscriberQueue = function(workflowId, workflowEmailId) {
return this.getWorkflowEmailSubscriberQueueWithHttpInfo(workflowId, workflowEmailId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get automated email subscriber
* Get information about a specific subscriber in a classic automation email queue.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {String} subscriberHash The MD5 hash of the lowercase version of the list member's email address.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubscriberInAutomationQueue2} and HTTP response
*/
this.getWorkflowEmailSubscriberWithHttpInfo = function(workflowId, workflowEmailId, subscriberHash) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
// verify the required parameter 'subscriberHash' is set
if (subscriberHash === undefined || subscriberHash === null) {
throw new Error("Missing the required parameter 'subscriberHash' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId,
'subscriber_hash': subscriberHash
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue/{subscriber_hash}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get automated email subscriber
* Get information about a specific subscriber in a classic automation email queue.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {String} subscriberHash The MD5 hash of the lowercase version of the list member's email address.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubscriberInAutomationQueue2}
*/
this.getWorkflowEmailSubscriber = function(workflowId, workflowEmailId, subscriberHash) {
return this.getWorkflowEmailSubscriberWithHttpInfo(workflowId, workflowEmailId, subscriberHash)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List subscribers removed from workflow
* Get information about subscribers who were removed from a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/RemovedSubscribers} and HTTP response
*/
this.listWorkflowEmailSubscribersRemovedWithHttpInfo = function(workflowId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/removed-subscribers', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List subscribers removed from workflow
* Get information about subscribers who were removed from a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/RemovedSubscribers}
*/
this.listWorkflowEmailSubscribersRemoved = function(workflowId) {
return this.listWorkflowEmailSubscribersRemovedWithHttpInfo(workflowId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get subscriber removed from workflow
* Get information about a specific subscriber who was removed from a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} subscriberHash The MD5 hash of the lowercase version of the list member's email address.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubscriberRemovedFromAutomationWorkflow} and HTTP response
*/
this.getRemovedWorkflowEmailSubscriberWithHttpInfo = function(workflowId, subscriberHash) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'subscriberHash' is set
if (subscriberHash === undefined || subscriberHash === null) {
throw new Error("Missing the required parameter 'subscriberHash' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'subscriber_hash': subscriberHash
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/removed-subscribers/{subscriber_hash}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get subscriber removed from workflow
* Get information about a specific subscriber who was removed from a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} subscriberHash The MD5 hash of the lowercase version of the list member's email address.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubscriberRemovedFromAutomationWorkflow}
*/
this.getRemovedWorkflowEmailSubscriber = function(workflowId, subscriberHash) {
return this.getRemovedWorkflowEmailSubscriberWithHttpInfo(workflowId, subscriberHash)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Update workflow email
* Update settings for a classic automation workflow email. Only works with workflows of type: abandonedBrowse, abandonedCart, emailFollowup, or singleWelcome.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {module:model/UpdateInformationAboutASpecificWorkflowEmail} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AutomationWorkflowEmail} and HTTP response
*/
this.updateWorkflowEmailWithHttpInfo = function(workflowId, workflowEmailId, body) {
var postBody = body;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Update workflow email
* Update settings for a classic automation workflow email. Only works with workflows of type: abandonedBrowse, abandonedCart, emailFollowup, or singleWelcome.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {module:model/UpdateInformationAboutASpecificWorkflowEmail} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AutomationWorkflowEmail}
*/
this.updateWorkflowEmail = function(workflowId, workflowEmailId, body) {
return this.updateWorkflowEmailWithHttpInfo(workflowId, workflowEmailId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add automation
* Create a new classic automation in your Mailchimp account.
* @param {module:model/AutomationWorkflow1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AutomationWorkflow} and HTTP response
*/
this.createWithHttpInfo = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Add automation
* Create a new classic automation in your Mailchimp account.
* @param {module:model/AutomationWorkflow1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AutomationWorkflow}
*/
this.create = function(body) {
return this.createWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Pause automation emails
* Pause all emails in a specific classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.pauseAllEmailsWithHttpInfo = function(workflowId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/actions/pause-all-emails', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Pause automation emails
* Pause all emails in a specific classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.pauseAllEmails = function(workflowId) {
return this.pauseAllEmailsWithHttpInfo(workflowId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Start automation emails
* Start all emails in a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.startAllEmailsWithHttpInfo = function(workflowId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/actions/start-all-emails', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Start automation emails
* Start all emails in a classic automation workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.startAllEmails = function(workflowId) {
return this.startAllEmailsWithHttpInfo(workflowId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Pause automated email
* Pause an automated email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.pauseWorkflowEmailWithHttpInfo = function(workflowId, workflowEmailId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}/actions/pause', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Pause automated email
* Pause an automated email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.pauseWorkflowEmail = function(workflowId, workflowEmailId) {
return this.pauseWorkflowEmailWithHttpInfo(workflowId, workflowEmailId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Start automated email
* Start an automated email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.startWorkflowEmailWithHttpInfo = function(workflowId, workflowEmailId) {
var postBody = null;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}/actions/start', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Start automated email
* Start an automated email.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.startWorkflowEmail = function(workflowId, workflowEmailId) {
return this.startWorkflowEmailWithHttpInfo(workflowId, workflowEmailId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add subscriber to workflow email
* Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {module:model/SubscriberInAutomationQueue1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubscriberInAutomationQueue2} and HTTP response
*/
this.addWorkflowEmailSubscriberWithHttpInfo = function(workflowId, workflowEmailId, body) {
var postBody = body;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'workflowEmailId' is set
if (workflowEmailId === undefined || workflowEmailId === null) {
throw new Error("Missing the required parameter 'workflowEmailId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'workflow_id': workflowId,
'workflow_email_id': workflowEmailId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/emails/{workflow_email_id}/queue', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Add subscriber to workflow email
* Manually add a subscriber to a workflow, bypassing the default trigger settings. You can also use this endpoint to trigger a series of automated emails in an API 3.0 workflow type.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {String} workflowEmailId The unique id for the Automation workflow email.
* @param {module:model/SubscriberInAutomationQueue1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubscriberInAutomationQueue2}
*/
this.addWorkflowEmailSubscriber = function(workflowId, workflowEmailId, body) {
return this.addWorkflowEmailSubscriberWithHttpInfo(workflowId, workflowEmailId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Remove subscriber from workflow
* Remove a subscriber from a specific classic automation workflow. You can remove a subscriber at any point in an automation workflow, regardless of how many emails they've been sent from that workflow. Once they're removed, they can never be added back to the same workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {module:model/SubscriberInAutomationQueue3} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubscriberRemovedFromAutomationWorkflow} and HTTP response
*/
this.removeWorkflowEmailSubscriberWithHttpInfo = function(workflowId, body) {
var postBody = body;
// verify the required parameter 'workflowId' is set
if (workflowId === undefined || workflowId === null) {
throw new Error("Missing the required parameter 'workflowId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'workflow_id': workflowId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/automations/{workflow_id}/removed-subscribers', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Remove subscriber from workflow
* Remove a subscriber from a specific classic automation workflow. You can remove a subscriber at any point in an automation workflow, regardless of how many emails they've been sent from that workflow. Once they're removed, they can never be added back to the same workflow.
* @param {String} workflowId The unique id for the Automation workflow.
* @param {module:model/SubscriberInAutomationQueue3} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubscriberRemovedFromAutomationWorkflow}
*/
this.removeWorkflowEmailSubscriber = function(workflowId, body) {
return this.removeWorkflowEmailSubscriberWithHttpInfo(workflowId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/BatchWebhooksApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* BatchWebhooks service.
* @module api/BatchWebhooksApi
*/
/**
* Constructs a new BatchWebhooksApi.
* @alias module:api/BatchWebhooksApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Delete batch webhook
* Remove a batch webhook. Webhooks will no longer be sent to the given URL.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.removeWithHttpInfo = function(batchWebhookId) {
var postBody = null;
// verify the required parameter 'batchWebhookId' is set
if (batchWebhookId === undefined || batchWebhookId === null) {
throw new Error("Missing the required parameter 'batchWebhookId' when calling ");
}
var pathParams = {
'batch_webhook_id': batchWebhookId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batch-webhooks/{batch_webhook_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete batch webhook
* Remove a batch webhook. Webhooks will no longer be sent to the given URL.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.remove = function(batchWebhookId) {
return this.removeWithHttpInfo(batchWebhookId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get batch webhook info
* Get information about a specific batch webhook.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BatchWebhook} and HTTP response
*/
this.getWithHttpInfo = function(batchWebhookId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'batchWebhookId' is set
if (batchWebhookId === undefined || batchWebhookId === null) {
throw new Error("Missing the required parameter 'batchWebhookId' when calling ");
}
var pathParams = {
'batch_webhook_id': batchWebhookId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batch-webhooks/{batch_webhook_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get batch webhook info
* Get information about a specific batch webhook.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BatchWebhook}
*/
this.get = function(batchWebhookId, opts) {
return this.getWithHttpInfo(batchWebhookId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List batch webhooks
* Get all webhooks that have been configured for batches.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BatchWebhooks} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batch-webhooks', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List batch webhooks
* Get all webhooks that have been configured for batches.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BatchWebhooks}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Update batch webhook
* Update a webhook that will fire whenever any batch request completes processing.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @param {module:model/BatchWebhook2} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BatchWebhook} and HTTP response
*/
this.updateWithHttpInfo = function(batchWebhookId, body) {
var postBody = body;
// verify the required parameter 'batchWebhookId' is set
if (batchWebhookId === undefined || batchWebhookId === null) {
throw new Error("Missing the required parameter 'batchWebhookId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'batch_webhook_id': batchWebhookId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batch-webhooks/{batch_webhook_id}', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Update batch webhook
* Update a webhook that will fire whenever any batch request completes processing.
* @param {String} batchWebhookId The unique id for the batch webhook.
* @param {module:model/BatchWebhook2} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BatchWebhook}
*/
this.update = function(batchWebhookId, body) {
return this.updateWithHttpInfo(batchWebhookId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add batch webhook
* Configure a webhook that will fire whenever any batch request completes processing. You may only have a maximum of 20 batch webhooks.
* @param {module:model/BatchWebhook1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BatchWebhook} and HTTP response
*/
this.createWithHttpInfo = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batch-webhooks', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Add batch webhook
* Configure a webhook that will fire whenever any batch request completes processing. You may only have a maximum of 20 batch webhooks.
* @param {module:model/BatchWebhook1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BatchWebhook}
*/
this.create = function(body) {
return this.createWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/BatchesApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* Batches service.
* @module api/BatchesApi
*/
/**
* Constructs a new BatchesApi.
* @alias module:api/BatchesApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Delete batch request
* Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call.
* @param {String} batchId The unique id for the batch operation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteRequestWithHttpInfo = function(batchId) {
var postBody = null;
// verify the required parameter 'batchId' is set
if (batchId === undefined || batchId === null) {
throw new Error("Missing the required parameter 'batchId' when calling ");
}
var pathParams = {
'batch_id': batchId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batches/{batch_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete batch request
* Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call.
* @param {String} batchId The unique id for the batch operation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteRequest = function(batchId) {
return this.deleteRequestWithHttpInfo(batchId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List batch requests
* Get a summary of batch requests that have been made.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BatchOperations} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batches', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List batch requests
* Get a summary of batch requests that have been made.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BatchOperations}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get batch operation status
* Get the status of a batch request.
* @param {String} batchId The unique id for the batch operation.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Batch} and HTTP response
*/
this.statusWithHttpInfo = function(batchId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'batchId' is set
if (batchId === undefined || batchId === null) {
throw new Error("Missing the required parameter 'batchId' when calling ");
}
var pathParams = {
'batch_id': batchId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batches/{batch_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get batch operation status
* Get the status of a batch request.
* @param {String} batchId The unique id for the batch operation.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Batch}
*/
this.status = function(batchId, opts) {
return this.statusWithHttpInfo(batchId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Start batch operation
* Begin processing a batch operations request.
* @param {module:model/Body} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Batch} and HTTP response
*/
this.startWithHttpInfo = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/batches', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Start batch operation
* Begin processing a batch operations request.
* @param {module:model/Body} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Batch}
*/
this.start = function(body) {
return this.startWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/CampaignFoldersApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* CampaignFolders service.
* @module api/CampaignFoldersApi
*/
/**
* Constructs a new CampaignFoldersApi.
* @alias module:api/CampaignFoldersApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Delete campaign folder
* Delete a specific campaign folder, and mark all the campaigns in the folder as 'unfiled'.
* @param {String} folderId The unique id for the campaign folder.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.removeWithHttpInfo = function(folderId) {
var postBody = null;
// verify the required parameter 'folderId' is set
if (folderId === undefined || folderId === null) {
throw new Error("Missing the required parameter 'folderId' when calling ");
}
var pathParams = {
'folder_id': folderId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaign-folders/{folder_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete campaign folder
* Delete a specific campaign folder, and mark all the campaigns in the folder as 'unfiled'.
* @param {String} folderId The unique id for the campaign folder.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.remove = function(folderId) {
return this.removeWithHttpInfo(folderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List campaign folders
* Get all folders used to organize campaigns.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignFolders} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaign-folders', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List campaign folders
* Get all folders used to organize campaigns.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignFolders}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get campaign folder
* Get information about a specific folder used to organize campaigns.
* @param {String} folderId The unique id for the campaign folder.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignFolder} and HTTP response
*/
this.getWithHttpInfo = function(folderId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'folderId' is set
if (folderId === undefined || folderId === null) {
throw new Error("Missing the required parameter 'folderId' when calling ");
}
var pathParams = {
'folder_id': folderId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaign-folders/{folder_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get campaign folder
* Get information about a specific folder used to organize campaigns.
* @param {String} folderId The unique id for the campaign folder.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignFolder}
*/
this.get = function(folderId, opts) {
return this.getWithHttpInfo(folderId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Update campaign folder
* Update a specific folder used to organize campaigns.
* @param {String} folderId The unique id for the campaign folder.
* @param {module:model/CampaignFolder2} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignFolder} and HTTP response
*/
this.updateWithHttpInfo = function(folderId, body) {
var postBody = body;
// verify the required parameter 'folderId' is set
if (folderId === undefined || folderId === null) {
throw new Error("Missing the required parameter 'folderId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'folder_id': folderId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaign-folders/{folder_id}', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Update campaign folder
* Update a specific folder used to organize campaigns.
* @param {String} folderId The unique id for the campaign folder.
* @param {module:model/CampaignFolder2} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignFolder}
*/
this.update = function(folderId, body) {
return this.updateWithHttpInfo(folderId, body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Add campaign folder
* Create a new campaign folder.
* @param {module:model/CampaignFolder1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignFolder} and HTTP response
*/
this.createWithHttpInfo = function(body) {
var postBody = body;
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaign-folders', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Add campaign folder
* Create a new campaign folder.
* @param {module:model/CampaignFolder1} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignFolder}
*/
this.create = function(body) {
return this.createWithHttpInfo(body)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
================================================
FILE: src/api/CampaignsApi.js
================================================
/*
* Mailchimp Marketing API
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 3.0.80
* Contact: apihelp@mailchimp.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
*
* Swagger Codegen version: 2.4.12
*
* Do not edit the class manually.
*
*/
var ApiClient = require('../ApiClient');
/**
* Campaigns service.
* @module api/CampaignsApi
*/
/**
* Constructs a new CampaignsApi.
* @alias module:api/CampaignsApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
module.exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Delete campaign
* Remove a campaign from your Mailchimp account.
* @param {String} campaignId The unique id for the campaign.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.removeWithHttpInfo = function(campaignId) {
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete campaign
* Remove a campaign from your Mailchimp account.
* @param {String} campaignId The unique id for the campaign.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.remove = function(campaignId) {
return this.removeWithHttpInfo(campaignId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete campaign feedback message
* Remove a specific feedback message for a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {String} feedbackId The unique id for the feedback message.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteFeedbackMessageWithHttpInfo = function(campaignId, feedbackId) {
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
// verify the required parameter 'feedbackId' is set
if (feedbackId === undefined || feedbackId === null) {
throw new Error("Missing the required parameter 'feedbackId' when calling ");
}
var pathParams = {
'campaign_id': campaignId,
'feedback_id': feedbackId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}/feedback/{feedback_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete campaign feedback message
* Remove a specific feedback message for a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {String} feedbackId The unique id for the feedback message.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteFeedbackMessage = function(campaignId, feedbackId) {
return this.deleteFeedbackMessageWithHttpInfo(campaignId, feedbackId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List campaigns
* Get all campaigns in an account.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.type The campaign type.
* @param {module:model/String} opts.status The status of the campaign.
* @param {Date} opts.beforeSendTime Restrict the response to campaigns sent before the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceSendTime Restrict the response to campaigns sent after the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.beforeCreateTime Restrict the response to campaigns created before the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceCreateTime Restrict the response to campaigns created after the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {String} opts.listId The unique id for the list.
* @param {String} opts.folderId The unique folder id.
* @param {String} opts.memberId Retrieve campaigns sent to a particular list member. Member ID is The MD5 hash of the lowercase version of the list member’s email address.
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @param {module:model/String} opts.sortDir Determines the order direction for sorted results.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2005} and HTTP response
*/
this.listWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv'),
'count': ( opts['count'] ? opts['count'] : opts['count']),
'offset': ( opts['offset'] ? opts['offset'] : opts['offset']),
'type': ( opts['type'] ? opts['type'] : opts['type']),
'status': ( opts['status'] ? opts['status'] : opts['status']),
'before_send_time': ( opts['beforeSendTime'] ? opts['beforeSendTime'] : opts['before_send_time']),
'since_send_time': ( opts['sinceSendTime'] ? opts['sinceSendTime'] : opts['since_send_time']),
'before_create_time': ( opts['beforeCreateTime'] ? opts['beforeCreateTime'] : opts['before_create_time']),
'since_create_time': ( opts['sinceCreateTime'] ? opts['sinceCreateTime'] : opts['since_create_time']),
'list_id': ( opts['listId'] ? opts['listId'] : opts['list_id']),
'folder_id': ( opts['folderId'] ? opts['folderId'] : opts['folder_id']),
'member_id': ( opts['memberId'] ? opts['memberId'] : opts['member_id']),
'sort_field': ( opts['sortField'] ? opts['sortField'] : opts['sort_field']),
'sort_dir': ( opts['sortDir'] ? opts['sortDir'] : opts['sort_dir'])
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List campaigns
* Get all campaigns in an account.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @param {Number} opts.count The number of records to return. Default value is 10. Maximum value is 1000 (default to 10)
* @param {Number} opts.offset Used for [pagination](https://mailchimp.com/developer/marketing/docs/methods-parameters/#pagination), this it the number of records from a collection to skip. Default value is 0. (default to 0)
* @param {module:model/String} opts.type The campaign type.
* @param {module:model/String} opts.status The status of the campaign.
* @param {Date} opts.beforeSendTime Restrict the response to campaigns sent before the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceSendTime Restrict the response to campaigns sent after the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.beforeCreateTime Restrict the response to campaigns created before the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {Date} opts.sinceCreateTime Restrict the response to campaigns created after the set time. Uses ISO 8601 time format: 2015-10-21T15:41:36+00:00.
* @param {String} opts.listId The unique id for the list.
* @param {String} opts.folderId The unique folder id.
* @param {String} opts.memberId Retrieve campaigns sent to a particular list member. Member ID is The MD5 hash of the lowercase version of the list member’s email address.
* @param {module:model/String} opts.sortField Returns files sorted by the specified field.
* @param {module:model/String} opts.sortDir Determines the order direction for sorted results.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2005}
*/
this.list = function(opts) {
return this.listWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get campaign info
* Get information about a specific campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Campaign} and HTTP response
*/
this.getWithHttpInfo = function(campaignId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get campaign info
* Get information about a specific campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Campaign}
*/
this.get = function(campaignId, opts) {
return this.getWithHttpInfo(campaignId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get campaign content
* Get the the HTML and plain-text content for a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignContent} and HTTP response
*/
this.getContentWithHttpInfo = function(campaignId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}/content', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get campaign content
* Get the the HTML and plain-text content for a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignContent}
*/
this.getContent = function(campaignId, opts) {
return this.getContentWithHttpInfo(campaignId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List campaign feedback
* Get team feedback while you're working together on a Mailchimp campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignReports} and HTTP response
*/
this.getFeedbackWithHttpInfo = function(campaignId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}/feedback', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List campaign feedback
* Get team feedback while you're working together on a Mailchimp campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignReports}
*/
this.getFeedback = function(campaignId, opts) {
return this.getFeedbackWithHttpInfo(campaignId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get campaign feedback message
* Get a specific feedback message from a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {String} feedbackId The unique id for the feedback message.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/CampaignFeedback2} and HTTP response
*/
this.getFeedbackMessageWithHttpInfo = function(campaignId, feedbackId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
// verify the required parameter 'feedbackId' is set
if (feedbackId === undefined || feedbackId === null) {
throw new Error("Missing the required parameter 'feedbackId' when calling ");
}
var pathParams = {
'campaign_id': campaignId,
'feedback_id': feedbackId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}/feedback/{feedback_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get campaign feedback message
* Get a specific feedback message from a campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {String} feedbackId The unique id for the feedback message.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/CampaignFeedback2}
*/
this.getFeedbackMessage = function(campaignId, feedbackId, opts) {
return this.getFeedbackMessageWithHttpInfo(campaignId, feedbackId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get campaign send checklist
* Review the send checklist for a campaign, and resolve any issues before sending.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SendChecklist} and HTTP response
*/
this.getSendChecklistWithHttpInfo = function(campaignId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
'fields': this.apiClient.buildCollectionParam(opts['fields'] ? opts['fields'] : opts['fields'], 'csv'),
'exclude_fields': this.apiClient.buildCollectionParam(opts['excludeFields'] ? opts['excludeFields'] : opts['exclude_fields'], 'csv')
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}/send-checklist', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get campaign send checklist
* Review the send checklist for a campaign, and resolve any issues before sending.
* @param {String} campaignId The unique id for the campaign.
* @param {Object} opts Optional parameters
* @param {Array.<String>} opts.fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation.
* @param {Array.<String>} opts.excludeFields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SendChecklist}
*/
this.getSendChecklist = function(campaignId, opts) {
return this.getSendChecklistWithHttpInfo(campaignId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Update campaign settings
* Update some or all of the settings for a specific campaign.
* @param {String} campaignId The unique id for the campaign.
* @param {module:model/Campaign2} body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Campaign} and HTTP response
*/
this.updateWithHttpInfo = function(campaignId, body) {
var postBody = body;
// verify the required parameter 'campaignId' is set
if (campaignId === undefined || campaignId === null) {
throw new Error("Missing the required parameter 'campaignId' when calling ");
}
// verify the required parameter 'body' is set
if (body === undefined || body === null) {
throw new Error("Missing the required parameter 'body' when calling ");
}
var pathParams = {
'campaign_id': campaignId
};
/*
The following block building queryParams is going to look a little odd, we're going look for values in $opts with both
camelCase and snake_case format (which will be the same if singular word). This is because the API docs use snake_case
but early versions of these SDKs used camelCase. So to be backward compatible we'll use both.
*/
var queryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['basicAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json', 'application/problem+json'];
var returnType = 'application/json';
return this.apiClient.callApi(
'/campaigns/{campaign_id}', 'PATCH',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Update campaign settings
* Update some or all of the settings for a specific campaign.
* @param {String} campaignId The unique id for the campaign.
* @p
gitextract_oj9b8vdw/
├── .github/
│ └── PULL_REQUEST_TEMPLATE.md
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── git_push.sh
├── package.json
└── src/
├── ApiClient.js
├── api/
│ ├── AccountExportApi.js
│ ├── AccountExportsApi.js
│ ├── ActivityFeedApi.js
│ ├── AuthorizedAppsApi.js
│ ├── AutomationsApi.js
│ ├── BatchWebhooksApi.js
│ ├── BatchesApi.js
│ ├── CampaignFoldersApi.js
│ ├── CampaignsApi.js
│ ├── ConnectedSitesApi.js
│ ├── ConversationsApi.js
│ ├── CustomerJourneysApi.js
│ ├── EcommerceApi.js
│ ├── FacebookAdsApi.js
│ ├── FileManagerApi.js
│ ├── LandingPagesApi.js
│ ├── ListsApi.js
│ ├── PingApi.js
│ ├── ReportingApi.js
│ ├── ReportsApi.js
│ ├── RootApi.js
│ ├── SearchCampaignsApi.js
│ ├── SearchMembersApi.js
│ ├── SurveysApi.js
│ ├── TemplateFoldersApi.js
│ ├── TemplatesApi.js
│ └── VerifiedDomainsApi.js
└── index.js
Condensed preview — 36 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (921K chars).
[
{
"path": ".github/PULL_REQUEST_TEMPLATE.md",
"chars": 219,
"preview": "Note: This repository is auto-generated, and does not accept pull requests.\n\nTo make changes or open issues for this SDK"
},
{
"path": ".travis.yml",
"chars": 65,
"preview": "language: node_js\nnode_js:\n - \"6\"\n - \"6.1\"\n - \"5\"\n - \"5.11\"\n\n"
},
{
"path": "CHANGELOG.md",
"chars": 2777,
"preview": "# Changelog\n\n## Transactional\n\n### 1.0.48\n* Allowing users to schedule messages (using messages/send, messages/send-temp"
},
{
"path": "LICENSE",
"chars": 11837,
"preview": "Mailchimp Client Library License Agreement\n \nIMPORTANT- PLEASE READ CAREFULLY BEFORE OPENING, INSTALLING, COPYING OR USI"
},
{
"path": "README.md",
"chars": 23034,
"preview": "<p align=\"center\">\n <a href=\"https://mailchimp.com/developer/\">\n <img src=\"https://raw.githubusercontent.com/mailchi"
},
{
"path": "git_push.sh",
"chars": 1663,
"preview": "#!/bin/sh\n# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/\n#\n# Usage"
},
{
"path": "package.json",
"chars": 865,
"preview": "{\n \"name\": \"@mailchimp/mailchimp_marketing\",\n \"version\": \"3.0.80\",\n \"description\": \"The official Node client library "
},
{
"path": "src/ApiClient.js",
"chars": 19283,
"preview": "/**\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/s"
},
{
"path": "src/api/AccountExportApi.js",
"chars": 3863,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/AccountExportsApi.js",
"chars": 6221,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ActivityFeedApi.js",
"chars": 3490,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/AuthorizedAppsApi.js",
"chars": 7230,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/AutomationsApi.js",
"chars": 50068,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/BatchWebhooksApi.js",
"chars": 13654,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/BatchesApi.js",
"chars": 11101,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/CampaignFoldersApi.js",
"chars": 13278,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/CampaignsApi.js",
"chars": 57150,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ConnectedSitesApi.js",
"chars": 13172,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ConversationsApi.js",
"chars": 17549,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/CustomerJourneysApi.js",
"chars": 4160,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/EcommerceApi.js",
"chars": 175937,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/FacebookAdsApi.js",
"chars": 7594,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/FileManagerApi.js",
"chars": 28409,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/LandingPagesApi.js",
"chars": 20129,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ListsApi.js",
"chars": 220931,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/PingApi.js",
"chars": 2419,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ReportingApi.js",
"chars": 40926,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/ReportsApi.js",
"chars": 81766,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/RootApi.js",
"chars": 3353,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/SearchCampaignsApi.js",
"chars": 3760,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/SearchMembersApi.js",
"chars": 4271,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/SurveysApi.js",
"chars": 5386,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/TemplateFoldersApi.js",
"chars": 13278,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/TemplatesApi.js",
"chars": 18641,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/api/VerifiedDomainsApi.js",
"chars": 10485,
"preview": "/*\n * Mailchimp Marketing API\n * No description provided (generated by Swagger Codegen https://github.com/swagger-api/sw"
},
{
"path": "src/index.js",
"chars": 78,
"preview": "var ApiClient = require('./ApiClient');\n\nmodule.exports = ApiClient.instance;\n"
}
]
About this extraction
This page contains the full source code of the mailchimp/mailchimp-marketing-node GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 36 files (877.0 KB), approximately 214.1k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.