File: /var/www/fintechfuel/node_modules/pipedrive/dist/api/PipelinesApi.js
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _AddNewPipeline = _interopRequireDefault(require("../model/AddNewPipeline"));
var _DeletePipelineResponse = _interopRequireDefault(require("../model/DeletePipelineResponse200"));
var _EditPipeline = _interopRequireDefault(require("../model/EditPipeline"));
var _GetAllPipelines = _interopRequireDefault(require("../model/GetAllPipelines"));
var _GetDealsConversionRatesInPipeline = _interopRequireDefault(require("../model/GetDealsConversionRatesInPipeline"));
var _GetDealsMovementsInPipeline = _interopRequireDefault(require("../model/GetDealsMovementsInPipeline"));
var _GetOnePipeline = _interopRequireDefault(require("../model/GetOnePipeline"));
var _GetStageDeals = _interopRequireDefault(require("../model/GetStageDeals"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _Pipeline = _interopRequireDefault(require("../model/Pipeline"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
/**
* Pipelines service.
* @module api/PipelinesApi
* @version 1.0.0
*/
var PipelinesApi = /*#__PURE__*/function () {
/**
* Constructs a new PipelinesApi.
* @alias module:api/PipelinesApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function PipelinesApi(apiClient) {
(0, _classCallCheck2["default"])(this, PipelinesApi);
this.apiClient = apiClient;
}
/**
* Add a new pipeline
* Adds a new pipeline.
* @param {Object} opts Optional parameters
* @param {module:model/Pipeline} opts.pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddNewPipeline} and HTTP response
*/
(0, _createClass2["default"])(PipelinesApi, [{
key: "addPipelineWithHttpInfo",
value: function addPipelineWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['pipeline'];
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = ['application/json'];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _AddNewPipeline["default"];
return this.apiClient.callApi('/pipelines', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a new pipeline
* Adds a new pipeline.
* @param {Object} opts Optional parameters
* @param {module:model/Pipeline} opts.pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddNewPipeline}
*/
}, {
key: "addPipeline",
value: function addPipeline(opts) {
return this.addPipelineWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a pipeline
* Marks a pipeline as deleted.
* @param {Number} id The ID of the pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeletePipelineResponse200} and HTTP response
*/
}, {
key: "deletePipelineWithHttpInfo",
value: function deletePipelineWithHttpInfo(id) {
var opts = {};
var postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling deletePipeline");
}
var pathParams = {
'id': id
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _DeletePipelineResponse["default"];
return this.apiClient.callApi('/pipelines/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a pipeline
* Marks a pipeline as deleted.
* @param {Number} id The ID of the pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeletePipelineResponse200}
*/
}, {
key: "deletePipeline",
value: function deletePipeline(id) {
return this.deletePipelineWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get one pipeline
* Returns data about a specific pipeline. Also returns the summary of the deals in this pipeline across its stages.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned in `deals_summary` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetOnePipeline} and HTTP response
*/
}, {
key: "getPipelineWithHttpInfo",
value: function getPipelineWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getPipeline");
}
var pathParams = {
'id': id
};
var queryParams = {
'totals_convert_currency': opts['totals_convert_currency'] === undefined ? opts['totalsConvertCurrency'] : opts['totals_convert_currency']
};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetOnePipeline["default"];
return this.apiClient.callApi('/pipelines/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get one pipeline
* Returns data about a specific pipeline. Also returns the summary of the deals in this pipeline across its stages.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned in `deals_summary` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetOnePipeline}
*/
}, {
key: "getPipeline",
value: function getPipeline(id, opts) {
return this.getPipelineWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get deals conversion rates in pipeline
* Returns all stage-to-stage conversion and pipeline-to-close rates for the given time period.
* @param {Number} id The ID of the pipeline
* @param {Date} startDate The start of the period. Date in format of YYYY-MM-DD.
* @param {Date} endDate The end of the period. Date in format of YYYY-MM-DD.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDealsConversionRatesInPipeline} and HTTP response
*/
}, {
key: "getPipelineConversionStatisticsWithHttpInfo",
value: function getPipelineConversionStatisticsWithHttpInfo(id, startDate, endDate, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getPipelineConversionStatistics");
}
// verify the required parameter 'startDate' is set
if (startDate === undefined || startDate === null) {
throw new Error("Missing the required parameter 'startDate' when calling getPipelineConversionStatistics");
}
// verify the required parameter 'endDate' is set
if (endDate === undefined || endDate === null) {
throw new Error("Missing the required parameter 'endDate' when calling getPipelineConversionStatistics");
}
var pathParams = {
'id': id
};
var queryParams = {
'start_date': startDate,
'end_date': endDate,
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id']
};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetDealsConversionRatesInPipeline["default"];
return this.apiClient.callApi('/pipelines/{id}/conversion_statistics', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get deals conversion rates in pipeline
* Returns all stage-to-stage conversion and pipeline-to-close rates for the given time period.
* @param {Number} id The ID of the pipeline
* @param {Date} startDate The start of the period. Date in format of YYYY-MM-DD.
* @param {Date} endDate The end of the period. Date in format of YYYY-MM-DD.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId The ID of the user who's pipeline metrics statistics to fetch. If omitted, the authorized user will be used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDealsConversionRatesInPipeline}
*/
}, {
key: "getPipelineConversionStatistics",
value: function getPipelineConversionStatistics(id, startDate, endDate, opts) {
return this.getPipelineConversionStatisticsWithHttpInfo(id, startDate, endDate, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get deals in a pipeline
* Lists deals in a specific pipeline across all its stages.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {Number} opts.filterId If supplied, only deals matching the given filter will be returned
* @param {Number} opts.userId If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned.
* @param {module:model/NumberBoolean} opts.everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.getSummary Whether to include a summary of the pipeline in the `additional_data` or not
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetStageDeals} and HTTP response
*/
}, {
key: "getPipelineDealsWithHttpInfo",
value: function getPipelineDealsWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getPipelineDeals");
}
var pathParams = {
'id': id
};
var queryParams = {
'filter_id': opts['filter_id'] === undefined ? opts['filterId'] : opts['filter_id'],
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'everyone': opts['everyone'] === undefined ? opts['everyone'] : opts['everyone'],
'stage_id': opts['stage_id'] === undefined ? opts['stageId'] : opts['stage_id'],
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'get_summary': opts['get_summary'] === undefined ? opts['getSummary'] : opts['get_summary'],
'totals_convert_currency': opts['totals_convert_currency'] === undefined ? opts['totalsConvertCurrency'] : opts['totals_convert_currency']
};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetStageDeals["default"];
return this.apiClient.callApi('/pipelines/{id}/deals', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get deals in a pipeline
* Lists deals in a specific pipeline across all its stages.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {Number} opts.filterId If supplied, only deals matching the given filter will be returned
* @param {Number} opts.userId If supplied, `filter_id` will not be considered and only deals owned by the given user will be returned. If omitted, deals owned by the authorized user will be returned.
* @param {module:model/NumberBoolean} opts.everyone If supplied, `filter_id` and `user_id` will not be considered – instead, deals owned by everyone will be returned
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.getSummary Whether to include a summary of the pipeline in the `additional_data` or not
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `per_stages_converted` is returned inside `deals_summary` inside `additional_data` which contains the currency-converted total amounts in the given currency per each stage. You may also set this parameter to `default_currency` in which case users default currency is used. Only works when `get_summary` parameter flag is enabled.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetStageDeals}
*/
}, {
key: "getPipelineDeals",
value: function getPipelineDeals(id, opts) {
return this.getPipelineDealsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get deals movements in pipeline
* Returns statistics for deals movements for the given time period.
* @param {Number} id The ID of the pipeline
* @param {Date} startDate The start of the period. Date in format of YYYY-MM-DD.
* @param {Date} endDate The end of the period. Date in format of YYYY-MM-DD.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDealsMovementsInPipeline} and HTTP response
*/
}, {
key: "getPipelineMovementStatisticsWithHttpInfo",
value: function getPipelineMovementStatisticsWithHttpInfo(id, startDate, endDate, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getPipelineMovementStatistics");
}
// verify the required parameter 'startDate' is set
if (startDate === undefined || startDate === null) {
throw new Error("Missing the required parameter 'startDate' when calling getPipelineMovementStatistics");
}
// verify the required parameter 'endDate' is set
if (endDate === undefined || endDate === null) {
throw new Error("Missing the required parameter 'endDate' when calling getPipelineMovementStatistics");
}
var pathParams = {
'id': id
};
var queryParams = {
'start_date': startDate,
'end_date': endDate,
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id']
};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetDealsMovementsInPipeline["default"];
return this.apiClient.callApi('/pipelines/{id}/movement_statistics', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get deals movements in pipeline
* Returns statistics for deals movements for the given time period.
* @param {Number} id The ID of the pipeline
* @param {Date} startDate The start of the period. Date in format of YYYY-MM-DD.
* @param {Date} endDate The end of the period. Date in format of YYYY-MM-DD.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId The ID of the user who's pipeline statistics to fetch. If omitted, the authorized user will be used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDealsMovementsInPipeline}
*/
}, {
key: "getPipelineMovementStatistics",
value: function getPipelineMovementStatistics(id, startDate, endDate, opts) {
return this.getPipelineMovementStatisticsWithHttpInfo(id, startDate, endDate, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all pipelines
* Returns data about all pipelines.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetAllPipelines} and HTTP response
*/
}, {
key: "getPipelinesWithHttpInfo",
value: function getPipelinesWithHttpInfo() {
var opts = {};
var postBody = null;
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetAllPipelines["default"];
return this.apiClient.callApi('/pipelines', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all pipelines
* Returns data about all pipelines.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetAllPipelines}
*/
}, {
key: "getPipelines",
value: function getPipelines() {
return this.getPipelinesWithHttpInfo().then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a pipeline
* Updates the properties of a pipeline.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {module:model/Pipeline} opts.pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EditPipeline} and HTTP response
*/
}, {
key: "updatePipelineWithHttpInfo",
value: function updatePipelineWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['pipeline'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updatePipeline");
}
var pathParams = {
'id': id
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = ['application/json'];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _EditPipeline["default"];
return this.apiClient.callApi('/pipelines/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a pipeline
* Updates the properties of a pipeline.
* @param {Number} id The ID of the pipeline
* @param {Object} opts Optional parameters
* @param {module:model/Pipeline} opts.pipeline
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EditPipeline}
*/
}, {
key: "updatePipeline",
value: function updatePipeline(id, opts) {
return this.updatePipelineWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return PipelinesApi;
}();
exports["default"] = PipelinesApi;