UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

369 lines (300 loc) 21.5 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** * Infusionsoft REST API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: V1.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * */ var _ApiClient = require('../ApiClient'); var _ApiClient2 = _interopRequireDefault(_ApiClient); var _Campaign = require('../model/Campaign'); var _Campaign2 = _interopRequireDefault(_Campaign); var _CampaignList = require('../model/CampaignList'); var _CampaignList2 = _interopRequireDefault(_CampaignList); var _Error = require('../model/Error'); var _Error2 = _interopRequireDefault(_Error); var _SetOfIds = require('../model/SetOfIds'); var _SetOfIds2 = _interopRequireDefault(_SetOfIds); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Campaign service. * @module api/CampaignApi * @version V1.0 */ var CampaignApi = function () { /** * Constructs a new CampaignApi. * @alias module:api/CampaignApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function CampaignApi(apiClient) { _classCallCheck(this, CampaignApi); this.apiClient = apiClient || _ApiClient2.default.instance; } /** * Callback function to receive the result of the addContactsToCampaignSequenceUsingPOST operation. * @callback module:api/CampaignApi~addContactsToCampaignSequenceUsingPOSTCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Add to Campaign Sequence * Adds a single contact to a campaign sequence * @param {Number} campaignId campaignId * @param {Number} sequenceId sequenceId * @param {Number} contactId contactId * @param {module:api/CampaignApi~addContactsToCampaignSequenceUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response */ _createClass(CampaignApi, [{ key: 'addContactsToCampaignSequenceUsingPOST', value: function addContactsToCampaignSequenceUsingPOST(campaignId, sequenceId, contactId, callback) { var postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new _Error2.default("Missing the required parameter 'campaignId' when calling addContactsToCampaignSequenceUsingPOST"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new _Error2.default("Missing the required parameter 'sequenceId' when calling addContactsToCampaignSequenceUsingPOST"); } // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling addContactsToCampaignSequenceUsingPOST"); } var pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId, 'contactId': contactId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/campaigns/{campaignId}/sequences/{sequenceId}/contacts/{contactId}', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the addContactsToCampaignSequenceUsingPOST1 operation. * @callback module:api/CampaignApi~addContactsToCampaignSequenceUsingPOST1Callback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Add Multiple to Campaign Sequence * Adds a list of contacts to a campaign sequence * @param {Number} campaignId campaignId * @param {Number} sequenceId sequenceId * @param {module:model/SetOfIds} ids ids * @param {module:api/CampaignApi~addContactsToCampaignSequenceUsingPOST1Callback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'addContactsToCampaignSequenceUsingPOST1', value: function addContactsToCampaignSequenceUsingPOST1(campaignId, sequenceId, ids, callback) { var postBody = ids; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new _Error2.default("Missing the required parameter 'campaignId' when calling addContactsToCampaignSequenceUsingPOST1"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new _Error2.default("Missing the required parameter 'sequenceId' when calling addContactsToCampaignSequenceUsingPOST1"); } // verify the required parameter 'ids' is set if (ids === undefined || ids === null) { throw new _Error2.default("Missing the required parameter 'ids' when calling addContactsToCampaignSequenceUsingPOST1"); } var pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/campaigns/{campaignId}/sequences/{sequenceId}/contacts', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getAllCampaignsUsingGET operation. * @callback module:api/CampaignApi~getAllCampaignsUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/CampaignList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Campaigns * Retrieves all campaigns for the authenticated user * @param {Object} opts Optional parameters * @param {Number} opts.limit Sets a total of items to return * @param {Number} opts.offset Sets a beginning range of items to return * @param {module:api/CampaignApi~getAllCampaignsUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/CampaignList} */ }, { key: 'getAllCampaignsUsingGET', value: function getAllCampaignsUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _CampaignList2.default; return this.apiClient.callApi('/campaigns', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getCampaignUsingGET operation. * @callback module:api/CampaignApi~getCampaignUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Campaign} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve a Campaign * Retrieves a single campaign * @param {Number} campaignId campaignId * @param {Object} opts Optional parameters * @param {Array.<String>} opts.optionalProperties Comma-delimited list of Campaign properties to include in the response. (The fields &#x60;goals&#x60; and &#x60;sequences&#x60; aren&#39;t included, by default.) * @param {module:api/CampaignApi~getCampaignUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Campaign} */ }, { key: 'getCampaignUsingGET', value: function getCampaignUsingGET(campaignId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new _Error2.default("Missing the required parameter 'campaignId' when calling getCampaignUsingGET"); } var pathParams = { 'campaignId': campaignId }; var queryParams = { 'optional_properties': this.apiClient.buildCollectionParam(opts['optionalProperties'], 'multi') }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Campaign2.default; return this.apiClient.callApi('/campaigns/{campaignId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the removeContactsFromCampaignSequenceUsingDELETE operation. * @callback module:api/CampaignApi~removeContactsFromCampaignSequenceUsingDELETECallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Remove from Campaign Sequence * Removes a single contact from a campaign sequence * @param {Number} campaignId campaignId * @param {Number} sequenceId sequenceId * @param {Number} contactId contactId * @param {module:api/CampaignApi~removeContactsFromCampaignSequenceUsingDELETECallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'removeContactsFromCampaignSequenceUsingDELETE', value: function removeContactsFromCampaignSequenceUsingDELETE(campaignId, sequenceId, contactId, callback) { var postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new _Error2.default("Missing the required parameter 'campaignId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new _Error2.default("Missing the required parameter 'sequenceId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } var pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId, 'contactId': contactId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/campaigns/{campaignId}/sequences/{sequenceId}/contacts/{contactId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the removeContactsFromCampaignSequenceUsingDELETE1 operation. * @callback module:api/CampaignApi~removeContactsFromCampaignSequenceUsingDELETE1Callback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Remove Multiple from Campaign Sequence * Removes a list of contacts from a campaign sequence * @param {Number} campaignId campaignId * @param {Number} sequenceId sequenceId * @param {module:model/SetOfIds} ids ids * @param {module:api/CampaignApi~removeContactsFromCampaignSequenceUsingDELETE1Callback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'removeContactsFromCampaignSequenceUsingDELETE1', value: function removeContactsFromCampaignSequenceUsingDELETE1(campaignId, sequenceId, ids, callback) { var postBody = ids; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new _Error2.default("Missing the required parameter 'campaignId' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new _Error2.default("Missing the required parameter 'sequenceId' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } // verify the required parameter 'ids' is set if (ids === undefined || ids === null) { throw new _Error2.default("Missing the required parameter 'ids' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } var pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/campaigns/{campaignId}/sequences/{sequenceId}/contacts', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } }]); return CampaignApi; }(); exports.default = CampaignApi;