UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

307 lines (249 loc) 18.7 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 _Error = require('../model/Error'); var _Error2 = _interopRequireDefault(_Error); var _Opportunity = require('../model/Opportunity'); var _Opportunity2 = _interopRequireDefault(_Opportunity); var _OpportunityList = require('../model/OpportunityList'); var _OpportunityList2 = _interopRequireDefault(_OpportunityList); var _SalesPipeline = require('../model/SalesPipeline'); var _SalesPipeline2 = _interopRequireDefault(_SalesPipeline); 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"); } } /** * Opportunity service. * @module api/OpportunityApi * @version V1.0 */ var OpportunityApi = function () { /** * Constructs a new OpportunityApi. * @alias module:api/OpportunityApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function OpportunityApi(apiClient) { _classCallCheck(this, OpportunityApi); this.apiClient = apiClient || _ApiClient2.default.instance; } /** * Callback function to receive the result of the createOpportunityUsingPOST operation. * @callback module:api/OpportunityApi~createOpportunityUsingPOSTCallback * @param {String} error Error message, if any. * @param {module:model/Opportunity} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create an Opportunity * Creates a new opportunity as the authenticated user. NB: Opportunity must contain values for &#x60;opportunity_title&#x60;, &#x60;contact&#x60;, and &#x60;stage&#x60;. * @param {Object} opts Optional parameters * @param {module:model/Opportunity} opts.opportunity opportunity * @param {module:api/OpportunityApi~createOpportunityUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Opportunity} */ _createClass(OpportunityApi, [{ key: 'createOpportunityUsingPOST', value: function createOpportunityUsingPOST(opts, callback) { opts = opts || {}; var postBody = opts['opportunity']; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Opportunity2.default; return this.apiClient.callApi('/opportunities', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getOpportunityUsingGET operation. * @callback module:api/OpportunityApi~getOpportunityUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Opportunity} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve an Opportunity * Retrives a single opportunity * @param {Number} opportunityId opportunityId * @param {module:api/OpportunityApi~getOpportunityUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Opportunity} */ }, { key: 'getOpportunityUsingGET', value: function getOpportunityUsingGET(opportunityId, callback) { var postBody = null; // verify the required parameter 'opportunityId' is set if (opportunityId === undefined || opportunityId === null) { throw new _Error2.default("Missing the required parameter 'opportunityId' when calling getOpportunityUsingGET"); } var pathParams = { 'opportunityId': opportunityId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Opportunity2.default; return this.apiClient.callApi('/opportunities/{opportunityId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getStagePipelineUsingGET operation. * @callback module:api/OpportunityApi~getStagePipelineUsingGETCallback * @param {String} error Error message, if any. * @param {Array.<module:model/SalesPipeline>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Opportunity Stage Pipeline * Retrieves a list of all opportunity stages with pipeline details * @param {module:api/OpportunityApi~getStagePipelineUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/SalesPipeline>} */ }, { key: 'getStagePipelineUsingGET', value: function getStagePipelineUsingGET(callback) { var postBody = null; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = [_SalesPipeline2.default]; return this.apiClient.callApi('/opportunity/stage_pipeline', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the listOpportunitiesUsingGET operation. * @callback module:api/OpportunityApi~listOpportunitiesUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/OpportunityList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Opportunities * Retrieves a list of all opportunities * @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 {Number} opts.userId Returns opportunities for the provided user id * @param {Number} opts.stageId Returns opportunities for the provided stage id * @param {String} opts.searchTerm Returns opportunities that match any of the contact&#39;s &#x60;given_name&#x60;, &#x60;family_name&#x60;, &#x60;company_name&#x60;, and &#x60;email_addresses&#x60; (searches &#x60;EMAIL1&#x60; only) fields as well as &#x60;opportunity_title&#x60; * @param {module:model/String} opts.order Attribute to order items by * @param {module:api/OpportunityApi~listOpportunitiesUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/OpportunityList} */ }, { key: 'listOpportunitiesUsingGET', value: function listOpportunitiesUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'], 'user_id': opts['userId'], 'stage_id': opts['stageId'], 'search_term': opts['searchTerm'], 'order': opts['order'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _OpportunityList2.default; return this.apiClient.callApi('/opportunities', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the replaceOpportunityUsingPUT operation. * @callback module:api/OpportunityApi~replaceOpportunityUsingPUTCallback * @param {String} error Error message, if any. * @param {module:model/Opportunity} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Replace an Opportunity * Replaces all values of a given opportunity * @param {Object} opts Optional parameters * @param {module:model/Opportunity} opts.opportunity opportunity * @param {module:api/OpportunityApi~replaceOpportunityUsingPUTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Opportunity} */ }, { key: 'replaceOpportunityUsingPUT', value: function replaceOpportunityUsingPUT(opts, callback) { opts = opts || {}; var postBody = opts['opportunity']; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Opportunity2.default; return this.apiClient.callApi('/opportunities', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the updateOpportunityUsingPATCH operation. * @callback module:api/OpportunityApi~updateOpportunityUsingPATCHCallback * @param {String} error Error message, if any. * @param {module:model/Opportunity} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Update an Opportunity * Updates an opportunity with only the values provided in the request. * @param {Number} opportunityId opportunityId * @param {Object} opts Optional parameters * @param {module:model/Opportunity} opts.opportunity opportunity * @param {module:api/OpportunityApi~updateOpportunityUsingPATCHCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Opportunity} */ }, { key: 'updateOpportunityUsingPATCH', value: function updateOpportunityUsingPATCH(opportunityId, opts, callback) { opts = opts || {}; var postBody = opts['opportunity']; // verify the required parameter 'opportunityId' is set if (opportunityId === undefined || opportunityId === null) { throw new _Error2.default("Missing the required parameter 'opportunityId' when calling updateOpportunityUsingPATCH"); } var pathParams = { 'opportunityId': opportunityId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Opportunity2.default; return this.apiClient.callApi('/opportunities/{opportunityId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } }]); return OpportunityApi; }(); exports.default = OpportunityApi;