@doist/todoist-api-typescript 6.5.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/todoist-api.js +32 -4
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/sync/commands/calendars.js +2 -0
- package/dist/cjs/types/sync/commands/filters.js +2 -0
- package/dist/cjs/types/sync/commands/folders.js +2 -0
- package/dist/cjs/types/sync/commands/index.js +35 -0
- package/dist/cjs/types/sync/commands/labels.js +2 -0
- package/dist/cjs/types/sync/commands/notes.js +2 -0
- package/dist/cjs/types/sync/commands/notifications.js +2 -0
- package/dist/cjs/types/sync/commands/others.js +2 -0
- package/dist/cjs/types/sync/commands/project-view-options.js +2 -0
- package/dist/cjs/types/sync/commands/projects.js +2 -0
- package/dist/cjs/types/sync/commands/reminders.js +2 -0
- package/dist/cjs/types/sync/commands/sections.js +2 -0
- package/dist/cjs/types/sync/commands/shared.js +5 -0
- package/dist/cjs/types/sync/commands/sharing.js +2 -0
- package/dist/cjs/types/sync/commands/tasks.js +2 -0
- package/dist/cjs/types/sync/commands/view-options.js +2 -0
- package/dist/cjs/types/sync/commands/workspace-filters.js +2 -0
- package/dist/cjs/types/sync/commands/workspace-goals.js +2 -0
- package/dist/cjs/types/sync/commands/workspaces.js +2 -0
- package/dist/cjs/types/sync/index.js +21 -0
- package/dist/cjs/types/sync/request.js +2 -0
- package/dist/cjs/types/{sync.js → sync/resource-types.js} +9 -0
- package/dist/cjs/types/sync/resources/calendars.js +27 -0
- package/dist/cjs/types/sync/resources/collaborators.js +23 -0
- package/dist/cjs/types/sync/resources/completed-info.js +30 -0
- package/dist/cjs/types/sync/resources/filters.js +16 -0
- package/dist/cjs/types/sync/resources/folders.js +14 -0
- package/dist/cjs/types/sync/resources/index.js +33 -0
- package/dist/cjs/types/sync/resources/live-notifications.js +28 -0
- package/dist/cjs/types/sync/resources/notes.js +23 -0
- package/dist/cjs/types/sync/resources/reminders.js +34 -0
- package/dist/cjs/types/sync/resources/suggestions.js +38 -0
- package/dist/cjs/types/sync/resources/tooltips.js +10 -0
- package/dist/cjs/types/sync/resources/user-plan-limits.js +24 -0
- package/dist/cjs/types/sync/resources/user-settings.js +42 -0
- package/dist/cjs/types/sync/resources/user.js +123 -0
- package/dist/cjs/types/sync/resources/view-options.js +75 -0
- package/dist/cjs/types/sync/resources/workspace-filters.js +21 -0
- package/dist/cjs/types/sync/resources/workspace-goals.js +32 -0
- package/dist/cjs/types/sync/resources/workspaces.js +49 -0
- package/dist/cjs/types/sync/response.js +2 -0
- package/dist/cjs/utils/index.js +3 -1
- package/dist/cjs/utils/multipart-upload.js +93 -42
- package/dist/cjs/utils/sync-helpers.js +22 -0
- package/dist/cjs/utils/validators.js +69 -88
- package/dist/esm/todoist-api.js +32 -4
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/sync/commands/calendars.js +1 -0
- package/dist/esm/types/sync/commands/filters.js +1 -0
- package/dist/esm/types/sync/commands/folders.js +1 -0
- package/dist/esm/types/sync/commands/index.js +19 -0
- package/dist/esm/types/sync/commands/labels.js +1 -0
- package/dist/esm/types/sync/commands/notes.js +1 -0
- package/dist/esm/types/sync/commands/notifications.js +1 -0
- package/dist/esm/types/sync/commands/others.js +1 -0
- package/dist/esm/types/sync/commands/project-view-options.js +1 -0
- package/dist/esm/types/sync/commands/projects.js +1 -0
- package/dist/esm/types/sync/commands/reminders.js +1 -0
- package/dist/esm/types/sync/commands/sections.js +1 -0
- package/dist/esm/types/sync/commands/shared.js +4 -0
- package/dist/esm/types/sync/commands/sharing.js +1 -0
- package/dist/esm/types/sync/commands/tasks.js +1 -0
- package/dist/esm/types/sync/commands/view-options.js +1 -0
- package/dist/esm/types/sync/commands/workspace-filters.js +1 -0
- package/dist/esm/types/sync/commands/workspace-goals.js +1 -0
- package/dist/esm/types/sync/commands/workspaces.js +1 -0
- package/dist/esm/types/sync/index.js +5 -0
- package/dist/esm/types/sync/request.js +1 -0
- package/dist/esm/types/{sync.js → sync/resource-types.js} +9 -0
- package/dist/esm/types/sync/resources/calendars.js +24 -0
- package/dist/esm/types/sync/resources/collaborators.js +20 -0
- package/dist/esm/types/sync/resources/completed-info.js +27 -0
- package/dist/esm/types/sync/resources/filters.js +13 -0
- package/dist/esm/types/sync/resources/folders.js +11 -0
- package/dist/esm/types/sync/resources/index.js +17 -0
- package/dist/esm/types/sync/resources/live-notifications.js +25 -0
- package/dist/esm/types/sync/resources/notes.js +20 -0
- package/dist/esm/types/sync/resources/reminders.js +31 -0
- package/dist/esm/types/sync/resources/suggestions.js +35 -0
- package/dist/esm/types/sync/resources/tooltips.js +7 -0
- package/dist/esm/types/sync/resources/user-plan-limits.js +21 -0
- package/dist/esm/types/sync/resources/user-settings.js +39 -0
- package/dist/esm/types/sync/resources/user.js +120 -0
- package/dist/esm/types/sync/resources/view-options.js +72 -0
- package/dist/esm/types/sync/resources/workspace-filters.js +18 -0
- package/dist/esm/types/sync/resources/workspace-goals.js +29 -0
- package/dist/esm/types/sync/resources/workspaces.js +46 -0
- package/dist/esm/types/sync/response.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/multipart-upload.js +60 -39
- package/dist/esm/utils/sync-helpers.js +19 -0
- package/dist/esm/utils/validators.js +65 -64
- package/dist/types/todoist-api.d.ts +26 -0
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/requests.d.ts +3 -3
- package/dist/types/types/sync/commands/calendars.d.ts +14 -0
- package/dist/types/types/sync/commands/filters.d.ts +21 -0
- package/dist/types/types/sync/commands/folders.d.ts +18 -0
- package/dist/types/types/sync/commands/index.d.ts +172 -0
- package/dist/types/types/sync/commands/labels.d.ts +27 -0
- package/dist/types/types/sync/commands/notes.d.ts +27 -0
- package/dist/types/types/sync/commands/notifications.d.ts +10 -0
- package/dist/types/types/sync/commands/others.d.ts +14 -0
- package/dist/types/types/sync/commands/project-view-options.d.ts +14 -0
- package/dist/types/types/sync/commands/projects.d.ts +88 -0
- package/dist/types/types/sync/commands/reminders.d.ts +27 -0
- package/dist/types/types/sync/commands/sections.d.ts +31 -0
- package/dist/types/types/sync/commands/shared.d.ts +46 -0
- package/dist/types/types/sync/commands/sharing.d.ts +16 -0
- package/dist/types/types/sync/commands/tasks.d.ts +78 -0
- package/dist/types/types/sync/commands/view-options.d.ts +19 -0
- package/dist/types/types/sync/commands/workspace-filters.d.ts +22 -0
- package/dist/types/types/sync/commands/workspace-goals.d.ts +24 -0
- package/dist/types/types/sync/commands/workspaces.d.ts +79 -0
- package/dist/types/types/sync/index.d.ts +5 -0
- package/dist/types/types/sync/request.d.ts +7 -0
- package/dist/types/types/sync/resource-types.d.ts +5 -0
- package/dist/types/types/sync/resources/calendars.d.ts +30 -0
- package/dist/types/types/sync/resources/collaborators.d.ts +24 -0
- package/dist/types/types/sync/resources/completed-info.d.ts +33 -0
- package/dist/types/types/sync/resources/filters.d.ts +12 -0
- package/dist/types/types/sync/resources/folders.d.ts +10 -0
- package/dist/types/types/sync/resources/index.d.ts +17 -0
- package/dist/types/types/sync/resources/live-notifications.d.ts +23 -0
- package/dist/types/types/sync/resources/notes.d.ts +34 -0
- package/dist/types/types/sync/resources/reminders.d.ts +101 -0
- package/dist/types/types/sync/resources/suggestions.d.ts +54 -0
- package/dist/types/types/sync/resources/tooltips.d.ts +6 -0
- package/dist/types/types/sync/resources/user-plan-limits.d.ts +41 -0
- package/dist/types/types/sync/resources/user-settings.d.ts +32 -0
- package/dist/types/types/sync/resources/user.d.ts +104 -0
- package/dist/types/types/sync/resources/view-options.d.ts +94 -0
- package/dist/types/types/sync/resources/workspace-filters.d.ts +17 -0
- package/dist/types/types/sync/resources/workspace-goals.d.ts +29 -0
- package/dist/types/types/sync/resources/workspaces.d.ts +52 -0
- package/dist/types/types/sync/response.d.ts +47 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/multipart-upload.d.ts +5 -3
- package/dist/types/utils/sync-helpers.d.ts +17 -0
- package/dist/types/utils/validators.d.ts +1163 -23
- package/package.json +8 -8
- package/dist/types/types/sync.d.ts +0 -30
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Attachment, PersonalProject, WorkspaceProject, Label, Section, Comment, Task, CurrentUser, ProductivityStats, WorkspaceInvitation, WorkspacePlanDetails, JoinWorkspaceResult, Workspace } from './types/entities.js';
|
|
2
2
|
import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs, GetProjectsArgs, SearchProjectsArgs, GetProjectCollaboratorsArgs, GetLabelsArgs, SearchLabelsArgs, GetLabelsResponse, GetTasksResponse, GetProjectsResponse, GetProjectCollaboratorsResponse, GetSectionsArgs, SearchSectionsArgs, GetSectionsResponse, GetSharedLabelsResponse, GetCommentsResponse, type MoveTaskArgs, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, SearchCompletedTasksArgs, GetActivityLogsArgs, GetActivityLogsResponse, UploadFileArgs, DeleteUploadArgs, GetWorkspaceInvitationsArgs, DeleteWorkspaceInvitationArgs, WorkspaceInvitationActionArgs, JoinWorkspaceArgs, WorkspaceLogoArgs, GetWorkspacePlanDetailsArgs, GetWorkspaceUsersArgs, GetWorkspaceUsersResponse, GetWorkspaceProjectsArgs, WorkspaceInvitationsResponse, AllWorkspaceInvitationsResponse, WorkspaceLogoResponse, MoveProjectToWorkspaceArgs, MoveProjectToPersonalArgs } from './types/requests.js';
|
|
3
3
|
import { CustomFetch } from './types/http.js';
|
|
4
|
+
import { type SyncResponse, type SyncRequest } from './types/sync/index.js';
|
|
4
5
|
/**
|
|
5
6
|
* A client for interacting with the Todoist API v1.
|
|
6
7
|
* This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
|
|
@@ -55,6 +56,31 @@ export declare class TodoistApi {
|
|
|
55
56
|
* @throws TodoistRequestError if sync status contains errors
|
|
56
57
|
*/
|
|
57
58
|
private requestSync;
|
|
59
|
+
/**
|
|
60
|
+
* Executes a raw Sync API request.
|
|
61
|
+
*
|
|
62
|
+
* This method provides direct access to the Sync API, allowing you to send
|
|
63
|
+
* strongly-typed commands and request specific resource types.
|
|
64
|
+
*
|
|
65
|
+
* @param request - The sync request payload containing commands and/or resource types.
|
|
66
|
+
* @param requestId - Optional custom identifier for the request.
|
|
67
|
+
* @returns A promise that resolves to the sync response.
|
|
68
|
+
* @throws TodoistRequestError if the sync status contains errors.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* import { createCommand } from '@doist/todoist-api-typescript'
|
|
73
|
+
*
|
|
74
|
+
* const response = await api.sync({
|
|
75
|
+
* commands: [
|
|
76
|
+
* createCommand('item_add', { content: 'Buy milk' }),
|
|
77
|
+
* ],
|
|
78
|
+
* resourceTypes: ['items'],
|
|
79
|
+
* syncToken: '*',
|
|
80
|
+
* })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
sync(syncRequest: SyncRequest, requestId?: string): Promise<SyncResponse>;
|
|
58
84
|
/**
|
|
59
85
|
* Retrieves information about the authenticated user.
|
|
60
86
|
*
|
|
@@ -511,10 +511,10 @@ export type UploadFileArgs = {
|
|
|
511
511
|
* - ReadableStream: File content as a stream (requires fileName)
|
|
512
512
|
* - string: Path to a file on the filesystem (fileName is optional, will be inferred from path)
|
|
513
513
|
*/
|
|
514
|
-
file: Buffer | NodeJS.ReadableStream | string;
|
|
514
|
+
file: Buffer | NodeJS.ReadableStream | string | Blob;
|
|
515
515
|
/**
|
|
516
516
|
* The name of the file. Required for Buffer and Stream inputs.
|
|
517
|
-
* Optional for file path strings (will be inferred
|
|
517
|
+
* Optional for file path strings and File objects (will be inferred if not provided).
|
|
518
518
|
*/
|
|
519
519
|
fileName?: string;
|
|
520
520
|
/**
|
|
@@ -609,7 +609,7 @@ export type WorkspaceLogoArgs = {
|
|
|
609
609
|
/**
|
|
610
610
|
* The image file to upload (Buffer, Stream, or file path).
|
|
611
611
|
*/
|
|
612
|
-
file?: Buffer | NodeJS.ReadableStream | string;
|
|
612
|
+
file?: Buffer | NodeJS.ReadableStream | string | Blob;
|
|
613
613
|
/**
|
|
614
614
|
* The file name (required for Buffer/Stream uploads).
|
|
615
615
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type CalendarUpdateArgs = {
|
|
2
|
+
id: string;
|
|
3
|
+
isVisible: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type CalendarAccountUpdateArgs = {
|
|
6
|
+
id: string;
|
|
7
|
+
isEventsEnabled?: boolean;
|
|
8
|
+
isTasksEnabled?: boolean;
|
|
9
|
+
isAllDayTasksEnabled?: boolean;
|
|
10
|
+
pendingOperationUntil?: string | null;
|
|
11
|
+
};
|
|
12
|
+
export type CalendarAccountRestoreTaskCalendarArgs = {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type FilterAddArgs = {
|
|
2
|
+
name: string;
|
|
3
|
+
query: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
itemOrder?: number;
|
|
6
|
+
isFavorite?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type FilterUpdateArgs = {
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
query?: string;
|
|
12
|
+
color?: string;
|
|
13
|
+
itemOrder?: number;
|
|
14
|
+
isFavorite?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type FilterUpdateOrdersArgs = {
|
|
17
|
+
idOrderMapping: Record<string, number>;
|
|
18
|
+
};
|
|
19
|
+
export type FilterDeleteArgs = {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type FolderAddArgs = {
|
|
2
|
+
name: string;
|
|
3
|
+
workspaceId: string;
|
|
4
|
+
childOrder?: number;
|
|
5
|
+
defaultOrder?: number;
|
|
6
|
+
addProjectIds?: string[];
|
|
7
|
+
};
|
|
8
|
+
export type FolderUpdateArgs = {
|
|
9
|
+
id: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
addProjectIds?: string[];
|
|
13
|
+
removeProjectIds?: string[];
|
|
14
|
+
};
|
|
15
|
+
export type FolderDeleteArgs = {
|
|
16
|
+
id: string;
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { TaskAddArgs, TaskUpdateArgs, TaskCompleteArgs, TaskCompleteUndoArgs, TaskMoveArgs, TaskReorderArgs, TaskUncompleteArgs, TaskUpdateDateCompleteArgs, TaskDeleteArgs, TaskUpdateDayOrderArgs } from './tasks.js';
|
|
2
|
+
import type { ProjectAddArgs, ProjectUpdateArgs, ProjectMoveArgs, ProjectReorderArgs, ShareProjectArgs, ProjectLeaveArgs, ProjectArchiveArgs, ProjectUnarchiveArgs, ProjectDeleteArgs, ProjectMoveToWorkspaceArgs, ProjectMoveToPersonalArgs } from './projects.js';
|
|
3
|
+
import type { SectionAddArgs, SectionUpdateArgs, SectionMoveArgs, SectionReorderArgs, SectionArchiveArgs, SectionUnarchiveArgs, SectionDeleteArgs } from './sections.js';
|
|
4
|
+
import type { LabelAddArgs, LabelRenameArgs, LabelUpdateArgs, LabelUpdateOrdersArgs, LabelDeleteArgs, LabelDeleteOccurrencesArgs } from './labels.js';
|
|
5
|
+
import type { FilterAddArgs, FilterUpdateArgs, FilterUpdateOrdersArgs, FilterDeleteArgs } from './filters.js';
|
|
6
|
+
import type { NoteAddArgs, NoteUpdateArgs, NoteDeleteArgs, NoteReactionAddArgs, NoteReactionRemoveArgs } from './notes.js';
|
|
7
|
+
import type { ReminderAddArgs, ReminderDeleteArgs } from './reminders.js';
|
|
8
|
+
import type { WorkspaceAddArgs, WorkspaceUpdateArgs, WorkspaceDeleteArgs, WorkspaceUpdateUserArgs, WorkspaceDeleteUserArgs, WorkspaceLeaveArgs, WorkspaceInviteArgs, WorkspaceSetDefaultOrderArgs, WorkspaceUpdateUserProjectSortPreferenceArgs } from './workspaces.js';
|
|
9
|
+
import type { FolderAddArgs, FolderUpdateArgs, FolderDeleteArgs } from './folders.js';
|
|
10
|
+
import type { WorkspaceFilterAddArgs, WorkspaceFilterUpdateArgs, WorkspaceFilterUpdateOrdersArgs, WorkspaceFilterDeleteArgs } from './workspace-filters.js';
|
|
11
|
+
import type { WorkspaceGoalAddArgs, WorkspaceGoalUpdateArgs, WorkspaceGoalDeleteArgs, WorkspaceGoalProjectAddArgs, WorkspaceGoalProjectRemoveArgs } from './workspace-goals.js';
|
|
12
|
+
import type { LiveNotificationsMarkUnreadArgs, LiveNotificationsMarkReadArgs, LiveNotificationsMarkReadAllArgs, LiveNotificationsSetLastReadArgs } from './notifications.js';
|
|
13
|
+
import type { AcceptInvitationArgs, RejectInvitationArgs, BizAcceptInvitationArgs, BizRejectInvitationArgs } from './sharing.js';
|
|
14
|
+
import type { ViewOptionsSetArgs, ViewOptionsDeleteArgs } from './view-options.js';
|
|
15
|
+
import type { ProjectViewOptionsDefaultsSetArgs } from './project-view-options.js';
|
|
16
|
+
import type { CalendarUpdateArgs, CalendarAccountUpdateArgs, CalendarAccountRestoreTaskCalendarArgs } from './calendars.js';
|
|
17
|
+
import type { UserUpdateArgs, DeleteCollaboratorArgs, IdMappingArgs, SuggestionDeleteArgs } from './others.js';
|
|
18
|
+
/**
|
|
19
|
+
* Maps each Sync API command type string to its corresponding argument type.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // TypeScript will enforce the correct args shape:
|
|
24
|
+
* const command: SyncCommand<'item_add'> = {
|
|
25
|
+
* type: 'item_add',
|
|
26
|
+
* uuid: '...',
|
|
27
|
+
* args: { content: 'Buy milk' } // Must satisfy TaskAddArgs
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type SyncCommandsMap = {
|
|
32
|
+
item_add: TaskAddArgs;
|
|
33
|
+
item_update: TaskUpdateArgs;
|
|
34
|
+
item_complete: TaskCompleteArgs;
|
|
35
|
+
item_complete_undo: TaskCompleteUndoArgs;
|
|
36
|
+
item_move: TaskMoveArgs;
|
|
37
|
+
item_reorder: TaskReorderArgs;
|
|
38
|
+
item_uncomplete: TaskUncompleteArgs;
|
|
39
|
+
item_update_date_complete: TaskUpdateDateCompleteArgs;
|
|
40
|
+
item_delete: TaskDeleteArgs;
|
|
41
|
+
item_update_day_orders: TaskUpdateDayOrderArgs;
|
|
42
|
+
project_add: ProjectAddArgs;
|
|
43
|
+
project_update: ProjectUpdateArgs;
|
|
44
|
+
project_move: ProjectMoveArgs;
|
|
45
|
+
project_reorder: ProjectReorderArgs;
|
|
46
|
+
share_project: ShareProjectArgs;
|
|
47
|
+
project_leave: ProjectLeaveArgs;
|
|
48
|
+
project_archive: ProjectArchiveArgs;
|
|
49
|
+
project_unarchive: ProjectUnarchiveArgs;
|
|
50
|
+
project_delete: ProjectDeleteArgs;
|
|
51
|
+
project_move_to_workspace: ProjectMoveToWorkspaceArgs;
|
|
52
|
+
project_move_to_personal: ProjectMoveToPersonalArgs;
|
|
53
|
+
section_add: SectionAddArgs;
|
|
54
|
+
section_update: SectionUpdateArgs;
|
|
55
|
+
section_move: SectionMoveArgs;
|
|
56
|
+
section_reorder: SectionReorderArgs;
|
|
57
|
+
section_archive: SectionArchiveArgs;
|
|
58
|
+
section_unarchive: SectionUnarchiveArgs;
|
|
59
|
+
section_delete: SectionDeleteArgs;
|
|
60
|
+
label_add: LabelAddArgs;
|
|
61
|
+
label_rename: LabelRenameArgs;
|
|
62
|
+
label_update: LabelUpdateArgs;
|
|
63
|
+
label_update_orders: LabelUpdateOrdersArgs;
|
|
64
|
+
label_delete: LabelDeleteArgs;
|
|
65
|
+
label_delete_occurrences: LabelDeleteOccurrencesArgs;
|
|
66
|
+
filter_add: FilterAddArgs;
|
|
67
|
+
filter_update: FilterUpdateArgs;
|
|
68
|
+
filter_update_orders: FilterUpdateOrdersArgs;
|
|
69
|
+
filter_delete: FilterDeleteArgs;
|
|
70
|
+
note_add: NoteAddArgs;
|
|
71
|
+
note_update: NoteUpdateArgs;
|
|
72
|
+
note_delete: NoteDeleteArgs;
|
|
73
|
+
note_reaction_add: NoteReactionAddArgs;
|
|
74
|
+
note_reaction_remove: NoteReactionRemoveArgs;
|
|
75
|
+
reminder_add: ReminderAddArgs;
|
|
76
|
+
reminder_delete: ReminderDeleteArgs;
|
|
77
|
+
workspace_add: WorkspaceAddArgs;
|
|
78
|
+
workspace_update: WorkspaceUpdateArgs;
|
|
79
|
+
workspace_delete: WorkspaceDeleteArgs;
|
|
80
|
+
workspace_update_user: WorkspaceUpdateUserArgs;
|
|
81
|
+
workspace_delete_user: WorkspaceDeleteUserArgs;
|
|
82
|
+
workspace_leave: WorkspaceLeaveArgs;
|
|
83
|
+
workspace_invite: WorkspaceInviteArgs;
|
|
84
|
+
workspace_set_default_project_ordering: WorkspaceSetDefaultOrderArgs;
|
|
85
|
+
workspace_update_user_project_sort_preference: WorkspaceUpdateUserProjectSortPreferenceArgs;
|
|
86
|
+
folder_add: FolderAddArgs;
|
|
87
|
+
folder_update: FolderUpdateArgs;
|
|
88
|
+
folder_delete: FolderDeleteArgs;
|
|
89
|
+
workspace_filter_add: WorkspaceFilterAddArgs;
|
|
90
|
+
workspace_filter_update: WorkspaceFilterUpdateArgs;
|
|
91
|
+
workspace_filter_update_orders: WorkspaceFilterUpdateOrdersArgs;
|
|
92
|
+
workspace_filter_delete: WorkspaceFilterDeleteArgs;
|
|
93
|
+
workspace_goal_add: WorkspaceGoalAddArgs;
|
|
94
|
+
workspace_goal_update: WorkspaceGoalUpdateArgs;
|
|
95
|
+
workspace_goal_delete: WorkspaceGoalDeleteArgs;
|
|
96
|
+
workspace_goal_project_add: WorkspaceGoalProjectAddArgs;
|
|
97
|
+
workspace_goal_project_remove: WorkspaceGoalProjectRemoveArgs;
|
|
98
|
+
live_notifications_mark_unread: LiveNotificationsMarkUnreadArgs;
|
|
99
|
+
live_notifications_mark_read: LiveNotificationsMarkReadArgs;
|
|
100
|
+
live_notifications_mark_read_all: LiveNotificationsMarkReadAllArgs;
|
|
101
|
+
live_notifications_set_last_read: LiveNotificationsSetLastReadArgs;
|
|
102
|
+
accept_invitation: AcceptInvitationArgs;
|
|
103
|
+
reject_invitation: RejectInvitationArgs;
|
|
104
|
+
biz_accept_invitation: BizAcceptInvitationArgs;
|
|
105
|
+
biz_reject_invitation: BizRejectInvitationArgs;
|
|
106
|
+
view_options_set: ViewOptionsSetArgs;
|
|
107
|
+
view_options_delete: ViewOptionsDeleteArgs;
|
|
108
|
+
project_view_options_defaults_set: ProjectViewOptionsDefaultsSetArgs;
|
|
109
|
+
calendar_update: CalendarUpdateArgs;
|
|
110
|
+
calendar_account_update: CalendarAccountUpdateArgs;
|
|
111
|
+
calendar_account_restore_task_calendar: CalendarAccountRestoreTaskCalendarArgs;
|
|
112
|
+
user_update: UserUpdateArgs;
|
|
113
|
+
delete_collaborator: DeleteCollaboratorArgs;
|
|
114
|
+
id_mapping: IdMappingArgs;
|
|
115
|
+
suggestion_delete: SuggestionDeleteArgs;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* All known Sync API command type strings.
|
|
119
|
+
*/
|
|
120
|
+
export type SyncCommandType = keyof SyncCommandsMap;
|
|
121
|
+
/**
|
|
122
|
+
* A strongly-typed Sync API command.
|
|
123
|
+
*
|
|
124
|
+
* When `Type` is a known command type (e.g. `'item_add'`), `args` is constrained
|
|
125
|
+
* to the corresponding argument type. For unknown command types, `args` falls back
|
|
126
|
+
* to `Record<string, unknown>`.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* // Strongly typed:
|
|
131
|
+
* const cmd: SyncCommand<'item_add'> = {
|
|
132
|
+
* type: 'item_add',
|
|
133
|
+
* uuid: 'abc-123',
|
|
134
|
+
* args: { content: 'Buy milk' },
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* // Untyped (backwards compatible):
|
|
138
|
+
* const cmd2: SyncCommand = {
|
|
139
|
+
* type: 'custom_command',
|
|
140
|
+
* uuid: 'def-456',
|
|
141
|
+
* args: { foo: 'bar' },
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
export type SyncCommand<Type extends SyncCommandType | string = string> = {
|
|
146
|
+
type: Type;
|
|
147
|
+
uuid: string;
|
|
148
|
+
args: Type extends SyncCommandType ? SyncCommandsMap[Type] : Record<string, unknown>;
|
|
149
|
+
tempId?: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* @deprecated Use `SyncCommand` instead.
|
|
153
|
+
*/
|
|
154
|
+
export type Command = SyncCommand<string>;
|
|
155
|
+
export * from './shared.js';
|
|
156
|
+
export * from './tasks.js';
|
|
157
|
+
export * from './projects.js';
|
|
158
|
+
export * from './sections.js';
|
|
159
|
+
export * from './labels.js';
|
|
160
|
+
export * from './filters.js';
|
|
161
|
+
export * from './notes.js';
|
|
162
|
+
export * from './reminders.js';
|
|
163
|
+
export * from './workspaces.js';
|
|
164
|
+
export * from './folders.js';
|
|
165
|
+
export * from './workspace-filters.js';
|
|
166
|
+
export * from './workspace-goals.js';
|
|
167
|
+
export * from './notifications.js';
|
|
168
|
+
export * from './sharing.js';
|
|
169
|
+
export * from './view-options.js';
|
|
170
|
+
export * from './project-view-options.js';
|
|
171
|
+
export * from './calendars.js';
|
|
172
|
+
export * from './others.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type LabelAddArgs = {
|
|
2
|
+
name: string;
|
|
3
|
+
color?: string;
|
|
4
|
+
itemOrder?: number;
|
|
5
|
+
isFavorite?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type LabelRenameArgs = {
|
|
8
|
+
nameOld: string;
|
|
9
|
+
nameNew: string;
|
|
10
|
+
};
|
|
11
|
+
export type LabelUpdateArgs = {
|
|
12
|
+
id: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
itemOrder?: number;
|
|
16
|
+
isFavorite?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type LabelUpdateOrdersArgs = {
|
|
19
|
+
idOrderMapping: Record<string, number>;
|
|
20
|
+
};
|
|
21
|
+
export type LabelDeleteArgs = {
|
|
22
|
+
id: string;
|
|
23
|
+
cascade?: 'none' | 'all';
|
|
24
|
+
};
|
|
25
|
+
export type LabelDeleteOccurrencesArgs = {
|
|
26
|
+
name: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type NoteAddArgs = {
|
|
2
|
+
itemId?: string;
|
|
3
|
+
projectId?: string;
|
|
4
|
+
content?: string;
|
|
5
|
+
fileAttachment?: unknown;
|
|
6
|
+
uidsToNotify?: string[];
|
|
7
|
+
postedAt: string;
|
|
8
|
+
};
|
|
9
|
+
export type NoteUpdateArgs = {
|
|
10
|
+
id: string;
|
|
11
|
+
itemId?: string;
|
|
12
|
+
projectId?: string;
|
|
13
|
+
content?: string;
|
|
14
|
+
fileAttachment?: unknown;
|
|
15
|
+
uidsToNotify?: string[];
|
|
16
|
+
};
|
|
17
|
+
export type NoteDeleteArgs = {
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
export type NoteReactionAddArgs = {
|
|
21
|
+
id: string;
|
|
22
|
+
reaction: string;
|
|
23
|
+
};
|
|
24
|
+
export type NoteReactionRemoveArgs = {
|
|
25
|
+
id: string;
|
|
26
|
+
reaction: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type LiveNotificationsMarkUnreadArgs = {
|
|
2
|
+
ids: string[];
|
|
3
|
+
};
|
|
4
|
+
export type LiveNotificationsMarkReadArgs = {
|
|
5
|
+
ids: string[];
|
|
6
|
+
};
|
|
7
|
+
export type LiveNotificationsMarkReadAllArgs = Record<never, never>;
|
|
8
|
+
export type LiveNotificationsSetLastReadArgs = {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type UserUpdateArgs = Record<string, unknown>;
|
|
2
|
+
export type DeleteCollaboratorArgs = {
|
|
3
|
+
projectId: string;
|
|
4
|
+
email: string;
|
|
5
|
+
};
|
|
6
|
+
export type IdMappingArgs = {
|
|
7
|
+
items?: Record<string, string>;
|
|
8
|
+
sections?: Record<string, string>;
|
|
9
|
+
notes?: Record<string, string>;
|
|
10
|
+
reminders?: Record<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export type SuggestionDeleteArgs = {
|
|
13
|
+
type: 'templates';
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ViewMode, GroupedBy, SortedBy, SortOrder } from './view-options.js';
|
|
2
|
+
export type CalendarSettings = {
|
|
3
|
+
layout?: 'WEEK' | 'MONTH';
|
|
4
|
+
};
|
|
5
|
+
export type ProjectViewOptionsDefaultsSetArgs = {
|
|
6
|
+
projectId: string;
|
|
7
|
+
viewMode?: ViewMode | null;
|
|
8
|
+
groupedBy?: GroupedBy | null;
|
|
9
|
+
sortedBy?: SortedBy | null;
|
|
10
|
+
sortOrder?: SortOrder | null;
|
|
11
|
+
showCompletedTasks?: boolean;
|
|
12
|
+
filteredBy?: string | null;
|
|
13
|
+
calendarSettings?: CalendarSettings | null;
|
|
14
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { ProjectViewStyle, ProjectVisibility, WorkspaceRole } from '../../entities.js';
|
|
2
|
+
import type { ProjectStatus, CollaboratorRole } from './shared.js';
|
|
3
|
+
export type ProjectAccessConfig = {
|
|
4
|
+
visibility: ProjectVisibility;
|
|
5
|
+
configuration?: {
|
|
6
|
+
hideCollaboratorDetails?: boolean;
|
|
7
|
+
disableDuplication?: boolean;
|
|
8
|
+
} | null;
|
|
9
|
+
};
|
|
10
|
+
export type ProjectAddArgs = {
|
|
11
|
+
name: string;
|
|
12
|
+
parentId?: string | null;
|
|
13
|
+
workspaceId?: string;
|
|
14
|
+
folderId?: string | null;
|
|
15
|
+
childOrder?: number;
|
|
16
|
+
defaultOrder?: number;
|
|
17
|
+
color?: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
isFavorite?: boolean;
|
|
20
|
+
isInviteOnly?: boolean;
|
|
21
|
+
isLinkSharingEnabled?: boolean;
|
|
22
|
+
viewStyle?: ProjectViewStyle;
|
|
23
|
+
status?: ProjectStatus;
|
|
24
|
+
collaboratorRoleDefault?: CollaboratorRole;
|
|
25
|
+
access?: ProjectAccessConfig;
|
|
26
|
+
};
|
|
27
|
+
export type ProjectUpdateArgs = {
|
|
28
|
+
id: string;
|
|
29
|
+
folderId?: string | null;
|
|
30
|
+
name?: string;
|
|
31
|
+
color?: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
isFavorite?: boolean;
|
|
34
|
+
isCollapsed?: boolean;
|
|
35
|
+
isInviteOnly?: boolean;
|
|
36
|
+
isLinkSharingEnabled?: boolean;
|
|
37
|
+
isProjectInsightsEnabled?: boolean;
|
|
38
|
+
viewStyle?: ProjectViewStyle;
|
|
39
|
+
status?: ProjectStatus;
|
|
40
|
+
collaboratorRoleDefault?: CollaboratorRole;
|
|
41
|
+
access?: ProjectAccessConfig;
|
|
42
|
+
};
|
|
43
|
+
export type ProjectMoveArgs = {
|
|
44
|
+
id: string;
|
|
45
|
+
parentId?: string | null;
|
|
46
|
+
};
|
|
47
|
+
export type ProjectReorderArgs = {
|
|
48
|
+
projects: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
childOrder: number;
|
|
51
|
+
}>;
|
|
52
|
+
};
|
|
53
|
+
export type ShareProjectArgs = {
|
|
54
|
+
projectId: string;
|
|
55
|
+
email: string;
|
|
56
|
+
message?: string;
|
|
57
|
+
workspaceRole?: WorkspaceRole;
|
|
58
|
+
} | {
|
|
59
|
+
projectId: string;
|
|
60
|
+
groupId: string;
|
|
61
|
+
message?: string;
|
|
62
|
+
workspaceRole?: WorkspaceRole;
|
|
63
|
+
};
|
|
64
|
+
export type ProjectLeaveArgs = {
|
|
65
|
+
projectId: string;
|
|
66
|
+
};
|
|
67
|
+
export type ProjectArchiveArgs = {
|
|
68
|
+
id: string;
|
|
69
|
+
};
|
|
70
|
+
export type ProjectUnarchiveArgs = {
|
|
71
|
+
id: string;
|
|
72
|
+
};
|
|
73
|
+
export type ProjectDeleteArgs = {
|
|
74
|
+
id: string;
|
|
75
|
+
};
|
|
76
|
+
export type ProjectMoveToWorkspaceArgs = {
|
|
77
|
+
projectId: string;
|
|
78
|
+
workspaceId: string;
|
|
79
|
+
isInviteOnly?: boolean;
|
|
80
|
+
publicAccess?: boolean;
|
|
81
|
+
access?: ProjectAccessConfig;
|
|
82
|
+
folderId?: string | null;
|
|
83
|
+
useLro?: boolean;
|
|
84
|
+
};
|
|
85
|
+
export type ProjectMoveToPersonalArgs = {
|
|
86
|
+
projectId: string;
|
|
87
|
+
useLro?: boolean;
|
|
88
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SyncDueDate, ReminderService } from './shared.js';
|
|
2
|
+
export type ReminderAddArgs = {
|
|
3
|
+
type: 'absolute';
|
|
4
|
+
itemId: string;
|
|
5
|
+
service?: ReminderService;
|
|
6
|
+
notifyUid?: string;
|
|
7
|
+
due?: SyncDueDate;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'relative';
|
|
10
|
+
itemId: string;
|
|
11
|
+
service?: ReminderService;
|
|
12
|
+
notifyUid?: string;
|
|
13
|
+
minuteOffset?: number;
|
|
14
|
+
due?: SyncDueDate;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'location';
|
|
17
|
+
itemId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
locLat: string;
|
|
20
|
+
locLong: string;
|
|
21
|
+
radius?: number;
|
|
22
|
+
locTrigger?: 'on_enter' | 'on_leave';
|
|
23
|
+
notifyUid?: string;
|
|
24
|
+
};
|
|
25
|
+
export type ReminderDeleteArgs = {
|
|
26
|
+
id: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type SectionAddArgs = {
|
|
2
|
+
projectId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
sectionOrder?: number;
|
|
5
|
+
addedAt?: string;
|
|
6
|
+
};
|
|
7
|
+
export type SectionUpdateArgs = {
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
isCollapsed?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type SectionMoveArgs = {
|
|
13
|
+
id: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
};
|
|
16
|
+
export type SectionReorderArgs = {
|
|
17
|
+
sections: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
sectionOrder: number;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
export type SectionArchiveArgs = {
|
|
23
|
+
id: string;
|
|
24
|
+
archivedAt?: string;
|
|
25
|
+
};
|
|
26
|
+
export type SectionUnarchiveArgs = {
|
|
27
|
+
id: string;
|
|
28
|
+
};
|
|
29
|
+
export type SectionDeleteArgs = {
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types used across multiple Sync API command argument types.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Due date for Sync API create/update operations.
|
|
6
|
+
* Unlike the REST API `DueDate` (which has required fields on responses),
|
|
7
|
+
* this type represents the input shape where all fields are optional.
|
|
8
|
+
*/
|
|
9
|
+
export type SyncDueDate = {
|
|
10
|
+
date?: string;
|
|
11
|
+
string?: string;
|
|
12
|
+
timezone?: string | null;
|
|
13
|
+
lang?: string;
|
|
14
|
+
isRecurring?: boolean;
|
|
15
|
+
} | null;
|
|
16
|
+
/**
|
|
17
|
+
* Deadline for Sync API create/update operations.
|
|
18
|
+
* Unlike the REST API `Deadline` (which requires `lang`),
|
|
19
|
+
* this type makes `lang` optional for input.
|
|
20
|
+
*/
|
|
21
|
+
export type SyncDeadline = {
|
|
22
|
+
date: string;
|
|
23
|
+
lang?: string;
|
|
24
|
+
} | null;
|
|
25
|
+
/**
|
|
26
|
+
* Duration for Sync API create/update operations.
|
|
27
|
+
*/
|
|
28
|
+
export type SyncDuration = {
|
|
29
|
+
amount: number;
|
|
30
|
+
unit: string;
|
|
31
|
+
} | null;
|
|
32
|
+
/** Task priority: 1 = normal, 2 = medium, 3 = high, 4 = urgent. */
|
|
33
|
+
export type TaskPriority = 1 | 2 | 3 | 4;
|
|
34
|
+
/** Project workflow status. */
|
|
35
|
+
export type ProjectStatus = 'PLANNED' | 'IN_PROGRESS' | 'PAUSED' | 'COMPLETED' | 'CANCELED';
|
|
36
|
+
/** Default collaborator role for a project. */
|
|
37
|
+
export type CollaboratorRole = 'CREATOR' | 'ADMIN' | 'READ_WRITE' | 'EDIT_ONLY' | 'COMPLETE_ONLY';
|
|
38
|
+
/** Reminder notification service. */
|
|
39
|
+
export type ReminderService = 'default' | 'email' | 'mobile' | 'push' | 'no_default';
|
|
40
|
+
/**
|
|
41
|
+
* Default access level for workspaces.
|
|
42
|
+
* Same values as {@link ProjectVisibility} from entities.
|
|
43
|
+
*/
|
|
44
|
+
export { type ProjectVisibility as DefaultAccessLevel } from '../../entities.js';
|
|
45
|
+
/** Workspace project sort order preference. */
|
|
46
|
+
export type WorkspaceProjectSortOrder = 'MANUAL' | 'A_TO_Z' | 'Z_TO_A';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type AcceptInvitationArgs = {
|
|
2
|
+
invitationId: string;
|
|
3
|
+
invitationSecret: string;
|
|
4
|
+
};
|
|
5
|
+
export type RejectInvitationArgs = {
|
|
6
|
+
invitationId: string;
|
|
7
|
+
invitationSecret: string;
|
|
8
|
+
};
|
|
9
|
+
export type BizAcceptInvitationArgs = {
|
|
10
|
+
invitationId: string;
|
|
11
|
+
invitationSecret: string;
|
|
12
|
+
};
|
|
13
|
+
export type BizRejectInvitationArgs = {
|
|
14
|
+
invitationId: string;
|
|
15
|
+
invitationSecret: string;
|
|
16
|
+
};
|