@doist/todoist-api-typescript 7.8.0 → 7.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/common.js +8 -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/cjs/types/sync/resources/workspaces.js +23 -6
- package/dist/cjs/types/workspaces/types.js +24 -6
- 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/common.js +7 -1
- 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/esm/types/sync/resources/workspaces.js +23 -6
- package/dist/esm/types/workspaces/types.js +24 -6
- 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/common.d.ts +7 -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/dist/types/types/sync/resources/workspaces.d.ts +94 -9
- package/dist/types/types/workspaces/types.d.ts +51 -9
- package/dist/types/utils/validators.d.ts +26 -28
- 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.
|
package/dist/cjs/types/common.js
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StringOrNumberSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Zod schema that accepts both string and number values and coerces to string.
|
|
7
|
+
* The REST API returns numeric IDs while the Sync API returns string IDs.
|
|
8
|
+
*/
|
|
9
|
+
const StringOrNumberSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).transform((val) => String(val));
|
|
10
|
+
exports.StringOrNumberSchema = StringOrNumberSchema;
|
|
@@ -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);
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.SyncWorkspaceSchema = void 0;
|
|
4
15
|
const zod_1 = require("zod");
|
|
16
|
+
const common_1 = require("../../common");
|
|
5
17
|
const types_1 = require("../../workspaces/types");
|
|
6
18
|
/**
|
|
7
19
|
* Sync API workspace resource.
|
|
@@ -12,20 +24,21 @@ const types_1 = require("../../workspaces/types");
|
|
|
12
24
|
*/
|
|
13
25
|
exports.SyncWorkspaceSchema = zod_1.z
|
|
14
26
|
.object({
|
|
15
|
-
id:
|
|
27
|
+
id: common_1.StringOrNumberSchema,
|
|
16
28
|
name: zod_1.z.string(),
|
|
17
29
|
description: zod_1.z.string(),
|
|
18
30
|
logoBig: zod_1.z.string().optional(),
|
|
19
31
|
logoMedium: zod_1.z.string().optional(),
|
|
20
32
|
logoSmall: zod_1.z.string().optional(),
|
|
21
33
|
logoS640: zod_1.z.string().optional(),
|
|
22
|
-
creatorId:
|
|
23
|
-
createdAt: zod_1.z.string(),
|
|
34
|
+
creatorId: common_1.StringOrNumberSchema,
|
|
35
|
+
createdAt: zod_1.z.string().optional(),
|
|
36
|
+
dateCreated: zod_1.z.string().optional(),
|
|
24
37
|
isDeleted: zod_1.z.boolean(),
|
|
25
38
|
isCollapsed: zod_1.z.boolean(),
|
|
26
|
-
role: types_1.WorkspaceRoleSchema,
|
|
39
|
+
role: types_1.WorkspaceRoleSchema.optional(),
|
|
27
40
|
plan: types_1.WorkspacePlanSchema,
|
|
28
|
-
limits: types_1.WorkspaceLimitsSchema,
|
|
41
|
+
limits: types_1.WorkspaceLimitsSchema.optional(),
|
|
29
42
|
inviteCode: zod_1.z.string().nullable().optional(),
|
|
30
43
|
isLinkSharingEnabled: zod_1.z.boolean().nullable().optional(),
|
|
31
44
|
isGuestAllowed: zod_1.z.boolean().nullable().optional(),
|
|
@@ -53,4 +66,8 @@ exports.SyncWorkspaceSchema = zod_1.z
|
|
|
53
66
|
.optional(),
|
|
54
67
|
properties: types_1.WorkspacePropertiesSchema.optional(),
|
|
55
68
|
})
|
|
56
|
-
.passthrough()
|
|
69
|
+
.passthrough()
|
|
70
|
+
.transform((_a) => {
|
|
71
|
+
var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
|
|
72
|
+
return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
|
|
73
|
+
});
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.WorkspaceUserTaskSchema = exports.MemberActivityInfoSchema = exports.WorkspaceSchema = exports.WorkspacePropertiesSchema = exports.WorkspaceLimitsSchema = exports.WorkspacePlanSchema = exports.WORKSPACE_PLANS = exports.JoinWorkspaceResultSchema = exports.WorkspacePlanDetailsSchema = exports.WORKSPACE_PLAN_STATUSES = exports.WORKSPACE_CURRENT_PLANS = exports.FormattedPriceListingSchema = exports.PlanPriceSchema = exports.WorkspaceInvitationSchema = exports.WorkspaceUserSchema = exports.WorkspaceRoleSchema = exports.WORKSPACE_ROLES = exports.COLLABORATOR_ROLES = void 0;
|
|
4
15
|
const zod_1 = require("zod");
|
|
16
|
+
const common_1 = require("../common");
|
|
5
17
|
const types_1 = require("../tasks/types");
|
|
6
18
|
/** Available project collaborator roles. */
|
|
7
19
|
exports.COLLABORATOR_ROLES = [
|
|
@@ -99,22 +111,28 @@ exports.WorkspacePropertiesSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.unk
|
|
|
99
111
|
/**
|
|
100
112
|
* Represents a workspace in Todoist.
|
|
101
113
|
*/
|
|
102
|
-
exports.WorkspaceSchema = zod_1.z
|
|
103
|
-
|
|
114
|
+
exports.WorkspaceSchema = zod_1.z
|
|
115
|
+
.object({
|
|
116
|
+
id: common_1.StringOrNumberSchema,
|
|
104
117
|
name: zod_1.z.string(),
|
|
105
118
|
plan: exports.WorkspacePlanSchema,
|
|
106
|
-
role: exports.WorkspaceRoleSchema,
|
|
119
|
+
role: exports.WorkspaceRoleSchema.optional(),
|
|
107
120
|
inviteCode: zod_1.z.string(),
|
|
108
121
|
isLinkSharingEnabled: zod_1.z.boolean(),
|
|
109
122
|
isGuestAllowed: zod_1.z.boolean(),
|
|
110
|
-
limits: exports.WorkspaceLimitsSchema,
|
|
123
|
+
limits: exports.WorkspaceLimitsSchema.optional(),
|
|
111
124
|
logoBig: zod_1.z.string().nullish(),
|
|
112
125
|
logoMedium: zod_1.z.string().nullish(),
|
|
113
126
|
logoSmall: zod_1.z.string().nullish(),
|
|
114
127
|
logoS640: zod_1.z.string().nullish(),
|
|
115
|
-
createdAt: zod_1.z.string(),
|
|
116
|
-
|
|
128
|
+
createdAt: zod_1.z.string().optional(),
|
|
129
|
+
dateCreated: zod_1.z.string().optional(),
|
|
130
|
+
creatorId: common_1.StringOrNumberSchema,
|
|
117
131
|
properties: exports.WorkspacePropertiesSchema,
|
|
132
|
+
})
|
|
133
|
+
.transform((_a) => {
|
|
134
|
+
var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
|
|
135
|
+
return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
|
|
118
136
|
});
|
|
119
137
|
exports.MemberActivityInfoSchema = zod_1.z.object({
|
|
120
138
|
userId: zod_1.z.string(),
|
|
@@ -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.
|
package/dist/esm/types/common.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema that accepts both string and number values and coerces to string.
|
|
4
|
+
* The REST API returns numeric IDs while the Sync API returns string IDs.
|
|
5
|
+
*/
|
|
6
|
+
const StringOrNumberSchema = z.union([z.string(), z.number()]).transform((val) => String(val));
|
|
7
|
+
export { StringOrNumberSchema };
|
|
@@ -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';
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { z } from 'zod';
|
|
13
|
+
import { StringOrNumberSchema } from '../../common.js';
|
|
2
14
|
import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, WorkspacePropertiesSchema, } from '../../workspaces/types.js';
|
|
3
15
|
/**
|
|
4
16
|
* Sync API workspace resource.
|
|
@@ -9,20 +21,21 @@ import { WorkspaceRoleSchema, WorkspacePlanSchema, WorkspaceLimitsSchema, Worksp
|
|
|
9
21
|
*/
|
|
10
22
|
export const SyncWorkspaceSchema = z
|
|
11
23
|
.object({
|
|
12
|
-
id:
|
|
24
|
+
id: StringOrNumberSchema,
|
|
13
25
|
name: z.string(),
|
|
14
26
|
description: z.string(),
|
|
15
27
|
logoBig: z.string().optional(),
|
|
16
28
|
logoMedium: z.string().optional(),
|
|
17
29
|
logoSmall: z.string().optional(),
|
|
18
30
|
logoS640: z.string().optional(),
|
|
19
|
-
creatorId:
|
|
20
|
-
createdAt: z.string(),
|
|
31
|
+
creatorId: StringOrNumberSchema,
|
|
32
|
+
createdAt: z.string().optional(),
|
|
33
|
+
dateCreated: z.string().optional(),
|
|
21
34
|
isDeleted: z.boolean(),
|
|
22
35
|
isCollapsed: z.boolean(),
|
|
23
|
-
role: WorkspaceRoleSchema,
|
|
36
|
+
role: WorkspaceRoleSchema.optional(),
|
|
24
37
|
plan: WorkspacePlanSchema,
|
|
25
|
-
limits: WorkspaceLimitsSchema,
|
|
38
|
+
limits: WorkspaceLimitsSchema.optional(),
|
|
26
39
|
inviteCode: z.string().nullable().optional(),
|
|
27
40
|
isLinkSharingEnabled: z.boolean().nullable().optional(),
|
|
28
41
|
isGuestAllowed: z.boolean().nullable().optional(),
|
|
@@ -50,4 +63,8 @@ export const SyncWorkspaceSchema = z
|
|
|
50
63
|
.optional(),
|
|
51
64
|
properties: WorkspacePropertiesSchema.optional(),
|
|
52
65
|
})
|
|
53
|
-
.passthrough()
|
|
66
|
+
.passthrough()
|
|
67
|
+
.transform((_a) => {
|
|
68
|
+
var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
|
|
69
|
+
return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
|
|
70
|
+
});
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { z } from 'zod';
|
|
13
|
+
import { StringOrNumberSchema } from '../common.js';
|
|
2
14
|
import { DueDateSchema, DeadlineSchema } from '../tasks/types.js';
|
|
3
15
|
/** Available project collaborator roles. */
|
|
4
16
|
export const COLLABORATOR_ROLES = [
|
|
@@ -96,22 +108,28 @@ export const WorkspacePropertiesSchema = z.record(z.string(), z.unknown());
|
|
|
96
108
|
/**
|
|
97
109
|
* Represents a workspace in Todoist.
|
|
98
110
|
*/
|
|
99
|
-
export const WorkspaceSchema = z
|
|
100
|
-
|
|
111
|
+
export const WorkspaceSchema = z
|
|
112
|
+
.object({
|
|
113
|
+
id: StringOrNumberSchema,
|
|
101
114
|
name: z.string(),
|
|
102
115
|
plan: WorkspacePlanSchema,
|
|
103
|
-
role: WorkspaceRoleSchema,
|
|
116
|
+
role: WorkspaceRoleSchema.optional(),
|
|
104
117
|
inviteCode: z.string(),
|
|
105
118
|
isLinkSharingEnabled: z.boolean(),
|
|
106
119
|
isGuestAllowed: z.boolean(),
|
|
107
|
-
limits: WorkspaceLimitsSchema,
|
|
120
|
+
limits: WorkspaceLimitsSchema.optional(),
|
|
108
121
|
logoBig: z.string().nullish(),
|
|
109
122
|
logoMedium: z.string().nullish(),
|
|
110
123
|
logoSmall: z.string().nullish(),
|
|
111
124
|
logoS640: z.string().nullish(),
|
|
112
|
-
createdAt: z.string(),
|
|
113
|
-
|
|
125
|
+
createdAt: z.string().optional(),
|
|
126
|
+
dateCreated: z.string().optional(),
|
|
127
|
+
creatorId: StringOrNumberSchema,
|
|
114
128
|
properties: WorkspacePropertiesSchema,
|
|
129
|
+
})
|
|
130
|
+
.transform((_a) => {
|
|
131
|
+
var { dateCreated, createdAt } = _a, rest = __rest(_a, ["dateCreated", "createdAt"]);
|
|
132
|
+
return (Object.assign(Object.assign({}, rest), { createdAt: createdAt !== null && createdAt !== void 0 ? createdAt : dateCreated }));
|
|
115
133
|
});
|
|
116
134
|
export const MemberActivityInfoSchema = z.object({
|
|
117
135
|
userId: z.string(),
|
|
@@ -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
|
*
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
type SearchArgs = {
|
|
2
3
|
query: string;
|
|
3
4
|
cursor?: string | null;
|
|
4
5
|
limit?: number;
|
|
5
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema that accepts both string and number values and coerces to string.
|
|
9
|
+
* The REST API returns numeric IDs while the Sync API returns string IDs.
|
|
10
|
+
*/
|
|
11
|
+
declare const StringOrNumberSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
12
|
+
export { StringOrNumberSchema };
|
|
6
13
|
export type { SearchArgs };
|
|
@@ -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';
|
|
@@ -6,31 +6,32 @@ import { z } from 'zod';
|
|
|
6
6
|
* additional fields like description, isDeleted, isCollapsed, member counts,
|
|
7
7
|
* domain settings, and sorting preferences.
|
|
8
8
|
*/
|
|
9
|
-
export declare const SyncWorkspaceSchema: z.ZodObject<{
|
|
10
|
-
id: z.ZodString
|
|
9
|
+
export declare const SyncWorkspaceSchema: z.ZodPipe<z.ZodObject<{
|
|
10
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
11
11
|
name: z.ZodString;
|
|
12
12
|
description: z.ZodString;
|
|
13
13
|
logoBig: z.ZodOptional<z.ZodString>;
|
|
14
14
|
logoMedium: z.ZodOptional<z.ZodString>;
|
|
15
15
|
logoSmall: z.ZodOptional<z.ZodString>;
|
|
16
16
|
logoS640: z.ZodOptional<z.ZodString>;
|
|
17
|
-
creatorId: z.ZodString
|
|
18
|
-
createdAt: z.ZodString
|
|
17
|
+
creatorId: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
18
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
19
|
+
dateCreated: z.ZodOptional<z.ZodString>;
|
|
19
20
|
isDeleted: z.ZodBoolean;
|
|
20
21
|
isCollapsed: z.ZodBoolean;
|
|
21
|
-
role: z.ZodEnum<{
|
|
22
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
22
23
|
ADMIN: "ADMIN";
|
|
23
24
|
MEMBER: "MEMBER";
|
|
24
25
|
GUEST: "GUEST";
|
|
25
|
-
}
|
|
26
|
+
}>>;
|
|
26
27
|
plan: z.ZodEnum<{
|
|
27
28
|
STARTER: "STARTER";
|
|
28
29
|
BUSINESS: "BUSINESS";
|
|
29
30
|
}>;
|
|
30
|
-
limits: z.ZodObject<{
|
|
31
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
31
32
|
current: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
32
33
|
next: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
33
|
-
}, z.core.$catchall<z.ZodAny
|
|
34
|
+
}, z.core.$catchall<z.ZodAny>>>;
|
|
34
35
|
inviteCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
36
|
isLinkSharingEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
36
37
|
isGuestAllowed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
@@ -53,5 +54,89 @@ export declare const SyncWorkspaceSchema: z.ZodObject<{
|
|
|
53
54
|
userIds: z.ZodArray<z.ZodNumber>;
|
|
54
55
|
}, z.core.$strip>>;
|
|
55
56
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
56
|
-
}, z.core.$loose
|
|
57
|
+
}, z.core.$loose>, z.ZodTransform<{
|
|
58
|
+
createdAt: string | undefined;
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
creatorId: string;
|
|
63
|
+
isDeleted: boolean;
|
|
64
|
+
isCollapsed: boolean;
|
|
65
|
+
plan: "STARTER" | "BUSINESS";
|
|
66
|
+
currentActiveProjects: number | null;
|
|
67
|
+
currentMemberCount: number | null;
|
|
68
|
+
currentTemplateCount: number | null;
|
|
69
|
+
adminSortingApplied: boolean;
|
|
70
|
+
logoBig?: string | undefined;
|
|
71
|
+
logoMedium?: string | undefined;
|
|
72
|
+
logoSmall?: string | undefined;
|
|
73
|
+
logoS640?: string | undefined;
|
|
74
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
75
|
+
limits?: {
|
|
76
|
+
[x: string]: any;
|
|
77
|
+
current: Record<string, any> | null;
|
|
78
|
+
next: Record<string, any> | null;
|
|
79
|
+
} | undefined;
|
|
80
|
+
inviteCode?: string | null | undefined;
|
|
81
|
+
isLinkSharingEnabled?: boolean | null | undefined;
|
|
82
|
+
isGuestAllowed?: boolean | null | undefined;
|
|
83
|
+
memberCountByType?: {
|
|
84
|
+
adminCount: number;
|
|
85
|
+
guestCount: number;
|
|
86
|
+
memberCount: number;
|
|
87
|
+
} | undefined;
|
|
88
|
+
pendingInvitations?: string[] | null | undefined;
|
|
89
|
+
domainName?: string | undefined;
|
|
90
|
+
domainDiscovery?: boolean | undefined;
|
|
91
|
+
restrictEmailDomains?: boolean | undefined;
|
|
92
|
+
projectSortPreference?: string | undefined;
|
|
93
|
+
defaultCollaborators?: {
|
|
94
|
+
predefinedGroupIds: string[];
|
|
95
|
+
userIds: number[];
|
|
96
|
+
} | undefined;
|
|
97
|
+
properties?: Record<string, unknown> | undefined;
|
|
98
|
+
}, {
|
|
99
|
+
[x: string]: unknown;
|
|
100
|
+
id: string;
|
|
101
|
+
name: string;
|
|
102
|
+
description: string;
|
|
103
|
+
creatorId: string;
|
|
104
|
+
isDeleted: boolean;
|
|
105
|
+
isCollapsed: boolean;
|
|
106
|
+
plan: "STARTER" | "BUSINESS";
|
|
107
|
+
currentActiveProjects: number | null;
|
|
108
|
+
currentMemberCount: number | null;
|
|
109
|
+
currentTemplateCount: number | null;
|
|
110
|
+
adminSortingApplied: boolean;
|
|
111
|
+
logoBig?: string | undefined;
|
|
112
|
+
logoMedium?: string | undefined;
|
|
113
|
+
logoSmall?: string | undefined;
|
|
114
|
+
logoS640?: string | undefined;
|
|
115
|
+
createdAt?: string | undefined;
|
|
116
|
+
dateCreated?: string | undefined;
|
|
117
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
118
|
+
limits?: {
|
|
119
|
+
[x: string]: any;
|
|
120
|
+
current: Record<string, any> | null;
|
|
121
|
+
next: Record<string, any> | null;
|
|
122
|
+
} | undefined;
|
|
123
|
+
inviteCode?: string | null | undefined;
|
|
124
|
+
isLinkSharingEnabled?: boolean | null | undefined;
|
|
125
|
+
isGuestAllowed?: boolean | null | undefined;
|
|
126
|
+
memberCountByType?: {
|
|
127
|
+
adminCount: number;
|
|
128
|
+
guestCount: number;
|
|
129
|
+
memberCount: number;
|
|
130
|
+
} | undefined;
|
|
131
|
+
pendingInvitations?: string[] | null | undefined;
|
|
132
|
+
domainName?: string | undefined;
|
|
133
|
+
domainDiscovery?: boolean | undefined;
|
|
134
|
+
restrictEmailDomains?: boolean | undefined;
|
|
135
|
+
projectSortPreference?: string | undefined;
|
|
136
|
+
defaultCollaborators?: {
|
|
137
|
+
predefinedGroupIds: string[];
|
|
138
|
+
userIds: number[];
|
|
139
|
+
} | undefined;
|
|
140
|
+
properties?: Record<string, unknown> | undefined;
|
|
141
|
+
}>>;
|
|
57
142
|
export type SyncWorkspace = z.infer<typeof SyncWorkspaceSchema>;
|
|
@@ -158,33 +158,75 @@ export type WorkspaceProperties = z.infer<typeof WorkspacePropertiesSchema>;
|
|
|
158
158
|
/**
|
|
159
159
|
* Represents a workspace in Todoist.
|
|
160
160
|
*/
|
|
161
|
-
export declare const WorkspaceSchema: z.ZodObject<{
|
|
162
|
-
id: z.ZodString
|
|
161
|
+
export declare const WorkspaceSchema: z.ZodPipe<z.ZodObject<{
|
|
162
|
+
id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
163
163
|
name: z.ZodString;
|
|
164
164
|
plan: z.ZodEnum<{
|
|
165
165
|
STARTER: "STARTER";
|
|
166
166
|
BUSINESS: "BUSINESS";
|
|
167
167
|
}>;
|
|
168
|
-
role: z.ZodEnum<{
|
|
168
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
169
169
|
ADMIN: "ADMIN";
|
|
170
170
|
MEMBER: "MEMBER";
|
|
171
171
|
GUEST: "GUEST";
|
|
172
|
-
}
|
|
172
|
+
}>>;
|
|
173
173
|
inviteCode: z.ZodString;
|
|
174
174
|
isLinkSharingEnabled: z.ZodBoolean;
|
|
175
175
|
isGuestAllowed: z.ZodBoolean;
|
|
176
|
-
limits: z.ZodObject<{
|
|
176
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
177
177
|
current: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
178
178
|
next: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
179
|
-
}, z.core.$catchall<z.ZodAny
|
|
179
|
+
}, z.core.$catchall<z.ZodAny>>>;
|
|
180
180
|
logoBig: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
181
|
logoMedium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
182
|
logoSmall: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
183
183
|
logoS640: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
184
|
-
createdAt: z.ZodString
|
|
185
|
-
|
|
184
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
185
|
+
dateCreated: z.ZodOptional<z.ZodString>;
|
|
186
|
+
creatorId: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
|
|
186
187
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
187
|
-
}, z.core.$strip
|
|
188
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
189
|
+
createdAt: string | undefined;
|
|
190
|
+
id: string;
|
|
191
|
+
name: string;
|
|
192
|
+
plan: "STARTER" | "BUSINESS";
|
|
193
|
+
inviteCode: string;
|
|
194
|
+
isLinkSharingEnabled: boolean;
|
|
195
|
+
isGuestAllowed: boolean;
|
|
196
|
+
creatorId: string;
|
|
197
|
+
properties: Record<string, unknown>;
|
|
198
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
199
|
+
limits?: {
|
|
200
|
+
[x: string]: any;
|
|
201
|
+
current: Record<string, any> | null;
|
|
202
|
+
next: Record<string, any> | null;
|
|
203
|
+
} | undefined;
|
|
204
|
+
logoBig?: string | null | undefined;
|
|
205
|
+
logoMedium?: string | null | undefined;
|
|
206
|
+
logoSmall?: string | null | undefined;
|
|
207
|
+
logoS640?: string | null | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
plan: "STARTER" | "BUSINESS";
|
|
212
|
+
inviteCode: string;
|
|
213
|
+
isLinkSharingEnabled: boolean;
|
|
214
|
+
isGuestAllowed: boolean;
|
|
215
|
+
creatorId: string;
|
|
216
|
+
properties: Record<string, unknown>;
|
|
217
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
218
|
+
limits?: {
|
|
219
|
+
[x: string]: any;
|
|
220
|
+
current: Record<string, any> | null;
|
|
221
|
+
next: Record<string, any> | null;
|
|
222
|
+
} | undefined;
|
|
223
|
+
logoBig?: string | null | undefined;
|
|
224
|
+
logoMedium?: string | null | undefined;
|
|
225
|
+
logoSmall?: string | null | undefined;
|
|
226
|
+
logoS640?: string | null | undefined;
|
|
227
|
+
createdAt?: string | undefined;
|
|
228
|
+
dateCreated?: string | undefined;
|
|
229
|
+
}>>;
|
|
188
230
|
export type Workspace = z.infer<typeof WorkspaceSchema>;
|
|
189
231
|
export declare const MemberActivityInfoSchema: z.ZodObject<{
|
|
190
232
|
userId: z.ZodString;
|
|
@@ -409,42 +409,42 @@ export declare const validateJoinWorkspaceResult: (input: unknown) => {
|
|
|
409
409
|
workspaceId: string;
|
|
410
410
|
};
|
|
411
411
|
export declare const validateWorkspace: (input: unknown) => {
|
|
412
|
+
createdAt: string | undefined;
|
|
412
413
|
id: string;
|
|
413
414
|
name: string;
|
|
414
415
|
plan: "STARTER" | "BUSINESS";
|
|
415
|
-
role: "ADMIN" | "MEMBER" | "GUEST";
|
|
416
416
|
inviteCode: string;
|
|
417
417
|
isLinkSharingEnabled: boolean;
|
|
418
418
|
isGuestAllowed: boolean;
|
|
419
|
-
|
|
419
|
+
creatorId: string;
|
|
420
|
+
properties: Record<string, unknown>;
|
|
421
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
422
|
+
limits?: {
|
|
420
423
|
[x: string]: any;
|
|
421
424
|
current: Record<string, any> | null;
|
|
422
425
|
next: Record<string, any> | null;
|
|
423
|
-
};
|
|
424
|
-
createdAt: string;
|
|
425
|
-
creatorId: string;
|
|
426
|
-
properties: Record<string, unknown>;
|
|
426
|
+
} | undefined;
|
|
427
427
|
logoBig?: string | null | undefined;
|
|
428
428
|
logoMedium?: string | null | undefined;
|
|
429
429
|
logoSmall?: string | null | undefined;
|
|
430
430
|
logoS640?: string | null | undefined;
|
|
431
431
|
};
|
|
432
432
|
export declare const validateWorkspaceArray: (input: unknown[]) => {
|
|
433
|
+
createdAt: string | undefined;
|
|
433
434
|
id: string;
|
|
434
435
|
name: string;
|
|
435
436
|
plan: "STARTER" | "BUSINESS";
|
|
436
|
-
role: "ADMIN" | "MEMBER" | "GUEST";
|
|
437
437
|
inviteCode: string;
|
|
438
438
|
isLinkSharingEnabled: boolean;
|
|
439
439
|
isGuestAllowed: boolean;
|
|
440
|
-
|
|
440
|
+
creatorId: string;
|
|
441
|
+
properties: Record<string, unknown>;
|
|
442
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
443
|
+
limits?: {
|
|
441
444
|
[x: string]: any;
|
|
442
445
|
current: Record<string, any> | null;
|
|
443
446
|
next: Record<string, any> | null;
|
|
444
|
-
};
|
|
445
|
-
createdAt: string;
|
|
446
|
-
creatorId: string;
|
|
447
|
-
properties: Record<string, unknown>;
|
|
447
|
+
} | undefined;
|
|
448
448
|
logoBig?: string | null | undefined;
|
|
449
449
|
logoMedium?: string | null | undefined;
|
|
450
450
|
logoSmall?: string | null | undefined;
|
|
@@ -1137,21 +1137,14 @@ export declare const validateLiveNotificationArray: (input: unknown[]) => {
|
|
|
1137
1137
|
invitationSecret?: string | undefined;
|
|
1138
1138
|
}[];
|
|
1139
1139
|
export declare const validateSyncWorkspace: (input: unknown) => {
|
|
1140
|
-
|
|
1140
|
+
createdAt: string | undefined;
|
|
1141
1141
|
id: string;
|
|
1142
1142
|
name: string;
|
|
1143
1143
|
description: string;
|
|
1144
1144
|
creatorId: string;
|
|
1145
|
-
createdAt: string;
|
|
1146
1145
|
isDeleted: boolean;
|
|
1147
1146
|
isCollapsed: boolean;
|
|
1148
|
-
role: "ADMIN" | "MEMBER" | "GUEST";
|
|
1149
1147
|
plan: "STARTER" | "BUSINESS";
|
|
1150
|
-
limits: {
|
|
1151
|
-
[x: string]: any;
|
|
1152
|
-
current: Record<string, any> | null;
|
|
1153
|
-
next: Record<string, any> | null;
|
|
1154
|
-
};
|
|
1155
1148
|
currentActiveProjects: number | null;
|
|
1156
1149
|
currentMemberCount: number | null;
|
|
1157
1150
|
currentTemplateCount: number | null;
|
|
@@ -1160,6 +1153,12 @@ export declare const validateSyncWorkspace: (input: unknown) => {
|
|
|
1160
1153
|
logoMedium?: string | undefined;
|
|
1161
1154
|
logoSmall?: string | undefined;
|
|
1162
1155
|
logoS640?: string | undefined;
|
|
1156
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
1157
|
+
limits?: {
|
|
1158
|
+
[x: string]: any;
|
|
1159
|
+
current: Record<string, any> | null;
|
|
1160
|
+
next: Record<string, any> | null;
|
|
1161
|
+
} | undefined;
|
|
1163
1162
|
inviteCode?: string | null | undefined;
|
|
1164
1163
|
isLinkSharingEnabled?: boolean | null | undefined;
|
|
1165
1164
|
isGuestAllowed?: boolean | null | undefined;
|
|
@@ -1180,21 +1179,14 @@ export declare const validateSyncWorkspace: (input: unknown) => {
|
|
|
1180
1179
|
properties?: Record<string, unknown> | undefined;
|
|
1181
1180
|
};
|
|
1182
1181
|
export declare const validateSyncWorkspaceArray: (input: unknown[]) => {
|
|
1183
|
-
|
|
1182
|
+
createdAt: string | undefined;
|
|
1184
1183
|
id: string;
|
|
1185
1184
|
name: string;
|
|
1186
1185
|
description: string;
|
|
1187
1186
|
creatorId: string;
|
|
1188
|
-
createdAt: string;
|
|
1189
1187
|
isDeleted: boolean;
|
|
1190
1188
|
isCollapsed: boolean;
|
|
1191
|
-
role: "ADMIN" | "MEMBER" | "GUEST";
|
|
1192
1189
|
plan: "STARTER" | "BUSINESS";
|
|
1193
|
-
limits: {
|
|
1194
|
-
[x: string]: any;
|
|
1195
|
-
current: Record<string, any> | null;
|
|
1196
|
-
next: Record<string, any> | null;
|
|
1197
|
-
};
|
|
1198
1190
|
currentActiveProjects: number | null;
|
|
1199
1191
|
currentMemberCount: number | null;
|
|
1200
1192
|
currentTemplateCount: number | null;
|
|
@@ -1203,6 +1195,12 @@ export declare const validateSyncWorkspaceArray: (input: unknown[]) => {
|
|
|
1203
1195
|
logoMedium?: string | undefined;
|
|
1204
1196
|
logoSmall?: string | undefined;
|
|
1205
1197
|
logoS640?: string | undefined;
|
|
1198
|
+
role?: "ADMIN" | "MEMBER" | "GUEST" | undefined;
|
|
1199
|
+
limits?: {
|
|
1200
|
+
[x: string]: any;
|
|
1201
|
+
current: Record<string, any> | null;
|
|
1202
|
+
next: Record<string, any> | null;
|
|
1203
|
+
} | undefined;
|
|
1206
1204
|
inviteCode?: string | null | undefined;
|
|
1207
1205
|
isLinkSharingEnabled?: boolean | null | undefined;
|
|
1208
1206
|
isGuestAllowed?: boolean | null | undefined;
|
package/package.json
CHANGED