@doist/todoist-sdk 9.1.0-next.2 → 9.1.1

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.
Files changed (70) hide show
  1. package/dist/cjs/authentication.js +1 -0
  2. package/dist/cjs/clients/app-client.js +347 -0
  3. package/dist/cjs/clients/base-client.js +1 -0
  4. package/dist/cjs/clients/ui-extension-client.js +109 -0
  5. package/dist/cjs/consts/endpoints.js +70 -6
  6. package/dist/cjs/test-utils/test-defaults.js +75 -23
  7. package/dist/cjs/todoist-api.js +269 -33
  8. package/dist/cjs/transport/http-client.js +1 -0
  9. package/dist/cjs/types/apps/types.js +253 -0
  10. package/dist/cjs/types/index.js +2 -1
  11. package/dist/cjs/types/sync/commands/index.js +0 -1
  12. package/dist/cjs/types/sync/resource-types.js +0 -1
  13. package/dist/cjs/types/sync/response.js +10 -12
  14. package/dist/cjs/types/ui-extensions/index.js +18 -0
  15. package/dist/cjs/types/ui-extensions/types.js +77 -0
  16. package/dist/cjs/utils/validators.js +45 -33
  17. package/dist/esm/authentication.js +1 -0
  18. package/dist/esm/clients/app-client.js +343 -0
  19. package/dist/esm/clients/base-client.js +1 -0
  20. package/dist/esm/clients/ui-extension-client.js +105 -0
  21. package/dist/esm/consts/endpoints.js +54 -5
  22. package/dist/esm/test-utils/test-defaults.js +73 -22
  23. package/dist/esm/todoist-api.js +269 -33
  24. package/dist/esm/transport/http-client.js +1 -0
  25. package/dist/esm/types/apps/types.js +248 -0
  26. package/dist/esm/types/index.js +2 -1
  27. package/dist/esm/types/sync/commands/index.js +0 -1
  28. package/dist/esm/types/sync/resource-types.js +0 -1
  29. package/dist/esm/types/sync/response.js +0 -2
  30. package/dist/esm/types/ui-extensions/types.js +74 -0
  31. package/dist/esm/utils/validators.js +14 -2
  32. package/dist/types/authentication.d.ts +1 -1
  33. package/dist/types/clients/app-client.d.ts +37 -0
  34. package/dist/types/clients/base-client.d.ts +1 -0
  35. package/dist/types/clients/ui-extension-client.d.ts +18 -0
  36. package/dist/types/consts/endpoints.d.ts +25 -5
  37. package/dist/types/test-utils/test-defaults.d.ts +16 -4
  38. package/dist/types/todoist-api.d.ts +202 -12
  39. package/dist/types/types/apps/index.d.ts +2 -0
  40. package/dist/types/types/apps/requests.d.ts +89 -0
  41. package/dist/types/types/apps/types.d.ts +414 -0
  42. package/dist/types/types/http.d.ts +1 -1
  43. package/dist/types/types/index.d.ts +2 -1
  44. package/dist/types/types/sync/commands/index.d.ts +0 -9
  45. package/dist/types/types/sync/resource-types.d.ts +1 -1
  46. package/dist/types/types/sync/resources/user.d.ts +2 -2
  47. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  48. package/dist/types/types/sync/response.d.ts +6 -31
  49. package/dist/types/types/sync/user-preferences.d.ts +1 -1
  50. package/dist/types/types/tasks/requests.d.ts +0 -1
  51. package/dist/types/types/ui-extensions/index.d.ts +2 -0
  52. package/dist/types/types/ui-extensions/requests.d.ts +108 -0
  53. package/dist/types/types/ui-extensions/types.d.ts +185 -0
  54. package/dist/types/utils/validators.d.ts +231 -55
  55. package/package.json +1 -1
  56. package/dist/cjs/clients/goals-client.js +0 -145
  57. package/dist/cjs/types/goals/types.js +0 -56
  58. package/dist/esm/clients/goals-client.js +0 -141
  59. package/dist/esm/types/goals/types.js +0 -53
  60. package/dist/types/clients/goals-client.d.ts +0 -20
  61. package/dist/types/types/goals/requests.d.ts +0 -33
  62. package/dist/types/types/goals/types.d.ts +0 -51
  63. package/dist/types/types/sync/commands/goals.d.ts +0 -33
  64. /package/dist/cjs/types/{goals → apps}/index.js +0 -0
  65. /package/dist/cjs/types/{goals → apps}/requests.js +0 -0
  66. /package/dist/cjs/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
  67. /package/dist/esm/types/{goals → apps}/index.js +0 -0
  68. /package/dist/esm/types/{goals → apps}/requests.js +0 -0
  69. /package/dist/{types/types/goals/index.d.ts → esm/types/ui-extensions/index.js} +0 -0
  70. /package/dist/esm/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
