@doist/todoist-api-typescript 7.4.0 → 7.5.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/README.md +2 -0
- package/dist/cjs/authentication.js +4 -4
- package/dist/cjs/consts/endpoints.js +11 -1
- package/dist/cjs/test-utils/test-defaults.js +33 -1
- package/dist/cjs/todoist-api.js +528 -84
- package/dist/cjs/{utils → transport}/fetch-with-retry.js +23 -71
- package/dist/cjs/{rest-client.js → transport/http-client.js} +5 -5
- package/dist/cjs/transport/http-dispatcher.js +72 -0
- package/dist/cjs/types/entities.js +9 -1
- package/dist/cjs/types/errors.js +9 -1
- package/dist/cjs/types/http.js +3 -1
- package/dist/cjs/types/requests.js +3 -0
- package/dist/cjs/types/sync/commands/shared.js +2 -8
- package/dist/cjs/types/sync/resources/reminders.js +2 -0
- package/dist/cjs/utils/multipart-upload.js +1 -1
- package/dist/esm/authentication.js +1 -1
- package/dist/esm/consts/endpoints.js +9 -0
- package/dist/esm/test-utils/test-defaults.js +32 -0
- package/dist/esm/todoist-api.js +461 -17
- package/dist/esm/{utils → transport}/fetch-with-retry.js +23 -38
- package/dist/esm/{rest-client.js → transport/http-client.js} +5 -5
- package/dist/esm/transport/http-dispatcher.js +35 -0
- package/dist/esm/types/entities.js +8 -0
- package/dist/esm/types/errors.js +7 -0
- package/dist/esm/types/http.js +3 -1
- package/dist/esm/types/requests.js +2 -1
- package/dist/esm/types/sync/commands/shared.js +1 -8
- package/dist/esm/types/sync/resources/reminders.js +2 -0
- package/dist/esm/utils/multipart-upload.js +1 -1
- package/dist/types/consts/endpoints.d.ts +9 -0
- package/dist/types/test-utils/test-defaults.d.ts +5 -1
- package/dist/types/todoist-api.d.ts +144 -3
- package/dist/types/{utils → transport}/fetch-with-retry.d.ts +1 -1
- package/dist/types/{rest-client.d.ts → transport/http-client.d.ts} +1 -1
- package/dist/types/transport/http-dispatcher.d.ts +3 -0
- package/dist/types/types/entities.d.ts +4 -0
- package/dist/types/types/errors.d.ts +4 -0
- package/dist/types/types/requests.d.ts +163 -1
- package/dist/types/types/sync/commands/projects.d.ts +2 -2
- package/dist/types/types/sync/commands/shared.d.ts +1 -4
- package/dist/types/types/sync/resources/reminders.d.ts +4 -0
- package/dist/types/utils/validators.d.ts +4 -0
- package/package.json +4 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Use effectively-disabled keep-alive so short-lived CLI processes do not stay
|
|
2
|
+
// open waiting on idle sockets. Undici requires positive values, so we use 1ms.
|
|
3
|
+
const KEEP_ALIVE_OPTIONS = {
|
|
4
|
+
keepAliveTimeout: 1,
|
|
5
|
+
keepAliveMaxTimeout: 1,
|
|
6
|
+
};
|
|
7
|
+
let defaultDispatcherPromise;
|
|
8
|
+
export function getDefaultDispatcher() {
|
|
9
|
+
if (!isNodeEnvironment()) {
|
|
10
|
+
return Promise.resolve(undefined);
|
|
11
|
+
}
|
|
12
|
+
if (!defaultDispatcherPromise) {
|
|
13
|
+
defaultDispatcherPromise = createDefaultDispatcher().catch((error) => {
|
|
14
|
+
defaultDispatcherPromise = undefined;
|
|
15
|
+
throw error;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return defaultDispatcherPromise;
|
|
19
|
+
}
|
|
20
|
+
export async function resetDefaultDispatcherForTests() {
|
|
21
|
+
if (!defaultDispatcherPromise) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const dispatcherPromise = defaultDispatcherPromise;
|
|
25
|
+
defaultDispatcherPromise = undefined;
|
|
26
|
+
await dispatcherPromise.then((dispatcher) => dispatcher.close(), () => undefined);
|
|
27
|
+
}
|
|
28
|
+
async function createDefaultDispatcher() {
|
|
29
|
+
const { EnvHttpProxyAgent } = await import('undici');
|
|
30
|
+
return new EnvHttpProxyAgent(KEEP_ALIVE_OPTIONS);
|
|
31
|
+
}
|
|
32
|
+
function isNodeEnvironment() {
|
|
33
|
+
var _a;
|
|
34
|
+
return typeof process !== 'undefined' && Boolean((_a = process.versions) === null || _a === void 0 ? void 0 : _a.node);
|
|
35
|
+
}
|
|
@@ -319,6 +319,14 @@ export const ActivityEventSchema = z
|
|
|
319
319
|
extraData: ActivityEventExtraDataSchema,
|
|
320
320
|
})
|
|
321
321
|
.catchall(z.any());
|
|
322
|
+
/** Available project collaborator roles. */
|
|
323
|
+
export const COLLABORATOR_ROLES = [
|
|
324
|
+
'CREATOR',
|
|
325
|
+
'ADMIN',
|
|
326
|
+
'READ_WRITE',
|
|
327
|
+
'EDIT_ONLY',
|
|
328
|
+
'COMPLETE_ONLY',
|
|
329
|
+
];
|
|
322
330
|
/**
|
|
323
331
|
* Available workspace roles.
|
|
324
332
|
*/
|
package/dist/esm/types/errors.js
CHANGED
|
@@ -15,3 +15,10 @@ export class TodoistRequestError extends CustomError {
|
|
|
15
15
|
Object.defineProperty(this, 'name', { value: 'TodoistRequestError' });
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
export class TodoistArgumentError extends CustomError {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.message = message;
|
|
22
|
+
Object.defineProperty(this, 'name', { value: 'TodoistArgumentError' });
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/esm/types/http.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
* Type guard to check if an error is a network error
|
|
3
3
|
*/
|
|
4
4
|
export function isNetworkError(error) {
|
|
5
|
-
// Network errors in fetch are typically TypeError with specific messages
|
|
5
|
+
// Network errors in fetch are typically TypeError with specific messages.
|
|
6
|
+
// Timeout errors are created by fetch-with-retry with the TimeoutError name.
|
|
6
7
|
return ((error instanceof TypeError &&
|
|
7
8
|
(error.message.includes('fetch') ||
|
|
8
9
|
error.message.includes('network') ||
|
|
9
10
|
error.message.includes('Failed to fetch') ||
|
|
10
11
|
error.message.includes('NetworkError'))) ||
|
|
12
|
+
error.name === 'TimeoutError' ||
|
|
11
13
|
error.isNetworkError === true);
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** Available reminder delivery services. */
|
|
2
|
+
export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
|
|
@@ -9,14 +9,7 @@ export const PROJECT_STATUSES = [
|
|
|
9
9
|
'COMPLETED',
|
|
10
10
|
'CANCELED',
|
|
11
11
|
];
|
|
12
|
-
|
|
13
|
-
export const COLLABORATOR_ROLES = [
|
|
14
|
-
'CREATOR',
|
|
15
|
-
'ADMIN',
|
|
16
|
-
'READ_WRITE',
|
|
17
|
-
'EDIT_ONLY',
|
|
18
|
-
'COMPLETE_ONLY',
|
|
19
|
-
];
|
|
12
|
+
export { COLLABORATOR_ROLES } from '../../entities.js';
|
|
20
13
|
/** Available reminder notification services. */
|
|
21
14
|
export const REMINDER_SERVICES = ['default', 'email', 'mobile', 'push', 'no_default'];
|
|
22
15
|
/** Available workspace project sort orders. */
|
|
@@ -20,11 +20,13 @@ export const LocationReminderSchema = ReminderBaseSchema.extend({
|
|
|
20
20
|
export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
|
|
21
21
|
type: z.literal('absolute'),
|
|
22
22
|
due: DueDateSchema,
|
|
23
|
+
isUrgent: z.boolean().optional(),
|
|
23
24
|
}).passthrough();
|
|
24
25
|
export const RelativeReminderSchema = ReminderBaseSchema.extend({
|
|
25
26
|
type: z.literal('relative'),
|
|
26
27
|
minuteOffset: z.number().int(),
|
|
27
28
|
due: DueDateSchema.optional(),
|
|
29
|
+
isUrgent: z.boolean().optional(),
|
|
28
30
|
}).passthrough();
|
|
29
31
|
export const ReminderSchema = z.discriminatedUnion('type', [
|
|
30
32
|
LocationReminderSchema,
|
|
@@ -16,6 +16,8 @@ export declare const ENDPOINT_REST_LABELS_SHARED: string;
|
|
|
16
16
|
export declare const ENDPOINT_REST_LABELS_SHARED_RENAME: string;
|
|
17
17
|
export declare const ENDPOINT_REST_LABELS_SHARED_REMOVE: string;
|
|
18
18
|
export declare const ENDPOINT_REST_COMMENTS = "comments";
|
|
19
|
+
export declare const ENDPOINT_REST_REMINDERS = "reminders";
|
|
20
|
+
export declare const ENDPOINT_REST_LOCATION_REMINDERS = "location_reminders";
|
|
19
21
|
export declare const ENDPOINT_REST_TASK_CLOSE = "close";
|
|
20
22
|
export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
|
21
23
|
export declare const ENDPOINT_REST_TASK_MOVE = "move";
|
|
@@ -29,6 +31,12 @@ export declare const ENDPOINT_REST_ACTIVITIES = "activities";
|
|
|
29
31
|
export declare const ENDPOINT_REST_UPLOADS = "uploads";
|
|
30
32
|
export declare const PROJECT_ARCHIVE = "archive";
|
|
31
33
|
export declare const PROJECT_UNARCHIVE = "unarchive";
|
|
34
|
+
export declare const ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT: string;
|
|
35
|
+
export declare const ENDPOINT_REST_PROJECTS_PERMISSIONS: string;
|
|
36
|
+
export declare const ENDPOINT_REST_PROJECT_FULL = "full";
|
|
37
|
+
export declare const ENDPOINT_REST_PROJECT_JOIN = "join";
|
|
38
|
+
export declare const SECTION_ARCHIVE = "archive";
|
|
39
|
+
export declare const SECTION_UNARCHIVE = "unarchive";
|
|
32
40
|
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE: string;
|
|
33
41
|
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL: string;
|
|
34
42
|
export declare const ENDPOINT_SYNC_QUICK_ADD: string;
|
|
@@ -36,6 +44,7 @@ export declare const ENDPOINT_SYNC = "sync";
|
|
|
36
44
|
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
37
45
|
export declare const ENDPOINT_GET_TOKEN = "access_token";
|
|
38
46
|
export declare const ENDPOINT_REVOKE = "revoke";
|
|
47
|
+
export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
|
|
39
48
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
|
|
40
49
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
|
|
41
50
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS_DELETE = "workspaces/invitations/delete";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject } from '../types/index.js';
|
|
1
|
+
import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, Reminder } from '../types/index.js';
|
|
2
2
|
export declare const DEFAULT_TASK_ID = "1234";
|
|
3
3
|
export declare const DEFAULT_TASK_CONTENT = "This is a task";
|
|
4
4
|
export declare const DEFAULT_TASK_DESCRIPTION = "A description";
|
|
@@ -148,6 +148,10 @@ export declare const DEFAULT_COMMENT: {
|
|
|
148
148
|
isDeleted: boolean;
|
|
149
149
|
projectId?: string | undefined;
|
|
150
150
|
};
|
|
151
|
+
export declare const DEFAULT_REMINDER_ID = "6XGgmFQrx44wfGHr";
|
|
152
|
+
export declare const DEFAULT_RELATIVE_REMINDER: Reminder;
|
|
153
|
+
export declare const DEFAULT_ABSOLUTE_REMINDER: Reminder;
|
|
154
|
+
export declare const DEFAULT_LOCATION_REMINDER: Reminder;
|
|
151
155
|
export declare const INVALID_COMMENT: {
|
|
152
156
|
isDeleted: string;
|
|
153
157
|
id: string;
|
|
@@ -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
|
-
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';
|
|
2
|
+
import { AddCommentArgs, AddLabelArgs, AddLocationReminderArgs, AddProjectArgs, AddReminderArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateLocationReminderArgs, UpdateProjectArgs, UpdateReminderArgs, 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, GetArchivedProjectsCountArgs, GetArchivedProjectsCountResponse, GetProjectPermissionsResponse, GetFullProjectArgs, GetFullProjectResponse, AddWorkspaceArgs, UpdateWorkspaceArgs } from './types/requests.js';
|
|
3
3
|
import { CustomFetch, CustomFetchResponse } from './types/http.js';
|
|
4
|
+
import type { Reminder } from './types/index.js';
|
|
4
5
|
import { type SyncResponse, type SyncRequest } from './types/sync/index.js';
|
|
5
6
|
/**
|
|
6
7
|
* Response from viewAttachment, extending CustomFetchResponse with
|
|
@@ -270,6 +271,35 @@ export declare class TodoistApi {
|
|
|
270
271
|
* @returns A promise that resolves to the moved project.
|
|
271
272
|
*/
|
|
272
273
|
moveProjectToPersonal(args: MoveProjectToPersonalArgs, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
274
|
+
/**
|
|
275
|
+
* Counts the number of archived projects.
|
|
276
|
+
*
|
|
277
|
+
* @param args - Optional parameters to filter the count.
|
|
278
|
+
* @returns A promise that resolves to the count of archived projects.
|
|
279
|
+
*/
|
|
280
|
+
getArchivedProjectsCount(args?: GetArchivedProjectsCountArgs): Promise<GetArchivedProjectsCountResponse>;
|
|
281
|
+
/**
|
|
282
|
+
* Retrieves the role-to-action permission mappings for projects.
|
|
283
|
+
*
|
|
284
|
+
* @returns A promise that resolves to the permission mappings.
|
|
285
|
+
*/
|
|
286
|
+
getProjectPermissions(): Promise<GetProjectPermissionsResponse>;
|
|
287
|
+
/**
|
|
288
|
+
* Retrieves full project data including tasks, sections, collaborators, and notes.
|
|
289
|
+
*
|
|
290
|
+
* @param id - The unique identifier of the project.
|
|
291
|
+
* @param args - Optional parameters.
|
|
292
|
+
* @returns A promise that resolves to the full project data.
|
|
293
|
+
*/
|
|
294
|
+
getFullProject(id: string, args?: GetFullProjectArgs): Promise<GetFullProjectResponse>;
|
|
295
|
+
/**
|
|
296
|
+
* Joins a shared project by its ID.
|
|
297
|
+
*
|
|
298
|
+
* @param id - The unique identifier of the project to join.
|
|
299
|
+
* @param requestId - Optional custom identifier for the request.
|
|
300
|
+
* @returns A promise that resolves to the joined project.
|
|
301
|
+
*/
|
|
302
|
+
joinProject(id: string, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
273
303
|
/**
|
|
274
304
|
* Retrieves a list of collaborators for a specific project.
|
|
275
305
|
*
|
|
@@ -325,6 +355,22 @@ export declare class TodoistApi {
|
|
|
325
355
|
* @returns A promise that resolves to `true` if successful.
|
|
326
356
|
*/
|
|
327
357
|
deleteSection(id: string, requestId?: string): Promise<boolean>;
|
|
358
|
+
/**
|
|
359
|
+
* Archives a section by its ID.
|
|
360
|
+
*
|
|
361
|
+
* @param id - The unique identifier of the section to archive.
|
|
362
|
+
* @param requestId - Optional custom identifier for the request.
|
|
363
|
+
* @returns A promise that resolves to the updated section.
|
|
364
|
+
*/
|
|
365
|
+
archiveSection(id: string, requestId?: string): Promise<Section>;
|
|
366
|
+
/**
|
|
367
|
+
* Unarchives a section by its ID.
|
|
368
|
+
*
|
|
369
|
+
* @param id - The unique identifier of the section to unarchive.
|
|
370
|
+
* @param requestId - Optional custom identifier for the request.
|
|
371
|
+
* @returns A promise that resolves to the updated section.
|
|
372
|
+
*/
|
|
373
|
+
unarchiveSection(id: string, requestId?: string): Promise<Section>;
|
|
328
374
|
/**
|
|
329
375
|
* Retrieves a label by its ID.
|
|
330
376
|
*
|
|
@@ -431,6 +477,70 @@ export declare class TodoistApi {
|
|
|
431
477
|
* @returns A promise that resolves to `true` if successful.
|
|
432
478
|
*/
|
|
433
479
|
deleteComment(id: string, requestId?: string): Promise<boolean>;
|
|
480
|
+
/**
|
|
481
|
+
* Retrieves a time-based reminder by its ID.
|
|
482
|
+
*
|
|
483
|
+
* @param id - The unique identifier of the reminder to retrieve.
|
|
484
|
+
* @returns A promise that resolves to the requested reminder.
|
|
485
|
+
*/
|
|
486
|
+
getReminder(id: string): Promise<Reminder>;
|
|
487
|
+
/**
|
|
488
|
+
* Retrieves a location reminder by its ID.
|
|
489
|
+
*
|
|
490
|
+
* @param id - The unique identifier of the location reminder to retrieve.
|
|
491
|
+
* @returns A promise that resolves to the requested reminder.
|
|
492
|
+
*/
|
|
493
|
+
getLocationReminder(id: string): Promise<Reminder>;
|
|
494
|
+
/**
|
|
495
|
+
* Creates a time-based reminder for a task.
|
|
496
|
+
*
|
|
497
|
+
* @param args - Reminder creation parameters for relative or absolute reminders.
|
|
498
|
+
* @param requestId - Optional custom identifier for the request.
|
|
499
|
+
* @returns A promise that resolves to the created reminder.
|
|
500
|
+
*/
|
|
501
|
+
addReminder(args: AddReminderArgs, requestId?: string): Promise<Reminder>;
|
|
502
|
+
/**
|
|
503
|
+
* Creates a location reminder for a task.
|
|
504
|
+
*
|
|
505
|
+
* @param args - Location reminder creation parameters.
|
|
506
|
+
* @param requestId - Optional custom identifier for the request.
|
|
507
|
+
* @returns A promise that resolves to the created reminder.
|
|
508
|
+
*/
|
|
509
|
+
addLocationReminder(args: AddLocationReminderArgs, requestId?: string): Promise<Reminder>;
|
|
510
|
+
/**
|
|
511
|
+
* Updates an existing time-based reminder.
|
|
512
|
+
*
|
|
513
|
+
* @param id - The unique identifier of the reminder to update.
|
|
514
|
+
* @param args - Reminder update parameters.
|
|
515
|
+
* @param requestId - Optional custom identifier for the request.
|
|
516
|
+
* @returns A promise that resolves to the updated reminder.
|
|
517
|
+
*/
|
|
518
|
+
updateReminder(id: string, args: UpdateReminderArgs, requestId?: string): Promise<Reminder>;
|
|
519
|
+
/**
|
|
520
|
+
* Updates an existing location reminder.
|
|
521
|
+
*
|
|
522
|
+
* @param id - The unique identifier of the location reminder to update.
|
|
523
|
+
* @param args - Location reminder update parameters.
|
|
524
|
+
* @param requestId - Optional custom identifier for the request.
|
|
525
|
+
* @returns A promise that resolves to the updated reminder.
|
|
526
|
+
*/
|
|
527
|
+
updateLocationReminder(id: string, args: UpdateLocationReminderArgs, requestId?: string): Promise<Reminder>;
|
|
528
|
+
/**
|
|
529
|
+
* Deletes a time-based reminder by its ID.
|
|
530
|
+
*
|
|
531
|
+
* @param id - The unique identifier of the reminder to delete.
|
|
532
|
+
* @param requestId - Optional custom identifier for the request.
|
|
533
|
+
* @returns A promise that resolves to `true` if successful.
|
|
534
|
+
*/
|
|
535
|
+
deleteReminder(id: string, requestId?: string): Promise<boolean>;
|
|
536
|
+
/**
|
|
537
|
+
* Deletes a location reminder by its ID.
|
|
538
|
+
*
|
|
539
|
+
* @param id - The unique identifier of the location reminder to delete.
|
|
540
|
+
* @param requestId - Optional custom identifier for the request.
|
|
541
|
+
* @returns A promise that resolves to `true` if successful.
|
|
542
|
+
*/
|
|
543
|
+
deleteLocationReminder(id: string, requestId?: string): Promise<boolean>;
|
|
434
544
|
/**
|
|
435
545
|
* Retrieves productivity stats for the authenticated user.
|
|
436
546
|
*
|
|
@@ -598,8 +708,6 @@ export declare class TodoistApi {
|
|
|
598
708
|
/**
|
|
599
709
|
* Retrieves all workspaces for the authenticated user.
|
|
600
710
|
*
|
|
601
|
-
* Uses the Sync API internally to fetch workspace data.
|
|
602
|
-
*
|
|
603
711
|
* @param requestId - Optional custom identifier for the request.
|
|
604
712
|
* @returns A promise that resolves to an array of workspaces.
|
|
605
713
|
*
|
|
@@ -612,6 +720,39 @@ export declare class TodoistApi {
|
|
|
612
720
|
* ```
|
|
613
721
|
*/
|
|
614
722
|
getWorkspaces(requestId?: string): Promise<Workspace[]>;
|
|
723
|
+
/**
|
|
724
|
+
* Retrieves a workspace by its ID.
|
|
725
|
+
*
|
|
726
|
+
* @param id - The unique identifier of the workspace.
|
|
727
|
+
* @param requestId - Optional custom identifier for the request.
|
|
728
|
+
* @returns A promise that resolves to the requested workspace.
|
|
729
|
+
*/
|
|
730
|
+
getWorkspace(id: string, requestId?: string): Promise<Workspace>;
|
|
731
|
+
/**
|
|
732
|
+
* Creates a new workspace.
|
|
733
|
+
*
|
|
734
|
+
* @param args - The arguments for creating the workspace.
|
|
735
|
+
* @param requestId - Optional custom identifier for the request.
|
|
736
|
+
* @returns A promise that resolves to the created workspace.
|
|
737
|
+
*/
|
|
738
|
+
addWorkspace(args: AddWorkspaceArgs, requestId?: string): Promise<Workspace>;
|
|
739
|
+
/**
|
|
740
|
+
* Updates an existing workspace.
|
|
741
|
+
*
|
|
742
|
+
* @param id - The unique identifier of the workspace to update.
|
|
743
|
+
* @param args - The arguments for updating the workspace.
|
|
744
|
+
* @param requestId - Optional custom identifier for the request.
|
|
745
|
+
* @returns A promise that resolves to the updated workspace.
|
|
746
|
+
*/
|
|
747
|
+
updateWorkspace(id: string, args: UpdateWorkspaceArgs, requestId?: string): Promise<Workspace>;
|
|
748
|
+
/**
|
|
749
|
+
* Deletes a workspace by its ID.
|
|
750
|
+
*
|
|
751
|
+
* @param id - The unique identifier of the workspace to delete.
|
|
752
|
+
* @param requestId - Optional custom identifier for the request.
|
|
753
|
+
* @returns A promise that resolves to `true` if successful.
|
|
754
|
+
*/
|
|
755
|
+
deleteWorkspace(id: string, requestId?: string): Promise<boolean>;
|
|
615
756
|
/**
|
|
616
757
|
* Gets active projects in a workspace with pagination.
|
|
617
758
|
*
|
|
@@ -781,6 +781,10 @@ export declare const ActivityEventSchema: z.ZodObject<{
|
|
|
781
781
|
* Represents an activity log event in Todoist.
|
|
782
782
|
*/
|
|
783
783
|
export type ActivityEvent = z.infer<typeof ActivityEventSchema>;
|
|
784
|
+
/** Available project collaborator roles. */
|
|
785
|
+
export declare const COLLABORATOR_ROLES: readonly ["CREATOR", "ADMIN", "READ_WRITE", "EDIT_ONLY", "COMPLETE_ONLY"];
|
|
786
|
+
/** Role of a collaborator in a project. */
|
|
787
|
+
export type CollaboratorRole = (typeof COLLABORATOR_ROLES)[number];
|
|
784
788
|
/**
|
|
785
789
|
* Available workspace roles.
|
|
786
790
|
*/
|
|
@@ -6,3 +6,7 @@ export declare class TodoistRequestError extends CustomError {
|
|
|
6
6
|
constructor(message: string, httpStatusCode?: number | undefined, responseData?: unknown | undefined);
|
|
7
7
|
isAuthenticationError: () => boolean;
|
|
8
8
|
}
|
|
9
|
+
export declare class TodoistArgumentError extends CustomError {
|
|
10
|
+
message: string;
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
|
|
2
2
|
import type { ColorKey } from '../utils/colors.js';
|
|
3
|
-
import type { ActivityEvent, ActivityObjectEventType, Comment, Duration, Label, PersonalProject, ProjectViewStyle, ProjectVisibility, Section, Task, User, WorkspaceProject } from './entities.js';
|
|
3
|
+
import type { ActivityEvent, ActivityObjectEventType, CollaboratorRole, Comment, DueDate, Duration, Label, PersonalProject, ProjectViewStyle, ProjectVisibility, Section, Task, User, WorkspaceProject, WorkspaceRole } from './entities.js';
|
|
4
|
+
import type { LocationTrigger } from './sync/resources/reminders.js';
|
|
4
5
|
/**
|
|
5
6
|
* Arguments for creating a new task.
|
|
6
7
|
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/create_task_api_v1_tasks_post
|
|
@@ -417,6 +418,56 @@ export type AddCommentArgs = {
|
|
|
417
418
|
export type UpdateCommentArgs = {
|
|
418
419
|
content: string;
|
|
419
420
|
};
|
|
421
|
+
/** Available reminder delivery services. */
|
|
422
|
+
export declare const REMINDER_DELIVERY_SERVICES: readonly ["email", "push"];
|
|
423
|
+
/** Delivery service for a reminder notification. */
|
|
424
|
+
export type ReminderDeliveryService = (typeof REMINDER_DELIVERY_SERVICES)[number];
|
|
425
|
+
export type ReminderDueDate = Partial<Pick<DueDate, 'date' | 'string' | 'timezone' | 'lang' | 'isRecurring'>>;
|
|
426
|
+
type ReminderTaskArgs = {
|
|
427
|
+
taskId: string;
|
|
428
|
+
};
|
|
429
|
+
type TimeBasedReminderArgs = {
|
|
430
|
+
service?: ReminderDeliveryService;
|
|
431
|
+
notifyUid?: string;
|
|
432
|
+
isUrgent?: boolean;
|
|
433
|
+
};
|
|
434
|
+
type AddLocationReminderFields = {
|
|
435
|
+
notifyUid?: string;
|
|
436
|
+
name: string;
|
|
437
|
+
locLat: string;
|
|
438
|
+
locLong: string;
|
|
439
|
+
locTrigger: LocationTrigger;
|
|
440
|
+
radius?: number;
|
|
441
|
+
};
|
|
442
|
+
export type AddRelativeReminderArgs = ReminderTaskArgs & {
|
|
443
|
+
reminderType?: 'relative';
|
|
444
|
+
minuteOffset: number;
|
|
445
|
+
} & TimeBasedReminderArgs;
|
|
446
|
+
export type AddAbsoluteReminderArgs = ReminderTaskArgs & {
|
|
447
|
+
reminderType: 'absolute';
|
|
448
|
+
due: ReminderDueDate;
|
|
449
|
+
} & TimeBasedReminderArgs;
|
|
450
|
+
export type AddLocationReminderArgs = ReminderTaskArgs & AddLocationReminderFields;
|
|
451
|
+
/**
|
|
452
|
+
* Arguments for creating a new reminder.
|
|
453
|
+
* @see https://developer.todoist.com/api/v1/#tag/Reminders/operation/create_reminder_api_v1_reminders_post
|
|
454
|
+
*/
|
|
455
|
+
export type AddReminderArgs = AddRelativeReminderArgs | AddAbsoluteReminderArgs;
|
|
456
|
+
export type UpdateRelativeReminderArgs = {
|
|
457
|
+
reminderType: 'relative';
|
|
458
|
+
} & Partial<Omit<AddRelativeReminderArgs, 'taskId' | 'reminderType'>>;
|
|
459
|
+
export type UpdateAbsoluteReminderArgs = {
|
|
460
|
+
reminderType: 'absolute';
|
|
461
|
+
} & Partial<Omit<AddAbsoluteReminderArgs, 'taskId' | 'reminderType'>>;
|
|
462
|
+
/**
|
|
463
|
+
* Arguments for updating an existing reminder.
|
|
464
|
+
* @see https://developer.todoist.com/api/v1/#tag/Reminders/operation/update_reminder_api_v1_reminders__reminder_id__post
|
|
465
|
+
*/
|
|
466
|
+
export type UpdateReminderArgs = UpdateRelativeReminderArgs | UpdateAbsoluteReminderArgs;
|
|
467
|
+
/**
|
|
468
|
+
* Arguments for updating an existing location reminder.
|
|
469
|
+
*/
|
|
470
|
+
export type UpdateLocationReminderArgs = Partial<Omit<AddLocationReminderArgs, 'taskId'>>;
|
|
420
471
|
/**
|
|
421
472
|
* Common arguments for retrieving activity logs (excluding filter-type params).
|
|
422
473
|
*/
|
|
@@ -554,6 +605,117 @@ export type MoveProjectToPersonalArgs = {
|
|
|
554
605
|
/** The ID of the project to move. */
|
|
555
606
|
projectId: string;
|
|
556
607
|
};
|
|
608
|
+
/**
|
|
609
|
+
* Arguments for counting archived projects.
|
|
610
|
+
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/count_projects_archived_api_v1_projects_archived_count_get
|
|
611
|
+
*/
|
|
612
|
+
export type GetArchivedProjectsCountArgs = {
|
|
613
|
+
workspaceId?: number | null;
|
|
614
|
+
joined?: boolean | null;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Response from counting archived projects.
|
|
618
|
+
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/count_projects_archived_api_v1_projects_archived_count_get
|
|
619
|
+
*/
|
|
620
|
+
export type GetArchivedProjectsCountResponse = {
|
|
621
|
+
count: number;
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* An action permitted for a role.
|
|
625
|
+
*/
|
|
626
|
+
export type ActionView = {
|
|
627
|
+
name: string;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* A project collaborator role with its permitted actions.
|
|
631
|
+
*/
|
|
632
|
+
export type ProjectRoleView = {
|
|
633
|
+
name: CollaboratorRole;
|
|
634
|
+
actions: ActionView[];
|
|
635
|
+
};
|
|
636
|
+
/**
|
|
637
|
+
* A workspace role with its permitted actions.
|
|
638
|
+
*/
|
|
639
|
+
export type WorkspaceRoleView = {
|
|
640
|
+
name: WorkspaceRole;
|
|
641
|
+
actions: ActionView[];
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Response from getting project permissions (role-to-action mappings).
|
|
645
|
+
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/permissions_api_v1_projects_permissions_get
|
|
646
|
+
*/
|
|
647
|
+
export type GetProjectPermissionsResponse = {
|
|
648
|
+
projectCollaboratorActions: ProjectRoleView[];
|
|
649
|
+
workspaceCollaboratorActions: WorkspaceRoleView[];
|
|
650
|
+
};
|
|
651
|
+
/**
|
|
652
|
+
* Arguments for getting full project data.
|
|
653
|
+
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/projects_full_data_api_v1_projects__project_id__full_get
|
|
654
|
+
*/
|
|
655
|
+
export type GetFullProjectArgs = {
|
|
656
|
+
/**
|
|
657
|
+
* Required to access the public project without authentication.
|
|
658
|
+
*/
|
|
659
|
+
publicKey?: string | null;
|
|
660
|
+
};
|
|
661
|
+
/**
|
|
662
|
+
* Response from getting full project data.
|
|
663
|
+
* @see https://todoist.com/api/v1/docs#tag/Projects/operation/projects_full_data_api_v1_projects__project_id__full_get
|
|
664
|
+
*/
|
|
665
|
+
export type GetFullProjectResponse = {
|
|
666
|
+
project: (PersonalProject | WorkspaceProject) | null;
|
|
667
|
+
commentsCount: number;
|
|
668
|
+
tasks: Task[];
|
|
669
|
+
sections: Section[];
|
|
670
|
+
collaborators: User[];
|
|
671
|
+
notes: Comment[];
|
|
672
|
+
};
|
|
673
|
+
/**
|
|
674
|
+
* Arguments for creating a new workspace.
|
|
675
|
+
* @see https://todoist.com/api/v1/docs#tag/Workspace/operation/create_workspace_api_v1_workspaces_post
|
|
676
|
+
*/
|
|
677
|
+
export type AddWorkspaceArgs = {
|
|
678
|
+
/** Name of the workspace. */
|
|
679
|
+
name: string;
|
|
680
|
+
/** Description of the workspace. */
|
|
681
|
+
description?: string | null;
|
|
682
|
+
/** Whether link sharing is enabled for the workspace. */
|
|
683
|
+
isLinkSharingEnabled?: boolean;
|
|
684
|
+
/** Whether guests are allowed in the workspace. */
|
|
685
|
+
isGuestAllowed?: boolean;
|
|
686
|
+
/** Workspace email domain. */
|
|
687
|
+
domainName?: string | null;
|
|
688
|
+
/** Whether users with matching email domains can discover this workspace. */
|
|
689
|
+
domainDiscovery?: boolean;
|
|
690
|
+
/** Whether workspace invites are restricted to workspace domain. */
|
|
691
|
+
restrictEmailDomains?: boolean;
|
|
692
|
+
/** Workspace properties. */
|
|
693
|
+
properties?: Record<string, unknown> | null;
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* Arguments for updating an existing workspace.
|
|
697
|
+
* @see https://todoist.com/api/v1/docs#tag/Workspace/operation/update_workspace_api_v1_workspaces__workspace_id__post
|
|
698
|
+
*/
|
|
699
|
+
export type UpdateWorkspaceArgs = {
|
|
700
|
+
/** Updated workspace name. */
|
|
701
|
+
name?: string;
|
|
702
|
+
/** Updated workspace description. */
|
|
703
|
+
description?: string | null;
|
|
704
|
+
/** Updated link sharing status. */
|
|
705
|
+
isLinkSharingEnabled?: boolean;
|
|
706
|
+
/** Updated guest access status. */
|
|
707
|
+
isGuestAllowed?: boolean | null;
|
|
708
|
+
/** Updated workspace email domain. */
|
|
709
|
+
domainName?: string | null;
|
|
710
|
+
/** Updated domain discovery setting. */
|
|
711
|
+
domainDiscovery?: boolean;
|
|
712
|
+
/** Updated email domain restriction setting. */
|
|
713
|
+
restrictEmailDomains?: boolean;
|
|
714
|
+
/** Updated workspace properties. */
|
|
715
|
+
properties?: Record<string, unknown> | null;
|
|
716
|
+
/** Updated collapse state for current user. */
|
|
717
|
+
isCollapsed?: boolean;
|
|
718
|
+
};
|
|
557
719
|
/**
|
|
558
720
|
* Arguments for getting workspace invitations.
|
|
559
721
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProjectViewStyle, ProjectVisibility, WorkspaceRole } from '../../entities.js';
|
|
2
|
-
import type { ProjectStatus
|
|
1
|
+
import type { ProjectViewStyle, ProjectVisibility, WorkspaceRole, CollaboratorRole } from '../../entities.js';
|
|
2
|
+
import type { ProjectStatus } from './shared.js';
|
|
3
3
|
import type { ColorKey } from '../../../utils/colors.js';
|
|
4
4
|
export type ProjectAccessConfig = {
|
|
5
5
|
visibility: ProjectVisibility;
|
|
@@ -35,10 +35,7 @@ export type TaskPriority = 1 | 2 | 3 | 4;
|
|
|
35
35
|
export declare const PROJECT_STATUSES: readonly ["PLANNED", "IN_PROGRESS", "PAUSED", "COMPLETED", "CANCELED"];
|
|
36
36
|
/** Project workflow status. */
|
|
37
37
|
export type ProjectStatus = (typeof PROJECT_STATUSES)[number];
|
|
38
|
-
|
|
39
|
-
export declare const COLLABORATOR_ROLES: readonly ["CREATOR", "ADMIN", "READ_WRITE", "EDIT_ONLY", "COMPLETE_ONLY"];
|
|
40
|
-
/** Default collaborator role for a project. */
|
|
41
|
-
export type CollaboratorRole = (typeof COLLABORATOR_ROLES)[number];
|
|
38
|
+
export { COLLABORATOR_ROLES, type CollaboratorRole } from '../../entities.js';
|
|
42
39
|
/** Available reminder notification services. */
|
|
43
40
|
export declare const REMINDER_SERVICES: readonly ["default", "email", "mobile", "push", "no_default"];
|
|
44
41
|
/** Reminder notification service. */
|
|
@@ -42,6 +42,7 @@ export declare const AbsoluteReminderSchema: z.ZodObject<{
|
|
|
42
42
|
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
43
|
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
44
|
}, z.core.$strip>;
|
|
45
|
+
isUrgent: z.ZodOptional<z.ZodBoolean>;
|
|
45
46
|
}, z.core.$loose>;
|
|
46
47
|
export type AbsoluteReminder = z.infer<typeof AbsoluteReminderSchema>;
|
|
47
48
|
export declare const RelativeReminderSchema: z.ZodObject<{
|
|
@@ -60,6 +61,7 @@ export declare const RelativeReminderSchema: z.ZodObject<{
|
|
|
60
61
|
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
62
|
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
62
63
|
}, z.core.$strip>>;
|
|
64
|
+
isUrgent: z.ZodOptional<z.ZodBoolean>;
|
|
63
65
|
}, z.core.$loose>;
|
|
64
66
|
export type RelativeReminder = z.infer<typeof RelativeReminderSchema>;
|
|
65
67
|
export declare const ReminderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -92,6 +94,7 @@ export declare const ReminderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
92
94
|
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
93
95
|
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
94
96
|
}, z.core.$strip>;
|
|
97
|
+
isUrgent: z.ZodOptional<z.ZodBoolean>;
|
|
95
98
|
}, z.core.$loose>, z.ZodObject<{
|
|
96
99
|
id: z.ZodString;
|
|
97
100
|
notifyUid: z.ZodString;
|
|
@@ -108,5 +111,6 @@ export declare const ReminderSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
108
111
|
timezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
109
112
|
lang: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
110
113
|
}, z.core.$strip>>;
|
|
114
|
+
isUrgent: z.ZodOptional<z.ZodBoolean>;
|
|
111
115
|
}, z.core.$loose>], "type">;
|
|
112
116
|
export type Reminder = z.infer<typeof ReminderSchema>;
|