/** * Task lifecycle methods: create, delete, complete, and uncomplete */ import type { CreateTaskOptions, CreateTaskPayload, UpdateTaskPayload } from '../../types/index.js'; import { UserMethods } from './user.js'; export declare abstract class TaskLifecycleMethods extends UserMethods { /** * Marks a task as complete * * @param taskId - The ID of the task to mark as complete * @param completeOn - The date/time when the task was completed (defaults to current time) * @param limitResponsePayload - Whether to limit the response payload size (defaults to true) * @returns The update result with success status and optionally the updated task * @throws SunsamaAuthError if not authenticated or request fails * * @example * ```typescript * // Mark a task as complete with current timestamp * const result = await client.updateTaskComplete('taskId'); * * // Mark complete with specific timestamp * const result = await client.updateTaskComplete('taskId', '2025-01-15T10:30:00Z'); * * // Get full task details in response * const result = await client.updateTaskComplete('taskId', new Date(), false); * ``` */ updateTaskComplete(taskId: string, completeOn?: Date | string, limitResponsePayload?: boolean): Promise; /** * Marks a task as incomplete (uncompletes it) * * @param taskId - The ID of the task to mark as incomplete * @param limitResponsePayload - Whether to limit the response payload size (defaults to true) * @returns The update result with success status and optionally the updated task * @throws SunsamaAuthError if not authenticated or request fails * * @example * ```typescript * // Mark a task as incomplete * const result = await client.updateTaskUncomplete('taskId'); * * // Get full task details in response * const result = await client.updateTaskUncomplete('taskId', false); * ``` */ updateTaskUncomplete(taskId: string, limitResponsePayload?: boolean): Promise; /** * Deletes a task * * @param taskId - The ID of the task to delete * @param limitResponsePayload - Whether to limit response size (defaults to true) * @param wasTaskMerged - Whether the task was merged before deletion (defaults to false) * @returns The update result with success status * @throws SunsamaAuthError if not authenticated or request fails * * @example * ```typescript * // Delete a task * const result = await client.deleteTask('taskId'); * * // Delete with full response payload * const result = await client.deleteTask('taskId', false); * * // Delete a merged task * const result = await client.deleteTask('taskId', true, true); * ``` */ deleteTask(taskId: string, limitResponsePayload?: boolean, wasTaskMerged?: boolean): Promise; /** * Creates a new task with flexible options * * @param text - The main text/title of the task * @param options - Additional task properties (including optional custom taskId) * @returns The created task result with success status * @throws SunsamaAuthError if not authenticated or request fails * * @example * ```typescript * // Create a simple task (ID auto-generated) * const result = await client.createTask('Complete project documentation'); * * // Create a task with options * const result = await client.createTask('Review pull requests', { * notes: 'Check all open PRs in the main repository', * timeEstimate: 30, * streamIds: ['stream-id-1'] * }); * * // Create a task with custom ID (useful for tracking/deletion) * const customId = SunsamaClient.generateTaskId(); * const result = await client.createTask('Follow up with client', { * taskId: customId, * snoozeUntil: new Date('2025-01-15T09:00:00') * }); * * // Create a task from a GitHub issue * const result = await client.createTask('Fix API documentation bug', { * integration: { * service: 'github', * identifier: { * id: 'I_kwDOO4SCuM7VTB4n', * repositoryOwnerLogin: 'robertn702', * repositoryName: 'sunsama-api', * number: 17, * type: 'Issue', * url: 'https://github.com/robertn702/sunsama-api/issues/17', * __typename: 'TaskGithubIntegrationIdentifier' * }, * __typename: 'TaskGithubIntegration' * }, * timeEstimate: 45 * }); * * // Create a task from a Gmail email * const result = await client.createTask('Project Update Email', { * integration: { * service: 'gmail', * identifier: { * id: '19a830b40fd7ab7d', * messageId: '19a830b40fd7ab7d', * accountId: 'user@example.com', * url: 'https://mail.google.com/mail/u/user@example.com/#inbox/19a830b40fd7ab7d', * __typename: 'TaskGmailIntegrationIdentifier' * }, * __typename: 'TaskGmailIntegration' * }, * timeEstimate: 15 * }); * ``` */ createTask(text: string, options?: CreateTaskOptions): Promise; } //# sourceMappingURL=task-lifecycle.d.ts.map