@@ -0,0 +1,74 @@
1
+ import { z } from 'zod';
2
+ import { StringOrNumberSchema } from '../common.js';
3
+ /**
4
+ * Discriminator values for the UI extension variants.
5
+ * Exposed as an enum-like object because the values are used in `z.literal()`
6
+ * across multiple variant schemas (see AGENTS.md "Discriminated unions" exception).
7
+ */
8
+ export const UiExtensionTypeEnum = {
9
+ ContextMenu: 'context-menu',
10
+ Composer: 'composer',
11
+ Settings: 'settings',
12
+ };
13
+ /**
14
+ * All UI extension type values.
15
+ */
16
+ export const UI_EXTENSION_TYPES = [
17
+ UiExtensionTypeEnum.ContextMenu,
18
+ UiExtensionTypeEnum.Composer,
19
+ UiExtensionTypeEnum.Settings,
20
+ ];
21
+ /**
22
+ * Context locations where a context-menu extension can appear.
23
+ */
24
+ export const CONTEXT_MENU_EXTENSION_CONTEXTS = ['project', 'task'];
25
+ export const ContextMenuExtensionContextSchema = z.enum(CONTEXT_MENU_EXTENSION_CONTEXTS);
26
+ /**
27
+ * Composer locations where a composer extension can appear.
28
+ */
29
+ export const COMPOSER_EXTENSION_CONTEXTS = ['task', 'comment'];
30
+ export const ComposerExtensionContextSchema = z.enum(COMPOSER_EXTENSION_CONTEXTS);
31
+ /**
32
+ * Shared fields across all UI extension variants.
33
+ */
34
+ export const UiExtensionBaseSchema = z.object({
35
+ id: StringOrNumberSchema,
36
+ integrationId: StringOrNumberSchema,
37
+ extensionId: z.string(),
38
+ url: z.string(),
39
+ icon: z.string().nullable(),
40
+ name: z.string(),
41
+ description: z.string(),
42
+ width: z.number().int().nullable(),
43
+ height: z.number().int().nullable(),
44
+ defVersion: z.number().int(),
45
+ minimumCardistVersion: z.string(),
46
+ });
47
+ /**
48
+ * Schema for a context-menu UI extension.
49
+ */
50
+ export const ContextMenuExtensionSchema = UiExtensionBaseSchema.extend({
51
+ extensionType: z.literal(UiExtensionTypeEnum.ContextMenu),
52
+ contextType: ContextMenuExtensionContextSchema,
53
+ });
54
+ /**
55
+ * Schema for a composer UI extension.
56
+ */
57
+ export const ComposerExtensionSchema = UiExtensionBaseSchema.extend({
58
+ extensionType: z.literal(UiExtensionTypeEnum.Composer),
59
+ composerType: ComposerExtensionContextSchema,
60
+ });
61
+ /**
62
+ * Schema for a settings UI extension.
63
+ */
64
+ export const SettingsExtensionSchema = UiExtensionBaseSchema.extend({
65
+ extensionType: z.literal(UiExtensionTypeEnum.Settings),
66
+ });
67
+ /**
68
+ * Discriminated union of all UI extension variants.
69
+ */
70
+ export const UiExtensionSchema = z.discriminatedUnion('extensionType', [
71
+ ContextMenuExtensionSchema,
72
+ ComposerExtensionSchema,
73
+ SettingsExtensionSchema,
74
+ ]);
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { ActivityEventSchema } from '../types/activity/types.js';
3
+ import { AppSchema, AppWithUserCountSchema, AppSecretsSchema, AppVerificationTokenSchema, AppTestTokenSchema, AppDistributionTokenSchema, AppByDistributionTokenSchema, AppWebhookSchema, AppInstallationSchema, UserAuthorizationSchema, } from '../types/apps/types.js';
3
4
  import { BackupSchema } from '../types/backups/types.js';
