File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/DealsApi.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 _AddDealFollowerRequest = _interopRequireDefault(require("../model/AddDealFollowerRequest"));
var _AddDealParticipantRequest = _interopRequireDefault(require("../model/AddDealParticipantRequest"));
var _AddedDealFollower = _interopRequireDefault(require("../model/AddedDealFollower"));
var _ChangelogResponse = _interopRequireDefault(require("../model/ChangelogResponse"));
var _DealFlowResponse = _interopRequireDefault(require("../model/DealFlowResponse"));
var _DealListActivitiesResponse = _interopRequireDefault(require("../model/DealListActivitiesResponse"));
var _DealParticipants = _interopRequireDefault(require("../model/DealParticipants"));
var _DealSearchResponse = _interopRequireDefault(require("../model/DealSearchResponse"));
var _DeleteDeal = _interopRequireDefault(require("../model/DeleteDeal"));
var _DeleteDealFollower = _interopRequireDefault(require("../model/DeleteDealFollower"));
var _DeleteDealParticipant = _interopRequireDefault(require("../model/DeleteDealParticipant"));
var _DeleteDealProduct = _interopRequireDefault(require("../model/DeleteDealProduct"));
var _DeleteMultipleDeals = _interopRequireDefault(require("../model/DeleteMultipleDeals"));
var _FailResponse = _interopRequireDefault(require("../model/FailResponse"));
var _GetAddProductAttachementDetails = _interopRequireDefault(require("../model/GetAddProductAttachementDetails"));
var _GetAddedDeal = _interopRequireDefault(require("../model/GetAddedDeal"));
var _GetDeal = _interopRequireDefault(require("../model/GetDeal"));
var _GetDeals = _interopRequireDefault(require("../model/GetDeals"));
var _GetDealsCollection = _interopRequireDefault(require("../model/GetDealsCollection"));
var _GetDealsSummary = _interopRequireDefault(require("../model/GetDealsSummary"));
var _GetDealsTimeline = _interopRequireDefault(require("../model/GetDealsTimeline"));
var _GetDuplicatedDeal = _interopRequireDefault(require("../model/GetDuplicatedDeal"));
var _GetMergedDeal = _interopRequireDefault(require("../model/GetMergedDeal"));
var _GetProductAttachementDetails = _interopRequireDefault(require("../model/GetProductAttachementDetails"));
var _ListFilesResponse = _interopRequireDefault(require("../model/ListFilesResponse"));
var _ListFollowersResponse = _interopRequireDefault(require("../model/ListFollowersResponse"));
var _ListMailMessagesResponse = _interopRequireDefault(require("../model/ListMailMessagesResponse"));
var _ListPermittedUsersResponse = _interopRequireDefault(require("../model/ListPermittedUsersResponse"));
var _ListPersonsResponse = _interopRequireDefault(require("../model/ListPersonsResponse"));
var _ListProductsResponse = _interopRequireDefault(require("../model/ListProductsResponse"));
var _MergeDealsRequest = _interopRequireDefault(require("../model/MergeDealsRequest"));
var _NewDeal = _interopRequireDefault(require("../model/NewDeal"));
var _NewDealProduct = _interopRequireDefault(require("../model/NewDealProduct"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _ParticipantsChangelog = _interopRequireDefault(require("../model/ParticipantsChangelog"));
var _PostDealParticipants = _interopRequireDefault(require("../model/PostDealParticipants"));
var _UpdateDealProduct = _interopRequireDefault(require("../model/UpdateDealProduct"));
var _UpdateDealRequest = _interopRequireDefault(require("../model/UpdateDealRequest"));
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; } /**
* Pipedrive API v1
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
/**
* Deals service.
* @module api/DealsApi
* @version 1.0.0
*/
var DealsApi = /*#__PURE__*/function () {
/**
* Constructs a new DealsApi.
* @alias module:api/DealsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function DealsApi(apiClient) {
(0, _classCallCheck2["default"])(this, DealsApi);
this.apiClient = apiClient;
}
/**
* Add a deal
* Adds a new deal. All deals created through the Pipedrive API will have a `origin` set to `API`. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for `key` values. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/creating-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">adding a deal</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewDeal} opts.newDeal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetAddedDeal} and HTTP response
*/
(0, _createClass2["default"])(DealsApi, [{
key: "addDealWithHttpInfo",
value: function addDealWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['newDeal'];
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 = _GetAddedDeal["default"];
return this.apiClient.callApi('/deals', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a deal
* Adds a new deal. All deals created through the Pipedrive API will have a `origin` set to `API`. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the dealFields and look for `key` values. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/creating-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">adding a deal</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewDeal} opts.newDeal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetAddedDeal}
*/
}, {
key: "addDeal",
value: function addDeal(opts) {
return this.addDealWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add a follower to a deal
* Adds a follower to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/AddDealFollowerRequest} opts.addDealFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddedDealFollower} and HTTP response
*/
}, {
key: "addDealFollowerWithHttpInfo",
value: function addDealFollowerWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['addDealFollowerRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling addDealFollower");
}
if (opts['user_id'] === undefined || opts['user_id'] === null) {
throw new Error("Missing the required parameter 'user_id' when calling addDealFollower");
}
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 = _AddedDealFollower["default"];
return this.apiClient.callApi('/deals/{id}/followers', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a follower to a deal
* Adds a follower to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/AddDealFollowerRequest} opts.addDealFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddedDealFollower}
*/
}, {
key: "addDealFollower",
value: function addDealFollower(id, opts) {
return this.addDealFollowerWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add a participant to a deal
* Adds a participant to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/AddDealParticipantRequest} opts.addDealParticipantRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PostDealParticipants} and HTTP response
*/
}, {
key: "addDealParticipantWithHttpInfo",
value: function addDealParticipantWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['addDealParticipantRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling addDealParticipant");
}
if (opts['person_id'] === undefined || opts['person_id'] === null) {
throw new Error("Missing the required parameter 'person_id' when calling addDealParticipant");
}
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 = _PostDealParticipants["default"];
return this.apiClient.callApi('/deals/{id}/participants', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a participant to a deal
* Adds a participant to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/AddDealParticipantRequest} opts.addDealParticipantRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PostDealParticipants}
*/
}, {
key: "addDealParticipant",
value: function addDealParticipant(id, opts) {
return this.addDealParticipantWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add a product to a deal
* Adds a product to a deal, creating a new item called a deal-product.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/NewDealProduct} opts.newDealProduct
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetAddProductAttachementDetails} and HTTP response
*/
}, {
key: "addDealProductWithHttpInfo",
value: function addDealProductWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['newDealProduct'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling addDealProduct");
}
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 = _GetAddProductAttachementDetails["default"];
return this.apiClient.callApi('/deals/{id}/products', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a product to a deal
* Adds a product to a deal, creating a new item called a deal-product.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/NewDealProduct} opts.newDealProduct
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetAddProductAttachementDetails}
*/
}, {
key: "addDealProduct",
value: function addDealProduct(id, opts) {
return this.addDealProductWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a deal
* Marks a deal as deleted. After 30 days, the deal will be permanently deleted.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteDeal} and HTTP response
*/
}, {
key: "deleteDealWithHttpInfo",
value: function deleteDealWithHttpInfo(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 deleteDeal");
}
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 = _DeleteDeal["default"];
return this.apiClient.callApi('/deals/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a deal
* Marks a deal as deleted. After 30 days, the deal will be permanently deleted.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteDeal}
*/
}, {
key: "deleteDeal",
value: function deleteDeal(id) {
return this.deleteDealWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a follower from a deal
* Deletes a follower from a deal.
* @param {Number} id The ID of the deal
* @param {Number} followerId The ID of the follower
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteDealFollower} and HTTP response
*/
}, {
key: "deleteDealFollowerWithHttpInfo",
value: function deleteDealFollowerWithHttpInfo(id, followerId) {
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 deleteDealFollower");
}
// verify the required parameter 'followerId' is set
if (followerId === undefined || followerId === null) {
throw new Error("Missing the required parameter 'followerId' when calling deleteDealFollower");
}
var pathParams = {
'id': id,
'follower_id': followerId
};
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 = _DeleteDealFollower["default"];
return this.apiClient.callApi('/deals/{id}/followers/{follower_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a follower from a deal
* Deletes a follower from a deal.
* @param {Number} id The ID of the deal
* @param {Number} followerId The ID of the follower
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteDealFollower}
*/
}, {
key: "deleteDealFollower",
value: function deleteDealFollower(id, followerId) {
return this.deleteDealFollowerWithHttpInfo(id, followerId).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a participant from a deal
* Deletes a participant from a deal.
* @param {Number} id The ID of the deal
* @param {Number} dealParticipantId The ID of the participant of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteDealParticipant} and HTTP response
*/
}, {
key: "deleteDealParticipantWithHttpInfo",
value: function deleteDealParticipantWithHttpInfo(id, dealParticipantId) {
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 deleteDealParticipant");
}
// verify the required parameter 'dealParticipantId' is set
if (dealParticipantId === undefined || dealParticipantId === null) {
throw new Error("Missing the required parameter 'dealParticipantId' when calling deleteDealParticipant");
}
var pathParams = {
'id': id,
'deal_participant_id': dealParticipantId
};
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 = _DeleteDealParticipant["default"];
return this.apiClient.callApi('/deals/{id}/participants/{deal_participant_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a participant from a deal
* Deletes a participant from a deal.
* @param {Number} id The ID of the deal
* @param {Number} dealParticipantId The ID of the participant of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteDealParticipant}
*/
}, {
key: "deleteDealParticipant",
value: function deleteDealParticipant(id, dealParticipantId) {
return this.deleteDealParticipantWithHttpInfo(id, dealParticipantId).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete an attached product from a deal
* Deletes a product attachment from a deal, using the `product_attachment_id`.
* @param {Number} id The ID of the deal
* @param {Number} productAttachmentId The product attachment ID
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteDealProduct} and HTTP response
*/
}, {
key: "deleteDealProductWithHttpInfo",
value: function deleteDealProductWithHttpInfo(id, productAttachmentId) {
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 deleteDealProduct");
}
// verify the required parameter 'productAttachmentId' is set
if (productAttachmentId === undefined || productAttachmentId === null) {
throw new Error("Missing the required parameter 'productAttachmentId' when calling deleteDealProduct");
}
var pathParams = {
'id': id,
'product_attachment_id': productAttachmentId
};
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 = _DeleteDealProduct["default"];
return this.apiClient.callApi('/deals/{id}/products/{product_attachment_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete an attached product from a deal
* Deletes a product attachment from a deal, using the `product_attachment_id`.
* @param {Number} id The ID of the deal
* @param {Number} productAttachmentId The product attachment ID
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteDealProduct}
*/
}, {
key: "deleteDealProduct",
value: function deleteDealProduct(id, productAttachmentId) {
return this.deleteDealProductWithHttpInfo(id, productAttachmentId).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete multiple deals in bulk
* Marks multiple deals as deleted. After 30 days, the deals will be permanently deleted.
* @param {String} ids The comma-separated IDs that will be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteMultipleDeals} and HTTP response
*/
}, {
key: "deleteDealsWithHttpInfo",
value: function deleteDealsWithHttpInfo(ids) {
var opts = {};
var postBody = null;
// verify the required parameter 'ids' is set
if (ids === undefined || ids === null) {
throw new Error("Missing the required parameter 'ids' when calling deleteDeals");
}
var pathParams = {};
var queryParams = {
'ids': ids
};
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 = _DeleteMultipleDeals["default"];
return this.apiClient.callApi('/deals', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete multiple deals in bulk
* Marks multiple deals as deleted. After 30 days, the deals will be permanently deleted.
* @param {String} ids The comma-separated IDs that will be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteMultipleDeals}
*/
}, {
key: "deleteDeals",
value: function deleteDeals(ids) {
return this.deleteDealsWithHttpInfo(ids).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Duplicate deal
* Duplicates a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDuplicatedDeal} and HTTP response
*/
}, {
key: "duplicateDealWithHttpInfo",
value: function duplicateDealWithHttpInfo(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 duplicateDeal");
}
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 = _GetDuplicatedDeal["default"];
return this.apiClient.callApi('/deals/{id}/duplicate', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Duplicate deal
* Duplicates a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDuplicatedDeal}
*/
}, {
key: "duplicateDeal",
value: function duplicateDeal(id) {
return this.duplicateDealWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get details of a deal
* Returns the details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of dealFields. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/getting-details-of-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">getting details of a deal</a>.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDeal} and HTTP response
*/
}, {
key: "getDealWithHttpInfo",
value: function getDealWithHttpInfo(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 getDeal");
}
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 = _GetDeal["default"];
return this.apiClient.callApi('/deals/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get details of a deal
* Returns the details of a specific deal. Note that this also returns some additional fields which are not present when asking for all deals – such as deal age and stay in pipeline stages. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of dealFields. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/getting-details-of-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">getting details of a deal</a>.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDeal}
*/
}, {
key: "getDeal",
value: function getDeal(id) {
return this.getDealWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List activities associated with a deal
* Lists activities associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities.
* @param {String} opts.exclude A comma-separated string of activity IDs to exclude from result
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DealListActivitiesResponse} and HTTP response
*/
}, {
key: "getDealActivitiesWithHttpInfo",
value: function getDealActivitiesWithHttpInfo(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 getDealActivities");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'done': opts['done'] === undefined ? opts['done'] : opts['done'],
'exclude': opts['exclude'] === undefined ? opts['exclude'] : opts['exclude']
};
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 = _DealListActivitiesResponse["default"];
return this.apiClient.callApi('/deals/{id}/activities', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List activities associated with a deal
* Lists activities associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities.
* @param {String} opts.exclude A comma-separated string of activity IDs to exclude from result
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DealListActivitiesResponse}
*/
}, {
key: "getDealActivities",
value: function getDealActivities(id, opts) {
return this.getDealActivitiesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about deal field values
* Lists updates about field values of a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ChangelogResponse} and HTTP response
*/
}, {
key: "getDealChangelogWithHttpInfo",
value: function getDealChangelogWithHttpInfo(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 getDealChangelog");
}
var pathParams = {
'id': id
};
var queryParams = {
'cursor': opts['cursor'] === undefined ? opts['cursor'] : opts['cursor'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _ChangelogResponse["default"];
return this.apiClient.callApi('/deals/{id}/changelog', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about deal field values
* Lists updates about field values of a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ChangelogResponse}
*/
}, {
key: "getDealChangelog",
value: function getDealChangelog(id, opts) {
return this.getDealChangelogWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List files attached to a deal
* Lists files associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListFilesResponse} and HTTP response
*/
}, {
key: "getDealFilesWithHttpInfo",
value: function getDealFilesWithHttpInfo(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 getDealFiles");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'sort': opts['sort'] === undefined ? opts['sort'] : opts['sort']
};
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 = _ListFilesResponse["default"];
return this.apiClient.callApi('/deals/{id}/files', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List files attached to a deal
* Lists files associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListFilesResponse}
*/
}, {
key: "getDealFiles",
value: function getDealFiles(id, opts) {
return this.getDealFilesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List followers of a deal
* Lists the followers of a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListFollowersResponse} and HTTP response
*/
}, {
key: "getDealFollowersWithHttpInfo",
value: function getDealFollowersWithHttpInfo(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 getDealFollowers");
}
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 = _ListFollowersResponse["default"];
return this.apiClient.callApi('/deals/{id}/followers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List followers of a deal
* Lists the followers of a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListFollowersResponse}
*/
}, {
key: "getDealFollowers",
value: function getDealFollowers(id) {
return this.getDealFollowersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List mail messages associated with a deal
* Lists mail messages associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListMailMessagesResponse} and HTTP response
*/
}, {
key: "getDealMailMessagesWithHttpInfo",
value: function getDealMailMessagesWithHttpInfo(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 getDealMailMessages");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _ListMailMessagesResponse["default"];
return this.apiClient.callApi('/deals/{id}/mailMessages', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List mail messages associated with a deal
* Lists mail messages associated with a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListMailMessagesResponse}
*/
}, {
key: "getDealMailMessages",
value: function getDealMailMessages(id, opts) {
return this.getDealMailMessagesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List participants of a deal
* Lists the participants associated with a deal.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DealParticipants} and HTTP response
*/
}, {
key: "getDealParticipantsWithHttpInfo",
value: function getDealParticipantsWithHttpInfo(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 getDealParticipants");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _DealParticipants["default"];
return this.apiClient.callApi('/deals/{id}/participants', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List participants of a deal
* Lists the participants associated with a deal.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DealParticipants}
*/
}, {
key: "getDealParticipants",
value: function getDealParticipants(id, opts) {
return this.getDealParticipantsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about participants of a deal
* List updates about participants of a deal. This is a cursor-paginated endpoint. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.limit Items shown per page
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ParticipantsChangelog} and HTTP response
*/
}, {
key: "getDealParticipantsChangelogWithHttpInfo",
value: function getDealParticipantsChangelogWithHttpInfo(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 getDealParticipantsChangelog");
}
var pathParams = {
'id': id
};
var queryParams = {
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'cursor': opts['cursor'] === undefined ? opts['cursor'] : opts['cursor']
};
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 = _ParticipantsChangelog["default"];
return this.apiClient.callApi('/deals/{id}/participantsChangelog', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about participants of a deal
* List updates about participants of a deal. This is a cursor-paginated endpoint. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.limit Items shown per page
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ParticipantsChangelog}
*/
}, {
key: "getDealParticipantsChangelog",
value: function getDealParticipantsChangelog(id, opts) {
return this.getDealParticipantsChangelogWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List all persons associated with a deal
* Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListPersonsResponse} and HTTP response
*/
}, {
key: "getDealPersonsWithHttpInfo",
value: function getDealPersonsWithHttpInfo(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 getDealPersons");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _ListPersonsResponse["default"];
return this.apiClient.callApi('/deals/{id}/persons', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List all persons associated with a deal
* Lists all persons associated with a deal, regardless of whether the person is the primary contact of the deal, or added as a participant.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListPersonsResponse}
*/
}, {
key: "getDealPersons",
value: function getDealPersons(id, opts) {
return this.getDealPersonsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List products attached to a deal
* Lists products attached to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.includeProductData Whether to fetch product data along with each attached product (1) or not (0, default)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListProductsResponse} and HTTP response
*/
}, {
key: "getDealProductsWithHttpInfo",
value: function getDealProductsWithHttpInfo(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 getDealProducts");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'include_product_data': opts['include_product_data'] === undefined ? opts['includeProductData'] : opts['include_product_data']
};
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 = _ListProductsResponse["default"];
return this.apiClient.callApi('/deals/{id}/products', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List products attached to a deal
* Lists products attached to a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.includeProductData Whether to fetch product data along with each attached product (1) or not (0, default)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListProductsResponse}
*/
}, {
key: "getDealProducts",
value: function getDealProducts(id, opts) {
return this.getDealProductsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about a deal
* Lists updates about a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.allChanges Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates.
* @param {String} opts.items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DealFlowResponse} and HTTP response
*/
}, {
key: "getDealUpdatesWithHttpInfo",
value: function getDealUpdatesWithHttpInfo(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 getDealUpdates");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'all_changes': opts['all_changes'] === undefined ? opts['allChanges'] : opts['all_changes'],
'items': opts['items'] === undefined ? opts['items'] : opts['items']
};
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 = _DealFlowResponse["default"];
return this.apiClient.callApi('/deals/{id}/flow', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about a deal
* Lists updates about a deal.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.allChanges Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates.
* @param {String} opts.items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DealFlowResponse}
*/
}, {
key: "getDealUpdates",
value: function getDealUpdates(id, opts) {
return this.getDealUpdatesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List permitted users
* Lists the users permitted to access a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListPermittedUsersResponse} and HTTP response
*/
}, {
key: "getDealUsersWithHttpInfo",
value: function getDealUsersWithHttpInfo(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 getDealUsers");
}
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 = _ListPermittedUsersResponse["default"];
return this.apiClient.callApi('/deals/{id}/permittedUsers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List permitted users
* Lists the users permitted to access a deal.
* @param {Number} id The ID of the deal
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListPermittedUsersResponse}
*/
}, {
key: "getDealUsers",
value: function getDealUsers(id) {
return this.getDealUsersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all deals
* Returns all deals. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/getting-all-deals\" target=\"_blank\" rel=\"noopener noreferrer\">getting all deals</a>.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied.
* @param {Number} opts.filterId The ID of the filter to use
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (default to 'all_not_deleted')
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @param {module:model/NumberBoolean} opts.ownedByYou When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDeals} and HTTP response
*/
}, {
key: "getDealsWithHttpInfo",
value: function getDealsWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'filter_id': opts['filter_id'] === undefined ? opts['filterId'] : opts['filter_id'],
'stage_id': opts['stage_id'] === undefined ? opts['stageId'] : opts['stage_id'],
'status': opts['status'] === undefined ? opts['status'] : opts['status'],
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'sort': opts['sort'] === undefined ? opts['sort'] : opts['sort'],
'owned_by_you': opts['owned_by_you'] === undefined ? opts['ownedByYou'] : opts['owned_by_you']
};
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 = _GetDeals["default"];
return this.apiClient.callApi('/deals', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all deals
* Returns all deals. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/getting-all-deals\" target=\"_blank\" rel=\"noopener noreferrer\">getting all deals</a>.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned. However, `filter_id` and `owned_by_you` takes precedence over `user_id` when supplied.
* @param {Number} opts.filterId The ID of the filter to use
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (default to 'all_not_deleted')
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @param {module:model/NumberBoolean} opts.ownedByYou When supplied, only deals owned by you are returned. However, `filter_id` takes precedence over `owned_by_you` when both are supplied.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDeals}
*/
}, {
key: "getDeals",
value: function getDeals(opts) {
return this.getDealsWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all deals (BETA)
* Returns all deals. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions <a href=\"https://support.pipedrive.com/en/article/global-user-management\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
* @param {String} opts.since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {String} opts.until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDealsCollection} and HTTP response
*/
}, {
key: "getDealsCollectionWithHttpInfo",
value: function getDealsCollectionWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'cursor': opts['cursor'] === undefined ? opts['cursor'] : opts['cursor'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'since': opts['since'] === undefined ? opts['since'] : opts['since'],
'until': opts['until'] === undefined ? opts['until'] : opts['until'],
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'stage_id': opts['stage_id'] === undefined ? opts['stageId'] : opts['stage_id'],
'status': opts['status'] === undefined ? opts['status'] : opts['status']
};
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 = _GetDealsCollection["default"];
return this.apiClient.callApi('/deals/collection', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all deals (BETA)
* Returns all deals. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions <a href=\"https://support.pipedrive.com/en/article/global-user-management\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
* @param {String} opts.since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {String} opts.until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned
* @param {Number} opts.stageId If supplied, only deals within the given stage will be returned
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDealsCollection}
*/
}, {
key: "getDealsCollection",
value: function getDealsCollection(opts) {
return this.getDealsCollectionWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get deals summary
* Returns a summary of all the deals.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost.
* @param {Number} opts.filterId <code>user_id</code> will not be considered. Only deals matching the given filter will be returned.
* @param {Number} opts.userId Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`.
* @param {Number} opts.stageId Only deals within the given stage will be returned
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDealsSummary} and HTTP response
*/
}, {
key: "getDealsSummaryWithHttpInfo",
value: function getDealsSummaryWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'status': opts['status'] === undefined ? opts['status'] : opts['status'],
'filter_id': opts['filter_id'] === undefined ? opts['filterId'] : opts['filter_id'],
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'stage_id': opts['stage_id'] === undefined ? opts['stageId'] : opts['stage_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 = _GetDealsSummary["default"];
return this.apiClient.callApi('/deals/summary', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get deals summary
* Returns a summary of all the deals.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.status Only fetch deals with a specific status. open = Open, won = Won, lost = Lost.
* @param {Number} opts.filterId <code>user_id</code> will not be considered. Only deals matching the given filter will be returned.
* @param {Number} opts.userId Only deals matching the given user will be returned. `user_id` will not be considered if you use `filter_id`.
* @param {Number} opts.stageId Only deals within the given stage will be returned
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDealsSummary}
*/
}, {
key: "getDealsSummary",
value: function getDealsSummary(opts) {
return this.getDealsSummaryWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get deals timeline
* Returns open and won deals, grouped by a defined interval of time set in a date-type dealField (`field_key`) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given `field_key`.
* @param {Date} startDate The date when the first interval starts. Format: YYYY-MM-DD.
* @param {module:model/String} interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table>
* @param {Number} amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months).
* @param {String} fieldKey The date field key which deals will be retrieved from
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned
* @param {Number} opts.pipelineId If supplied, only deals matching the given pipeline will be returned
* @param {Number} opts.filterId If supplied, only deals matching the given filter will be returned
* @param {module:model/NumberBoolean} opts.excludeDeals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned.
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetDealsTimeline} and HTTP response
*/
}, {
key: "getDealsTimelineWithHttpInfo",
value: function getDealsTimelineWithHttpInfo(startDate, interval, amount, fieldKey, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'startDate' is set
if (startDate === undefined || startDate === null) {
throw new Error("Missing the required parameter 'startDate' when calling getDealsTimeline");
}
// verify the required parameter 'interval' is set
if (interval === undefined || interval === null) {
throw new Error("Missing the required parameter 'interval' when calling getDealsTimeline");
}
// verify the required parameter 'amount' is set
if (amount === undefined || amount === null) {
throw new Error("Missing the required parameter 'amount' when calling getDealsTimeline");
}
// verify the required parameter 'fieldKey' is set
if (fieldKey === undefined || fieldKey === null) {
throw new Error("Missing the required parameter 'fieldKey' when calling getDealsTimeline");
}
var pathParams = {};
var queryParams = {
'start_date': startDate,
'interval': interval,
'amount': amount,
'field_key': fieldKey,
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'pipeline_id': opts['pipeline_id'] === undefined ? opts['pipelineId'] : opts['pipeline_id'],
'filter_id': opts['filter_id'] === undefined ? opts['filterId'] : opts['filter_id'],
'exclude_deals': opts['exclude_deals'] === undefined ? opts['excludeDeals'] : opts['exclude_deals'],
'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 = _GetDealsTimeline["default"];
return this.apiClient.callApi('/deals/timeline', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get deals timeline
* Returns open and won deals, grouped by a defined interval of time set in a date-type dealField (`field_key`) — e.g. when month is the chosen interval, and 3 months are asked starting from January 1st, 2012, deals are returned grouped into 3 groups — January, February and March — based on the value of the given `field_key`.
* @param {Date} startDate The date when the first interval starts. Format: YYYY-MM-DD.
* @param {module:model/String} interval The type of the interval<table><tr><th>Value</th><th>Description</th></tr><tr><td>`day`</td><td>Day</td></tr><tr><td>`week`</td><td>A full week (7 days) starting from `start_date`</td></tr><tr><td>`month`</td><td>A full month (depending on the number of days in given month) starting from `start_date`</td></tr><tr><td>`quarter`</td><td>A full quarter (3 months) starting from `start_date`</td></tr></table>
* @param {Number} amount The number of given intervals, starting from `start_date`, to fetch. E.g. 3 (months).
* @param {String} fieldKey The date field key which deals will be retrieved from
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only deals matching the given user will be returned
* @param {Number} opts.pipelineId If supplied, only deals matching the given pipeline will be returned
* @param {Number} opts.filterId If supplied, only deals matching the given filter will be returned
* @param {module:model/NumberBoolean} opts.excludeDeals Whether to exclude deals list (1) or not (0). Note that when deals are excluded, the timeline summary (counts and values) is still returned.
* @param {String} opts.totalsConvertCurrency The 3-letter currency code of any of the supported currencies. When supplied, `totals_converted` is returned per each interval which contains the currency-converted total amounts in the given currency. You may also set this parameter to `default_currency` in which case the user's default currency is used.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetDealsTimeline}
*/
}, {
key: "getDealsTimeline",
value: function getDealsTimeline(startDate, interval, amount, fieldKey, opts) {
return this.getDealsTimelineWithHttpInfo(startDate, interval, amount, fieldKey, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Merge two deals
* Merges a deal with another deal. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-deals\" target=\"_blank\" rel=\"noopener noreferrer\">merging two deals</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/MergeDealsRequest} opts.mergeDealsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetMergedDeal} and HTTP response
*/
}, {
key: "mergeDealsWithHttpInfo",
value: function mergeDealsWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['mergeDealsRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling mergeDeals");
}
if (opts['merge_with_id'] === undefined || opts['merge_with_id'] === null) {
throw new Error("Missing the required parameter 'merge_with_id' when calling mergeDeals");
}
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 = _GetMergedDeal["default"];
return this.apiClient.callApi('/deals/{id}/merge', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Merge two deals
* Merges a deal with another deal. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-deals\" target=\"_blank\" rel=\"noopener noreferrer\">merging two deals</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/MergeDealsRequest} opts.mergeDealsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetMergedDeal}
*/
}, {
key: "mergeDeals",
value: function mergeDeals(id, opts) {
return this.mergeDealsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Search deals
* Searches all deals by title, notes and/or custom fields. This endpoint is a wrapper of <a href=\"https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\">/v1/itemSearch</a> with a narrower OAuth scope. Found deals can be filtered by the person ID and the organization ID.
* @param {String} term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Boolean} opts.exactMatch When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
* @param {Number} opts.personId Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000.
* @param {Number} opts.organizationId Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000.
* @param {module:model/String} opts.status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000.
* @param {module:model/String} opts.includeFields Supports including optional fields in the results which are not provided by default
* @param {Number} opts.start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DealSearchResponse} and HTTP response
*/
}, {
key: "searchDealsWithHttpInfo",
value: function searchDealsWithHttpInfo(term, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'term' is set
if (term === undefined || term === null) {
throw new Error("Missing the required parameter 'term' when calling searchDeals");
}
var pathParams = {};
var queryParams = {
'term': term,
'fields': opts['fields'] === undefined ? opts['fields'] : opts['fields'],
'exact_match': opts['exact_match'] === undefined ? opts['exactMatch'] : opts['exact_match'],
'person_id': opts['person_id'] === undefined ? opts['personId'] : opts['person_id'],
'organization_id': opts['organization_id'] === undefined ? opts['organizationId'] : opts['organization_id'],
'status': opts['status'] === undefined ? opts['status'] : opts['status'],
'include_fields': opts['include_fields'] === undefined ? opts['includeFields'] : opts['include_fields'],
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _DealSearchResponse["default"];
return this.apiClient.callApi('/deals/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Search deals
* Searches all deals by title, notes and/or custom fields. This endpoint is a wrapper of <a href=\"https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\">/v1/itemSearch</a> with a narrower OAuth scope. Found deals can be filtered by the person ID and the organization ID.
* @param {String} term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Boolean} opts.exactMatch When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
* @param {Number} opts.personId Will filter deals by the provided person ID. The upper limit of found deals associated with the person is 2000.
* @param {Number} opts.organizationId Will filter deals by the provided organization ID. The upper limit of found deals associated with the organization is 2000.
* @param {module:model/String} opts.status Will filter deals by the provided specific status. open = Open, won = Won, lost = Lost. The upper limit of found deals associated with the status is 2000.
* @param {module:model/String} opts.includeFields Supports including optional fields in the results which are not provided by default
* @param {Number} opts.start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DealSearchResponse}
*/
}, {
key: "searchDeals",
value: function searchDeals(term, opts) {
return this.searchDealsWithHttpInfo(term, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a deal
* Updates the properties of a deal. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/updating-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">updating a deal</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/UpdateDealRequest} opts.updateDealRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetAddedDeal} and HTTP response
*/
}, {
key: "updateDealWithHttpInfo",
value: function updateDealWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['updateDealRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateDeal");
}
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 = _GetAddedDeal["default"];
return this.apiClient.callApi('/deals/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a deal
* Updates the properties of a deal. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/updating-a-deal\" target=\"_blank\" rel=\"noopener noreferrer\">updating a deal</a>.
* @param {Number} id The ID of the deal
* @param {Object} opts Optional parameters
* @param {module:model/UpdateDealRequest} opts.updateDealRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetAddedDeal}
*/
}, {
key: "updateDeal",
value: function updateDeal(id, opts) {
return this.updateDealWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update the product attached to a deal
* Updates the details of the product that has been attached to a deal.
* @param {Number} id The ID of the deal
* @param {Number} productAttachmentId The ID of the deal-product (the ID of the product attached to the deal)
* @param {Object} opts Optional parameters
* @param {module:model/UpdateDealProduct} opts.updateDealProduct
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetProductAttachementDetails} and HTTP response
*/
}, {
key: "updateDealProductWithHttpInfo",
value: function updateDealProductWithHttpInfo(id, productAttachmentId, opts) {
opts = opts || {};
var postBody = opts['updateDealProduct'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateDealProduct");
}
// verify the required parameter 'productAttachmentId' is set
if (productAttachmentId === undefined || productAttachmentId === null) {
throw new Error("Missing the required parameter 'productAttachmentId' when calling updateDealProduct");
}
var pathParams = {
'id': id,
'product_attachment_id': productAttachmentId
};
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 = _GetProductAttachementDetails["default"];
return this.apiClient.callApi('/deals/{id}/products/{product_attachment_id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update the product attached to a deal
* Updates the details of the product that has been attached to a deal.
* @param {Number} id The ID of the deal
* @param {Number} productAttachmentId The ID of the deal-product (the ID of the product attached to the deal)
* @param {Object} opts Optional parameters
* @param {module:model/UpdateDealProduct} opts.updateDealProduct
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetProductAttachementDetails}
*/
}, {
key: "updateDealProduct",
value: function updateDealProduct(id, productAttachmentId, opts) {
return this.updateDealProductWithHttpInfo(id, productAttachmentId, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return DealsApi;
}();
exports["default"] = DealsApi;