/** * Todoist Integration for WORKWAY * * Enables task management automation: sync tasks to Notion, * alert teams on Slack, create follow-ups, and compound workflows. * * Key use cases: * - Task Created → Notion page + Slack alert * - Task Completed → Update records + trigger follow-up workflows * - Project sync → Bidirectional Notion database sync * * @example * ```typescript * import { Todoist } from '@workwayco/integrations/todoist'; * * const todoist = new Todoist({ accessToken: tokens.todoist.access_token }); * * // Get all tasks * const tasks = await todoist.listTasks(); * * // Create a task * const task = await todoist.createTask({ * content: 'Review meeting notes', * projectId: 'project-123', * dueString: 'tomorrow at 10am', * priority: 4, // Highest priority * }); * * // Complete a task * await todoist.closeTask(task.data.id); * ``` */ import { ActionResult } from '@workwayco/sdk'; import { BaseAPIClient } from '../core/index.js'; /** * Todoist integration configuration */ export interface TodoistConfig { /** OAuth access token */ accessToken: string; /** Optional: Override API endpoint */ apiUrl?: string; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; } /** * Todoist task */ export interface TodoistTask { id: string; project_id: string; section_id: string | null; content: string; description: string; is_completed: boolean; labels: string[]; parent_id: string | null; order: number; priority: 1 | 2 | 3 | 4; due: TodoistDue | null; url: string; comment_count: number; created_at: string; creator_id: string; assignee_id: string | null; assigner_id: string | null; duration: TodoistDuration | null; } /** * Task due date */ export interface TodoistDue { date: string; string: string; lang: string; is_recurring: boolean; datetime?: string; timezone?: string; } /** * Task duration */ export interface TodoistDuration { amount: number; unit: 'minute' | 'day'; } /** * Options for creating a task */ export interface CreateTaskOptions { /** Task content (required) */ content: string; /** Task description (markdown) */ description?: string; /** Project ID */ projectId?: string; /** Section ID */ sectionId?: string; /** Parent task ID (for subtasks) */ parentId?: string; /** Label names */ labels?: string[]; /** Priority (1=normal, 4=urgent) */ priority?: 1 | 2 | 3 | 4; /** Due date string (natural language) */ dueString?: string; /** Due date (YYYY-MM-DD) */ dueDate?: string; /** Due datetime (RFC3339) */ dueDatetime?: string; /** Language for due string parsing */ dueLang?: string; /** Assignee user ID */ assigneeId?: string; /** Duration amount */ duration?: number; /** Duration unit */ durationUnit?: 'minute' | 'day'; } /** * Options for updating a task */ export interface UpdateTaskOptions { /** Task content */ content?: string; /** Task description */ description?: string; /** Label names */ labels?: string[]; /** Priority (1=normal, 4=urgent) */ priority?: 1 | 2 | 3 | 4; /** Due date string (natural language) */ dueString?: string; /** Due date (YYYY-MM-DD) */ dueDate?: string; /** Due datetime (RFC3339) */ dueDatetime?: string; /** Language for due string parsing */ dueLang?: string; /** Assignee user ID */ assigneeId?: string; /** Duration amount */ duration?: number; /** Duration unit */ durationUnit?: 'minute' | 'day'; } /** * Options for listing tasks */ export interface ListTasksOptions { /** Filter by project ID */ projectId?: string; /** Filter by section ID */ sectionId?: string; /** Filter by label name */ label?: string; /** Filter expression */ filter?: string; /** Language for filter */ lang?: string; /** Specific task IDs to retrieve */ ids?: string[]; } /** * Options for getting completed tasks * * Uses the Sync API which requires a separate endpoint. * See: https://developer.todoist.com/sync/v9/#get-all-completed-items */ export interface GetCompletedTasksOptions { /** Filter by project ID */ projectId?: string; /** Filter by section ID */ sectionId?: string; /** Completed after this date (ISO 8601) */ since?: string; /** Completed before this date (ISO 8601) */ until?: string; /** Limit number of results (default: 30, max: 200) */ limit?: number; /** Offset for pagination */ offset?: number; } /** * Completed task from Sync API */ export interface TodoistCompletedTask { /** Completed item ID */ id: string; /** Original task ID */ task_id: string; /** Task content */ content: string; /** User ID who completed the task */ user_id: string; /** Project ID */ project_id: string; /** Section ID (if any) */ section_id: string | null; /** Completion time (ISO 8601) */ completed_at: string; /** Task metadata (if included) */ meta_data?: string; /** Note content */ note_count?: number; } /** * Response from completed tasks API */ export interface CompletedTasksResponse { /** List of completed tasks */ items: TodoistCompletedTask[]; /** Total count of completed tasks matching filters */ total?: number; } /** * Todoist project */ export interface TodoistProject { id: string; name: string; color: string; parent_id: string | null; order: number; comment_count: number; is_shared: boolean; is_favorite: boolean; is_inbox_project: boolean; is_team_inbox: boolean; view_style: 'list' | 'board'; url: string; } /** * Options for creating a project */ export interface CreateProjectOptions { /** Project name (required) */ name: string; /** Parent project ID */ parentId?: string; /** Color name */ color?: string; /** Mark as favorite */ isFavorite?: boolean; /** View style */ viewStyle?: 'list' | 'board'; } /** * Options for updating a project */ export interface UpdateProjectOptions { /** Project name */ name?: string; /** Color name */ color?: string; /** Mark as favorite */ isFavorite?: boolean; /** View style */ viewStyle?: 'list' | 'board'; } /** * Project collaborator */ export interface TodoistCollaborator { id: string; name: string; email: string; } /** * Todoist section */ export interface TodoistSection { id: string; project_id: string; order: number; name: string; } /** * Options for creating a section */ export interface CreateSectionOptions { /** Section name (required) */ name: string; /** Project ID (required) */ projectId: string; /** Order position */ order?: number; } /** * Todoist personal label */ export interface TodoistLabel { id: string; name: string; color: string; order: number; is_favorite: boolean; } /** * Options for creating a label */ export interface CreateLabelOptions { /** Label name (required) */ name: string; /** Color name */ color?: string; /** Order position */ order?: number; /** Mark as favorite */ isFavorite?: boolean; } /** * Options for updating a label */ export interface UpdateLabelOptions { /** Label name */ name?: string; /** Color name */ color?: string; /** Order position */ order?: number; /** Mark as favorite */ isFavorite?: boolean; } /** * Todoist comment */ export interface TodoistComment { id: string; task_id?: string; project_id?: string; posted_at: string; content: string; attachment?: TodoistAttachment; } /** * Comment attachment */ export interface TodoistAttachment { file_name: string; file_type: string; file_url: string; resource_type: string; } /** * Options for creating a comment */ export interface CreateCommentOptions { /** Comment content (required) */ content: string; /** Task ID (required if no projectId) */ taskId?: string; /** Project ID (required if no taskId) */ projectId?: string; /** Attachment object */ attachment?: { fileName: string; fileType: string; fileUrl: string; resourceType?: string; }; } /** * Todoist Integration * * Weniger, aber besser: Task data for compound workflows. */ export declare class Todoist extends BaseAPIClient { constructor(config: TodoistConfig); /** * List active tasks */ listTasks(options?: ListTasksOptions): Promise>; /** * Get a task by ID */ getTask(taskId: string): Promise>; /** * Create a new task */ createTask(options: CreateTaskOptions): Promise>; /** * Update a task */ updateTask(taskId: string, options: UpdateTaskOptions): Promise>; /** * Close (complete) a task */ closeTask(taskId: string): Promise>; /** * Reopen a completed task */ reopenTask(taskId: string): Promise>; /** * Delete a task */ deleteTask(taskId: string): Promise>; /** * Get completed tasks * * Uses the Sync API to retrieve completed tasks (not available in REST API). * This is essential for workflows that track productivity (task-sync-bridge, * weekly-productivity-digest). * * @example * ```typescript * // Get tasks completed this week * const weekAgo = new Date(); * weekAgo.setDate(weekAgo.getDate() - 7); * * const completed = await todoist.getCompletedTasks({ * since: weekAgo.toISOString(), * limit: 100, * }); * ``` */ getCompletedTasks(options?: GetCompletedTasksOptions): Promise>; /** * List all projects */ listProjects(): Promise>; /** * Get a project by ID */ getProject(projectId: string): Promise>; /** * Create a new project */ createProject(options: CreateProjectOptions): Promise>; /** * Update a project */ updateProject(projectId: string, options: UpdateProjectOptions): Promise>; /** * Archive a project */ archiveProject(projectId: string): Promise>; /** * Unarchive a project */ unarchiveProject(projectId: string): Promise>; /** * Delete a project */ deleteProject(projectId: string): Promise>; /** * Get project collaborators */ getCollaborators(projectId: string): Promise>; /** * List sections */ listSections(projectId?: string): Promise>; /** * Get a section by ID */ getSection(sectionId: string): Promise>; /** * Create a section */ createSection(options: CreateSectionOptions): Promise>; /** * Update a section */ updateSection(sectionId: string, name: string): Promise>; /** * Delete a section */ deleteSection(sectionId: string): Promise>; /** * List personal labels */ listLabels(): Promise>; /** * Get a label by ID */ getLabel(labelId: string): Promise>; /** * Create a label */ createLabel(options: CreateLabelOptions): Promise>; /** * Update a label */ updateLabel(labelId: string, options: UpdateLabelOptions): Promise>; /** * Delete a label */ deleteLabel(labelId: string): Promise>; /** * List comments for a task or project */ listComments(options: { taskId?: string; projectId?: string; }): Promise>; /** * Get a comment by ID */ getComment(commentId: string): Promise>; /** * Create a comment */ createComment(options: CreateCommentOptions): Promise>; /** * Update a comment */ updateComment(commentId: string, content: string): Promise>; /** * Delete a comment */ deleteComment(commentId: string): Promise>; /** * Extract task summary for display * * Zuhandenheit: Developer thinks "get task summary" * not "navigate task object structure" */ static extractTaskSummary(task: TodoistTask): { id: string; content: string; description: string; isCompleted: boolean; priority: 'normal' | 'low' | 'medium' | 'high'; dueString: string | null; dueDate: string | null; isRecurring: boolean; labels: string[]; projectId: string; url: string; }; /** * Format due date for display */ static formatDueDate(due: TodoistDue | null, timezone?: string): string; /** * Get capabilities for Todoist actions */ private getCapabilities; } //# sourceMappingURL=index.d.ts.map