4
5
  import { AttachmentSchema, CommentSchema } from '../types/comments/types.js';
5
- import { GoalSchema } from '../types/goals/types.js';
6
6
  import { IdMappingSchema, MovedIdSchema } from '../types/id-mappings/types.js';
7
7
  import { ProjectActivityStatsSchema, ProjectHealthSchema, ProjectHealthContextSchema, ProjectProgressSchema, WorkspaceInsightsSchema, } from '../types/insights/types.js';
8
8
  import { LabelSchema } from '../types/labels/types.js';
@@ -11,6 +11,7 @@ import { WorkspaceProjectSchema, ProjectSchema } from '../types/projects/types.j
11
11
  import { SectionSchema } from '../types/sections/types.js';
12
12
  import { SyncResponseSchema } from '../types/sync/response.js';
13
13
  import { TaskSchema } from '../types/tasks/types.js';
14
+ import { UiExtensionSchema } from '../types/ui-extensions/types.js';
14
15
  import { UserSchema, CurrentUserSchema } from '../types/users/types.js';
15
16
  import { WorkspaceUserSchema, WorkspaceInvitationSchema, WorkspacePlanDetailsSchema, JoinWorkspaceResultSchema, WorkspaceSchema, MemberActivityInfoSchema, WorkspaceUserTaskSchema, } from '../types/workspaces/types.js';
16
17
  import { FilterSchema, CollaboratorSchema, CollaboratorStateSchema, FolderSchema, NoteSchema, TooltipsSchema, WorkspaceFilterSchema, WorkspaceGoalSchema, CalendarSchema, CalendarAccountSchema, ReminderSchema, LocationReminderSchema, CompletedInfoSchema, ViewOptionsSchema, ProjectViewOptionsDefaultsSchema, UserPlanLimitsSchema, LiveNotificationSchema, SyncWorkspaceSchema, SyncUserSchema, UserSettingsSchema, SuggestionSchema, } from '../types/sync/resources/index.js';
@@ -57,7 +58,6 @@ export const { validate: validateFilter, validateArray: validateFilterArray } =
57
58
  export const { validate: validateCollaborator, validateArray: validateCollaboratorArray } = createValidator(CollaboratorSchema);
58
59
  export const { validate: validateCollaboratorState, validateArray: validateCollaboratorStateArray, } = createValidator(CollaboratorStateSchema);
59
60
  export const { validate: validateFolder, validateArray: validateFolderArray } = createValidator(FolderSchema);
60
- export const { validate: validateGoal, validateArray: validateGoalArray } = createValidator(GoalSchema);
61
61
  export const { validate: validateNote, validateArray: validateNoteArray } = createValidator(NoteSchema);
62
62
  export const { validate: validateTooltips } = createValidator(TooltipsSchema);
63
63
  export const { validate: validateWorkspaceFilter, validateArray: validateWorkspaceFilterArray } = createValidator(WorkspaceFilterSchema);
