File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/TasksApi.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 _AddTaskResponse = _interopRequireDefault(require("../model/AddTaskResponse201"));
var _DeleteTaskResponse = _interopRequireDefault(require("../model/DeleteTaskResponse200"));
var _GetTaskResponse = _interopRequireDefault(require("../model/GetTaskResponse200"));
var _GetTasksResponse = _interopRequireDefault(require("../model/GetTasksResponse200"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _TaskPostObject = _interopRequireDefault(require("../model/TaskPostObject"));
var _TaskPutObject = _interopRequireDefault(require("../model/TaskPutObject"));
var _UpdateTaskResponse = _interopRequireDefault(require("../model/UpdateTaskResponse200"));
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.
*
*/
/**
* Tasks service.
* @module api/TasksApi
* @version 1.0.0
*/
var TasksApi = /*#__PURE__*/function () {
/**
* Constructs a new TasksApi.
* @alias module:api/TasksApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function TasksApi(apiClient) {
(0, _classCallCheck2["default"])(this, TasksApi);
this.apiClient = apiClient;
}
/**
* Add a task
* Adds a new task.
* @param {Object} opts Optional parameters
* @param {module:model/TaskPostObject} opts.taskPostObject
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddTaskResponse201} and HTTP response
*/
(0, _createClass2["default"])(TasksApi, [{
key: "addTaskWithHttpInfo",
value: function addTaskWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['taskPostObject'];
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 = _AddTaskResponse["default"];
return this.apiClient.callApi('/tasks', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a task
* Adds a new task.
* @param {Object} opts Optional parameters
* @param {module:model/TaskPostObject} opts.taskPostObject
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddTaskResponse201}
*/
}, {
key: "addTask",
value: function addTask(opts) {
return this.addTaskWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a task
* Marks a task as deleted. If the task has subtasks then those will also be deleted.
* @param {Number} id The ID of the task
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteTaskResponse200} and HTTP response
*/
}, {
key: "deleteTaskWithHttpInfo",
value: function deleteTaskWithHttpInfo(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 deleteTask");
}
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 = _DeleteTaskResponse["default"];
return this.apiClient.callApi('/tasks/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a task
* Marks a task as deleted. If the task has subtasks then those will also be deleted.
* @param {Number} id The ID of the task
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteTaskResponse200}
*/
}, {
key: "deleteTask",
value: function deleteTask(id) {
return this.deleteTaskWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get details of a task
* Returns the details of a specific task.
* @param {Number} id The ID of the task
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetTaskResponse200} and HTTP response
*/
}, {
key: "getTaskWithHttpInfo",
value: function getTaskWithHttpInfo(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 getTask");
}
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 = _GetTaskResponse["default"];
return this.apiClient.callApi('/tasks/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get details of a task
* Returns the details of a specific task.
* @param {Number} id The ID of the task
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetTaskResponse200}
*/
}, {
key: "getTask",
value: function getTask(id) {
return this.getTaskWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all tasks
* Returns all tasks. 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 {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, up to 500 items will be returned.
* @param {Number} opts.assigneeId If supplied, only tasks that are assigned to this user are returned
* @param {Number} opts.projectId If supplied, only tasks that are assigned to this project are returned
* @param {Number} opts.parentTaskId If `null` is supplied then only parent tasks are returned. If integer is supplied then only subtasks of a specific task are returned. By default all tasks are returned.
* @param {module:model/NumberBoolean} opts.done Whether the task is done or not. `0` = Not done, `1` = Done. If not omitted then returns both done and not done tasks.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetTasksResponse200} and HTTP response
*/
}, {
key: "getTasksWithHttpInfo",
value: function getTasksWithHttpInfo(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'],
'assignee_id': opts['assignee_id'] === undefined ? opts['assigneeId'] : opts['assignee_id'],
'project_id': opts['project_id'] === undefined ? opts['projectId'] : opts['project_id'],
'parent_task_id': opts['parent_task_id'] === undefined ? opts['parentTaskId'] : opts['parent_task_id'],
'done': opts['done'] === undefined ? opts['done'] : opts['done']
};
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 = _GetTasksResponse["default"];
return this.apiClient.callApi('/tasks', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all tasks
* Returns all tasks. 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 {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, up to 500 items will be returned.
* @param {Number} opts.assigneeId If supplied, only tasks that are assigned to this user are returned
* @param {Number} opts.projectId If supplied, only tasks that are assigned to this project are returned
* @param {Number} opts.parentTaskId If `null` is supplied then only parent tasks are returned. If integer is supplied then only subtasks of a specific task are returned. By default all tasks are returned.
* @param {module:model/NumberBoolean} opts.done Whether the task is done or not. `0` = Not done, `1` = Done. If not omitted then returns both done and not done tasks.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetTasksResponse200}
*/
}, {
key: "getTasks",
value: function getTasks(opts) {
return this.getTasksWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a task
* Updates a task.
* @param {Number} id The ID of the task
* @param {Object} opts Optional parameters
* @param {module:model/TaskPutObject} opts.taskPutObject
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UpdateTaskResponse200} and HTTP response
*/
}, {
key: "updateTaskWithHttpInfo",
value: function updateTaskWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['taskPutObject'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateTask");
}
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 = _UpdateTaskResponse["default"];
return this.apiClient.callApi('/tasks/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a task
* Updates a task.
* @param {Number} id The ID of the task
* @param {Object} opts Optional parameters
* @param {module:model/TaskPutObject} opts.taskPutObject
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UpdateTaskResponse200}
*/
}, {
key: "updateTask",
value: function updateTask(id, opts) {
return this.updateTaskWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return TasksApi;
}();
exports["default"] = TasksApi;