File: /var/www/fintechfuel/node_modules/pipedrive/dist/api/LeadLabelsApi.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 _AddLeadLabelRequest = _interopRequireDefault(require("../model/AddLeadLabelRequest"));
var _AddOrUpdateLeadLabelResponse = _interopRequireDefault(require("../model/AddOrUpdateLeadLabelResponse200"));
var _GetLeadLabelsResponse = _interopRequireDefault(require("../model/GetLeadLabelsResponse200"));
var _LeadIdResponse = _interopRequireDefault(require("../model/LeadIdResponse200"));
var _LeadResponse = _interopRequireDefault(require("../model/LeadResponse404"));
var _UpdateLeadLabelRequest = _interopRequireDefault(require("../model/UpdateLeadLabelRequest"));
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; }
/**
* LeadLabels service.
* @module api/LeadLabelsApi
* @version 1.0.0
*/
var LeadLabelsApi = /*#__PURE__*/function () {
/**
* Constructs a new LeadLabelsApi.
* @alias module:api/LeadLabelsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function LeadLabelsApi(apiClient) {
(0, _classCallCheck2["default"])(this, LeadLabelsApi);
this.apiClient = apiClient;
}
/**
* Add a lead label
* Creates a lead label.
* @param {Object} opts Optional parameters
* @param {module:model/AddLeadLabelRequest} opts.addLeadLabelRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddOrUpdateLeadLabelResponse200} and HTTP response
*/
(0, _createClass2["default"])(LeadLabelsApi, [{
key: "addLeadLabelWithHttpInfo",
value: function addLeadLabelWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['addLeadLabelRequest'];
if (opts['name'] === undefined || opts['name'] === null) {
throw new Error("Missing the required parameter 'name' when calling addLeadLabel");
}
if (opts['color'] === undefined || opts['color'] === null) {
throw new Error("Missing the required parameter 'color' when calling addLeadLabel");
}
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 = _AddOrUpdateLeadLabelResponse["default"];
return this.apiClient.callApi('/leadLabels', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a lead label
* Creates a lead label.
* @param {Object} opts Optional parameters
* @param {module:model/AddLeadLabelRequest} opts.addLeadLabelRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddOrUpdateLeadLabelResponse200}
*/
}, {
key: "addLeadLabel",
value: function addLeadLabel(opts) {
return this.addLeadLabelWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a lead label
* Deletes a specific lead label.
* @param {String} id The ID of the lead label
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/LeadIdResponse200} and HTTP response
*/
}, {
key: "deleteLeadLabelWithHttpInfo",
value: function deleteLeadLabelWithHttpInfo(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 deleteLeadLabel");
}
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 = _LeadIdResponse["default"];
return this.apiClient.callApi('/leadLabels/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a lead label
* Deletes a specific lead label.
* @param {String} id The ID of the lead label
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/LeadIdResponse200}
*/
}, {
key: "deleteLeadLabel",
value: function deleteLeadLabel(id) {
return this.deleteLeadLabelWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all lead labels
* Returns details of all lead labels. This endpoint does not support pagination and all labels are always returned.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetLeadLabelsResponse200} and HTTP response
*/
}, {
key: "getLeadLabelsWithHttpInfo",
value: function getLeadLabelsWithHttpInfo() {
var opts = {};
var postBody = null;
var pathParams = {};
var queryParams = {};
var headerParams = {};
var formParams = {};
var formParamArray = [];
var contentTypes = [];
var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
var isJSON = contentTypes.includes('application/json');
if (isJSON) {
postBody = _objectSpread(_objectSpread({}, postBody), opts);
} else if (isURLEncoded) {
for (var key in opts) {
if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
formParams[key] = opts[key];
}
}
}
var authNames = ['api_key', 'oauth2'];
var accepts = ['application/json'];
var returnType = _GetLeadLabelsResponse["default"];
return this.apiClient.callApi('/leadLabels', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all lead labels
* Returns details of all lead labels. This endpoint does not support pagination and all labels are always returned.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetLeadLabelsResponse200}
*/
}, {
key: "getLeadLabels",
value: function getLeadLabels() {
return this.getLeadLabelsWithHttpInfo().then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a lead label
* Updates one or more properties of a lead label. Only properties included in the request will be updated.
* @param {String} id The ID of the lead label
* @param {Object} opts Optional parameters
* @param {module:model/UpdateLeadLabelRequest} opts.updateLeadLabelRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddOrUpdateLeadLabelResponse200} and HTTP response
*/
}, {
key: "updateLeadLabelWithHttpInfo",
value: function updateLeadLabelWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['updateLeadLabelRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateLeadLabel");
}
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 = _AddOrUpdateLeadLabelResponse["default"];
return this.apiClient.callApi('/leadLabels/{id}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a lead label
* Updates one or more properties of a lead label. Only properties included in the request will be updated.
* @param {String} id The ID of the lead label
* @param {Object} opts Optional parameters
* @param {module:model/UpdateLeadLabelRequest} opts.updateLeadLabelRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddOrUpdateLeadLabelResponse200}
*/
}, {
key: "updateLeadLabel",
value: function updateLeadLabel(id, opts) {
return this.updateLeadLabelWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return LeadLabelsApi;
}();
exports["default"] = LeadLabelsApi;