@@ -78,3 +78,15 @@ export const { validate: validateSuggestion, validateArray: validateSuggestionAr
78
78
  export function parseSyncResponse(raw) {
79
79
  return SyncResponseSchema.parse(raw);
80
80
  }
81
+ // App management validators
82
+ export const { validate: validateApp, validateArray: validateAppArray } = createValidator(AppSchema);
83
+ export const { validate: validateAppWithUserCount } = createValidator(AppWithUserCountSchema);
84
+ export const { validate: validateAppSecrets } = createValidator(AppSecretsSchema);
85
+ export const { validate: validateAppVerificationToken } = createValidator(AppVerificationTokenSchema);
86
+ export const { validate: validateAppTestToken } = createValidator(AppTestTokenSchema);
87
+ export const { validate: validateAppDistributionToken } = createValidator(AppDistributionTokenSchema);
88
+ export const { validate: validateAppByDistributionToken } = createValidator(AppByDistributionTokenSchema);
89
+ export const { validate: validateAppWebhook } = createValidator(AppWebhookSchema);
90
+ export const { validate: validateAppInstallation, validateArray: validateAppInstallationArray } = createValidator(AppInstallationSchema);
91
+ export const { validate: validateUserAuthorization, validateArray: validateUserAuthorizationArray, } = createValidator(UserAuthorizationSchema);
92
+ export const { validate: validateUiExtension, validateArray: validateUiExtensionArray } = createValidator(UiExtensionSchema);
@@ -7,7 +7,7 @@ export type AuthOptions = {
7
7
  customFetch?: CustomFetch;
8
8
  };
9
9
  /** Available OAuth2 permission scopes. */
10
- export declare const PERMISSIONS: readonly ["task:add", "data:read", "data:read_write", "data:delete", "project:delete", "backups:read"];
10
+ export declare const PERMISSIONS: readonly ["task:add", "data:read", "data:read_write", "data:delete", "project:delete", "backups:read", "dev:app_console"];
11
11
  /**
12
12
  * Permission scope that can be requested during OAuth2 authorization.
13
13
  * @see {@link https://developer.todoist.com/api/v1/#tag/Authorization}
@@ -0,0 +1,37 @@
1
+ import type { AddAppArgs, App, AppByDistributionToken, AppDistributionToken, AppInstallation, AppSecrets, AppTestToken, AppVerificationToken, AppWebhook, AppWithUserCount, InstallAppArgs, RevokeUserAuthorizationArgs, UpdateAppArgs, UpdateAppInstallationArgs, UpdateAppWebhookArgs, UploadAppIconArgs, UserAuthorization } from '../types/apps/index.js';
2
+ import { BaseClient } from './base-client.js';
3
+ /**
4
+ * Internal sub-client handling all developer-app management endpoints
5
+ * (apps, secrets, tokens, webhooks, installations, user authorizations).
6
+ * All endpoints require the `dev:app_console` OAuth scope.
7
+ *
8
+ * Instantiated by `TodoistApi`; every public app-management method on
9
+ * `TodoistApi` delegates here. See `todoist-api.ts` for user-facing JSDoc.
10
+ */
11
+ export declare class AppClient extends BaseClient {
12
+ getApps(requestId?: string): Promise<App[]>;
13
+ getApp(appId: string, requestId?: string): Promise<AppWithUserCount>;
14
+ addApp(args: AddAppArgs, requestId?: string): Promise<App>;
15
+ updateApp(appId: string, args: UpdateAppArgs, requestId?: string): Promise<AppWithUserCount>;
16
+ deleteApp(appId: string, requestId?: string): Promise<boolean>;
17
+ getAppSecrets(appId: string, requestId?: string): Promise<AppSecrets>;
18
+ resetAppClientSecret(appId: string, requestId?: string): Promise<AppWithUserCount>;
19
+ revokeAppTokens(appId: string, requestId?: string): Promise<AppWithUserCount>;
20
+ uploadAppIcon(args: UploadAppIconArgs, requestId?: string): Promise<AppWithUserCount>;
21
+ getAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
22
+ createAppTestToken(appId: string, requestId?: string): Promise<AppTestToken>;
23
+ getAppDistributionToken(appId: string, requestId?: string): Promise<AppDistributionToken>;
24
+ getAppVerificationToken(appId: string, requestId?: string): Promise<AppVerificationToken>;
25
+ resetAppVerificationToken(appId: string, requestId?: string): Promise<AppVerificationToken>;
26
+ getAppByDistributionToken(distributionToken: string, requestId?: string): Promise<AppByDistributionToken>;
27
+ getAppWebhook(appId: string, requestId?: string): Promise<AppWebhook | null>;
28
+ updateAppWebhook(args: UpdateAppWebhookArgs, requestId?: string): Promise<AppWebhook>;
29
+ deleteAppWebhook(appId: string, requestId?: string): Promise<boolean>;
30
+ getAppInstallations(requestId?: string): Promise<AppInstallation[]>;
31
+ installApp(args: InstallAppArgs, requestId?: string): Promise<AppInstallation>;
32
+ getAppInstallation(installationId: string, requestId?: string): Promise<AppInstallation>;
33
+ updateAppInstallation(installationId: string, args: UpdateAppInstallationArgs, requestId?: string): Promise<AppInstallation>;
34
+ uninstallApp(installationId: string, requestId?: string): Promise<boolean>;
35
+ getUserAuthorizations(requestId?: string): Promise<UserAuthorization[]>;
36
+ revokeUserAuthorization(args: RevokeUserAuthorizationArgs, requestId?: string): Promise<boolean>;
37
+ }
@@ -15,6 +15,7 @@ import type { CustomFetch } from '../types/http.js';
15
15
  export declare abstract class BaseClient {
16
16
  protected readonly authToken: string;
17
17
  protected readonly syncApiBase: string;
18
+ protected readonly apiRootBase: string;
18
19
  protected readonly customFetch?: CustomFetch;
19
20
  constructor(context: SyncRequestContext);
20
21
  protected get syncContext(): SyncRequestContext;
@@ -0,0 +1,18 @@
1
+ import type { AddUiExtensionArgs, UiExtension, UpdateUiExtensionArgs, UploadUiExtensionIconArgs } from '../types/ui-extensions/index.js';
2
+ import { BaseClient } from './base-client.js';
3
+ /**
4
+ * Internal sub-client handling all UI-extension endpoints for developer
5
+ * applications. All endpoints require the `dev:app_console` OAuth scope.
6
+ *
7
+ * Instantiated by `TodoistApi`; every public UI-extension method on
8
+ * `TodoistApi` delegates here. See `todoist-api.ts` for user-facing JSDoc.
9
+ */
10
+ export declare class UiExtensionClient extends BaseClient {
11
+ getUiExtension(uiExtensionId: string, requestId?: string): Promise<UiExtension>;
12
+ getInstalledUiExtensions(requestId?: string): Promise<UiExtension[]>;
13
+ getUiExtensionsForApp(appId: string, requestId?: string): Promise<UiExtension[]>;
14
+ addUiExtension(args: AddUiExtensionArgs, requestId?: string): Promise<UiExtension>;
15
+ updateUiExtension(uiExtensionId: string, args: UpdateUiExtensionArgs, requestId?: string): Promise<UiExtension>;
16
+ deleteUiExtension(uiExtensionId: string, requestId?: string): Promise<boolean>;
17
+ uploadUiExtensionIcon(args: UploadUiExtensionIconArgs, requestId?: string): Promise<UiExtension>;
18
+ }
@@ -2,6 +2,7 @@ export declare const TODOIST_WEB_URI = "https://app.todoist.com/app";
2
2
  export declare const API_VERSION = "v1";
3
3
  export declare const API_BASE_URI = "/api/v1/";
4
4
  export declare function getSyncBaseUri(domainBase?: string): string;
5
+ export declare function getApiRootBaseUri(domainBase?: string): string;
5
6
  export declare function getAuthBaseUri(domainBase?: string): string;
6
7
  export declare const ENDPOINT_REST_TASKS = "tasks";
7
8
  export declare const ENDPOINT_REST_TASKS_FILTER: string;
@@ -58,11 +59,6 @@ export declare const ENDPOINT_GET_TOKEN = "access_token";
58
59
  export declare const ENDPOINT_REVOKE = "revoke";
59
60
  export declare const ENDPOINT_REGISTER = "register";
60
61
  export declare const ENDPOINT_REST_FOLDERS = "folders";
61
- export declare const ENDPOINT_REST_GOALS = "goals";
62
- export declare const ENDPOINT_REST_GOALS_SEARCH: string;
63
- export declare const GOAL_COMPLETE = "complete";
64
- export declare const GOAL_UNCOMPLETE = "uncomplete";
65
- export declare const GOAL_TASKS = "items";
66
62
  export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
67
63
  export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
68
64
  export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
@@ -85,3 +81,27 @@ export declare function getWorkspaceInviteUsersEndpoint(workspaceId: string): st
85
81
  export declare function getWorkspaceUserEndpoint(workspaceId: string, userId: string): string;
86
82
  export declare function getWorkspaceActiveProjectsEndpoint(workspaceId: string): string;
87
83
  export declare function getWorkspaceArchivedProjectsEndpoint(workspaceId: string): string;
84
+ export declare const ENDPOINT_REST_APPS = "apps";
85
+ export declare const ENDPOINT_REST_APPS_INSTALLATIONS = "apps/installations";
86
+ export declare const ENDPOINT_REST_APPS_UI_EXTENSIONS = "apps/ui_extensions";
87
+ export declare const ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED = "apps/ui_extensions/installed";
88
+ export declare const ENDPOINT_REST_USER_AUTHORIZATIONS = "user/authorizations";
89
+ export declare const ENDPOINT_REST_USER_AUTHORIZATIONS_DELETE = "user/authorizations/delete";
90
+ /** Available app icon sizes (small 60x60, medium 300x300, large 600x600). */
91
+ export declare const APP_ICON_SIZES: readonly ["small", "medium", "large"];
92
+ /** Size of an app icon. */
93
+ export type AppIconSize = (typeof APP_ICON_SIZES)[number];
94
+ export declare function getAppEndpoint(appId: string): string;
95
+ export declare function getAppSecretsEndpoint(appId: string): string;
96
+ export declare function getAppClientSecretEndpoint(appId: string): string;
97
+ export declare function getAppTokensEndpoint(appId: string): string;
98
+ export declare function getAppTestTokenEndpoint(appId: string): string;
99
+ export declare function getAppDistributionTokenEndpoint(appId: string): string;
100
+ export declare function getAppVerificationTokenEndpoint(appId: string): string;
101
+ export declare function getAppWebhookEndpoint(appId: string): string;
102
+ export declare function getAppIconEndpoint(appId: string, size: AppIconSize): string;
103
+ export declare function getAppInstallationEndpoint(installationId: string): string;
104
+ export declare function getAppByDistributionTokenEndpoint(distributionToken: string): string;
105
+ export declare function getUiExtensionEndpoint(uiExtensionId: string): string;
106
+ export declare function getUiExtensionIconEndpoint(uiExtensionId: string): string;
107
+ export declare function getUiExtensionsByIntegrationEndpoint(integrationId: string): string;
@@ -1,4 +1,4 @@
1
- import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, WorkspaceProject, Reminder, Folder, Goal } from '../types/index.js';
1
+ import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, WorkspaceProject, Reminder, Folder, App, AppWithUserCount, AppSecrets, AppVerificationToken, AppTestToken, AppDistributionToken, AppWebhook, AppInstallation, UserAuthorization, UiExtension } from '../types/index.js';
2
2
  import type { Collaborator, CollaboratorState } from '../types/sync/resources/collaborators.js';
