File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/ProductFieldsApi.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 _DeleteMultipleProductFieldsResponse = _interopRequireDefault(require("../model/DeleteMultipleProductFieldsResponse"));
var _DeleteProductFieldResponse = _interopRequireDefault(require("../model/DeleteProductFieldResponse"));
var _FailResponse = _interopRequireDefault(require("../model/FailResponse"));
var _GetAllProductFieldsResponse = _interopRequireDefault(require("../model/GetAllProductFieldsResponse"));
var _GetProductFieldResponse = _interopRequireDefault(require("../model/GetProductFieldResponse"));
var _NewProductField = _interopRequireDefault(require("../model/NewProductField"));
var _UpdateProductField = _interopRequireDefault(require("../model/UpdateProductField"));
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.
*
*/
/**
* ProductFields service.
* @module api/ProductFieldsApi
* @version 1.0.0
*/
var ProductFieldsApi = /*#__PURE__*/function () {
/**
* Constructs a new ProductFieldsApi.
* @alias module:api/ProductFieldsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function ProductFieldsApi(apiClient) {
(0, _classCallCheck2["default"])(this, ProductFieldsApi);
this.apiClient = apiClient;
}
/**
* Add a new product field
* Adds a new product field. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-a-new-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">adding a new custom field</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewProductField} opts.newProductField
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetProductFieldResponse} and HTTP response
*/
(0, _createClass2["default"])(ProductFieldsApi, [{
key: "addProductFieldWithHttpInfo",
value: function addProductFieldWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['newProductField'];
if (opts['name'] === undefined || opts['name'] === null) {
throw new Error("Missing the required parameter 'name' when calling addProductField");
}
if (opts['field_type'] === undefined || opts['field_type'] === null) {
throw new Error("Missing the required parameter 'field_type' when calling addProductField");
}
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 = _GetProductFieldResponse["default"];
return this.apiClient.callApi('/productFields', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a new product field
* Adds a new product field. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-a-new-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">adding a new custom field</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewProductField} opts.newProductField
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetProductFieldResponse}
*/
}, {
key: "addProductField",
value: function addProductField(opts) {
return this.addProductFieldWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a product field
* Marks a product field as deleted. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/deleting-a-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">deleting a custom field</a>.
* @param {Number} id The ID of the product field
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteProductFieldResponse} and HTTP response
*/
}, {
key: "deleteProductFieldWithHttpInfo",
value: function deleteProductFieldWithHttpInfo(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 deleteProductField");
}
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 = _DeleteProductFieldResponse["default"];
return this.apiClient.callApi('/productFields/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a product field
* Marks a product field as deleted. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/deleting-a-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">deleting a custom field</a>.
* @param {Number} id The ID of the product field
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteProductFieldResponse}
*/
}, {
key: "deleteProductField",
value: function deleteProductField(id) {
return this.deleteProductFieldWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete multiple product fields in bulk
* Marks multiple fields as deleted.
* @param {String} ids The comma-separated field IDs to delete
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteMultipleProductFieldsResponse} and HTTP response
*/
}, {
key: "deleteProductFieldsWithHttpInfo",
value: function deleteProductFieldsWithHttpInfo(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 deleteProductFields");
}
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 = _DeleteMultipleProductFieldsResponse["default"];
return this.apiClient.callApi('/productFields', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete multiple product fields in bulk
* Marks multiple fields as deleted.
* @param {String} ids The comma-separated field IDs to delete
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteMultipleProductFieldsResponse}
*/
}, {
key: "deleteProductFields",
value: function deleteProductFields(ids) {
return this.deleteProductFieldsWithHttpInfo(ids).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get one product field
* Returns data about a specific product field.
* @param {Number} id The ID of the product field
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetProductFieldResponse} and HTTP response
*/
}, {
key: "getProductFieldWithHttpInfo",
value: function getProductFieldWithHttpInfo(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 getProductField");
}
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 = _GetProductFieldResponse["default"];
return this.apiClient.callApi('/productFields/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get one product field
* Returns data about a specific product field.
* @param {Number} id The ID of the product field
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetProductFieldResponse}
*/
}, {
key: "getProductField",
value: function getProductField(id) {
return this.getProductFieldWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all product fields
* Returns data about all product fields.
* @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/GetAllProductFieldsResponse} and HTTP response
*/
}, {
key: "getProductFieldsWithHttpInfo",
value: function getProductFieldsWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
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 = _GetAllProductFieldsResponse["default"];
return this.apiClient.callApi('/productFields', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all product fields
* Returns data about all product fields.
* @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/GetAllProductFieldsResponse}
*/
}, {
key: "getProductFields",
value: function getProductFields(opts) {
return this.getProductFieldsWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a product field
* Updates a product field. For more information, see the tutorial for <a href=\" https://pipedrive.readme.io/docs/updating-custom-field-value \" target=\"_blank\" rel=\"noopener noreferrer\">updating custom fields' values</a>.
* @param {Number} id The ID of the product field
* @param {Object} opts Optional parameters
* @param {module:model/UpdateProductField} opts.updateProductField
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetProductFieldResponse} and HTTP response
*/
}, {
key: "updateProductFieldWithHttpInfo",
value: function updateProductFieldWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['updateProductField'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateProductField");
}
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 = _GetProductFieldResponse["default"];
return this.apiClient.callApi('/productFields/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a product field
* Updates a product field. For more information, see the tutorial for <a href=\" https://pipedrive.readme.io/docs/updating-custom-field-value \" target=\"_blank\" rel=\"noopener noreferrer\">updating custom fields' values</a>.
* @param {Number} id The ID of the product field
* @param {Object} opts Optional parameters
* @param {module:model/UpdateProductField} opts.updateProductField
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetProductFieldResponse}
*/
}, {
key: "updateProductField",
value: function updateProductField(id, opts) {
return this.updateProductFieldWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return ProductFieldsApi;
}();
exports["default"] = ProductFieldsApi;