Tasks

interface Tasks

This module provides methods for managing tasks related to the connected user.

Tasks represent to-do items with properties like title, description, category, position, and a completion status.

This interface lets you create, update, fetch, and delete tasks easily.

You can also create tasks directly from Instant Messaging (IM) messages, making it simple to turn conversations into actionable items.

Tasks created while offline will be synced automatically once the connection is back.

Each task is represented by a Task object containing all the necessary information.

Samples

com.ale.rainbowsdk.samples.TasksSample

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract val tasks: StateFlow<Map<TaskCategory, List<Task>>>

Retrieves the user's tasks grouped by category.

Functions

Link copied to clipboard
abstract suspend fun createTask(text: String, categoryId: String, additionalDescription: String? = null, position: Int? = 0): RainbowResult<Task>

Creates a new Task associated with a specified category.

Link copied to clipboard
abstract suspend fun createTaskFromMessage(message: IMMessage, conversation: IRainbowConversation, categoryId: String, position: Int? = 0): RainbowResult<Task>

Creates a new Task linked to a given IMMessage and associates it with a category.

Link copied to clipboard
abstract suspend fun deleteTask(taskId: String): RainbowResult<Unit>

Deletes a Task identified by its unique ID.

Link copied to clipboard
abstract suspend fun deleteTaskFromMessage(messageId: String): RainbowResult<Unit>

Deletes the Task linked to a specific instant message.

Link copied to clipboard
abstract suspend fun fetchTasks(categoryId: String? = null): RainbowResult<Map<TaskCategory, List<Task>>>

Fetches the user's tasks, optionally filtered by category.

Link copied to clipboard
abstract suspend fun updateTask(task: Task, newPosition: Int? = null): RainbowResult<Unit>

Updates an existing Task with new properties.