3
3
  import type { Note } from '../types/sync/resources/notes.js';
4
4
  export declare const DEFAULT_TASK_ID = "1234";
@@ -264,7 +264,19 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
264
264
  export declare const DEFAULT_FOLDER: Folder;
265
265
  export declare const DEFAULT_COLLABORATOR: Collaborator;
266
266
  export declare const DEFAULT_COLLABORATOR_STATE: CollaboratorState;
267
- export declare const DEFAULT_GOAL_ID = "550e8400-e29b-41d4-a716-446655440000";
268
- export declare const DEFAULT_GOAL: Goal;
269
- export declare const DEFAULT_GOAL_NO_PROGRESS: Goal;
267
+ export declare const DEFAULT_APP_ID = "42";
268
+ export declare const DEFAULT_INSTALLATION_ID = "1001";
269
+ export declare const DEFAULT_UI_EXTENSION_ID = "2002";
270
+ export declare const DEFAULT_DISTRIBUTION_TOKEN = "dist-token-abc";
271
+ export declare const DEFAULT_ACCESS_TOKEN_ID = "3003";
272
+ export declare const DEFAULT_APP: App;
273
+ export declare const DEFAULT_APP_WITH_USER_COUNT: AppWithUserCount;
274
+ export declare const DEFAULT_APP_SECRETS: AppSecrets;
275
+ export declare const DEFAULT_APP_VERIFICATION_TOKEN: AppVerificationToken;
276
+ export declare const DEFAULT_APP_TEST_TOKEN: AppTestToken;
277
+ export declare const DEFAULT_APP_DISTRIBUTION_TOKEN: AppDistributionToken;
278
+ export declare const DEFAULT_APP_WEBHOOK: AppWebhook;
279
+ export declare const DEFAULT_APP_INSTALLATION: AppInstallation;
280
+ export declare const DEFAULT_USER_AUTHORIZATION: UserAuthorization;
281
+ export declare const DEFAULT_UI_EXTENSION: UiExtension;
270
282
  export declare const DEFAULT_NOTE: Note;
