@doist/todoist-api-typescript 7.8.0 → 7.9.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 +2 -1
- package/dist/cjs/test-utils/test-defaults.js +9 -1
- package/dist/cjs/todoist-api.js +97 -0
- package/dist/cjs/types/folders/index.js +17 -0
- package/dist/cjs/types/folders/requests.js +2 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/esm/consts/endpoints.js +1 -0
- package/dist/esm/test-utils/test-defaults.js +8 -0
- package/dist/esm/todoist-api.js +99 -2
- package/dist/esm/types/folders/index.js +1 -0
- package/dist/esm/types/folders/requests.js +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/types/consts/endpoints.d.ts +1 -0
- package/dist/types/test-utils/test-defaults.d.ts +2 -1
- package/dist/types/todoist-api.d.ts +41 -0
- package/dist/types/types/folders/index.d.ts +1 -0
- package/dist/types/types/folders/requests.d.ts +20 -0
- package/dist/types/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENDPOINT_REST_ID_MAPPINGS = exports.ENDPOINT_REST_EMAILS = exports.ENDPOINT_REST_BACKUPS_DOWNLOAD = exports.ENDPOINT_REST_BACKUPS = exports.ENDPOINT_REST_ACCESS_TOKENS_MIGRATE = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID = exports.ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE = exports.ENDPOINT_REST_TEMPLATES_URL = exports.ENDPOINT_REST_TEMPLATES_FILE = exports.ENDPOINT_REST_TASKS_COMPLETED = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL = exports.ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE = exports.SECTION_UNARCHIVE = exports.SECTION_ARCHIVE = exports.ENDPOINT_REST_PROJECT_JOIN = exports.ENDPOINT_REST_PROJECT_FULL = exports.ENDPOINT_REST_PROJECTS_PERMISSIONS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT = 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_LOCATION_REMINDERS = exports.ENDPOINT_REST_REMINDERS = 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
|
-
exports.ENDPOINT_WORKSPACE_MEMBERS = 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_REST_WORKSPACES = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
|
|
4
|
+
exports.ENDPOINT_WORKSPACE_MEMBERS = 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_REST_WORKSPACES = exports.ENDPOINT_REST_FOLDERS = exports.ENDPOINT_REVOKE = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_MOVED_IDS = void 0;
|
|
5
5
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
6
6
|
exports.getAuthBaseUri = getAuthBaseUri;
|
|
7
7
|
exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
|
|
@@ -84,6 +84,7 @@ exports.ENDPOINT_SYNC = 'sync';
|
|
|
84
84
|
exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
|
85
85
|
exports.ENDPOINT_GET_TOKEN = 'access_token';
|
|
86
86
|
exports.ENDPOINT_REVOKE = 'revoke';
|
|
87
|
+
exports.ENDPOINT_REST_FOLDERS = 'folders';
|
|
87
88
|
// Workspace endpoints
|
|
88
89
|
exports.ENDPOINT_REST_WORKSPACES = 'workspaces';
|
|
89
90
|
exports.ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_LOCATION_REMINDER = exports.DEFAULT_ABSOLUTE_REMINDER = exports.DEFAULT_RELATIVE_REMINDER = exports.DEFAULT_REMINDER_ID = exports.DEFAULT_COMMENT = exports.DEFAULT_RAW_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = exports.DEFAULT_PROJECT_VIEW_STYLE = exports.DEFAULT_PROJECT_NAME = exports.DEFAULT_PROJECT_ID = exports.DEFAULT_ORDER = exports.DEFAULT_TASK_PRIORITY = exports.DEFAULT_TASK_DESCRIPTION = exports.DEFAULT_TASK_CONTENT = exports.DEFAULT_TASK_ID = void 0;
|
|
3
|
+
exports.DEFAULT_FOLDER = exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_LOCATION_REMINDER = exports.DEFAULT_ABSOLUTE_REMINDER = exports.DEFAULT_RELATIVE_REMINDER = exports.DEFAULT_REMINDER_ID = exports.DEFAULT_COMMENT = exports.DEFAULT_RAW_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = exports.DEFAULT_PROJECT_VIEW_STYLE = exports.DEFAULT_PROJECT_NAME = exports.DEFAULT_PROJECT_ID = exports.DEFAULT_ORDER = exports.DEFAULT_TASK_PRIORITY = exports.DEFAULT_TASK_DESCRIPTION = exports.DEFAULT_TASK_CONTENT = exports.DEFAULT_TASK_ID = void 0;
|
|
4
4
|
const url_helpers_1 = require("../utils/url-helpers");
|
|
5
5
|
exports.DEFAULT_TASK_ID = '1234';
|
|
6
6
|
exports.DEFAULT_TASK_CONTENT = 'This is a task';
|
|
@@ -230,3 +230,11 @@ exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = Object.assign(Objec
|
|
|
230
230
|
exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = Object.assign(Object.assign({}, exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL), { taskId: exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL.itemId, itemId: undefined });
|
|
231
231
|
exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = Object.assign(Object.assign({}, exports.DEFAULT_RAW_COMMENT), { itemId: undefined, projectId: exports.DEFAULT_PROJECT_ID });
|
|
232
232
|
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = Object.assign(Object.assign({}, exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT), { taskId: undefined });
|
|
233
|
+
exports.DEFAULT_FOLDER = {
|
|
234
|
+
id: '789',
|
|
235
|
+
name: 'This is a folder',
|
|
236
|
+
workspaceId: '100',
|
|
237
|
+
defaultOrder: 3,
|
|
238
|
+
childOrder: 3,
|
|
239
|
+
isDeleted: false,
|
|
240
|
+
};
|
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -1793,6 +1793,103 @@ class TodoistApi {
|
|
|
1793
1793
|
arrayBuffer: () => response.arrayBuffer(),
|
|
1794
1794
|
};
|
|
1795
1795
|
}
|
|
1796
|
+
// ── Folders ──
|
|
1797
|
+
/**
|
|
1798
|
+
* Retrieves a paginated list of folders.
|
|
1799
|
+
*
|
|
1800
|
+
* @param args - Filter parameters such as workspace ID.
|
|
1801
|
+
* @returns A promise that resolves to a paginated response of folders.
|
|
1802
|
+
*/
|
|
1803
|
+
async getFolders(args) {
|
|
1804
|
+
const { data: { results, nextCursor }, } = await (0, http_client_1.request)({
|
|
1805
|
+
httpMethod: 'GET',
|
|
1806
|
+
baseUri: this.syncApiBase,
|
|
1807
|
+
relativePath: endpoints_1.ENDPOINT_REST_FOLDERS,
|
|
1808
|
+
apiToken: this.authToken,
|
|
1809
|
+
customFetch: this.customFetch,
|
|
1810
|
+
payload: args,
|
|
1811
|
+
});
|
|
1812
|
+
return {
|
|
1813
|
+
results: (0, validators_1.validateFolderArray)(results),
|
|
1814
|
+
nextCursor,
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Retrieves a single folder by its ID.
|
|
1819
|
+
*
|
|
1820
|
+
* @param id - The unique identifier of the folder.
|
|
1821
|
+
* @returns A promise that resolves to the requested folder.
|
|
1822
|
+
*/
|
|
1823
|
+
async getFolder(id) {
|
|
1824
|
+
zod_1.z.string().parse(id);
|
|
1825
|
+
const response = await (0, http_client_1.request)({
|
|
1826
|
+
httpMethod: 'GET',
|
|
1827
|
+
baseUri: this.syncApiBase,
|
|
1828
|
+
relativePath: generatePath(endpoints_1.ENDPOINT_REST_FOLDERS, id),
|
|
1829
|
+
apiToken: this.authToken,
|
|
1830
|
+
customFetch: this.customFetch,
|
|
1831
|
+
});
|
|
1832
|
+
return (0, validators_1.validateFolder)(response.data);
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Creates a new folder.
|
|
1836
|
+
*
|
|
1837
|
+
* @param args - Folder creation parameters including name and workspace ID.
|
|
1838
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1839
|
+
* @returns A promise that resolves to the created folder.
|
|
1840
|
+
*/
|
|
1841
|
+
async addFolder(args, requestId) {
|
|
1842
|
+
const response = await (0, http_client_1.request)({
|
|
1843
|
+
httpMethod: 'POST',
|
|
1844
|
+
baseUri: this.syncApiBase,
|
|
1845
|
+
relativePath: endpoints_1.ENDPOINT_REST_FOLDERS,
|
|
1846
|
+
apiToken: this.authToken,
|
|
1847
|
+
customFetch: this.customFetch,
|
|
1848
|
+
payload: args,
|
|
1849
|
+
requestId: requestId,
|
|
1850
|
+
});
|
|
1851
|
+
return (0, validators_1.validateFolder)(response.data);
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Updates an existing folder by its ID.
|
|
1855
|
+
*
|
|
1856
|
+
* @param id - The unique identifier of the folder to update.
|
|
1857
|
+
* @param args - Update parameters such as name or default order.
|
|
1858
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1859
|
+
* @returns A promise that resolves to the updated folder.
|
|
1860
|
+
*/
|
|
1861
|
+
async updateFolder(id, args, requestId) {
|
|
1862
|
+
zod_1.z.string().parse(id);
|
|
1863
|
+
const response = await (0, http_client_1.request)({
|
|
1864
|
+
httpMethod: 'POST',
|
|
1865
|
+
baseUri: this.syncApiBase,
|
|
1866
|
+
relativePath: generatePath(endpoints_1.ENDPOINT_REST_FOLDERS, id),
|
|
1867
|
+
apiToken: this.authToken,
|
|
1868
|
+
customFetch: this.customFetch,
|
|
1869
|
+
payload: args,
|
|
1870
|
+
requestId: requestId,
|
|
1871
|
+
});
|
|
1872
|
+
return (0, validators_1.validateFolder)(response.data);
|
|
1873
|
+
}
|
|
1874
|
+
/**
|
|
1875
|
+
* Deletes a folder by its ID.
|
|
1876
|
+
*
|
|
1877
|
+
* @param id - The unique identifier of the folder to delete.
|
|
1878
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1879
|
+
* @returns A promise that resolves to `true` if successful.
|
|
1880
|
+
*/
|
|
1881
|
+
async deleteFolder(id, requestId) {
|
|
1882
|
+
zod_1.z.string().parse(id);
|
|
1883
|
+
const response = await (0, http_client_1.request)({
|
|
1884
|
+
httpMethod: 'DELETE',
|
|
1885
|
+
baseUri: this.syncApiBase,
|
|
1886
|
+
relativePath: generatePath(endpoints_1.ENDPOINT_REST_FOLDERS, id),
|
|
1887
|
+
apiToken: this.authToken,
|
|
1888
|
+
customFetch: this.customFetch,
|
|
1889
|
+
requestId: requestId,
|
|
1890
|
+
});
|
|
1891
|
+
return (0, http_client_1.isSuccess)(response);
|
|
1892
|
+
}
|
|
1796
1893
|
// ── Backups ──
|
|
1797
1894
|
/**
|
|
1798
1895
|
* Retrieves a list of available backups.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __exportStar(require("./users"), exports);
|
|
|
24
24
|
__exportStar(require("./productivity"), exports);
|
|
25
25
|
__exportStar(require("./activity"), exports);
|
|
26
26
|
__exportStar(require("./workspaces"), exports);
|
|
27
|
+
__exportStar(require("./folders"), exports);
|
|
27
28
|
__exportStar(require("./insights"), exports);
|
|
28
29
|
__exportStar(require("./backups"), exports);
|
|
29
30
|
__exportStar(require("./id-mappings"), exports);
|
|
@@ -65,6 +65,7 @@ export const ENDPOINT_SYNC = 'sync';
|
|
|
65
65
|
export const ENDPOINT_AUTHORIZATION = 'authorize';
|
|
66
66
|
export const ENDPOINT_GET_TOKEN = 'access_token';
|
|
67
67
|
export const ENDPOINT_REVOKE = 'revoke';
|
|
68
|
+
export const ENDPOINT_REST_FOLDERS = 'folders';
|
|
68
69
|
// Workspace endpoints
|
|
69
70
|
export const ENDPOINT_REST_WORKSPACES = 'workspaces';
|
|
70
71
|
export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
|
|
@@ -227,3 +227,11 @@ export const RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = Object.assign(
|
|
|
227
227
|
export const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = Object.assign(Object.assign({}, RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL), { taskId: RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL.itemId, itemId: undefined });
|
|
228
228
|
export const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = Object.assign(Object.assign({}, DEFAULT_RAW_COMMENT), { itemId: undefined, projectId: DEFAULT_PROJECT_ID });
|
|
229
229
|
export const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = Object.assign(Object.assign({}, RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT), { taskId: undefined });
|
|
230
|
+
export const DEFAULT_FOLDER = {
|
|
231
|
+
id: '789',
|
|
232
|
+
name: 'This is a folder',
|
|
233
|
+
workspaceId: '100',
|
|
234
|
+
defaultOrder: 3,
|
|
235
|
+
childOrder: 3,
|
|
236
|
+
isDeleted: false,
|
|
237
|
+
};
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -11,8 +11,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
|
|
13
13
|
import { request, isSuccess } from './transport/http-client.js';
|
|
14
|
-
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_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, 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_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, 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_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, 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';
|
|
15
|
-
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, } from './utils/validators.js';
|
|
14
|
+
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_TASKS_COMPLETED, ENDPOINT_REST_TEMPLATES_FILE, ENDPOINT_REST_TEMPLATES_URL, ENDPOINT_REST_TEMPLATES_CREATE_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_FILE, ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID, 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_LOCATION_REMINDERS, ENDPOINT_REST_REMINDERS, 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_PROJECTS_ARCHIVED_COUNT, ENDPOINT_REST_PROJECTS_PERMISSIONS, ENDPOINT_REST_PROJECT_FULL, ENDPOINT_REST_PROJECT_JOIN, SECTION_ARCHIVE, SECTION_UNARCHIVE, ENDPOINT_REST_USER, ENDPOINT_REST_PRODUCTIVITY, ENDPOINT_REST_ACTIVITIES, ENDPOINT_REST_UPLOADS, getProjectInsightsActivityStatsEndpoint, getProjectInsightsHealthEndpoint, getProjectInsightsHealthContextEndpoint, getProjectInsightsProgressEndpoint, getProjectInsightsHealthAnalyzeEndpoint, getWorkspaceInsightsEndpoint, ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD, ENDPOINT_REST_EMAILS, ENDPOINT_REST_ID_MAPPINGS, ENDPOINT_REST_MOVED_IDS, ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_MEMBERS, getWorkspaceUserTasksEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, 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, ENDPOINT_REST_FOLDERS, } from './consts/endpoints.js';
|
|
15
|
+
import { validateAttachment, validateComment, validateCommentArray, validateCurrentUser, validateLabel, validateLabelArray, validateProject, validateProjectArray, validateSection, validateSectionArray, validateTask, validateTaskArray, validateUserArray, validateProductivityStats, validateReminder, validateReminderArray, validateLocationReminderArray, validateActivityEventArray, validateWorkspaceUserArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateJoinWorkspaceResult, validateWorkspace, validateWorkspaceArray, validateMemberActivityInfoArray, validateWorkspaceUserTaskArray, validateProjectActivityStats, validateProjectHealth, validateProjectHealthContext, validateProjectProgress, validateWorkspaceInsights, validateBackupArray, validateIdMappingArray, validateMovedIdArray, validateFolder, validateFolderArray, } from './utils/validators.js';
|
|
16
16
|
import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
|
|
17
17
|
import { uploadMultipartFile } from './utils/multipart-upload.js';
|
|
18
18
|
import { camelCaseKeys } from './utils/case-conversion.js';
|
|
@@ -1790,6 +1790,103 @@ export class TodoistApi {
|
|
|
1790
1790
|
arrayBuffer: () => response.arrayBuffer(),
|
|
1791
1791
|
};
|
|
1792
1792
|
}
|
|
1793
|
+
// ── Folders ──
|
|
1794
|
+
/**
|
|
1795
|
+
* Retrieves a paginated list of folders.
|
|
1796
|
+
*
|
|
1797
|
+
* @param args - Filter parameters such as workspace ID.
|
|
1798
|
+
* @returns A promise that resolves to a paginated response of folders.
|
|
1799
|
+
*/
|
|
1800
|
+
async getFolders(args) {
|
|
1801
|
+
const { data: { results, nextCursor }, } = await request({
|
|
1802
|
+
httpMethod: 'GET',
|
|
1803
|
+
baseUri: this.syncApiBase,
|
|
1804
|
+
relativePath: ENDPOINT_REST_FOLDERS,
|
|
1805
|
+
apiToken: this.authToken,
|
|
1806
|
+
customFetch: this.customFetch,
|
|
1807
|
+
payload: args,
|
|
1808
|
+
});
|
|
1809
|
+
return {
|
|
1810
|
+
results: validateFolderArray(results),
|
|
1811
|
+
nextCursor,
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Retrieves a single folder by its ID.
|
|
1816
|
+
*
|
|
1817
|
+
* @param id - The unique identifier of the folder.
|
|
1818
|
+
* @returns A promise that resolves to the requested folder.
|
|
1819
|
+
*/
|
|
1820
|
+
async getFolder(id) {
|
|
1821
|
+
z.string().parse(id);
|
|
1822
|
+
const response = await request({
|
|
1823
|
+
httpMethod: 'GET',
|
|
1824
|
+
baseUri: this.syncApiBase,
|
|
1825
|
+
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
1826
|
+
apiToken: this.authToken,
|
|
1827
|
+
customFetch: this.customFetch,
|
|
1828
|
+
});
|
|
1829
|
+
return validateFolder(response.data);
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Creates a new folder.
|
|
1833
|
+
*
|
|
1834
|
+
* @param args - Folder creation parameters including name and workspace ID.
|
|
1835
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1836
|
+
* @returns A promise that resolves to the created folder.
|
|
1837
|
+
*/
|
|
1838
|
+
async addFolder(args, requestId) {
|
|
1839
|
+
const response = await request({
|
|
1840
|
+
httpMethod: 'POST',
|
|
1841
|
+
baseUri: this.syncApiBase,
|
|
1842
|
+
relativePath: ENDPOINT_REST_FOLDERS,
|
|
1843
|
+
apiToken: this.authToken,
|
|
1844
|
+
customFetch: this.customFetch,
|
|
1845
|
+
payload: args,
|
|
1846
|
+
requestId: requestId,
|
|
1847
|
+
});
|
|
1848
|
+
return validateFolder(response.data);
|
|
1849
|
+
}
|
|
1850
|
+
/**
|
|
1851
|
+
* Updates an existing folder by its ID.
|
|
1852
|
+
*
|
|
1853
|
+
* @param id - The unique identifier of the folder to update.
|
|
1854
|
+
* @param args - Update parameters such as name or default order.
|
|
1855
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1856
|
+
* @returns A promise that resolves to the updated folder.
|
|
1857
|
+
*/
|
|
1858
|
+
async updateFolder(id, args, requestId) {
|
|
1859
|
+
z.string().parse(id);
|
|
1860
|
+
const response = await request({
|
|
1861
|
+
httpMethod: 'POST',
|
|
1862
|
+
baseUri: this.syncApiBase,
|
|
1863
|
+
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
1864
|
+
apiToken: this.authToken,
|
|
1865
|
+
customFetch: this.customFetch,
|
|
1866
|
+
payload: args,
|
|
1867
|
+
requestId: requestId,
|
|
1868
|
+
});
|
|
1869
|
+
return validateFolder(response.data);
|
|
1870
|
+
}
|
|
1871
|
+
/**
|
|
1872
|
+
* Deletes a folder by its ID.
|
|
1873
|
+
*
|
|
1874
|
+
* @param id - The unique identifier of the folder to delete.
|
|
1875
|
+
* @param requestId - Optional custom identifier for the request.
|
|
1876
|
+
* @returns A promise that resolves to `true` if successful.
|
|
1877
|
+
*/
|
|
1878
|
+
async deleteFolder(id, requestId) {
|
|
1879
|
+
z.string().parse(id);
|
|
1880
|
+
const response = await request({
|
|
1881
|
+
httpMethod: 'DELETE',
|
|
1882
|
+
baseUri: this.syncApiBase,
|
|
1883
|
+
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
1884
|
+
apiToken: this.authToken,
|
|
1885
|
+
customFetch: this.customFetch,
|
|
1886
|
+
requestId: requestId,
|
|
1887
|
+
});
|
|
1888
|
+
return isSuccess(response);
|
|
1889
|
+
}
|
|
1793
1890
|
// ── Backups ──
|
|
1794
1891
|
/**
|
|
1795
1892
|
* Retrieves a list of available backups.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/types/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from './users/index.js';
|
|
|
8
8
|
export * from './productivity/index.js';
|
|
9
9
|
export * from './activity/index.js';
|
|
10
10
|
export * from './workspaces/index.js';
|
|
11
|
+
export * from './folders/index.js';
|
|
11
12
|
export * from './insights/index.js';
|
|
12
13
|
export * from './backups/index.js';
|
|
13
14
|
export * from './id-mappings/index.js';
|
|
@@ -56,6 +56,7 @@ export declare const ENDPOINT_SYNC = "sync";
|
|
|
56
56
|
export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
57
57
|
export declare const ENDPOINT_GET_TOKEN = "access_token";
|
|
58
58
|
export declare const ENDPOINT_REVOKE = "revoke";
|
|
59
|
+
export declare const ENDPOINT_REST_FOLDERS = "folders";
|
|
59
60
|
export declare const ENDPOINT_REST_WORKSPACES = "workspaces";
|
|
60
61
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
|
|
61
62
|
export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, Reminder } from '../types/index.js';
|
|
1
|
+
import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject, Reminder, Folder } 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";
|
|
@@ -258,3 +258,4 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
|
|
|
258
258
|
itemId?: string | undefined;
|
|
259
259
|
projectId?: string | undefined;
|
|
260
260
|
};
|
|
261
|
+
export declare const DEFAULT_FOLDER: Folder;
|
|
@@ -8,6 +8,8 @@ import { CurrentUser } from './types/users/index.js';
|
|
|
8
8
|
import { ProductivityStats } from './types/productivity/index.js';
|
|
9
9
|
import { GetActivityLogsArgs, GetActivityLogsResponse } from './types/activity/index.js';
|
|
10
10
|
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';
|
|
11
|
+
import { GetFoldersArgs, GetFoldersResponse, AddFolderArgs, UpdateFolderArgs } from './types/folders/index.js';
|
|
12
|
+
import type { Folder } from './types/sync/resources/folders.js';
|
|
11
13
|
import { ProjectActivityStats, ProjectHealth, ProjectHealthContext, ProjectProgress, WorkspaceInsights, GetProjectActivityStatsArgs, GetWorkspaceInsightsArgs } from './types/insights/index.js';
|
|
12
14
|
import { Backup, GetBackupsArgs, DownloadBackupArgs } from './types/backups/index.js';
|
|
13
15
|
import { IdMapping, MovedId, GetIdMappingsArgs, GetMovedIdsArgs } from './types/id-mappings/index.js';
|
|
@@ -714,6 +716,45 @@ export declare class TodoistApi {
|
|
|
714
716
|
* ```
|
|
715
717
|
*/
|
|
716
718
|
viewAttachment(commentOrUrl: Comment | string): Promise<FileResponse>;
|
|
719
|
+
/**
|
|
720
|
+
* Retrieves a paginated list of folders.
|
|
721
|
+
*
|
|
722
|
+
* @param args - Filter parameters such as workspace ID.
|
|
723
|
+
* @returns A promise that resolves to a paginated response of folders.
|
|
724
|
+
*/
|
|
725
|
+
getFolders(args: GetFoldersArgs): Promise<GetFoldersResponse>;
|
|
726
|
+
/**
|
|
727
|
+
* Retrieves a single folder by its ID.
|
|
728
|
+
*
|
|
729
|
+
* @param id - The unique identifier of the folder.
|
|
730
|
+
* @returns A promise that resolves to the requested folder.
|
|
731
|
+
*/
|
|
732
|
+
getFolder(id: string): Promise<Folder>;
|
|
733
|
+
/**
|
|
734
|
+
* Creates a new folder.
|
|
735
|
+
*
|
|
736
|
+
* @param args - Folder creation parameters including name and workspace ID.
|
|
737
|
+
* @param requestId - Optional custom identifier for the request.
|
|
738
|
+
* @returns A promise that resolves to the created folder.
|
|
739
|
+
*/
|
|
740
|
+
addFolder(args: AddFolderArgs, requestId?: string): Promise<Folder>;
|
|
741
|
+
/**
|
|
742
|
+
* Updates an existing folder by its ID.
|
|
743
|
+
*
|
|
744
|
+
* @param id - The unique identifier of the folder to update.
|
|
745
|
+
* @param args - Update parameters such as name or default order.
|
|
746
|
+
* @param requestId - Optional custom identifier for the request.
|
|
747
|
+
* @returns A promise that resolves to the updated folder.
|
|
748
|
+
*/
|
|
749
|
+
updateFolder(id: string, args: UpdateFolderArgs, requestId?: string): Promise<Folder>;
|
|
750
|
+
/**
|
|
751
|
+
* Deletes a folder by its ID.
|
|
752
|
+
*
|
|
753
|
+
* @param id - The unique identifier of the folder to delete.
|
|
754
|
+
* @param requestId - Optional custom identifier for the request.
|
|
755
|
+
* @returns A promise that resolves to `true` if successful.
|
|
756
|
+
*/
|
|
757
|
+
deleteFolder(id: string, requestId?: string): Promise<boolean>;
|
|
717
758
|
/**
|
|
718
759
|
* Retrieves a list of available backups.
|
|
719
760
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './requests.js';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Folder } from '../sync/resources/folders.js';
|
|
2
|
+
export type GetFoldersArgs = {
|
|
3
|
+
workspaceId: number;
|
|
4
|
+
cursor?: string | null;
|
|
5
|
+
limit?: number;
|
|
6
|
+
};
|
|
7
|
+
export type GetFoldersResponse = {
|
|
8
|
+
results: Folder[];
|
|
9
|
+
nextCursor: string | null;
|
|
10
|
+
};
|
|
11
|
+
export type AddFolderArgs = {
|
|
12
|
+
name: string;
|
|
13
|
+
workspaceId: number;
|
|
14
|
+
defaultOrder?: number | null;
|
|
15
|
+
childOrder?: number | null;
|
|
16
|
+
};
|
|
17
|
+
export type UpdateFolderArgs = {
|
|
18
|
+
name?: string | null;
|
|
19
|
+
defaultOrder?: number | null;
|
|
20
|
+
};
|
|
@@ -8,6 +8,7 @@ export * from './users/index.js';
|
|
|
8
8
|
export * from './productivity/index.js';
|
|
9
9
|
export * from './activity/index.js';
|
|
10
10
|
export * from './workspaces/index.js';
|
|
11
|
+
export * from './folders/index.js';
|
|
11
12
|
export * from './insights/index.js';
|
|
12
13
|
export * from './backups/index.js';
|
|
13
14
|
export * from './id-mappings/index.js';
|
package/package.json
CHANGED