import type { Reminder } from './types/index.js'; import { GetActivityLogsArgs, GetActivityLogsResponse } from './types/activity/index.js'; import type { AddAppArgs, App, AppByDistributionToken, AppDistributionToken, AppInstallation, AppSecrets, AppTestToken, AppVerificationToken, AppWebhook, AppWithUserCount, InstallAppArgs, RevokeUserAuthorizationArgs, UpdateAppArgs, UpdateAppInstallationArgs, UpdateAppWebhookArgs, UploadAppIconArgs, UserAuthorization } from './types/apps/index.js'; import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/index.js'; import type { BillingPortalUrlResponse, CancelPlanArgs, CheckoutSessionResponse, GetPricingArgs, PricesResponse, PricingResponse, ProBillingPortalArgs, ProPlanDetails, StartProTrialArgs, StartWorkspaceTrialArgs, SubscriptionInfo, UpgradeToProArgs, UpgradeWorkspaceArgs, WorkspaceBillingPortalArgs } from './types/billing/index.js'; import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js'; import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js'; import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js'; import type { AddGoalArgs, GetGoalsArgs, GetGoalsResponse, Goal, SearchGoalsArgs, TaskLinkingArgs, UpdateGoalArgs } from './types/goals/index.js'; import { CustomFetch, FileResponse } from './types/http.js'; import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js'; import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js'; import { Label, AddLabelArgs, UpdateLabelArgs, GetLabelsArgs, SearchLabelsArgs, GetLabelsResponse, GetSharedLabelsArgs, GetSharedLabelsResponse, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/labels/index.js'; import { ProductivityStats } from './types/productivity/index.js'; import { PersonalProject, WorkspaceProject, AddProjectArgs, UpdateProjectArgs, GetProjectsArgs, SearchProjectsArgs, GetProjectCollaboratorsArgs, GetProjectsResponse, GetProjectCollaboratorsResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, MoveProjectToWorkspaceArgs, MoveProjectToPersonalArgs, GetArchivedProjectsCountArgs, GetArchivedProjectsCountResponse, GetProjectPermissionsResponse, GetFullProjectArgs, GetFullProjectResponse, JoinProjectResponse } from './types/projects/index.js'; import { AddReminderArgs, UpdateReminderArgs, AddLocationReminderArgs, UpdateLocationReminderArgs, GetRemindersArgs, GetRemindersResponse, GetLocationRemindersArgs, GetLocationRemindersResponse } from './types/reminders/index.js'; import { Section, AddSectionArgs, UpdateSectionArgs, GetSectionsArgs, SearchSectionsArgs, GetSectionsResponse } from './types/sections/index.js'; import type { Folder } from './types/sync/resources/folders.js'; import { Task, AddTaskArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateTaskArgs, QuickAddTaskArgs, type MoveTaskArgs, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, SearchCompletedTasksArgs, GetTasksResponse, GetAllCompletedTasksArgs, GetAllCompletedTasksResponse } from './types/tasks/index.js'; import { ExportTemplateFileArgs, ExportTemplateUrlArgs, ExportTemplateUrlResponse, CreateProjectFromTemplateArgs, CreateProjectFromTemplateResponse, ImportTemplateIntoProjectArgs, ImportTemplateFromIdArgs, ImportTemplateResponse } from './types/templates/index.js'; import type { AddUiExtensionArgs, UiExtension, UpdateUiExtensionArgs, UploadUiExtensionIconArgs } from './types/ui-extensions/index.js'; import { UploadFileArgs, DeleteUploadArgs } from './types/uploads/index.js'; import { CurrentUser } from './types/users/index.js'; import { WorkspaceInvitation, WorkspacePlanDetails, JoinWorkspaceResult, Workspace, AddWorkspaceArgs, UpdateWorkspaceArgs, GetWorkspaceMembersActivityArgs, GetWorkspaceMembersActivityResponse, GetWorkspaceUserTasksArgs, GetWorkspaceUserTasksResponse, InviteWorkspaceUsersArgs, InviteWorkspaceUsersResponse, UpdateWorkspaceUserArgs, RemoveWorkspaceUserArgs, GetWorkspaceInvitationsArgs, DeleteWorkspaceInvitationArgs, WorkspaceInvitationActionArgs, JoinWorkspaceArgs, WorkspaceLogoArgs, GetWorkspacePlanDetailsArgs, GetWorkspaceUsersArgs, GetWorkspaceUsersResponse, GetWorkspaceProjectsArgs, WorkspaceInvitationsResponse, AllWorkspaceInvitationsResponse, WorkspaceLogoResponse } from './types/workspaces/index.js'; import { type SyncResponse, type SyncRequest } from './types/sync/index.js'; /** * A client for interacting with the Todoist API v1. * This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist. * * @example * ```typescript * const api = new TodoistApi('your-api-token'); * * // Get all tasks * const tasks = await api.getTasks(); * * // Create a new task * const newTask = await api.addTask({ * content: 'My new task', * projectId: '12345' * }); * ``` * * For more information about the Todoist API v1, see the [official documentation](https://todoist.com/api/v1). * If you're migrating from v9, please refer to the [migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9). */ /** * Configuration options for the TodoistApi constructor */ export type TodoistApiOptions = { /** * Optional custom API base URL. If not provided, defaults to Todoist's standard API endpoint */ baseUrl?: string; /** * Optional custom fetch function for alternative HTTP clients (e.g., Obsidian's requestUrl, React Native fetch) */ customFetch?: CustomFetch; }; export declare class TodoistApi { private authToken; private syncApiBase; private customFetch?; private readonly taskClient; private readonly projectClient; private readonly sectionClient; private readonly labelClient; private readonly commentClient; private readonly reminderClient; private readonly insightsClient; private readonly folderClient; private readonly templateClient; private readonly uploadClient; private readonly backupClient; private readonly emailClient; private readonly idMappingClient; private readonly activityClient; private readonly productivityClient; private readonly workspaceClient; private readonly goalsClient; private readonly billingClient; private readonly appClient; private readonly uiExtensionClient; constructor( /** * Your Todoist API token. */ authToken: string, /** * Optional configuration options */ options?: TodoistApiOptions); /** * Executes a raw Sync API request. * * This method provides direct access to the Sync API, allowing you to send * strongly-typed commands and request specific resource types. * * @param request - The sync request payload containing commands and/or resource types. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the sync response. * @throws TodoistRequestError if the sync status contains errors. * * @example * ```typescript * import { createCommand } from '@doist/todoist-sdk' * * const response = await api.sync({ * commands: [ * createCommand('item_add', { content: 'Buy milk' }), * ], * resourceTypes: ['items'], * syncToken: '*', * }) * ``` */ sync(syncRequest: SyncRequest, requestId?: string): Promise; /** * Retrieves information about the authenticated user. * * @returns A promise that resolves to the current user's information. */ getUser(): Promise; /** * Retrieves a single active (non-completed) task by its ID. * * @param id - The unique identifier of the task. * @returns A promise that resolves to the requested task. */ getTask(id: string): Promise; /** * Retrieves a list of active tasks filtered by specific parameters. * * @param args - Filter parameters such as project ID, label ID, or due date. * @returns A promise that resolves to an array of tasks. */ getTasks(args?: GetTasksArgs): Promise; /** * Retrieves tasks filtered by a filter string. * * @param args - Parameters for filtering tasks, including the query string and optional language. * @returns A promise that resolves to a paginated response of tasks. */ getTasksByFilter(args: GetTasksByFilterArgs): Promise; /** * Retrieves completed tasks by completion date. * * @param args - Parameters for filtering, including required since, until. * @returns A promise that resolves to a paginated response of completed tasks. */ getCompletedTasksByCompletionDate(args: GetCompletedTasksByCompletionDateArgs): Promise; /** * Retrieves completed tasks by due date. * * @param args - Parameters for filtering, including required since, until. * @returns A promise that resolves to a paginated response of completed tasks. */ getCompletedTasksByDueDate(args: GetCompletedTasksByDueDateArgs): Promise; /** * Searches completed tasks by query string. * * @param args - Parameters for searching, including the query string. * @returns A promise that resolves to a paginated response of completed tasks. */ searchCompletedTasks(args: SearchCompletedTasksArgs): Promise; /** * Retrieves all completed tasks with optional filters. * * Uses offset-based pagination rather than cursor-based. * * @param args - Optional parameters including project ID, label, date range, and pagination. * @returns A promise that resolves to completed tasks with associated project and section data. */ getAllCompletedTasks(args?: GetAllCompletedTasksArgs): Promise; /** * Creates a new task with the provided parameters. * * @param args - Task creation parameters such as content, due date, or priority. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the created task. */ addTask(args: AddTaskArgs, requestId?: string): Promise; /** * Quickly adds a task using natural language processing for due dates. * * @param args - Quick add task parameters, including content and due date. * @returns A promise that resolves to the created task. */ quickAddTask(args: QuickAddTaskArgs): Promise; /** * Updates an existing task by its ID with the provided parameters. * * @param id - The unique identifier of the task to update. * @param args - Update parameters such as content, priority, or due date. Pass * `dueString: null` (or `"no date"`) to clear the due date. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated task. */ updateTask(id: string, args: UpdateTaskArgs, requestId?: string): Promise; /** * Moves existing tasks by their ID to either a different parent/section/project. * * @param ids - The unique identifier of the tasks to be moved. * @param args - The paramets that should contain only one of projectId, sectionId, or parentId * @param requestId - Optional custom identifier for the request. * @returns - A promise that resolves to an array of the updated tasks. */ moveTasks(ids: string[], args: MoveTaskArgs, requestId?: string): Promise; /** * Moves a task by its ID to either a different parent/section/project. * * @param id - The unique identifier of the task to be moved. * @param args - The parameters that should contain exactly one of projectId, sectionId, or parentId * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated task. */ moveTask(id: string, args: MoveTaskArgs, requestId?: string): Promise; /** * Closes (completes) a task by its ID. * * @param id - The unique identifier of the task to close. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to `true` if successful. */ closeTask(id: string, requestId?: string): Promise; /** * Reopens a previously closed (completed) task by its ID. * * @param id - The unique identifier of the task to reopen. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to `true` if successful. */ reopenTask(id: string, requestId?: string): Promise; /** * Deletes a task by its ID. * * @param id - The unique identifier of the task to delete. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to `true` if successful. */ deleteTask(id: string, requestId?: string): Promise; /** * Retrieves a project by its ID. * * @param id - The unique identifier of the project. * @returns A promise that resolves to the requested project. */ getProject(id: string): Promise; /** * Retrieves all projects with optional filters. * * @param args - Optional filters for retrieving projects. * @returns A promise that resolves to an array of projects. */ getProjects(args?: GetProjectsArgs): Promise; /** * Searches projects by name. * * @param args - Search parameters including the query string. * @returns A promise that resolves to a paginated response of projects. */ searchProjects(args: SearchProjectsArgs): Promise; /** * Retrieves all archived projects with optional filters. * * @param args - Optional filters for retrieving archived projects. * @returns A promise that resolves to an array of archived projects. */ getArchivedProjects(args?: GetArchivedProjectsArgs): Promise; /** * Creates a new project with the provided parameters. * * @param args - Project creation parameters such as name or color. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the created project. */ addProject(args: AddProjectArgs, requestId?: string): Promise; /** * Updates an existing project by its ID with the provided parameters. * * @param id - The unique identifier of the project to update. * @param args - Update parameters such as name or color. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated project. */ updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise; /** * Deletes a project by its ID. * * If the project is a workspace project, it must have been * archived first before it can be deleted, otherwise calling * this function will result in an error. Personal projects can * be deleted regardless of their archived status. * * @param id - The unique identifier of the project to delete. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to `true` if successful. */ deleteProject(id: string, requestId?: string): Promise; /** * Archives a project by its ID. * * @param id - The unique identifier of the project to archive. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated project. */ archiveProject(id: string, requestId?: string): Promise; /** * Unarchives a project by its ID. * * @param id - The unique identifier of the project to unarchive. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated project. */ unarchiveProject(id: string, requestId?: string): Promise; /** * Moves a project to a workspace. * * @param args - The arguments for moving the project. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the moved project. */ moveProjectToWorkspace(args: MoveProjectToWorkspaceArgs, requestId?: string): Promise; /** * Moves a project to personal. * * @param args - The arguments for moving the project. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the moved project. */ moveProjectToPersonal(args: MoveProjectToPersonalArgs, requestId?: string): Promise; /** * Counts the number of archived projects. * * @param args - Optional parameters to filter the count. * @returns A promise that resolves to the count of archived projects. */ getArchivedProjectsCount(args?: GetArchivedProjectsCountArgs): Promise; /** * Retrieves the role-to-action permission mappings for projects. * * @returns A promise that resolves to the permission mappings. */ getProjectPermissions(): Promise; /** * Retrieves full project data including tasks, sections, collaborators, and notes. * * @param id - The unique identifier of the project. * @param args - Optional parameters. * @returns A promise that resolves to the full project data. */ getFullProject(id: string, args?: GetFullProjectArgs): Promise; /** * Joins a workspace project. * * Only used for workspaces — this endpoint is used to join a workspace project * by a workspace user. * * @param id - The unique identifier of the workspace project to join. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the full project data after joining. */ joinProject(id: string, requestId?: string): Promise; /** * Retrieves a list of collaborators for a specific project. * * @param projectId - The unique identifier of the project. * @param args - Optional parameters to filter collaborators. * @returns A promise that resolves to an array of collaborators for the project. */ getProjectCollaborators(projectId: string, args?: GetProjectCollaboratorsArgs): Promise; /** * Retrieves activity statistics for a project. * * @param projectId - The unique identifier of the project. * @param args - Optional parameters including weeks and weekly counts flag. * @returns A promise that resolves to the project activity stats. */ getProjectActivityStats(projectId: string, args?: GetProjectActivityStatsArgs): Promise; /** * Retrieves the health status of a project. * * @param projectId - The unique identifier of the project. * @returns A promise that resolves to the project health data. */ getProjectHealth(projectId: string): Promise; /** * Retrieves the health context for a project, including metrics and task details. * * @param projectId - The unique identifier of the project. * @returns A promise that resolves to the project health context. */ getProjectHealthContext(projectId: string): Promise; /** * Retrieves progress information for a project. * * @param projectId - The unique identifier of the project. * @returns A promise that resolves to the project progress data. */ getProjectProgress(projectId: string): Promise; /** * Retrieves insights for all projects in a workspace. * * @param workspaceId - The unique identifier of the workspace. * @param args - Optional parameters including project IDs filter. * @returns A promise that resolves to workspace insights data. */ getWorkspaceInsights(workspaceId: string, args?: GetWorkspaceInsightsArgs): Promise; /** * Triggers a health analysis for a project. * * @param projectId - The unique identifier of the project. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated project health data. */ analyzeProjectHealth(projectId: string, requestId?: string): Promise; /** * Retrieves all sections within a specific project or matching criteria. * * @param args - Filter parameters such as project ID. If no projectId is provided, * all sections are returned. * @returns A promise that resolves to an array of sections. */ getSections(args?: GetSectionsArgs): Promise; /** * Searches sections by name. * * @param args - Search parameters including the query string. * @returns A promise that resolves to a paginated response of sections. */ searchSections(args: SearchSectionsArgs): Promise; /** * Retrieves a single section by its ID. * * @param id - The unique identifier of the section. * @returns A promise that resolves to the requested section. */ getSection(id: string): Promise
; /** * Creates a new section within a project. * * @param args - Section creation parameters such as name or project ID. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the created section. */ addSection(args: AddSectionArgs, requestId?: string): Promise
; /** * Updates a section by its ID with the provided parameters. * * @param id - The unique identifier of the section to update. * @param args - Update parameters such as name or project ID. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated section. */ updateSection(id: string, args: UpdateSectionArgs, requestId?: string): Promise
; /** * Deletes a section by its ID. * * @param id - The unique identifier of the section to delete. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to `true` if successful. */ deleteSection(id: string, requestId?: string): Promise; /** * Archives a section by its ID. * * @param id - The unique identifier of the section to archive. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated section. */ archiveSection(id: string, requestId?: string): Promise
; /** * Unarchives a section by its ID. * * @param id - The unique identifier of the section to unarchive. * @param requestId - Optional custom identifier for the request. * @returns A promise that resolves to the updated section. */ unarchiveSection(id: string, requestId?: string): Promise
; /** * Retrieves a label by its ID. * * @param id - The unique identifier of the label. * @returns A promise that resolves to the requested label. */ getLabel(id: string): Promise