UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

313 lines (267 loc) 11.1 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 Error from '../model/Error'; import Opportunity from '../model/Opportunity'; import OpportunityList from '../model/OpportunityList'; import SalesPipeline from '../model/SalesPipeline'; /** * Opportunity service. * @module api/OpportunityApi * @version V1.0 */ export default class OpportunityApi { /** * 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. */ constructor(apiClient) { this.apiClient = apiClient || ApiClient.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} */ createOpportunityUsingPOST(opts, callback) { opts = opts || {}; let postBody = opts['opportunity']; let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Opportunity; 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} */ getOpportunityUsingGET(opportunityId, callback) { let postBody = null; // verify the required parameter 'opportunityId' is set if (opportunityId === undefined || opportunityId === null) { throw new Error("Missing the required parameter 'opportunityId' when calling getOpportunityUsingGET"); } let pathParams = { 'opportunityId': opportunityId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Opportunity; 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>} */ getStagePipelineUsingGET(callback) { let postBody = null; let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = [SalesPipeline]; 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} */ listOpportunitiesUsingGET(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'limit': opts['limit'], 'offset': opts['offset'], 'user_id': opts['userId'], 'stage_id': opts['stageId'], 'search_term': opts['searchTerm'], 'order': opts['order'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = OpportunityList; 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} */ replaceOpportunityUsingPUT(opts, callback) { opts = opts || {}; let postBody = opts['opportunity']; let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Opportunity; 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} */ updateOpportunityUsingPATCH(opportunityId, opts, callback) { opts = opts || {}; let postBody = opts['opportunity']; // verify the required parameter 'opportunityId' is set if (opportunityId === undefined || opportunityId === null) { throw new Error("Missing the required parameter 'opportunityId' when calling updateOpportunityUsingPATCH"); } let pathParams = { 'opportunityId': opportunityId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Opportunity; return this.apiClient.callApi( '/opportunities/{opportunityId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }