@industriousoffice/mailchimp_marketing
Version:
This is a modified version of the official Node client library for the Mailchimp Marketing API meant to be usesd for both production and testing purposes.
1,206 lines (1,063 loc) • 176 kB
JavaScript
/*
* 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');
/**
* Ecommerce service.
* @module api/EcommerceApi
*/
/**
* Constructs a new EcommerceApi.
* @alias module:api/EcommerceApi
* @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 store
* Delete a store. Deleting a store will also delete any associated subresources, including Customers, Orders, Products, and Carts.
* @param {String} storeId The store id.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link Object} and HTTP response
*/
this.deleteStoreWithHttpInfo = function(storeId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
var pathParams = {
'store_id': storeId
};
/*
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(
'/ecommerce/stores/{store_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete store
* Delete a store. Deleting a store will also delete any associated subresources, including Customers, Orders, Products, and Carts.
* @param {String} storeId The store id.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link Object}
*/
this.deleteStore = function(storeId) {
return this.deleteStoreWithHttpInfo(storeId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete cart
* Delete a cart.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteStoreCartWithHttpInfo = function(storeId, cartId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'cartId' is set
if (cartId === undefined || cartId === null) {
throw new Error("Missing the required parameter 'cartId' when calling ");
}
var pathParams = {
'store_id': storeId,
'cart_id': cartId
};
/*
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(
'/ecommerce/stores/{store_id}/carts/{cart_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete cart
* Delete a cart.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteStoreCart = function(storeId, cartId) {
return this.deleteStoreCartWithHttpInfo(storeId, cartId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete cart line item
* Delete a specific cart line item.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @param {String} lineId The id for the line item of a cart.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteCartLineItemWithHttpInfo = function(storeId, cartId, lineId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'cartId' is set
if (cartId === undefined || cartId === null) {
throw new Error("Missing the required parameter 'cartId' when calling ");
}
// verify the required parameter 'lineId' is set
if (lineId === undefined || lineId === null) {
throw new Error("Missing the required parameter 'lineId' when calling ");
}
var pathParams = {
'store_id': storeId,
'cart_id': cartId,
'line_id': lineId
};
/*
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(
'/ecommerce/stores/{store_id}/carts/{cart_id}/lines/{line_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete cart line item
* Delete a specific cart line item.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @param {String} lineId The id for the line item of a cart.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteCartLineItem = function(storeId, cartId, lineId) {
return this.deleteCartLineItemWithHttpInfo(storeId, cartId, lineId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete customer
* Delete a customer from a store.
* @param {String} storeId The store id.
* @param {String} customerId The id for the customer of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteStoreCustomerWithHttpInfo = function(storeId, customerId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'customerId' is set
if (customerId === undefined || customerId === null) {
throw new Error("Missing the required parameter 'customerId' when calling ");
}
var pathParams = {
'store_id': storeId,
'customer_id': customerId
};
/*
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(
'/ecommerce/stores/{store_id}/customers/{customer_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete customer
* Delete a customer from a store.
* @param {String} storeId The store id.
* @param {String} customerId The id for the customer of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteStoreCustomer = function(storeId, customerId) {
return this.deleteStoreCustomerWithHttpInfo(storeId, customerId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete order
* Delete an order.
* @param {String} storeId The store id.
* @param {String} orderId The id for the order in a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteOrderWithHttpInfo = function(storeId, orderId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'orderId' is set
if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling ");
}
var pathParams = {
'store_id': storeId,
'order_id': orderId
};
/*
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(
'/ecommerce/stores/{store_id}/orders/{order_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete order
* Delete an order.
* @param {String} storeId The store id.
* @param {String} orderId The id for the order in a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteOrder = function(storeId, orderId) {
return this.deleteOrderWithHttpInfo(storeId, orderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete order line item
* Delete a specific order line item.
* @param {String} storeId The store id.
* @param {String} orderId The id for the order in a store.
* @param {String} lineId The id for the line item of an order.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteOrderLineItemWithHttpInfo = function(storeId, orderId, lineId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'orderId' is set
if (orderId === undefined || orderId === null) {
throw new Error("Missing the required parameter 'orderId' when calling ");
}
// verify the required parameter 'lineId' is set
if (lineId === undefined || lineId === null) {
throw new Error("Missing the required parameter 'lineId' when calling ");
}
var pathParams = {
'store_id': storeId,
'order_id': orderId,
'line_id': lineId
};
/*
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(
'/ecommerce/stores/{store_id}/orders/{order_id}/lines/{line_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete order line item
* Delete a specific order line item.
* @param {String} storeId The store id.
* @param {String} orderId The id for the order in a store.
* @param {String} lineId The id for the line item of an order.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteOrderLineItem = function(storeId, orderId, lineId) {
return this.deleteOrderLineItemWithHttpInfo(storeId, orderId, lineId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete product
* Delete a product.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteStoreProductWithHttpInfo = function(storeId, productId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'productId' is set
if (productId === undefined || productId === null) {
throw new Error("Missing the required parameter 'productId' when calling ");
}
var pathParams = {
'store_id': storeId,
'product_id': productId
};
/*
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(
'/ecommerce/stores/{store_id}/products/{product_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete product
* Delete a product.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteStoreProduct = function(storeId, productId) {
return this.deleteStoreProductWithHttpInfo(storeId, productId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete product image
* Delete a product image.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @param {String} imageId The id for the product image.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteProductImageWithHttpInfo = function(storeId, productId, imageId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'productId' is set
if (productId === undefined || productId === null) {
throw new Error("Missing the required parameter 'productId' when calling ");
}
// verify the required parameter 'imageId' is set
if (imageId === undefined || imageId === null) {
throw new Error("Missing the required parameter 'imageId' when calling ");
}
var pathParams = {
'store_id': storeId,
'product_id': productId,
'image_id': imageId
};
/*
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(
'/ecommerce/stores/{store_id}/products/{product_id}/images/{image_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete product image
* Delete a product image.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @param {String} imageId The id for the product image.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteProductImage = function(storeId, productId, imageId) {
return this.deleteProductImageWithHttpInfo(storeId, productId, imageId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete product variant
* Delete a product variant.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @param {String} variantId The id for the product variant.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deleteProductVariantWithHttpInfo = function(storeId, productId, variantId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'productId' is set
if (productId === undefined || productId === null) {
throw new Error("Missing the required parameter 'productId' when calling ");
}
// verify the required parameter 'variantId' is set
if (variantId === undefined || variantId === null) {
throw new Error("Missing the required parameter 'variantId' when calling ");
}
var pathParams = {
'store_id': storeId,
'product_id': productId,
'variant_id': variantId
};
/*
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(
'/ecommerce/stores/{store_id}/products/{product_id}/variants/{variant_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete product variant
* Delete a product variant.
* @param {String} storeId The store id.
* @param {String} productId The id for the product of a store.
* @param {String} variantId The id for the product variant.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deleteProductVariant = function(storeId, productId, variantId) {
return this.deleteProductVariantWithHttpInfo(storeId, productId, variantId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete promo code
* Delete a promo code from a store.
* @param {String} storeId The store id.
* @param {String} promoRuleId The id for the promo rule of a store.
* @param {String} promoCodeId The id for the promo code of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deletePromoCodeWithHttpInfo = function(storeId, promoRuleId, promoCodeId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'promoRuleId' is set
if (promoRuleId === undefined || promoRuleId === null) {
throw new Error("Missing the required parameter 'promoRuleId' when calling ");
}
// verify the required parameter 'promoCodeId' is set
if (promoCodeId === undefined || promoCodeId === null) {
throw new Error("Missing the required parameter 'promoCodeId' when calling ");
}
var pathParams = {
'store_id': storeId,
'promo_rule_id': promoRuleId,
'promo_code_id': promoCodeId
};
/*
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(
'/ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}/promo-codes/{promo_code_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete promo code
* Delete a promo code from a store.
* @param {String} storeId The store id.
* @param {String} promoRuleId The id for the promo rule of a store.
* @param {String} promoCodeId The id for the promo code of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deletePromoCode = function(storeId, promoRuleId, promoCodeId) {
return this.deletePromoCodeWithHttpInfo(storeId, promoRuleId, promoCodeId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete promo rule
* Delete a promo rule from a store.
* @param {String} storeId The store id.
* @param {String} promoRuleId The id for the promo rule of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.deletePromoRuleWithHttpInfo = function(storeId, promoRuleId) {
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'promoRuleId' is set
if (promoRuleId === undefined || promoRuleId === null) {
throw new Error("Missing the required parameter 'promoRuleId' when calling ");
}
var pathParams = {
'store_id': storeId,
'promo_rule_id': promoRuleId
};
/*
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(
'/ecommerce/stores/{store_id}/promo-rules/{promo_rule_id}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete promo rule
* Delete a promo rule from a store.
* @param {String} storeId The store id.
* @param {String} promoRuleId The id for the promo rule of a store.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.deletePromoRule = function(storeId, promoRuleId) {
return this.deletePromoRuleWithHttpInfo(storeId, promoRuleId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List account orders
* Get information about an account's orders.
* @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 {String} opts.campaignId Restrict results to orders with a specific `campaign_id` value.
* @param {String} opts.outreachId Restrict results to orders with a specific `outreach_id` value.
* @param {String} opts.customerId Restrict results to orders made by a specific customer.
* @param {Boolean} opts.hasOutreach Restrict results to orders that have an outreach attached. For example, an email campaign or Facebook ad.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Orders} and HTTP response
*/
this.ordersWithHttpInfo = 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']),
'campaign_id': ( opts['campaignId'] ? opts['campaignId'] : opts['campaign_id']),
'outreach_id': ( opts['outreachId'] ? opts['outreachId'] : opts['outreach_id']),
'customer_id': ( opts['customerId'] ? opts['customerId'] : opts['customer_id']),
'has_outreach': ( opts['hasOutreach'] ? opts['hasOutreach'] : opts['has_outreach'])
};
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(
'/ecommerce/orders', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List account orders
* Get information about an account's orders.
* @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 {String} opts.campaignId Restrict results to orders with a specific `campaign_id` value.
* @param {String} opts.outreachId Restrict results to orders with a specific `outreach_id` value.
* @param {String} opts.customerId Restrict results to orders made by a specific customer.
* @param {Boolean} opts.hasOutreach Restrict results to orders that have an outreach attached. For example, an email campaign or Facebook ad.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Orders}
*/
this.orders = function(opts) {
return this.ordersWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List stores
* Get information about all stores in the 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/EcommerceStores} and HTTP response
*/
this.storesWithHttpInfo = 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(
'/ecommerce/stores', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List stores
* Get information about all stores in the 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/EcommerceStores}
*/
this.stores = function(opts) {
return this.storesWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get store info
* Get information about a specific store.
* @param {String} storeId The store id.
* @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/EcommerceStore} and HTTP response
*/
this.getStoreWithHttpInfo = function(storeId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
var pathParams = {
'store_id': storeId
};
/*
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(
'/ecommerce/stores/{store_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get store info
* Get information about a specific store.
* @param {String} storeId The store id.
* @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/EcommerceStore}
*/
this.getStore = function(storeId, opts) {
return this.getStoreWithHttpInfo(storeId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List carts
* Get information about a store's carts.
* @param {String} storeId The store id.
* @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/Carts} and HTTP response
*/
this.getStoreCartsWithHttpInfo = function(storeId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
var pathParams = {
'store_id': storeId
};
/*
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(
'/ecommerce/stores/{store_id}/carts', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List carts
* Get information about a store's carts.
* @param {String} storeId The store id.
* @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/Carts}
*/
this.getStoreCarts = function(storeId, opts) {
return this.getStoreCartsWithHttpInfo(storeId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get cart info
* Get information about a specific cart.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @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/EcommerceCart} and HTTP response
*/
this.getStoreCartWithHttpInfo = function(storeId, cartId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'cartId' is set
if (cartId === undefined || cartId === null) {
throw new Error("Missing the required parameter 'cartId' when calling ");
}
var pathParams = {
'store_id': storeId,
'cart_id': cartId
};
/*
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(
'/ecommerce/stores/{store_id}/carts/{cart_id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get cart info
* Get information about a specific cart.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @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/EcommerceCart}
*/
this.getStoreCart = function(storeId, cartId, opts) {
return this.getStoreCartWithHttpInfo(storeId, cartId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* List cart line items
* Get information about a cart's line items.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @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/CartLines} and HTTP response
*/
this.getAllCartLineItemsWithHttpInfo = function(storeId, cartId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'cartId' is set
if (cartId === undefined || cartId === null) {
throw new Error("Missing the required parameter 'cartId' when calling ");
}
var pathParams = {
'store_id': storeId,
'cart_id': cartId
};
/*
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(
'/ecommerce/stores/{store_id}/carts/{cart_id}/lines', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* List cart line items
* Get information about a cart's line items.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @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/CartLines}
*/
this.getAllCartLineItems = function(storeId, cartId, opts) {
return this.getAllCartLineItemsWithHttpInfo(storeId, cartId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get cart line item
* Get information about a specific cart line item.
* @param {String} storeId The store id.
* @param {String} cartId The id for the cart.
* @param {String} lineId The id for the line item of a cart.
* @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/EcommerceCartLineItem} and HTTP response
*/
this.getCartLineItemWithHttpInfo = function(storeId, cartId, lineId, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'storeId' is set
if (storeId === undefined || storeId === null) {
throw new Error("Missing the required parameter 'storeId' when calling ");
}
// verify the required parameter 'cartId' is set
if (cartId === undefined || cartId === null) {
throw new Error("Missing the required parameter 'cartId' when calling ");
}
// verify the required pa