@doist/todoist-api-typescript 7.7.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.
@@ -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
+ };
@@ -12,9 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.TodoistApi = void 0;
15
- const tasks_1 = require("./types/tasks");
16
15
  const reminders_1 = require("./types/reminders");
17
- const reminders_2 = require("./types/sync/resources/reminders");
18
16
  const http_client_1 = require("./transport/http-client");
19
17
  const endpoints_1 = require("./consts/endpoints");
20
18
  const validators_1 = require("./utils/validators");
@@ -87,56 +85,6 @@ function headersToRecord(headers) {
87
85
  });
88
86
  return result;
89
87
  }
90
- const ReminderDeliveryServiceSchema = zod_1.z.enum(reminders_1.REMINDER_DELIVERY_SERVICES);
91
- const ReminderIdSchema = zod_1.z.string();
92
- const ReminderDueDateSchema = tasks_1.DueDateSchema.pick({
93
- date: true,
94
- string: true,
95
- timezone: true,
96
- lang: true,
97
- isRecurring: true,
98
- })
99
- .partial()
100
- .strict();
101
- const UpdateRelativeReminderArgsSchema = zod_1.z
102
- .object({
103
- reminderType: zod_1.z.literal('relative'),
104
- minuteOffset: zod_1.z.number().int().optional(),
105
- notifyUid: zod_1.z.string().optional(),
106
- service: ReminderDeliveryServiceSchema.optional(),
107
- isUrgent: zod_1.z.boolean().optional(),
108
- })
109
- .strict();
110
- const UpdateAbsoluteReminderArgsSchema = zod_1.z
111
- .object({
112
- reminderType: zod_1.z.literal('absolute'),
113
- due: ReminderDueDateSchema.optional(),
114
- notifyUid: zod_1.z.string().optional(),
115
- service: ReminderDeliveryServiceSchema.optional(),
116
- isUrgent: zod_1.z.boolean().optional(),
117
- })
118
- .strict();
119
- const UpdateLocationReminderArgsSchema = zod_1.z
120
- .object({
121
- notifyUid: zod_1.z.string().optional(),
122
- name: zod_1.z.string().optional(),
123
- locLat: zod_1.z.string().optional(),
124
- locLong: zod_1.z.string().optional(),
125
- locTrigger: zod_1.z.enum(reminders_2.LOCATION_TRIGGERS).optional(),
126
- radius: zod_1.z.number().int().optional(),
127
- })
128
- .strict()
129
- .refine((args) => Object.values(args).some((value) => value !== undefined), {
130
- message: 'At least one reminder field must be provided to updateLocationReminder',
131
- });
132
- const UpdateReminderArgsSchema = zod_1.z
133
- .discriminatedUnion('reminderType', [
134
- UpdateRelativeReminderArgsSchema,
135
- UpdateAbsoluteReminderArgsSchema,
136
- ])
137
- .refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
138
- message: 'At least one reminder field must be provided to updateReminder',
139
- });
140
88
  class TodoistApi {
141
89
  constructor(
142
90
  /**
@@ -1439,7 +1387,7 @@ class TodoistApi {
1439
1387
  * @returns A promise that resolves to the requested reminder.
1440
1388
  */
1441
1389
  async getReminder(id) {
1442
- ReminderIdSchema.parse(id);
1390
+ reminders_1.ReminderIdSchema.parse(id);
1443
1391
  try {
1444
1392
  const response = await (0, http_client_1.request)({
1445
1393
  httpMethod: 'GET',
@@ -1464,7 +1412,7 @@ class TodoistApi {
1464
1412
  * @returns A promise that resolves to the requested reminder.
1465
1413
  */
1466
1414
  async getLocationReminder(id) {
1467
- ReminderIdSchema.parse(id);
1415
+ reminders_1.ReminderIdSchema.parse(id);
1468
1416
  try {
1469
1417
  const response = await (0, http_client_1.request)({
1470
1418
  httpMethod: 'GET',
@@ -1529,8 +1477,8 @@ class TodoistApi {
1529
1477
  * @returns A promise that resolves to the updated reminder.
1530
1478
  */
1531
1479
  async updateReminder(id, args, requestId) {
1532
- ReminderIdSchema.parse(id);
1533
- const payload = UpdateReminderArgsSchema.parse(args);
1480
+ reminders_1.ReminderIdSchema.parse(id);
1481
+ const payload = reminders_1.UpdateReminderArgsSchema.parse(args);
1534
1482
  try {
1535
1483
  const response = await (0, http_client_1.request)({
1536
1484
  httpMethod: 'POST',
@@ -1559,8 +1507,8 @@ class TodoistApi {
1559
1507
  * @returns A promise that resolves to the updated reminder.
1560
1508
  */
1561
1509
  async updateLocationReminder(id, args, requestId) {
1562
- ReminderIdSchema.parse(id);
1563
- const payload = UpdateLocationReminderArgsSchema.parse(args);
1510
+ reminders_1.ReminderIdSchema.parse(id);
1511
+ const payload = reminders_1.UpdateLocationReminderArgsSchema.parse(args);
1564
1512
  try {
1565
1513
  const response = await (0, http_client_1.request)({
1566
1514
  httpMethod: 'POST',
@@ -1588,7 +1536,7 @@ class TodoistApi {
1588
1536
  * @returns A promise that resolves to `true` if successful.
1589
1537
  */
1590
1538
  async deleteReminder(id, requestId) {
1591
- ReminderIdSchema.parse(id);
1539
+ reminders_1.ReminderIdSchema.parse(id);
1592
1540
  try {
1593
1541
  const response = await (0, http_client_1.request)({
1594
1542
  httpMethod: 'DELETE',
@@ -1615,7 +1563,7 @@ class TodoistApi {
1615
1563
  * @returns A promise that resolves to `true` if successful.
1616
1564
  */
1617
1565
  async deleteLocationReminder(id, requestId) {
1618
- ReminderIdSchema.parse(id);
1566
+ reminders_1.ReminderIdSchema.parse(id);
1619
1567
  try {
1620
1568
  const response = await (0, http_client_1.request)({
1621
1569
  httpMethod: 'DELETE',
@@ -1845,6 +1793,103 @@ class TodoistApi {
1845
1793
  arrayBuffer: () => response.arrayBuffer(),
1846
1794
  };
1847
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
+ }
1848
1893
  // ── Backups ──
1849
1894
  /**
1850
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);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,5 +1,95 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REMINDER_DELIVERY_SERVICES = void 0;
3
+ exports.UpdateLocationReminderArgsSchema = exports.UpdateReminderArgsSchema = exports.UpdateAbsoluteReminderArgsSchema = exports.UpdateRelativeReminderArgsSchema = exports.AddLocationReminderArgsSchema = exports.AddReminderArgsSchema = exports.AddAbsoluteReminderArgsSchema = exports.AddRelativeReminderArgsSchema = exports.ReminderDueDateSchema = exports.ReminderIdSchema = exports.ReminderDeliveryServiceSchema = exports.REMINDER_DELIVERY_SERVICES = void 0;
4
+ const zod_1 = require("zod");
5
+ const types_1 = require("../tasks/types");
6
+ const reminders_1 = require("../sync/resources/reminders");
4
7
  /** Available reminder delivery services. */
5
8
  exports.REMINDER_DELIVERY_SERVICES = ['email', 'push'];
9
+ exports.ReminderDeliveryServiceSchema = zod_1.z.enum(exports.REMINDER_DELIVERY_SERVICES);
10
+ exports.ReminderIdSchema = zod_1.z.string();
11
+ exports.ReminderDueDateSchema = types_1.DueDateSchema.pick({
12
+ date: true,
13
+ string: true,
14
+ timezone: true,
15
+ lang: true,
16
+ isRecurring: true,
17
+ })
18
+ .partial()
19
+ .strict();
20
+ // ── Add schemas ──────────────────────────────────────────────────────
21
+ exports.AddRelativeReminderArgsSchema = zod_1.z
22
+ .object({
23
+ taskId: zod_1.z.string(),
24
+ reminderType: zod_1.z.literal(reminders_1.ReminderTypeEnum.Relative).optional(),
25
+ minuteOffset: zod_1.z.number().int(),
26
+ service: exports.ReminderDeliveryServiceSchema.optional(),
27
+ notifyUid: zod_1.z.string().optional(),
28
+ isUrgent: zod_1.z.boolean().optional(),
29
+ })
30
+ .strict();
31
+ exports.AddAbsoluteReminderArgsSchema = zod_1.z
32
+ .object({
33
+ taskId: zod_1.z.string(),
34
+ reminderType: zod_1.z.literal(reminders_1.ReminderTypeEnum.Absolute),
35
+ due: exports.ReminderDueDateSchema,
36
+ service: exports.ReminderDeliveryServiceSchema.optional(),
37
+ notifyUid: zod_1.z.string().optional(),
38
+ isUrgent: zod_1.z.boolean().optional(),
39
+ })
40
+ .strict();
41
+ exports.AddReminderArgsSchema = zod_1.z.union([
42
+ exports.AddRelativeReminderArgsSchema,
43
+ exports.AddAbsoluteReminderArgsSchema,
44
+ ]);
45
+ exports.AddLocationReminderArgsSchema = zod_1.z
46
+ .object({
47
+ taskId: zod_1.z.string(),
48
+ notifyUid: zod_1.z.string().optional(),
49
+ name: zod_1.z.string(),
50
+ locLat: zod_1.z.string(),
51
+ locLong: zod_1.z.string(),
52
+ locTrigger: zod_1.z.enum(reminders_1.LOCATION_TRIGGERS),
53
+ radius: zod_1.z.number().int().optional(),
54
+ })
55
+ .strict();
56
+ // ── Update schemas ───────────────────────────────────────────────────
57
+ exports.UpdateRelativeReminderArgsSchema = zod_1.z
58
+ .object({
59
+ reminderType: zod_1.z.literal(reminders_1.ReminderTypeEnum.Relative),
60
+ minuteOffset: zod_1.z.number().int().optional(),
61
+ notifyUid: zod_1.z.string().optional(),
62
+ service: exports.ReminderDeliveryServiceSchema.optional(),
63
+ isUrgent: zod_1.z.boolean().optional(),
64
+ })
65
+ .strict();
66
+ exports.UpdateAbsoluteReminderArgsSchema = zod_1.z
67
+ .object({
68
+ reminderType: zod_1.z.literal(reminders_1.ReminderTypeEnum.Absolute),
69
+ due: exports.ReminderDueDateSchema.optional(),
70
+ notifyUid: zod_1.z.string().optional(),
71
+ service: exports.ReminderDeliveryServiceSchema.optional(),
72
+ isUrgent: zod_1.z.boolean().optional(),
73
+ })
74
+ .strict();
75
+ exports.UpdateReminderArgsSchema = zod_1.z
76
+ .discriminatedUnion('reminderType', [
77
+ exports.UpdateRelativeReminderArgsSchema,
78
+ exports.UpdateAbsoluteReminderArgsSchema,
79
+ ])
80
+ .refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
81
+ message: 'At least one reminder field must be provided to updateReminder',
82
+ });
83
+ exports.UpdateLocationReminderArgsSchema = zod_1.z
84
+ .object({
85
+ notifyUid: zod_1.z.string().optional(),
86
+ name: zod_1.z.string().optional(),
87
+ locLat: zod_1.z.string().optional(),
88
+ locLong: zod_1.z.string().optional(),
89
+ locTrigger: zod_1.z.enum(reminders_1.LOCATION_TRIGGERS).optional(),
90
+ radius: zod_1.z.number().int().optional(),
91
+ })
92
+ .strict()
93
+ .refine((args) => Object.values(args).some((value) => value !== undefined), {
94
+ message: 'At least one reminder field must be provided to updateLocationReminder',
95
+ });
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReminderSchema = exports.RelativeReminderSchema = exports.AbsoluteReminderSchema = exports.LocationReminderSchema = exports.LOCATION_TRIGGERS = exports.ReminderBaseSchema = void 0;
3
+ exports.ReminderSchema = exports.RelativeReminderSchema = exports.AbsoluteReminderSchema = exports.LocationReminderSchema = exports.LOCATION_TRIGGERS = exports.REMINDER_TYPES = exports.ReminderTypeEnum = exports.ReminderBaseSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const types_1 = require("../../tasks/types");
6
6
  exports.ReminderBaseSchema = zod_1.z.object({
@@ -10,10 +10,22 @@ exports.ReminderBaseSchema = zod_1.z.object({
10
10
  projectId: zod_1.z.string().optional(),
11
11
  isDeleted: zod_1.z.boolean(),
12
12
  });
13
+ /** Enum-like object of reminder type values. */
14
+ exports.ReminderTypeEnum = {
15
+ Relative: 'relative',
16
+ Absolute: 'absolute',
17
+ Location: 'location',
18
+ };
19
+ /** Available reminder types. */
20
+ exports.REMINDER_TYPES = [
21
+ exports.ReminderTypeEnum.Relative,
22
+ exports.ReminderTypeEnum.Absolute,
23
+ exports.ReminderTypeEnum.Location,
24
+ ];
13
25
  /** Available location reminder triggers. */
14
26
  exports.LOCATION_TRIGGERS = ['on_enter', 'on_leave'];
15
27
  exports.LocationReminderSchema = exports.ReminderBaseSchema.extend({
16
- type: zod_1.z.literal('location'),
28
+ type: zod_1.z.literal(exports.ReminderTypeEnum.Location),
17
29
  name: zod_1.z.string(),
18
30
  locLat: zod_1.z.string(),
19
31
  locLong: zod_1.z.string(),
@@ -21,12 +33,12 @@ exports.LocationReminderSchema = exports.ReminderBaseSchema.extend({
21
33
  radius: zod_1.z.number().int(),
22
34
  }).passthrough();
23
35
  exports.AbsoluteReminderSchema = exports.ReminderBaseSchema.extend({
24
- type: zod_1.z.literal('absolute'),
36
+ type: zod_1.z.literal(exports.ReminderTypeEnum.Absolute),
25
37
  due: types_1.DueDateSchema,
26
38
  isUrgent: zod_1.z.boolean().optional(),
27
39
  }).passthrough();
28
40
  exports.RelativeReminderSchema = exports.ReminderBaseSchema.extend({
29
- type: zod_1.z.literal('relative'),
41
+ type: zod_1.z.literal(exports.ReminderTypeEnum.Relative),
30
42
  minuteOffset: zod_1.z.number().int(),
31
43
  due: types_1.DueDateSchema.optional(),
32
44
  isUrgent: zod_1.z.boolean().optional(),
@@ -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
+ };
@@ -9,12 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { DueDateSchema, } from './types/tasks/index.js';
13
- import { REMINDER_DELIVERY_SERVICES, } from './types/reminders/index.js';
14
- import { LOCATION_TRIGGERS } from './types/sync/resources/reminders.js';
12
+ import { UpdateReminderArgsSchema, UpdateLocationReminderArgsSchema, ReminderIdSchema, } from './types/reminders/index.js';
15
13
  import { request, isSuccess } from './transport/http-client.js';
16
- 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';
17
- 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';
18
16
  import { formatDateToYYYYMMDD } from './utils/url-helpers.js';
19
17
  import { uploadMultipartFile } from './utils/multipart-upload.js';
20
18
  import { camelCaseKeys } from './utils/case-conversion.js';
@@ -84,56 +82,6 @@ function headersToRecord(headers) {
84
82
  });
85
83
  return result;
86
84
  }
87
- const ReminderDeliveryServiceSchema = z.enum(REMINDER_DELIVERY_SERVICES);
88
- const ReminderIdSchema = z.string();
89
- const ReminderDueDateSchema = DueDateSchema.pick({
90
- date: true,
91
- string: true,
92
- timezone: true,
93
- lang: true,
94
- isRecurring: true,
95
- })
96
- .partial()
97
- .strict();
98
- const UpdateRelativeReminderArgsSchema = z
99
- .object({
100
- reminderType: z.literal('relative'),
101
- minuteOffset: z.number().int().optional(),
102
- notifyUid: z.string().optional(),
103
- service: ReminderDeliveryServiceSchema.optional(),
104
- isUrgent: z.boolean().optional(),
105
- })
106
- .strict();
107
- const UpdateAbsoluteReminderArgsSchema = z
108
- .object({
109
- reminderType: z.literal('absolute'),
110
- due: ReminderDueDateSchema.optional(),
111
- notifyUid: z.string().optional(),
112
- service: ReminderDeliveryServiceSchema.optional(),
113
- isUrgent: z.boolean().optional(),
114
- })
115
- .strict();
116
- const UpdateLocationReminderArgsSchema = z
117
- .object({
118
- notifyUid: z.string().optional(),
119
- name: z.string().optional(),
120
- locLat: z.string().optional(),
121
- locLong: z.string().optional(),
122
- locTrigger: z.enum(LOCATION_TRIGGERS).optional(),
123
- radius: z.number().int().optional(),
124
- })
125
- .strict()
126
- .refine((args) => Object.values(args).some((value) => value !== undefined), {
127
- message: 'At least one reminder field must be provided to updateLocationReminder',
128
- });
129
- const UpdateReminderArgsSchema = z
130
- .discriminatedUnion('reminderType', [
131
- UpdateRelativeReminderArgsSchema,
132
- UpdateAbsoluteReminderArgsSchema,
133
- ])
134
- .refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
135
- message: 'At least one reminder field must be provided to updateReminder',
136
- });
137
85
  export class TodoistApi {
138
86
  constructor(
139
87
  /**
@@ -1842,6 +1790,103 @@ export class TodoistApi {
1842
1790
  arrayBuffer: () => response.arrayBuffer(),
1843
1791
  };
1844
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
+ }
1845
1890
  // ── Backups ──
1846
1891
  /**
1847
1892
  * Retrieves a list of available backups.
@@ -0,0 +1 @@
1
+ export * from './requests.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -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,2 +1,92 @@
1
+ import { z } from 'zod';
2
+ import { DueDateSchema } from '../tasks/types.js';
3
+ import { LOCATION_TRIGGERS, ReminderTypeEnum } from '../sync/resources/reminders.js';
1
4
  /** Available reminder delivery services. */
2
5
  export const REMINDER_DELIVERY_SERVICES = ['email', 'push'];
6
+ export const ReminderDeliveryServiceSchema = z.enum(REMINDER_DELIVERY_SERVICES);
7
+ export const ReminderIdSchema = z.string();
8
+ export const ReminderDueDateSchema = DueDateSchema.pick({
9
+ date: true,
10
+ string: true,
11
+ timezone: true,
12
+ lang: true,
13
+ isRecurring: true,
14
+ })
15
+ .partial()
16
+ .strict();
17
+ // ── Add schemas ──────────────────────────────────────────────────────
18
+ export const AddRelativeReminderArgsSchema = z
19
+ .object({
20
+ taskId: z.string(),
21
+ reminderType: z.literal(ReminderTypeEnum.Relative).optional(),
22
+ minuteOffset: z.number().int(),
23
+ service: ReminderDeliveryServiceSchema.optional(),
24
+ notifyUid: z.string().optional(),
25
+ isUrgent: z.boolean().optional(),
26
+ })
27
+ .strict();
28
+ export const AddAbsoluteReminderArgsSchema = z
29
+ .object({
30
+ taskId: z.string(),
31
+ reminderType: z.literal(ReminderTypeEnum.Absolute),
32
+ due: ReminderDueDateSchema,
33
+ service: ReminderDeliveryServiceSchema.optional(),
34
+ notifyUid: z.string().optional(),
35
+ isUrgent: z.boolean().optional(),
36
+ })
37
+ .strict();
38
+ export const AddReminderArgsSchema = z.union([
39
+ AddRelativeReminderArgsSchema,
40
+ AddAbsoluteReminderArgsSchema,
41
+ ]);
42
+ export const AddLocationReminderArgsSchema = z
43
+ .object({
44
+ taskId: z.string(),
45
+ notifyUid: z.string().optional(),
46
+ name: z.string(),
47
+ locLat: z.string(),
48
+ locLong: z.string(),
49
+ locTrigger: z.enum(LOCATION_TRIGGERS),
50
+ radius: z.number().int().optional(),
51
+ })
52
+ .strict();
53
+ // ── Update schemas ───────────────────────────────────────────────────
54
+ export const UpdateRelativeReminderArgsSchema = z
55
+ .object({
56
+ reminderType: z.literal(ReminderTypeEnum.Relative),
57
+ minuteOffset: z.number().int().optional(),
58
+ notifyUid: z.string().optional(),
59
+ service: ReminderDeliveryServiceSchema.optional(),
60
+ isUrgent: z.boolean().optional(),
61
+ })
62
+ .strict();
63
+ export const UpdateAbsoluteReminderArgsSchema = z
64
+ .object({
65
+ reminderType: z.literal(ReminderTypeEnum.Absolute),
66
+ due: ReminderDueDateSchema.optional(),
67
+ notifyUid: z.string().optional(),
68
+ service: ReminderDeliveryServiceSchema.optional(),
69
+ isUrgent: z.boolean().optional(),
70
+ })
71
+ .strict();
72
+ export const UpdateReminderArgsSchema = z
73
+ .discriminatedUnion('reminderType', [
74
+ UpdateRelativeReminderArgsSchema,
75
+ UpdateAbsoluteReminderArgsSchema,
76
+ ])
77
+ .refine((args) => Object.entries(args).some(([key, value]) => key !== 'reminderType' && value !== undefined), {
78
+ message: 'At least one reminder field must be provided to updateReminder',
79
+ });
80
+ export const UpdateLocationReminderArgsSchema = z
81
+ .object({
82
+ notifyUid: z.string().optional(),
83
+ name: z.string().optional(),
84
+ locLat: z.string().optional(),
85
+ locLong: z.string().optional(),
86
+ locTrigger: z.enum(LOCATION_TRIGGERS).optional(),
87
+ radius: z.number().int().optional(),
88
+ })
89
+ .strict()
90
+ .refine((args) => Object.values(args).some((value) => value !== undefined), {
91
+ message: 'At least one reminder field must be provided to updateLocationReminder',
92
+ });
@@ -7,10 +7,22 @@ export const ReminderBaseSchema = z.object({
7
7
  projectId: z.string().optional(),
8
8
  isDeleted: z.boolean(),
9
9
  });
10
+ /** Enum-like object of reminder type values. */
11
+ export const ReminderTypeEnum = {
12
+ Relative: 'relative',
13
+ Absolute: 'absolute',
14
+ Location: 'location',
15
+ };
16
+ /** Available reminder types. */
17
+ export const REMINDER_TYPES = [
18
+ ReminderTypeEnum.Relative,
19
+ ReminderTypeEnum.Absolute,
20
+ ReminderTypeEnum.Location,
21
+ ];
10
22
  /** Available location reminder triggers. */
11
23
  export const LOCATION_TRIGGERS = ['on_enter', 'on_leave'];
12
24
  export const LocationReminderSchema = ReminderBaseSchema.extend({
13
- type: z.literal('location'),
25
+ type: z.literal(ReminderTypeEnum.Location),
14
26
  name: z.string(),
15
27
  locLat: z.string(),
16
28
  locLong: z.string(),
@@ -18,12 +30,12 @@ export const LocationReminderSchema = ReminderBaseSchema.extend({
18
30
  radius: z.number().int(),
19
31
  }).passthrough();
20
32
  export const AbsoluteReminderSchema = ReminderBaseSchema.extend({
21
- type: z.literal('absolute'),
33
+ type: z.literal(ReminderTypeEnum.Absolute),
22
34
  due: DueDateSchema,
23
35
  isUrgent: z.boolean().optional(),
24
36
  }).passthrough();
25
37
  export const RelativeReminderSchema = ReminderBaseSchema.extend({
26
- type: z.literal('relative'),
38
+ type: z.literal(ReminderTypeEnum.Relative),
27
39
  minuteOffset: z.number().int(),
28
40
  due: DueDateSchema.optional(),
29
41
  isUrgent: z.boolean().optional(),
@@ -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';
@@ -1,55 +1,170 @@
1
- import type { DueDate } from '../tasks/types.js';
2
- import type { LocationTrigger, Reminder, LocationReminder } from '../sync/resources/reminders.js';
1
+ import { z } from 'zod';
2
+ import type { Reminder, LocationReminder } from '../sync/resources/reminders.js';
3
3
  /** Available reminder delivery services. */
4
4
  export declare const REMINDER_DELIVERY_SERVICES: readonly ["email", "push"];
5
5
  /** Delivery service for a reminder notification. */
6
6
  export type ReminderDeliveryService = (typeof REMINDER_DELIVERY_SERVICES)[number];
7
- export type ReminderDueDate = Partial<Pick<DueDate, 'date' | 'string' | 'timezone' | 'lang' | 'isRecurring'>>;
8
- type ReminderTaskArgs = {
9
- taskId: string;
10
- };
11
- type TimeBasedReminderArgs = {
12
- service?: ReminderDeliveryService;
13
- notifyUid?: string;
14
- isUrgent?: boolean;
15
- };
16
- type AddLocationReminderFields = {
17
- notifyUid?: string;
18
- name: string;
19
- locLat: string;
20
- locLong: string;
21
- locTrigger: LocationTrigger;
22
- radius?: number;
23
- };
24
- export type AddRelativeReminderArgs = ReminderTaskArgs & {
25
- reminderType?: 'relative';
26
- minuteOffset: number;
27
- } & TimeBasedReminderArgs;
28
- export type AddAbsoluteReminderArgs = ReminderTaskArgs & {
29
- reminderType: 'absolute';
30
- due: ReminderDueDate;
31
- } & TimeBasedReminderArgs;
32
- export type AddLocationReminderArgs = ReminderTaskArgs & AddLocationReminderFields;
7
+ export declare const ReminderDeliveryServiceSchema: z.ZodEnum<{
8
+ email: "email";
9
+ push: "push";
10
+ }>;
11
+ export declare const ReminderIdSchema: z.ZodString;
12
+ export declare const ReminderDueDateSchema: z.ZodObject<{
13
+ string: z.ZodOptional<z.ZodString>;
14
+ isRecurring: z.ZodOptional<z.ZodBoolean>;
15
+ date: z.ZodOptional<z.ZodString>;
16
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
17
+ lang: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
18
+ }, z.core.$strict>;
19
+ export type ReminderDueDate = z.infer<typeof ReminderDueDateSchema>;
20
+ export declare const AddRelativeReminderArgsSchema: z.ZodObject<{
21
+ taskId: z.ZodString;
22
+ reminderType: z.ZodOptional<z.ZodLiteral<"relative">>;
23
+ minuteOffset: z.ZodNumber;
24
+ service: z.ZodOptional<z.ZodEnum<{
25
+ email: "email";
26
+ push: "push";
27
+ }>>;
28
+ notifyUid: z.ZodOptional<z.ZodString>;
29
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
30
+ }, z.core.$strict>;
31
+ export type AddRelativeReminderArgs = z.infer<typeof AddRelativeReminderArgsSchema>;
32
+ export declare const AddAbsoluteReminderArgsSchema: z.ZodObject<{
33
+ taskId: z.ZodString;
34
+ reminderType: z.ZodLiteral<"absolute">;
35
+ due: z.ZodObject<{
36
+ string: z.ZodOptional<z.ZodString>;
37
+ isRecurring: z.ZodOptional<z.ZodBoolean>;
38
+ date: z.ZodOptional<z.ZodString>;
39
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
40
+ lang: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
41
+ }, z.core.$strict>;
42
+ service: z.ZodOptional<z.ZodEnum<{
43
+ email: "email";
44
+ push: "push";
45
+ }>>;
46
+ notifyUid: z.ZodOptional<z.ZodString>;
47
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
48
+ }, z.core.$strict>;
49
+ export type AddAbsoluteReminderArgs = z.infer<typeof AddAbsoluteReminderArgsSchema>;
50
+ export declare const AddReminderArgsSchema: z.ZodUnion<readonly [z.ZodObject<{
51
+ taskId: z.ZodString;
52
+ reminderType: z.ZodOptional<z.ZodLiteral<"relative">>;
53
+ minuteOffset: z.ZodNumber;
54
+ service: z.ZodOptional<z.ZodEnum<{
55
+ email: "email";
56
+ push: "push";
57
+ }>>;
58
+ notifyUid: z.ZodOptional<z.ZodString>;
59
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ taskId: z.ZodString;
62
+ reminderType: z.ZodLiteral<"absolute">;
63
+ due: z.ZodObject<{
64
+ string: z.ZodOptional<z.ZodString>;
65
+ isRecurring: z.ZodOptional<z.ZodBoolean>;
66
+ date: z.ZodOptional<z.ZodString>;
67
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
68
+ lang: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
69
+ }, z.core.$strict>;
70
+ service: z.ZodOptional<z.ZodEnum<{
71
+ email: "email";
72
+ push: "push";
73
+ }>>;
74
+ notifyUid: z.ZodOptional<z.ZodString>;
75
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
76
+ }, z.core.$strict>]>;
33
77
  /**
34
78
  * Arguments for creating a new reminder.
35
79
  * @see https://developer.todoist.com/api/v1/#tag/Reminders/operation/create_reminder_api_v1_reminders_post
36
80
  */
37
81
  export type AddReminderArgs = AddRelativeReminderArgs | AddAbsoluteReminderArgs;
38
- export type UpdateRelativeReminderArgs = {
39
- reminderType: 'relative';
40
- } & Partial<Omit<AddRelativeReminderArgs, 'taskId' | 'reminderType'>>;
41
- export type UpdateAbsoluteReminderArgs = {
42
- reminderType: 'absolute';
43
- } & Partial<Omit<AddAbsoluteReminderArgs, 'taskId' | 'reminderType'>>;
82
+ export declare const AddLocationReminderArgsSchema: z.ZodObject<{
83
+ taskId: z.ZodString;
84
+ notifyUid: z.ZodOptional<z.ZodString>;
85
+ name: z.ZodString;
86
+ locLat: z.ZodString;
87
+ locLong: z.ZodString;
88
+ locTrigger: z.ZodEnum<{
89
+ on_enter: "on_enter";
90
+ on_leave: "on_leave";
91
+ }>;
92
+ radius: z.ZodOptional<z.ZodNumber>;
93
+ }, z.core.$strict>;
94
+ export type AddLocationReminderArgs = z.infer<typeof AddLocationReminderArgsSchema>;
95
+ export declare const UpdateRelativeReminderArgsSchema: z.ZodObject<{
96
+ reminderType: z.ZodLiteral<"relative">;
97
+ minuteOffset: z.ZodOptional<z.ZodNumber>;
98
+ notifyUid: z.ZodOptional<z.ZodString>;
99
+ service: z.ZodOptional<z.ZodEnum<{
100
+ email: "email";
101
+ push: "push";
102
+ }>>;
103
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
104
+ }, z.core.$strict>;
105
+ export type UpdateRelativeReminderArgs = z.infer<typeof UpdateRelativeReminderArgsSchema>;
106
+ export declare const UpdateAbsoluteReminderArgsSchema: z.ZodObject<{
107
+ reminderType: z.ZodLiteral<"absolute">;
108
+ due: z.ZodOptional<z.ZodObject<{
109
+ string: z.ZodOptional<z.ZodString>;
110
+ isRecurring: z.ZodOptional<z.ZodBoolean>;
111
+ date: z.ZodOptional<z.ZodString>;
112
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
113
+ lang: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
114
+ }, z.core.$strict>>;
115
+ notifyUid: z.ZodOptional<z.ZodString>;
116
+ service: z.ZodOptional<z.ZodEnum<{
117
+ email: "email";
118
+ push: "push";
119
+ }>>;
120
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
121
+ }, z.core.$strict>;
122
+ export type UpdateAbsoluteReminderArgs = z.infer<typeof UpdateAbsoluteReminderArgsSchema>;
123
+ export declare const UpdateReminderArgsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
124
+ reminderType: z.ZodLiteral<"relative">;
125
+ minuteOffset: z.ZodOptional<z.ZodNumber>;
126
+ notifyUid: z.ZodOptional<z.ZodString>;
127
+ service: z.ZodOptional<z.ZodEnum<{
128
+ email: "email";
129
+ push: "push";
130
+ }>>;
131
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ reminderType: z.ZodLiteral<"absolute">;
134
+ due: z.ZodOptional<z.ZodObject<{
135
+ string: z.ZodOptional<z.ZodString>;
136
+ isRecurring: z.ZodOptional<z.ZodBoolean>;
137
+ date: z.ZodOptional<z.ZodString>;
138
+ timezone: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
139
+ lang: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
140
+ }, z.core.$strict>>;
141
+ notifyUid: z.ZodOptional<z.ZodString>;
142
+ service: z.ZodOptional<z.ZodEnum<{
143
+ email: "email";
144
+ push: "push";
145
+ }>>;
146
+ isUrgent: z.ZodOptional<z.ZodBoolean>;
147
+ }, z.core.$strict>], "reminderType">;
44
148
  /**
45
149
  * Arguments for updating an existing reminder.
46
150
  * @see https://developer.todoist.com/api/v1/#tag/Reminders/operation/update_reminder_api_v1_reminders__reminder_id__post
47
151
  */
48
152
  export type UpdateReminderArgs = UpdateRelativeReminderArgs | UpdateAbsoluteReminderArgs;
153
+ export declare const UpdateLocationReminderArgsSchema: z.ZodObject<{
154
+ notifyUid: z.ZodOptional<z.ZodString>;
155
+ name: z.ZodOptional<z.ZodString>;
156
+ locLat: z.ZodOptional<z.ZodString>;
157
+ locLong: z.ZodOptional<z.ZodString>;
158
+ locTrigger: z.ZodOptional<z.ZodEnum<{
159
+ on_enter: "on_enter";
160
+ on_leave: "on_leave";
161
+ }>>;
162
+ radius: z.ZodOptional<z.ZodNumber>;
163
+ }, z.core.$strict>;
49
164
  /**
50
165
  * Arguments for updating an existing location reminder.
51
166
  */
52
- export type UpdateLocationReminderArgs = Partial<Omit<AddLocationReminderArgs, 'taskId'>>;
167
+ export type UpdateLocationReminderArgs = z.infer<typeof UpdateLocationReminderArgsSchema>;
53
168
  /**
54
169
  * Arguments for listing reminders.
55
170
  * @see https://developer.todoist.com/api/v1/#tag/Reminders/operation/get_reminders_api_v1_reminders_get
@@ -88,4 +203,3 @@ export type GetLocationRemindersResponse = {
88
203
  results: LocationReminder[];
89
204
  nextCursor: string | null;
90
205
  };
91
- export {};
@@ -1,20 +1,20 @@
1
1
  import type { SyncDueDate, ReminderService } from './shared.js';
2
- import type { LocationTrigger } from '../resources/reminders.js';
2
+ import type { LocationTrigger, ReminderType } from '../resources/reminders.js';
3
3
  export type ReminderAddArgs = {
4
- type: 'absolute';
4
+ type: Extract<ReminderType, 'absolute'>;
5
5
  itemId: string;
6
6
  service?: ReminderService;
7
7
  notifyUid?: string;
8
8
  due?: SyncDueDate;
9
9
  } | {
10
- type: 'relative';
10
+ type: Extract<ReminderType, 'relative'>;
11
11
  itemId: string;
12
12
  service?: ReminderService;
13
13
  notifyUid?: string;
14
14
  minuteOffset?: number;
15
15
  due?: SyncDueDate;
16
16
  } | {
17
- type: 'location';
17
+ type: Extract<ReminderType, 'location'>;
18
18
  itemId: string;
19
19
  name: string;
20
20
  locLat: string;
@@ -25,20 +25,20 @@ export type ReminderAddArgs = {
25
25
  };
26
26
  export type ReminderUpdateArgs = {
27
27
  id: string;
28
- type: 'absolute';
28
+ type: Extract<ReminderType, 'absolute'>;
29
29
  service?: ReminderService;
30
30
  notifyUid?: string;
31
31
  due?: SyncDueDate;
32
32
  } | {
33
33
  id: string;
34
- type: 'relative';
34
+ type: Extract<ReminderType, 'relative'>;
35
35
  service?: ReminderService;
36
36
  notifyUid?: string;
37
37
  minuteOffset?: number;
38
38
  due?: SyncDueDate;
39
39
  } | {
40
40
  id: string;
41
- type: 'location';
41
+ type: Extract<ReminderType, 'location'>;
42
42
  name?: string;
43
43
  locLat?: string;
44
44
  locLong?: string;
@@ -6,6 +6,16 @@ export declare const ReminderBaseSchema: z.ZodObject<{
6
6
  projectId: z.ZodOptional<z.ZodString>;
7
7
  isDeleted: z.ZodBoolean;
8
8
  }, z.core.$strip>;
9
+ /** Enum-like object of reminder type values. */
10
+ export declare const ReminderTypeEnum: {
11
+ readonly Relative: "relative";
12
+ readonly Absolute: "absolute";
13
+ readonly Location: "location";
14
+ };
15
+ /** Available reminder types. */
16
+ export declare const REMINDER_TYPES: readonly ["relative", "absolute", "location"];
17
+ /** Discriminator for reminder type. */
18
+ export type ReminderType = (typeof REMINDER_TYPES)[number];
9
19
  /** Available location reminder triggers. */
10
20
  export declare const LOCATION_TRIGGERS: readonly ["on_enter", "on_leave"];
11
21
  /** Trigger condition for a location-based reminder. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "7.7.0",
3
+ "version": "7.9.0",
4
4
  "description": "A typescript wrapper for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "https://github.com/Doist/todoist-api-typescript",
@@ -17,6 +17,10 @@
17
17
  "require": "./dist/cjs/index.js"
18
18
  }
19
19
  },
20
+ "publishConfig": {
21
+ "access": "public",
22
+ "provenance": true
23
+ },
20
24
  "sideEffects": false,
21
25
  "engines": {
22
26
  "node": ">=20.18.1"
@@ -55,6 +59,10 @@
55
59
  },
56
60
  "devDependencies": {
57
61
  "@doist/prettier-config": "4.0.0",
62
+ "@semantic-release/changelog": "6.0.3",
63
+ "@semantic-release/exec": "7.1.0",
64
+ "@semantic-release/git": "10.0.1",
65
+ "conventional-changelog-conventionalcommits": "9.3.0",
58
66
  "dotenv": "17.3.1",
59
67
  "husky": "9.1.7",
60
68
  "lint-staged": "16.2.7",
@@ -64,6 +72,7 @@
64
72
  "oxlint": "1.57.0",
65
73
  "prettier": "3.3.2",
66
74
  "rimraf": "6.1.3",
75
+ "semantic-release": "25.0.3",
67
76
  "ts-node": "10.9.2",
68
77
  "type-fest": "^5.0.0",
69
78
  "typescript": "5.9.3",