import { GenericService } from "./GenericService"; export {}; import { Logger } from "../common/Logger"; import { EventEmitter } from "events"; import { Core } from "../Core"; interface TaskInput { id?: string; category: string; position?: number; content: { done: boolean; personalNote: boolean; title?: string; peerId?: string; peerJid?: string; conversationJid?: string; messageId?: string; messageTimestamp?: number; roomId?: string; text?: string; fileInfo?: any; creationDate?: number; }; categoryId?: string; } declare class TasksService extends GenericService { private _tasks; private tasksEventHandler; private tasksHandlerToken; static getClassName(): string; getClassName(): string; static getAccessorName(): string; getAccessorName(): string; constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _startConfig: { start_up: boolean; optional: boolean; }); start(_options: any): Promise; stop(): Promise; init(useRestAtStartup: boolean): Promise; attachHandlers(): void; /** * @public * @nodered true * @method addTask * @since 2.28.0 * @instance * @param {TaskInput} task The task to create. * @description * Create a new task
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @fulfil {Task} - Created task object or an error object depending on the result * @category async */ addTask(task: TaskInput): Promise; /** * @public * @nodered true * @method createTaskcategory * @since 2.28.0 * @instance * @param {string} category The category to create. * @description * Create a new category
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ createTaskcategory(category: string): Promise; /** * @public * @nodered true * @since 2.28.0 * @method createOrUpdatePropertiesTaskByCategoryId * @instance * @param {string} categoryId The id of the category where the property must be added. * @param {any} property The property to be added to the category. JSON object containing category properties attribute properties must contain field color with hexadecimal RGB values. * @description * Create a new property for category.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ createOrUpdatePropertiesTaskByCategoryId(categoryId: string, property: any): Promise; /** * @public * @nodered true * @method getTaskById * @since 2.28.0 * @instance * @param {string} taskId The id of the task to search. * @param {boolean} forceServerSearch=boolean force to search on server. * @description * Get a task by Id.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ getTaskById(taskId: string, forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method getTasksByCategoryId * @since 2.28.0 * @instance * @param {string} categoryId allows to retrieve only todos in that category by Id. * @param {boolean} forceServerSearch=false True to force a request to the server * @description * This API can be used to retrieve the list of user's todos. This API can only be used by user himself.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @fulfil {any} - This API can be used to retrieve the list of user's todos. This API can only be used by user himself. * @category async */ getTasksByCategoryId(categoryId?: string, forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method getTasks * @since 2.28.0 * @instance * @param {string} categoryId allows to retrieve only todos in that category by Id. * @param {boolean} forceServerSearch=false True to force a request to the server * @description * This API can be used to retrieve the list of user's todos. This API can only be used by user himself.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @fulfil {any} - This API can be used to retrieve the list of user's todos. This API can only be used by user himself. * @category async */ getTasks(categoryId?: string, forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method getAllCategories * @since 2.28.0 * @param {boolean} forceServerSearch=false True to force a request to the server * @instance * @description * This API can be used to retrieve the list of categories for tasks. This API can only be used by user himself.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @fulfil {any} - This API can be used to retrieve the list of categories for tasks. This API can only be used by user himself. * @category async */ getAllCategories(forceServerSearch?: boolean): Promise; /** * @public * @nodered true * @method deletePropertiesFromCategoriesTasks * @since 2.28.0 * @param {string} categoriId category unique identifier of the properties to delete. * @instance * @description * This API can be used to remove a category's properties from a user's to do list. This API can only be used by user himself .
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ deletePropertiesFromCategoriesTasks(categoriId: string): Promise; /** * @public * @nodered true * @method deleteTask * @since 2.28.0 * @param {string} taskId the id of the task to delete from server and cache. * @instance * @description * This API can be used to delete a task. This API can only be used by user himself.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ deleteTask(taskId: string): Promise; /** * @public * @nodered true * @method deleteCategoryFromTasks * @since 2.28.0 * @param {string} categoryId the id of the category to delete from server and cache. * @instance * @description * This API can be used to delete a task. This API can only be used by user himself.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ deleteCategoryFromTasks(categoryId: string): Promise; /** * @public * @nodered true * @method updateTask * @since 2.28.0 * @instance * @param {string} taskId The id of a task to update. * @param {TaskInput} task The properties to be updated. * @description * update a task.
* @async * @category Tasks MANAGEMENT * @return {Promise} The result * @category async */ updateTask(taskId: string, task: TaskInput): Promise; /** * @private * @method _onTaskCreated * @instance * @param {any} data Contains the information of the created task * @description * Method called when a task is created
*/ _onTaskCreated(data: any): Promise; /** * @private * @method _onTaskDeleted * @instance * @param {any} data Contains the taskId of the deleted task * @description * Method called when a task is deleted
*/ _onTaskDeleted(data: any): Promise; /** * @private * @method _onTaskUpdated * @instance * @param {any} data Contains the data of the updated task * @description * Method called when a task is updated (name, comment, isFavorite)
*/ _onTaskUpdated(data: any): Promise; /** * @private * @param taskId * @category Tasks Management tasks cache * @description * GET A Task FROM CACHE
*/ private getTaskFromCache; transformTaskInputToJson(task: TaskInput): void; private addOrUpdateTaskToCache; private removeTaskFromCache; private removeAllTasksFromCache; /** * @description * remove tasks from cache that are in the provided category and are not present in tasks provided in parameter. * If category is not provided, then remove tasks from cache that are not present in tasks provided in parameter. */ private keepTasksInCacheByCategory; } export type { TaskInput as TaskInput }; export { TasksService as TasksService };