@@ -1,10 +1,10 @@
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 type { AddGoalArgs, GetGoalsArgs, GetGoalsResponse, Goal, SearchGoalsArgs, TaskLinkingArgs, UpdateGoalArgs } from './types/goals/index.js';
8
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';
@@ -16,6 +16,7 @@ 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';
@@ -74,7 +75,8 @@ export declare class TodoistApi {
74
75
  private readonly activityClient;
75
76
  private readonly productivityClient;
76
77
  private readonly workspaceClient;
77
- private readonly goalsClient;
78
+ private readonly appClient;
79
+ private readonly uiExtensionClient;
78
80
  constructor(
79
81
  /**
80
82
  * Your Todoist API token.
@@ -785,16 +787,6 @@ export declare class TodoistApi {
785
787
  * @returns A promise that resolves to `true` if successful.
786
788
  */
787
789
  deleteFolder(id: string, requestId?: string): Promise<boolean>;
788
- getGoals(args?: GetGoalsArgs): Promise<GetGoalsResponse>;
789
- searchGoals(args: SearchGoalsArgs): Promise<GetGoalsResponse>;
790
- getGoal(id: string): Promise<Goal>;
791
- addGoal(args: AddGoalArgs, requestId?: string): Promise<Goal>;
792
- updateGoal(id: string, args: UpdateGoalArgs, requestId?: string): Promise<Goal>;
793
- deleteGoal(id: string, requestId?: string): Promise<boolean>;
794
- completeGoal(id: string, requestId?: string): Promise<Goal>;
795
- uncompleteGoal(id: string, requestId?: string): Promise<Goal>;
796
- linkTaskToGoal(args: TaskLinkingArgs, requestId?: string): Promise<Goal>;
797
- unlinkTaskFromGoal(args: TaskLinkingArgs, requestId?: string): Promise<boolean>;
798
790
  /**
799
791
  * Retrieves a list of available backups.
800
792
  *
@@ -1054,4 +1046,202 @@ export declare class TodoistApi {
1054
1046
  * @returns Paginated list of archived workspace projects.
1055
1047
  */
1056
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>;
1057
1247
  }
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ export * from './requests.js';
@@ -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
+ };