@doist/todoist-api-typescript 6.4.1 → 6.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/dist/cjs/consts/endpoints.js +3 -1
- package/dist/cjs/todoist-api.js +38 -0
- package/dist/cjs/types/entities.js +3 -1
- package/dist/esm/consts/endpoints.js +2 -0
- package/dist/esm/todoist-api.js +39 -1
- package/dist/esm/types/entities.js +2 -0
- package/dist/types/consts/endpoints.d.ts +2 -0
- package/dist/types/todoist-api.d.ts +17 -1
- package/dist/types/types/entities.d.ts +19 -0
- package/dist/types/types/requests.d.ts +23 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REVOKE = exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
3
|
+
exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REVOKE = exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS_SEARCH = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS_SEARCH = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS_SEARCH = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
4
4
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
5
5
|
exports.getAuthBaseUri = getAuthBaseUri;
|
|
6
6
|
exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
|
|
@@ -47,6 +47,8 @@ exports.ENDPOINT_REST_ACTIVITIES = 'activities';
|
|
|
47
47
|
exports.ENDPOINT_REST_UPLOADS = 'uploads';
|
|
48
48
|
exports.PROJECT_ARCHIVE = 'archive';
|
|
49
49
|
exports.PROJECT_UNARCHIVE = 'unarchive';
|
|
50
|
+
exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.ENDPOINT_REST_PROJECTS + '/move_to_workspace';
|
|
51
|
+
exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS + '/move_to_personal';
|
|
50
52
|
exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_TASKS + '/quick';
|
|
51
53
|
exports.ENDPOINT_SYNC = 'sync';
|
|
52
54
|
exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -557,6 +557,44 @@ class TodoistApi {
|
|
|
557
557
|
});
|
|
558
558
|
return (0, validators_1.validateProject)(response.data);
|
|
559
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Moves a project to a workspace.
|
|
562
|
+
*
|
|
563
|
+
* @param args - The arguments for moving the project.
|
|
564
|
+
* @param requestId - Optional custom identifier for the request.
|
|
565
|
+
* @returns A promise that resolves to the moved project.
|
|
566
|
+
*/
|
|
567
|
+
async moveProjectToWorkspace(args, requestId) {
|
|
568
|
+
const response = await (0, rest_client_1.request)({
|
|
569
|
+
httpMethod: 'POST',
|
|
570
|
+
baseUri: this.syncApiBase,
|
|
571
|
+
relativePath: endpoints_1.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE,
|
|
572
|
+
apiToken: this.authToken,
|
|
573
|
+
customFetch: this.customFetch,
|
|
574
|
+
payload: args,
|
|
575
|
+
requestId: requestId,
|
|
576
|
+
});
|
|
577
|
+
return (0, validators_1.validateProject)(response.data.project);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Moves a project to personal.
|
|
581
|
+
*
|
|
582
|
+
* @param args - The arguments for moving the project.
|
|
583
|
+
* @param requestId - Optional custom identifier for the request.
|
|
584
|
+
* @returns A promise that resolves to the moved project.
|
|
585
|
+
*/
|
|
586
|
+
async moveProjectToPersonal(args, requestId) {
|
|
587
|
+
const response = await (0, rest_client_1.request)({
|
|
588
|
+
httpMethod: 'POST',
|
|
589
|
+
baseUri: this.syncApiBase,
|
|
590
|
+
relativePath: endpoints_1.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL,
|
|
591
|
+
apiToken: this.authToken,
|
|
592
|
+
customFetch: this.customFetch,
|
|
593
|
+
payload: args,
|
|
594
|
+
requestId: requestId,
|
|
595
|
+
});
|
|
596
|
+
return (0, validators_1.validateProject)(response.data.project);
|
|
597
|
+
}
|
|
560
598
|
/**
|
|
561
599
|
* Retrieves a list of collaborators for a specific project.
|
|
562
600
|
*
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = exports.ColorSchema = exports.ProductivityStatsSchema = exports.CurrentUserSchema = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
|
|
14
|
+
exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = exports.ColorSchema = exports.ProductivityStatsSchema = exports.CurrentUserSchema = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.ProjectVisibilitySchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const url_helpers_1 = require("../utils/url-helpers");
|
|
17
17
|
const uncompletable_helpers_1 = require("../utils/uncompletable-helpers");
|
|
@@ -101,10 +101,12 @@ exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
|
|
|
101
101
|
}).transform((data) => {
|
|
102
102
|
return Object.assign(Object.assign({}, data), { url: (0, url_helpers_1.getProjectUrl)(data.id, data.name) });
|
|
103
103
|
});
|
|
104
|
+
exports.ProjectVisibilitySchema = zod_1.z.enum(['restricted', 'team', 'public']);
|
|
104
105
|
/**
|
|
105
106
|
* Schema for workspace projects in Todoist.
|
|
106
107
|
*/
|
|
107
108
|
exports.WorkspaceProjectSchema = exports.BaseProjectSchema.extend({
|
|
109
|
+
access: zod_1.z.object({ visibility: exports.ProjectVisibilitySchema }).optional(),
|
|
108
110
|
collaboratorRoleDefault: zod_1.z.string(),
|
|
109
111
|
folderId: zod_1.z.string().nullable(),
|
|
110
112
|
isInviteOnly: zod_1.z.boolean().nullable(),
|
|
@@ -38,6 +38,8 @@ export const ENDPOINT_REST_ACTIVITIES = 'activities';
|
|
|
38
38
|
export const ENDPOINT_REST_UPLOADS = 'uploads';
|
|
39
39
|
export const PROJECT_ARCHIVE = 'archive';
|
|
40
40
|
export const PROJECT_UNARCHIVE = 'unarchive';
|
|
41
|
+
export const ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = ENDPOINT_REST_PROJECTS + '/move_to_workspace';
|
|
42
|
+
export const ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = ENDPOINT_REST_PROJECTS + '/move_to_personal';
|
|
41
43
|
export const ENDPOINT_SYNC_QUICK_ADD = ENDPOINT_REST_TASKS + '/quick';
|
|
42
44
|
export const ENDPOINT_SYNC = 'sync';
|
|
43
45
|
export const ENDPOINT_AUTHORIZATION = 'authorize';
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { request, isSuccess } from './rest-client.js';
|
|
2
|
-
import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, } from './consts/endpoints.js';
|
|
2
|
+
import { getSyncBaseUri, ENDPOINT_REST_TASKS, ENDPOINT_REST_TASKS_FILTER, ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE, ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE, ENDPOINT_REST_TASKS_COMPLETED_SEARCH, ENDPOINT_REST_PROJECTS, ENDPOINT_REST_PROJECTS_SEARCH, ENDPOINT_SYNC_QUICK_ADD, ENDPOINT_REST_TASK_CLOSE, ENDPOINT_REST_TASK_REOPEN, ENDPOINT_REST_TASK_MOVE, ENDPOINT_REST_LABELS, ENDPOINT_REST_LABELS_SEARCH, ENDPOINT_REST_PROJECT_COLLABORATORS, ENDPOINT_REST_SECTIONS, ENDPOINT_REST_SECTIONS_SEARCH, ENDPOINT_REST_COMMENTS, ENDPOINT_REST_LABELS_SHARED, ENDPOINT_REST_LABELS_SHARED_RENAME, ENDPOINT_REST_LABELS_SHARED_REMOVE, ENDPOINT_SYNC, PROJECT_ARCHIVE, PROJECT_UNARCHIVE, ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE, ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL, ENDPOINT_REST_PROJECTS_ARCHIVED, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, } from './consts/endpoints.js';
|
|
3
3
|
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspaceArray, } from './utils/validators.js';
|
|
4
4
|
import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
|
|
5
5
|
import { uploadMultipartFile } from './utils/multipart-upload.js';
|
|
@@ -554,6 +554,44 @@ export class TodoistApi {
|
|
|
554
554
|
});
|
|
555
555
|
return validateProject(response.data);
|
|
556
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Moves a project to a workspace.
|
|
559
|
+
*
|
|
560
|
+
* @param args - The arguments for moving the project.
|
|
561
|
+
* @param requestId - Optional custom identifier for the request.
|
|
562
|
+
* @returns A promise that resolves to the moved project.
|
|
563
|
+
*/
|
|
564
|
+
async moveProjectToWorkspace(args, requestId) {
|
|
565
|
+
const response = await request({
|
|
566
|
+
httpMethod: 'POST',
|
|
567
|
+
baseUri: this.syncApiBase,
|
|
568
|
+
relativePath: ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE,
|
|
569
|
+
apiToken: this.authToken,
|
|
570
|
+
customFetch: this.customFetch,
|
|
571
|
+
payload: args,
|
|
572
|
+
requestId: requestId,
|
|
573
|
+
});
|
|
574
|
+
return validateProject(response.data.project);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Moves a project to personal.
|
|
578
|
+
*
|
|
579
|
+
* @param args - The arguments for moving the project.
|
|
580
|
+
* @param requestId - Optional custom identifier for the request.
|
|
581
|
+
* @returns A promise that resolves to the moved project.
|
|
582
|
+
*/
|
|
583
|
+
async moveProjectToPersonal(args, requestId) {
|
|
584
|
+
const response = await request({
|
|
585
|
+
httpMethod: 'POST',
|
|
586
|
+
baseUri: this.syncApiBase,
|
|
587
|
+
relativePath: ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL,
|
|
588
|
+
apiToken: this.authToken,
|
|
589
|
+
customFetch: this.customFetch,
|
|
590
|
+
payload: args,
|
|
591
|
+
requestId: requestId,
|
|
592
|
+
});
|
|
593
|
+
return validateProject(response.data.project);
|
|
594
|
+
}
|
|
557
595
|
/**
|
|
558
596
|
* Retrieves a list of collaborators for a specific project.
|
|
559
597
|
*
|
|
@@ -98,10 +98,12 @@ export const PersonalProjectSchema = BaseProjectSchema.extend({
|
|
|
98
98
|
}).transform((data) => {
|
|
99
99
|
return Object.assign(Object.assign({}, data), { url: getProjectUrl(data.id, data.name) });
|
|
100
100
|
});
|
|
101
|
+
export const ProjectVisibilitySchema = z.enum(['restricted', 'team', 'public']);
|
|
101
102
|
/**
|
|
102
103
|
* Schema for workspace projects in Todoist.
|
|
103
104
|
*/
|
|
104
105
|
export const WorkspaceProjectSchema = BaseProjectSchema.extend({
|
|
106
|
+
access: z.object({ visibility: ProjectVisibilitySchema }).optional(),
|
|
105
107
|
collaboratorRoleDefault: z.string(),
|
|
106
108
|
folderId: z.string().nullable(),
|
|
107
109
|
isInviteOnly: z.boolean().nullable(),
|
|
@@ -29,6 +29,8 @@ export declare const ENDPOINT_REST_ACTIVITIES = "activities";
|
|
|
29
29
|
export declare const ENDPOINT_REST_UPLOADS = "uploads";
|
|
30
30
|
export declare const PROJECT_ARCHIVE = "archive";
|
|
31
31
|
export declare const PROJECT_UNARCHIVE = "unarchive";
|
|
32
|
+
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE: string;
|
|
33
|
+
export declare const ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL: string;
|
|
32
34
|
export declare const ENDPOINT_SYNC_QUICK_ADD: string;
|
|
33
35
|
export declare const ENDPOINT_SYNC = "sync";
|
|
34
36
|
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
@@ -1,5 +1,5 @@
|
|
|
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 } from './types/requests.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';
|
|
3
3
|
import { CustomFetch } from './types/http.js';
|
|
4
4
|
/**
|
|
5
5
|
* A client for interacting with the Todoist API v1.
|
|
@@ -239,6 +239,22 @@ export declare class TodoistApi {
|
|
|
239
239
|
* @returns A promise that resolves to the updated project.
|
|
240
240
|
*/
|
|
241
241
|
unarchiveProject(id: string, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
242
|
+
/**
|
|
243
|
+
* Moves a project to a workspace.
|
|
244
|
+
*
|
|
245
|
+
* @param args - The arguments for moving the project.
|
|
246
|
+
* @param requestId - Optional custom identifier for the request.
|
|
247
|
+
* @returns A promise that resolves to the moved project.
|
|
248
|
+
*/
|
|
249
|
+
moveProjectToWorkspace(args: MoveProjectToWorkspaceArgs, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
250
|
+
/**
|
|
251
|
+
* Moves a project to personal.
|
|
252
|
+
*
|
|
253
|
+
* @param args - The arguments for moving the project.
|
|
254
|
+
* @param requestId - Optional custom identifier for the request.
|
|
255
|
+
* @returns A promise that resolves to the moved project.
|
|
256
|
+
*/
|
|
257
|
+
moveProjectToPersonal(args: MoveProjectToPersonalArgs, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
|
|
242
258
|
/**
|
|
243
259
|
* Retrieves a list of collaborators for a specific project.
|
|
244
260
|
*
|
|
@@ -243,6 +243,12 @@ export declare const PersonalProjectSchema: z.ZodPipe<z.ZodObject<{
|
|
|
243
243
|
parentId: string | null;
|
|
244
244
|
inboxProject: boolean;
|
|
245
245
|
}>>;
|
|
246
|
+
export declare const ProjectVisibilitySchema: z.ZodEnum<{
|
|
247
|
+
restricted: "restricted";
|
|
248
|
+
team: "team";
|
|
249
|
+
public: "public";
|
|
250
|
+
}>;
|
|
251
|
+
export type ProjectVisibility = z.infer<typeof ProjectVisibilitySchema>;
|
|
246
252
|
/**
|
|
247
253
|
* Schema for workspace projects in Todoist.
|
|
248
254
|
*/
|
|
@@ -263,6 +269,13 @@ export declare const WorkspaceProjectSchema: z.ZodPipe<z.ZodObject<{
|
|
|
263
269
|
description: z.ZodString;
|
|
264
270
|
isCollapsed: z.ZodBoolean;
|
|
265
271
|
isShared: z.ZodBoolean;
|
|
272
|
+
access: z.ZodOptional<z.ZodObject<{
|
|
273
|
+
visibility: z.ZodEnum<{
|
|
274
|
+
restricted: "restricted";
|
|
275
|
+
team: "team";
|
|
276
|
+
public: "public";
|
|
277
|
+
}>;
|
|
278
|
+
}, z.core.$strip>>;
|
|
266
279
|
collaboratorRoleDefault: z.ZodString;
|
|
267
280
|
folderId: z.ZodNullable<z.ZodString>;
|
|
268
281
|
isInviteOnly: z.ZodNullable<z.ZodBoolean>;
|
|
@@ -295,6 +308,9 @@ export declare const WorkspaceProjectSchema: z.ZodPipe<z.ZodObject<{
|
|
|
295
308
|
role: string | null;
|
|
296
309
|
status: string;
|
|
297
310
|
workspaceId: string;
|
|
311
|
+
access?: {
|
|
312
|
+
visibility: "restricted" | "team" | "public";
|
|
313
|
+
} | undefined;
|
|
298
314
|
}, {
|
|
299
315
|
id: string;
|
|
300
316
|
canAssignTasks: boolean;
|
|
@@ -319,6 +335,9 @@ export declare const WorkspaceProjectSchema: z.ZodPipe<z.ZodObject<{
|
|
|
319
335
|
role: string | null;
|
|
320
336
|
status: string;
|
|
321
337
|
workspaceId: string;
|
|
338
|
+
access?: {
|
|
339
|
+
visibility: "restricted" | "team" | "public";
|
|
340
|
+
} | undefined;
|
|
322
341
|
}>>;
|
|
323
342
|
/**
|
|
324
343
|
* Represents a personal project in Todoist.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
|
|
2
|
-
import type { ActivityEvent, ActivityEventType, ActivityObjectType, Comment, Duration, Label, PersonalProject, ProjectViewStyle, Section, Task, User, WorkspaceProject } from './entities.js';
|
|
2
|
+
import type { ActivityEvent, ActivityEventType, ActivityObjectType, Comment, Duration, Label, PersonalProject, ProjectViewStyle, ProjectVisibility, Section, Task, User, WorkspaceProject } from './entities.js';
|
|
3
3
|
/**
|
|
4
4
|
* Arguments for creating a new task.
|
|
5
5
|
* @see https://todoist.com/api/v1/docs#tag/Tasks/operation/create_task_api_v1_tasks_post
|
|
@@ -532,6 +532,28 @@ export type DeleteUploadArgs = {
|
|
|
532
532
|
*/
|
|
533
533
|
fileUrl: string;
|
|
534
534
|
};
|
|
535
|
+
/**
|
|
536
|
+
* Arguments for moving a project to a workspace.
|
|
537
|
+
*/
|
|
538
|
+
export type MoveProjectToWorkspaceArgs = {
|
|
539
|
+
/** The ID of the project to move. */
|
|
540
|
+
projectId: string;
|
|
541
|
+
/** The target workspace ID. */
|
|
542
|
+
workspaceId: string;
|
|
543
|
+
/** Optional target folder ID within the workspace. */
|
|
544
|
+
folderId?: string | null;
|
|
545
|
+
/** Optional access settings for the project in the workspace. */
|
|
546
|
+
access?: {
|
|
547
|
+
visibility: ProjectVisibility;
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
/**
|
|
551
|
+
* Arguments for moving a project to personal.
|
|
552
|
+
*/
|
|
553
|
+
export type MoveProjectToPersonalArgs = {
|
|
554
|
+
/** The ID of the project to move. */
|
|
555
|
+
projectId: string;
|
|
556
|
+
};
|
|
535
557
|
/**
|
|
536
558
|
* Arguments for getting workspace invitations.
|
|
537
559
|
*/
|
package/package.json
CHANGED