@doist/todoist-sdk 9.1.0-next.1 → 9.1.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/authentication.js +1 -0
- package/dist/cjs/clients/activity-client.js +63 -0
- package/dist/cjs/clients/app-client.js +347 -0
- package/dist/cjs/clients/backup-client.js +65 -0
- package/dist/cjs/clients/base-client.js +30 -0
- package/dist/cjs/clients/comment-client.js +92 -0
- package/dist/cjs/clients/email-client.js +43 -0
- package/dist/cjs/clients/folder-client.js +80 -0
- package/dist/cjs/clients/id-mapping-client.js +39 -0
- package/dist/cjs/clients/insights-client.js +88 -0
- package/dist/cjs/clients/label-client.js +127 -0
- package/dist/cjs/clients/productivity-client.js +27 -0
- package/dist/cjs/clients/project-client.js +232 -0
- package/dist/cjs/clients/reminder-client.js +198 -0
- package/dist/cjs/clients/section-client.js +118 -0
- package/dist/cjs/clients/task-client.js +255 -0
- package/dist/cjs/clients/template-client.js +89 -0
- package/dist/cjs/clients/ui-extension-client.js +109 -0
- package/dist/cjs/clients/upload-client.js +102 -0
- package/dist/cjs/clients/workspace-client.js +367 -0
- package/dist/cjs/consts/endpoints.js +66 -6
- package/dist/cjs/test-utils/test-defaults.js +77 -1
- package/dist/cjs/todoist-api.js +422 -1665
- package/dist/cjs/transport/http-client.js +1 -0
- package/dist/cjs/transport/sync-request.js +75 -0
- package/dist/cjs/types/apps/types.js +253 -0
- package/dist/cjs/types/index.js +2 -1
- package/dist/cjs/types/sync/commands/index.js +0 -1
- package/dist/cjs/types/sync/resource-types.js +0 -1
- package/dist/cjs/types/sync/response.js +10 -12
- package/dist/cjs/types/ui-extensions/index.js +18 -0
- package/dist/cjs/types/ui-extensions/types.js +77 -0
- package/dist/cjs/utils/headers.js +16 -0
- package/dist/cjs/utils/request-helpers.js +21 -0
- package/dist/cjs/utils/validators.js +45 -33
- package/dist/esm/authentication.js +1 -0
- package/dist/esm/clients/activity-client.js +59 -0
- package/dist/esm/clients/app-client.js +343 -0
- package/dist/esm/clients/backup-client.js +61 -0
- package/dist/esm/clients/base-client.js +26 -0
- package/dist/esm/clients/comment-client.js +88 -0
- package/dist/esm/clients/email-client.js +39 -0
- package/dist/esm/clients/folder-client.js +76 -0
- package/dist/esm/clients/id-mapping-client.js +35 -0
- package/dist/esm/clients/insights-client.js +84 -0
- package/dist/esm/clients/label-client.js +123 -0
- package/dist/esm/clients/productivity-client.js +23 -0
- package/dist/esm/clients/project-client.js +228 -0
- package/dist/esm/clients/reminder-client.js +194 -0
- package/dist/esm/clients/section-client.js +114 -0
- package/dist/esm/clients/task-client.js +251 -0
- package/dist/esm/clients/template-client.js +85 -0
- package/dist/esm/clients/ui-extension-client.js +105 -0
- package/dist/esm/clients/upload-client.js +98 -0
- package/dist/esm/clients/workspace-client.js +363 -0
- package/dist/esm/consts/endpoints.js +51 -5
- package/dist/esm/test-utils/test-defaults.js +75 -0
- package/dist/esm/todoist-api.js +425 -1668
- package/dist/esm/transport/http-client.js +1 -0
- package/dist/esm/transport/sync-request.js +72 -0
- package/dist/esm/types/apps/types.js +248 -0
- package/dist/esm/types/index.js +2 -1
- package/dist/esm/types/sync/commands/index.js +0 -1
- package/dist/esm/types/sync/resource-types.js +0 -1
- package/dist/esm/types/sync/response.js +0 -2
- package/dist/esm/types/ui-extensions/types.js +74 -0
- package/dist/esm/utils/headers.js +13 -0
- package/dist/esm/utils/request-helpers.js +17 -0
- package/dist/esm/utils/validators.js +14 -2
- package/dist/types/authentication.d.ts +1 -1
- package/dist/types/clients/activity-client.d.ts +12 -0
- package/dist/types/clients/app-client.d.ts +37 -0
- package/dist/types/clients/backup-client.d.ts +14 -0
- package/dist/types/clients/base-client.d.ts +21 -0
- package/dist/types/clients/comment-client.d.ts +15 -0
- package/dist/types/clients/email-client.d.ts +13 -0
- package/dist/types/clients/folder-client.d.ts +16 -0
- package/dist/types/clients/id-mapping-client.d.ts +13 -0
- package/dist/types/clients/insights-client.d.ts +18 -0
- package/dist/types/clients/label-client.d.ts +19 -0
- package/dist/types/clients/productivity-client.d.ts +12 -0
- package/dist/types/clients/project-client.d.ts +26 -0
- package/dist/types/clients/reminder-client.d.ts +25 -0
- package/dist/types/clients/section-client.d.ts +18 -0
- package/dist/types/clients/task-client.d.ts +25 -0
- package/dist/types/clients/template-client.d.ts +17 -0
- package/dist/types/clients/ui-extension-client.d.ts +18 -0
- package/dist/types/clients/upload-client.d.ts +17 -0
- package/dist/types/clients/workspace-client.d.ts +43 -0
- package/dist/types/consts/endpoints.d.ts +24 -5
- package/dist/types/test-utils/test-defaults.d.ts +16 -1
- package/dist/types/todoist-api.d.ts +238 -28
- package/dist/types/transport/sync-request.d.ts +27 -0
- package/dist/types/types/apps/index.d.ts +2 -0
- package/dist/types/types/apps/requests.d.ts +89 -0
- package/dist/types/types/apps/types.d.ts +414 -0
- package/dist/types/types/http.d.ts +8 -1
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/sync/commands/index.d.ts +0 -9
- package/dist/types/types/sync/resource-types.d.ts +1 -1
- package/dist/types/types/sync/resources/user.d.ts +2 -2
- package/dist/types/types/sync/resources/view-options.d.ts +6 -6
- package/dist/types/types/sync/response.d.ts +6 -31
- package/dist/types/types/sync/user-preferences.d.ts +1 -1
- package/dist/types/types/tasks/requests.d.ts +0 -1
- package/dist/types/types/ui-extensions/index.d.ts +2 -0
- package/dist/types/types/ui-extensions/requests.d.ts +108 -0
- package/dist/types/types/ui-extensions/types.d.ts +185 -0
- package/dist/types/utils/headers.d.ts +7 -0
- package/dist/types/utils/request-helpers.d.ts +13 -0
- package/dist/types/utils/validators.d.ts +231 -55
- package/package.json +1 -1
- package/dist/cjs/types/goals/types.js +0 -29
- package/dist/esm/types/goals/types.js +0 -26
- package/dist/types/types/goals/requests.d.ts +0 -33
- package/dist/types/types/goals/types.d.ts +0 -41
- package/dist/types/types/sync/commands/goals.d.ts +0 -33
- /package/dist/cjs/types/{goals → apps}/index.js +0 -0
- /package/dist/cjs/types/{goals → apps}/requests.js +0 -0
- /package/dist/cjs/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
- /package/dist/esm/types/{goals → apps}/index.js +0 -0
- /package/dist/esm/types/{goals → apps}/requests.js +0 -0
- /package/dist/{types/types/goals/index.d.ts → esm/types/ui-extensions/index.js} +0 -0
- /package/dist/esm/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Reminder } from './types/index.js';
|
|
2
2
|
import { GetActivityLogsArgs, GetActivityLogsResponse } from './types/activity/index.js';
|
|
3
|
+
import type { AddAppArgs, App, AppByDistributionToken, AppDistributionToken, AppInstallation, AppSecrets, AppTestToken, AppVerificationToken, AppWebhook, AppWithUserCount, InstallAppArgs, RevokeUserAuthorizationArgs, UpdateAppArgs, UpdateAppInstallationArgs, UpdateAppWebhookArgs, UploadAppIconArgs, UserAuthorization } from './types/apps/index.js';
|
|
3
4
|
import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/index.js';
|
|
4
5
|
import { Attachment, Comment, AddCommentArgs, UpdateCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetCommentsResponse } from './types/comments/index.js';
|
|
5
6
|
import { GetOrCreateEmailArgs, GetOrCreateEmailResponse, DisableEmailArgs } from './types/emails/index.js';
|
|
6
7
|
import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
|
|
7
|
-
import
|
|
8
|
-
import { CustomFetch, CustomFetchResponse } from './types/http.js';
|
|
8
|
+
import { CustomFetch, FileResponse } from './types/http.js';
|
|
9
9
|
import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
|
|
10
10
|
import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
|
|
11
11
|
import { Label, AddLabelArgs, UpdateLabelArgs, GetLabelsArgs, SearchLabelsArgs, GetLabelsResponse, GetSharedLabelsArgs, GetSharedLabelsResponse, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/labels/index.js';
|
|
@@ -16,17 +16,32 @@ import { Section, AddSectionArgs, UpdateSectionArgs, GetSectionsArgs, SearchSect
|
|
|
16
16
|
import type { Folder } from './types/sync/resources/folders.js';
|
|
17
17
|
import { Task, AddTaskArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateTaskArgs, QuickAddTaskArgs, type MoveTaskArgs, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, SearchCompletedTasksArgs, GetTasksResponse, GetAllCompletedTasksArgs, GetAllCompletedTasksResponse } from './types/tasks/index.js';
|
|
18
18
|
import { ExportTemplateFileArgs, ExportTemplateUrlArgs, ExportTemplateUrlResponse, CreateProjectFromTemplateArgs, CreateProjectFromTemplateResponse, ImportTemplateIntoProjectArgs, ImportTemplateFromIdArgs, ImportTemplateResponse } from './types/templates/index.js';
|
|
19
|
+
import type { AddUiExtensionArgs, UiExtension, UpdateUiExtensionArgs, UploadUiExtensionIconArgs } from './types/ui-extensions/index.js';
|
|
19
20
|
import { UploadFileArgs, DeleteUploadArgs } from './types/uploads/index.js';
|
|
20
21
|
import { CurrentUser } from './types/users/index.js';
|
|
21
22
|
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';
|
|
22
23
|
import { type SyncResponse, type SyncRequest } from './types/sync/index.js';
|
|
23
24
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* A client for interacting with the Todoist API v1.
|
|
26
|
+
* This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* const api = new TodoistApi('your-api-token');
|
|
31
|
+
*
|
|
32
|
+
* // Get all tasks
|
|
33
|
+
* const tasks = await api.getTasks();
|
|
34
|
+
*
|
|
35
|
+
* // Create a new task
|
|
36
|
+
* const newTask = await api.addTask({
|
|
37
|
+
* content: 'My new task',
|
|
38
|
+
* projectId: '12345'
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* For more information about the Todoist API v1, see the [official documentation](https://todoist.com/api/v1).
|
|
43
|
+
* If you're migrating from v9, please refer to the [migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9).
|
|
26
44
|
*/
|
|
27
|
-
export type FileResponse = CustomFetchResponse & {
|
|
28
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
|
29
|
-
};
|
|
30
45
|
/**
|
|
31
46
|
* Configuration options for the TodoistApi constructor
|
|
32
47
|
*/
|
|
@@ -44,6 +59,24 @@ export declare class TodoistApi {
|
|
|
44
59
|
private authToken;
|
|
45
60
|
private syncApiBase;
|
|
46
61
|
private customFetch?;
|
|
62
|
+
private readonly taskClient;
|
|
63
|
+
private readonly projectClient;
|
|
64
|
+
private readonly sectionClient;
|
|
65
|
+
private readonly labelClient;
|
|
66
|
+
private readonly commentClient;
|
|
67
|
+
private readonly reminderClient;
|
|
68
|
+
private readonly insightsClient;
|
|
69
|
+
private readonly folderClient;
|
|
70
|
+
private readonly templateClient;
|
|
71
|
+
private readonly uploadClient;
|
|
72
|
+
private readonly backupClient;
|
|
73
|
+
private readonly emailClient;
|
|
74
|
+
private readonly idMappingClient;
|
|
75
|
+
private readonly activityClient;
|
|
76
|
+
private readonly productivityClient;
|
|
77
|
+
private readonly workspaceClient;
|
|
78
|
+
private readonly appClient;
|
|
79
|
+
private readonly uiExtensionClient;
|
|
47
80
|
constructor(
|
|
48
81
|
/**
|
|
49
82
|
* Your Todoist API token.
|
|
@@ -53,16 +86,6 @@ export declare class TodoistApi {
|
|
|
53
86
|
* Optional configuration options
|
|
54
87
|
*/
|
|
55
88
|
options?: TodoistApiOptions);
|
|
56
|
-
/**
|
|
57
|
-
* Makes a request to the Sync API and handles error checking.
|
|
58
|
-
*
|
|
59
|
-
* @param syncRequest - The sync request payload
|
|
60
|
-
* @param requestId - Optional request identifier
|
|
61
|
-
* @param hasSyncCommands - Whether this request contains sync commands (write operations)
|
|
62
|
-
* @returns The sync response data
|
|
63
|
-
* @throws TodoistRequestError if sync status contains errors
|
|
64
|
-
*/
|
|
65
|
-
private requestSync;
|
|
66
89
|
/**
|
|
67
90
|
* Executes a raw Sync API request.
|
|
68
91
|
*
|
|
@@ -764,16 +787,6 @@ export declare class TodoistApi {
|
|
|
764
787
|
* @returns A promise that resolves to `true` if successful.
|
|
765
788
|
*/
|
|
766
789
|
deleteFolder(id: string, requestId?: string): Promise<boolean>;
|
|
767
|
-
getGoals(args?: GetGoalsArgs): Promise<GetGoalsResponse>;
|
|
768
|
-
searchGoals(args: SearchGoalsArgs): Promise<GetGoalsResponse>;
|
|
769
|
-
getGoal(id: string): Promise<Goal>;
|
|
770
|
-
addGoal(args: AddGoalArgs, requestId?: string): Promise<Goal>;
|
|
771
|
-
updateGoal(id: string, args: UpdateGoalArgs, requestId?: string): Promise<Goal>;
|
|
772
|
-
deleteGoal(id: string, requestId?: string): Promise<boolean>;
|
|
773
|
-
completeGoal(id: string, requestId?: string): Promise<Goal>;
|
|
774
|
-
uncompleteGoal(id: string, requestId?: string): Promise<Goal>;
|
|
775
|
-
linkTaskToGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<Goal>;
|
|
776
|
-
unlinkTaskFromGoal({ goalId, taskId }: TaskLinkingArgs, requestId?: string): Promise<boolean>;
|
|
777
790
|
/**
|
|
778
791
|
* Retrieves a list of available backups.
|
|
779
792
|
*
|
|
@@ -856,7 +869,6 @@ export declare class TodoistApi {
|
|
|
856
869
|
* @returns A promise that resolves to the import result.
|
|
857
870
|
*/
|
|
858
871
|
importTemplateFromId(args: ImportTemplateFromIdArgs, requestId?: string): Promise<ImportTemplateResponse>;
|
|
859
|
-
private validateTemplateResponse;
|
|
860
872
|
/**
|
|
861
873
|
* Gets pending invitations for a workspace.
|
|
862
874
|
*
|
|
@@ -1034,4 +1046,202 @@ export declare class TodoistApi {
|
|
|
1034
1046
|
* @returns Paginated list of archived workspace projects.
|
|
1035
1047
|
*/
|
|
1036
1048
|
getWorkspaceArchivedProjects(args: GetWorkspaceProjectsArgs, requestId?: string): Promise<GetProjectsResponse>;
|
|
1049
|
+
/**
|
|
1050
|
+
* Lists all developer applications owned by the authenticated user.
|
|
1051
|
+
*
|
|
1052
|
+
* Requires the `dev:app_console` scope.
|
|
1053
|
+
*
|
|
1054
|
+
* @param requestId - Optional request ID for idempotency.
|
|
1055
|
+
* @returns A promise that resolves to the list of apps.
|
|
1056
|
+
*/
|
|
1057
|
+
getApps(requestId?: string): Promise<App[]>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Retrieves a single developer application by ID.
|
|
1060
|
+
*
|
|
1061
|
+
* Requires the `dev:app_console` scope.
|
|
1062
|
+
*/
|
|
1063
|
+
getApp(appId: string, requestId?: string): Promise<AppWithUserCount>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Creates a new developer application.
|
|
1066
|
+
*
|
|
1067
|
+
* Requires the `dev:app_console` scope.
|
|
1068
|
+
*/
|
|
1069
|
+
addApp(args: AddAppArgs, requestId?: string): Promise<App>;
|
|
1070
|
+
/**
|
|
1071
|
+
* Updates a developer application.
|
|
1072
|
+
*
|
|
1073
|
+
* Requires the `dev:app_console` scope.
|
|
1074
|
+
*/
|
|
1075
|
+
updateApp(appId: string, args: UpdateAppArgs, requestId?: string): Promise<AppWithUserCount>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Deletes a developer application.
|
|
1078
|
+
*
|
|
1079
|
+
* Requires the `dev:app_console` scope.
|
|
1080
|
+
*/
|
|
1081
|
+
deleteApp(appId: string, requestId?: string): Promise<boolean>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Retrieves the OAuth client credentials (client ID and secret) for an app.
|
|
1084
|
+
*
|
|
1085
|
+
* Requires the `dev:app_console` scope.
|
|
1086
|
+
*/
|
|
1087
|
+
getAppSecrets(appId: string, requestId?: string): Promise<AppSecrets>;
|
|
1088
|
+
/**
|
|
1089
|
+
* Rotates the app's OAuth client secret, returning the updated app record.
|
|
1090
|
+
*
|
|
1091
|
+
* Requires the `dev:app_console` scope.
|
|
1092
|
+
*/
|
|
1093
|
+
resetAppClientSecret(appId: string, requestId?: string): Promise<AppWithUserCount>;
|
|
1094
|
+
/**
|
|
1095
|
+
* Revokes every access token issued for the given app.
|
|
1096
|
+
*
|
|
1097
|
+
* Requires the `dev:app_console` scope.
|
|
1098
|
+
*/
|
|
1099
|
+
revokeAppTokens(appId: string, requestId?: string): Promise<AppWithUserCount>;
|
|
1100
|
+
/**
|
|
1101
|
+
* Uploads an icon for a developer application. The `size` argument
|
|
1102
|
+
* selects which icon slot to update (defaults to `'medium'`).
|
|
1103
|
+
*
|
|
1104
|
+
* Requires the `dev:app_console` scope.
|
|
1105
|
+
*/
|
|
1106
|
+
uploadAppIcon(args: UploadAppIconArgs, requestId?: string): Promise<AppWithUserCount>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Gets the currently issued developer test token for an app (null if none exists).
|
|
1109
|
+
*
|
|
1110
|
+
* Requires the `dev:app_console` scope.
|
|
1111
|
+
*/
|
|
1112
|
+
getAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Creates (or rotates) a developer test token for an app.
|
|
1115
|
+
*
|
|
1116
|
+
* Requires the `dev:app_console` scope.
|
|
1117
|
+
*/
|
|
1118
|
+
createAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
|
|
1119
|
+
/**
|
|
1120
|
+
* Gets the distribution token for an app, which third parties use to install it.
|
|
1121
|
+
*
|
|
1122
|
+
* Requires the `dev:app_console` scope.
|
|
1123
|
+
*/
|
|
1124
|
+
getAppDistributionToken(appId: string, requestId?: string): Promise<AppDistributionToken>;
|
|
1125
|
+
/**
|
|
1126
|
+
* Gets the current webhook verification token for an app.
|
|
1127
|
+
*
|
|
1128
|
+
* Requires the `dev:app_console` scope.
|
|
1129
|
+
*/
|
|
1130
|
+
getAppVerificationToken(appId: string, requestId?: string): Promise<AppVerificationToken>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Resets the webhook verification token for an app, returning the new value.
|
|
1133
|
+
*
|
|
1134
|
+
* Requires the `dev:app_console` scope.
|
|
1135
|
+
*/
|
|
1136
|
+
resetAppVerificationToken(appId: string, requestId?: string): Promise<AppVerificationToken>;
|
|
1137
|
+
/**
|
|
1138
|
+
* Resolves a public-facing app view from a distribution token. Used during
|
|
1139
|
+
* the installation flow to show prospective installers what the app does
|
|
1140
|
+
* and which scopes it requests.
|
|
1141
|
+
*
|
|
1142
|
+
* Requires the `dev:app_console` scope.
|
|
1143
|
+
*/
|
|
1144
|
+
getAppByDistributionToken(distributionToken: string, requestId?: string): Promise<AppByDistributionToken>;
|
|
1145
|
+
/**
|
|
1146
|
+
* Gets the webhook configuration for an app (null if no webhook is configured).
|
|
1147
|
+
*
|
|
1148
|
+
* Requires the `dev:app_console` scope.
|
|
1149
|
+
*/
|
|
1150
|
+
getAppWebhook(appId: string, requestId?: string): Promise<AppWebhook | null>;
|
|
1151
|
+
/**
|
|
1152
|
+
* Creates or updates an app webhook configuration (upsert).
|
|
1153
|
+
*
|
|
1154
|
+
* Requires the `dev:app_console` scope.
|
|
1155
|
+
*/
|
|
1156
|
+
updateAppWebhook(args: UpdateAppWebhookArgs, requestId?: string): Promise<AppWebhook>;
|
|
1157
|
+
/**
|
|
1158
|
+
* Deletes an app webhook configuration.
|
|
1159
|
+
*
|
|
1160
|
+
* Requires the `dev:app_console` scope.
|
|
1161
|
+
*/
|
|
1162
|
+
deleteAppWebhook(appId: string, requestId?: string): Promise<boolean>;
|
|
1163
|
+
/**
|
|
1164
|
+
* Lists all apps installed on the authenticated user's account.
|
|
1165
|
+
*
|
|
1166
|
+
* Requires the `dev:app_console` scope.
|
|
1167
|
+
*/
|
|
1168
|
+
getAppInstallations(requestId?: string): Promise<AppInstallation[]>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Installs an application via its distribution token.
|
|
1171
|
+
*
|
|
1172
|
+
* Requires the `dev:app_console` scope.
|
|
1173
|
+
*/
|
|
1174
|
+
installApp(args: InstallAppArgs, requestId?: string): Promise<AppInstallation>;
|
|
1175
|
+
/**
|
|
1176
|
+
* Retrieves a single app installation by ID.
|
|
1177
|
+
*
|
|
1178
|
+
* Requires the `dev:app_console` scope.
|
|
1179
|
+
*/
|
|
1180
|
+
getAppInstallation(installationId: string, requestId?: string): Promise<AppInstallation>;
|
|
1181
|
+
/**
|
|
1182
|
+
* Updates an app installation.
|
|
1183
|
+
*
|
|
1184
|
+
* Requires the `dev:app_console` scope.
|
|
1185
|
+
*/
|
|
1186
|
+
updateAppInstallation(installationId: string, args: UpdateAppInstallationArgs, requestId?: string): Promise<AppInstallation>;
|
|
1187
|
+
/**
|
|
1188
|
+
* Uninstalls (removes) an app installation.
|
|
1189
|
+
*
|
|
1190
|
+
* Requires the `dev:app_console` scope.
|
|
1191
|
+
*/
|
|
1192
|
+
uninstallApp(installationId: string, requestId?: string): Promise<boolean>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Retrieves a single UI extension by ID.
|
|
1195
|
+
*
|
|
1196
|
+
* Requires the `dev:app_console` scope.
|
|
1197
|
+
*/
|
|
1198
|
+
getUiExtension(uiExtensionId: string, requestId?: string): Promise<UiExtension>;
|
|
1199
|
+
/**
|
|
1200
|
+
* Lists UI extensions available (installed) in the web client for the current user.
|
|
1201
|
+
*
|
|
1202
|
+
* Requires the `dev:app_console` scope.
|
|
1203
|
+
*/
|
|
1204
|
+
getInstalledUiExtensions(requestId?: string): Promise<UiExtension[]>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Lists all UI extensions belonging to a given app (integration).
|
|
1207
|
+
*
|
|
1208
|
+
* Requires the `dev:app_console` scope.
|
|
1209
|
+
*/
|
|
1210
|
+
getUiExtensionsForApp(appId: string, requestId?: string): Promise<UiExtension[]>;
|
|
1211
|
+
/**
|
|
1212
|
+
* Adds a new UI extension to an app.
|
|
1213
|
+
*
|
|
1214
|
+
* Requires the `dev:app_console` scope.
|
|
1215
|
+
*/
|
|
1216
|
+
addUiExtension(args: AddUiExtensionArgs, requestId?: string): Promise<UiExtension>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Updates an existing UI extension.
|
|
1219
|
+
*
|
|
1220
|
+
* Requires the `dev:app_console` scope.
|
|
1221
|
+
*/
|
|
1222
|
+
updateUiExtension(uiExtensionId: string, args: UpdateUiExtensionArgs, requestId?: string): Promise<UiExtension>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Deletes a UI extension.
|
|
1225
|
+
*
|
|
1226
|
+
* Requires the `dev:app_console` scope.
|
|
1227
|
+
*/
|
|
1228
|
+
deleteUiExtension(uiExtensionId: string, requestId?: string): Promise<boolean>;
|
|
1229
|
+
/**
|
|
1230
|
+
* Uploads an icon for a UI extension.
|
|
1231
|
+
*
|
|
1232
|
+
* Requires the `dev:app_console` scope.
|
|
1233
|
+
*/
|
|
1234
|
+
uploadUiExtensionIcon(args: UploadUiExtensionIconArgs, requestId?: string): Promise<UiExtension>;
|
|
1235
|
+
/**
|
|
1236
|
+
* Lists all apps the user has authorized (granted a token to).
|
|
1237
|
+
*
|
|
1238
|
+
* Requires the `dev:app_console` scope.
|
|
1239
|
+
*/
|
|
1240
|
+
getUserAuthorizations(requestId?: string): Promise<UserAuthorization[]>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Revokes a specific user authorization (access token granted to a third-party app).
|
|
1243
|
+
*
|
|
1244
|
+
* Requires the `dev:app_console` scope.
|
|
1245
|
+
*/
|
|
1246
|
+
revokeUserAuthorization(args: RevokeUserAuthorizationArgs, requestId?: string): Promise<boolean>;
|
|
1037
1247
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CustomFetch } from '../types/http.js';
|
|
2
|
+
import { type SyncRequest, type SyncResponse } from '../types/sync/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared context needed to issue Sync API requests.
|
|
5
|
+
*
|
|
6
|
+
* Constructed by {@link TodoistApi} and each {@link BaseClient} subclass so
|
|
7
|
+
* that sub-clients can delegate to {@link performSyncRequest} without
|
|
8
|
+
* rebuilding the HTTP identity on every call.
|
|
9
|
+
*/
|
|
10
|
+
export type SyncRequestContext = {
|
|
11
|
+
authToken: string;
|
|
12
|
+
syncApiBase: string;
|
|
13
|
+
customFetch?: CustomFetch;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Makes a request to the Sync API and handles error checking.
|
|
17
|
+
*
|
|
18
|
+
* @param ctx - HTTP identity (auth token, sync API base URI, optional custom fetch).
|
|
19
|
+
* @param syncRequest - The sync request payload.
|
|
20
|
+
* @param options - Optional request identifier and commands flag.
|
|
21
|
+
* @returns The sync response data.
|
|
22
|
+
* @throws TodoistRequestError if sync status contains errors.
|
|
23
|
+
*/
|
|
24
|
+
export declare function performSyncRequest(ctx: SyncRequestContext, syncRequest: SyncRequest, options?: {
|
|
25
|
+
requestId?: string;
|
|
26
|
+
hasSyncCommands?: boolean;
|
|
27
|
+
}): Promise<SyncResponse>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Permission } from '../../authentication.js';
|
|
2
|
+
import type { AppIconSize } from '../../consts/endpoints.js';
|
|
3
|
+
import type { InstallationType, WebhookEvent, WebhookVersion } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Arguments for creating a new developer application.
|
|
6
|
+
*/
|
|
7
|
+
export type AddAppArgs = {
|
|
8
|
+
/** Display name of the application. */
|
|
9
|
+
displayName: string;
|
|
10
|
+
/** The application's service URL. */
|
|
11
|
+
serviceUrl: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Arguments for updating a developer application.
|
|
15
|
+
* All fields are optional — only provided fields are updated.
|
|
16
|
+
*
|
|
17
|
+
* Pass `appTokenScopes` as an array (e.g. `['data:read', 'task:add']`);
|
|
18
|
+
* the SDK serializes it to the comma-separated string the backend expects.
|
|
19
|
+
*/
|
|
20
|
+
export type UpdateAppArgs = {
|
|
21
|
+
/** Updated display name. */
|
|
22
|
+
displayName?: string;
|
|
23
|
+
/** Updated OAuth redirect URI. Pass `null` to clear. */
|
|
24
|
+
oauthRedirectUri?: string | null;
|
|
25
|
+
/** Updated service URL. */
|
|
26
|
+
serviceUrl?: string;
|
|
27
|
+
/** Updated app description. */
|
|
28
|
+
description?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Updated list of scopes the app may request. Pass `null` to clear.
|
|
31
|
+
*
|
|
32
|
+
* Typed as `Permission | (string & {})` so known scopes get autocomplete
|
|
33
|
+
* while still permitting plain strings — needed so a fetched
|
|
34
|
+
* `App['appTokenScopes']` (typed `string[] | null`) can be passed back
|
|
35
|
+
* to `updateApp()` without casts.
|
|
36
|
+
*/
|
|
37
|
+
appTokenScopes?: readonly (Permission | (string & {}))[] | null;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Arguments for uploading an app icon.
|
|
41
|
+
*/
|
|
42
|
+
export type UploadAppIconArgs = {
|
|
43
|
+
/** The application ID. */
|
|
44
|
+
appId: string;
|
|
45
|
+
/** The icon file to upload (Buffer, Stream, or file path). */
|
|
46
|
+
file: Buffer | NodeJS.ReadableStream | string | Blob;
|
|
47
|
+
/** The file name (required for Buffer/Stream uploads). */
|
|
48
|
+
fileName?: string;
|
|
49
|
+
/** Icon size variant. Defaults to `'medium'`. */
|
|
50
|
+
size?: AppIconSize;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Arguments for configuring (creating or updating) an app webhook.
|
|
54
|
+
*/
|
|
55
|
+
export type UpdateAppWebhookArgs = {
|
|
56
|
+
/** The application ID. */
|
|
57
|
+
appId: string;
|
|
58
|
+
/** The URL the webhook will POST events to. */
|
|
59
|
+
callbackUrl: string;
|
|
60
|
+
/** Events the webhook should receive. Must be unique. */
|
|
61
|
+
events: readonly WebhookEvent[];
|
|
62
|
+
/** Webhook payload version. Defaults to the backend's latest supported version. */
|
|
63
|
+
version?: WebhookVersion;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Arguments for installing a developer application via its distribution token.
|
|
67
|
+
*/
|
|
68
|
+
export type InstallAppArgs = {
|
|
69
|
+
/** The distribution token for the app being installed. */
|
|
70
|
+
distributionToken: string;
|
|
71
|
+
/** Type of installation to create. */
|
|
72
|
+
installationType: InstallationType;
|
|
73
|
+
/** Whether the requesting client has validated the app's requested scopes with the user. */
|
|
74
|
+
appTokenScopesValidated?: boolean;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Arguments for updating an app installation.
|
|
78
|
+
*/
|
|
79
|
+
export type UpdateAppInstallationArgs = {
|
|
80
|
+
/** Updated validated-scopes flag. */
|
|
81
|
+
appTokenScopesValidated?: boolean;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Arguments for revoking a user's authorization of a third-party app.
|
|
85
|
+
*/
|
|
86
|
+
export type RevokeUserAuthorizationArgs = {
|
|
87
|
+
/** The ID of the access token to revoke. */
|
|
88
|
+
accessTokenId: string;
|
|
89
|
+
};
|