UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

371 lines (314 loc) 13.8 kB
/** * 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. * */ import ApiClient from "../ApiClient"; import Campaign from '../model/Campaign'; import CampaignList from '../model/CampaignList'; import Error from '../model/Error'; import SetOfIds from '../model/SetOfIds'; /** * Campaign service. * @module api/CampaignApi * @version V1.0 */ export default class CampaignApi { /** * 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. */ constructor(apiClient) { this.apiClient = apiClient || ApiClient.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 */ addContactsToCampaignSequenceUsingPOST(campaignId, sequenceId, contactId, callback) { let postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new Error("Missing the required parameter 'campaignId' when calling addContactsToCampaignSequenceUsingPOST"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new Error("Missing the required parameter 'sequenceId' when calling addContactsToCampaignSequenceUsingPOST"); } // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new Error("Missing the required parameter 'contactId' when calling addContactsToCampaignSequenceUsingPOST"); } let pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId, 'contactId': contactId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let 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 */ addContactsToCampaignSequenceUsingPOST1(campaignId, sequenceId, ids, callback) { let postBody = ids; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new Error("Missing the required parameter 'campaignId' when calling addContactsToCampaignSequenceUsingPOST1"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new Error("Missing the required parameter 'sequenceId' when calling addContactsToCampaignSequenceUsingPOST1"); } // verify the required parameter 'ids' is set if (ids === undefined || ids === null) { throw new Error("Missing the required parameter 'ids' when calling addContactsToCampaignSequenceUsingPOST1"); } let pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let 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} */ getAllCampaignsUsingGET(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'limit': opts['limit'], 'offset': opts['offset'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = CampaignList; 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} */ getCampaignUsingGET(campaignId, opts, callback) { opts = opts || {}; let postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new Error("Missing the required parameter 'campaignId' when calling getCampaignUsingGET"); } let pathParams = { 'campaignId': campaignId }; let queryParams = { 'optional_properties': this.apiClient.buildCollectionParam(opts['optionalProperties'], 'multi') }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Campaign; 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 */ removeContactsFromCampaignSequenceUsingDELETE(campaignId, sequenceId, contactId, callback) { let postBody = null; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new Error("Missing the required parameter 'campaignId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new Error("Missing the required parameter 'sequenceId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new Error("Missing the required parameter 'contactId' when calling removeContactsFromCampaignSequenceUsingDELETE"); } let pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId, 'contactId': contactId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let 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 */ removeContactsFromCampaignSequenceUsingDELETE1(campaignId, sequenceId, ids, callback) { let postBody = ids; // verify the required parameter 'campaignId' is set if (campaignId === undefined || campaignId === null) { throw new Error("Missing the required parameter 'campaignId' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } // verify the required parameter 'sequenceId' is set if (sequenceId === undefined || sequenceId === null) { throw new Error("Missing the required parameter 'sequenceId' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } // verify the required parameter 'ids' is set if (ids === undefined || ids === null) { throw new Error("Missing the required parameter 'ids' when calling removeContactsFromCampaignSequenceUsingDELETE1"); } let pathParams = { 'campaignId': campaignId, 'sequenceId': sequenceId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/campaigns/{campaignId}/sequences/{sequenceId}/contacts', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }