@doist/todoist-api-typescript 7.6.1 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/todoist-api.js +10 -61
- package/dist/cjs/types/reminders/requests.js +91 -1
- package/dist/cjs/types/sync/resources/reminders.js +16 -4
- package/dist/esm/todoist-api.js +3 -54
- package/dist/esm/types/reminders/requests.js +90 -0
- package/dist/esm/types/sync/resources/reminders.js +15 -3
- package/dist/types/types/comments/requests.d.ts +1 -0
- package/dist/types/types/reminders/requests.d.ts +150 -36
- package/dist/types/types/sync/commands/reminders.d.ts +7 -7
- package/dist/types/types/sync/resources/reminders.d.ts +10 -0
- package/package.json +12 -3
package/dist/cjs/todoist-api.js
CHANGED
|
@@ -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
|
/**
|
|
@@ -1340,13 +1288,14 @@ class TodoistApi {
|
|
|
1340
1288
|
* @returns A promise that resolves to the created comment.
|
|
1341
1289
|
*/
|
|
1342
1290
|
async addComment(args, requestId) {
|
|
1291
|
+
const { uidsToNotify } = args, rest = __rest(args, ["uidsToNotify"]);
|
|
1343
1292
|
const response = await (0, http_client_1.request)({
|
|
1344
1293
|
httpMethod: 'POST',
|
|
1345
1294
|
baseUri: this.syncApiBase,
|
|
1346
1295
|
relativePath: endpoints_1.ENDPOINT_REST_COMMENTS,
|
|
1347
1296
|
apiToken: this.authToken,
|
|
1348
1297
|
customFetch: this.customFetch,
|
|
1349
|
-
payload:
|
|
1298
|
+
payload: Object.assign(Object.assign({}, rest), (uidsToNotify ? { uidsToNotify: uidsToNotify.join(',') } : {})),
|
|
1350
1299
|
requestId: requestId,
|
|
1351
1300
|
});
|
|
1352
1301
|
return (0, validators_1.validateComment)(response.data);
|
|
@@ -1438,7 +1387,7 @@ class TodoistApi {
|
|
|
1438
1387
|
* @returns A promise that resolves to the requested reminder.
|
|
1439
1388
|
*/
|
|
1440
1389
|
async getReminder(id) {
|
|
1441
|
-
ReminderIdSchema.parse(id);
|
|
1390
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1442
1391
|
try {
|
|
1443
1392
|
const response = await (0, http_client_1.request)({
|
|
1444
1393
|
httpMethod: 'GET',
|
|
@@ -1463,7 +1412,7 @@ class TodoistApi {
|
|
|
1463
1412
|
* @returns A promise that resolves to the requested reminder.
|
|
1464
1413
|
*/
|
|
1465
1414
|
async getLocationReminder(id) {
|
|
1466
|
-
ReminderIdSchema.parse(id);
|
|
1415
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1467
1416
|
try {
|
|
1468
1417
|
const response = await (0, http_client_1.request)({
|
|
1469
1418
|
httpMethod: 'GET',
|
|
@@ -1528,8 +1477,8 @@ class TodoistApi {
|
|
|
1528
1477
|
* @returns A promise that resolves to the updated reminder.
|
|
1529
1478
|
*/
|
|
1530
1479
|
async updateReminder(id, args, requestId) {
|
|
1531
|
-
ReminderIdSchema.parse(id);
|
|
1532
|
-
const payload = UpdateReminderArgsSchema.parse(args);
|
|
1480
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1481
|
+
const payload = reminders_1.UpdateReminderArgsSchema.parse(args);
|
|
1533
1482
|
try {
|
|
1534
1483
|
const response = await (0, http_client_1.request)({
|
|
1535
1484
|
httpMethod: 'POST',
|
|
@@ -1558,8 +1507,8 @@ class TodoistApi {
|
|
|
1558
1507
|
* @returns A promise that resolves to the updated reminder.
|
|
1559
1508
|
*/
|
|
1560
1509
|
async updateLocationReminder(id, args, requestId) {
|
|
1561
|
-
ReminderIdSchema.parse(id);
|
|
1562
|
-
const payload = UpdateLocationReminderArgsSchema.parse(args);
|
|
1510
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1511
|
+
const payload = reminders_1.UpdateLocationReminderArgsSchema.parse(args);
|
|
1563
1512
|
try {
|
|
1564
1513
|
const response = await (0, http_client_1.request)({
|
|
1565
1514
|
httpMethod: 'POST',
|
|
@@ -1587,7 +1536,7 @@ class TodoistApi {
|
|
|
1587
1536
|
* @returns A promise that resolves to `true` if successful.
|
|
1588
1537
|
*/
|
|
1589
1538
|
async deleteReminder(id, requestId) {
|
|
1590
|
-
ReminderIdSchema.parse(id);
|
|
1539
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1591
1540
|
try {
|
|
1592
1541
|
const response = await (0, http_client_1.request)({
|
|
1593
1542
|
httpMethod: 'DELETE',
|
|
@@ -1614,7 +1563,7 @@ class TodoistApi {
|
|
|
1614
1563
|
* @returns A promise that resolves to `true` if successful.
|
|
1615
1564
|
*/
|
|
1616
1565
|
async deleteLocationReminder(id, requestId) {
|
|
1617
|
-
ReminderIdSchema.parse(id);
|
|
1566
|
+
reminders_1.ReminderIdSchema.parse(id);
|
|
1618
1567
|
try {
|
|
1619
1568
|
const response = await (0, http_client_1.request)({
|
|
1620
1569
|
httpMethod: 'DELETE',
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(),
|
package/dist/esm/todoist-api.js
CHANGED
|
@@ -9,9 +9,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
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
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';
|
|
17
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';
|
|
@@ -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
|
/**
|
|
@@ -1337,13 +1285,14 @@ export class TodoistApi {
|
|
|
1337
1285
|
* @returns A promise that resolves to the created comment.
|
|
1338
1286
|
*/
|
|
1339
1287
|
async addComment(args, requestId) {
|
|
1288
|
+
const { uidsToNotify } = args, rest = __rest(args, ["uidsToNotify"]);
|
|
1340
1289
|
const response = await request({
|
|
1341
1290
|
httpMethod: 'POST',
|
|
1342
1291
|
baseUri: this.syncApiBase,
|
|
1343
1292
|
relativePath: ENDPOINT_REST_COMMENTS,
|
|
1344
1293
|
apiToken: this.authToken,
|
|
1345
1294
|
customFetch: this.customFetch,
|
|
1346
|
-
payload:
|
|
1295
|
+
payload: Object.assign(Object.assign({}, rest), (uidsToNotify ? { uidsToNotify: uidsToNotify.join(',') } : {})),
|
|
1347
1296
|
requestId: requestId,
|
|
1348
1297
|
});
|
|
1349
1298
|
return validateComment(response.data);
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
38
|
+
type: z.literal(ReminderTypeEnum.Relative),
|
|
27
39
|
minuteOffset: z.number().int(),
|
|
28
40
|
due: DueDateSchema.optional(),
|
|
29
41
|
isUrgent: z.boolean().optional(),
|
|
@@ -1,55 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
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
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export
|
|
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
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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 =
|
|
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.
|
|
3
|
+
"version": "7.8.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",
|
|
@@ -12,11 +12,15 @@
|
|
|
12
12
|
"types": "dist/types/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"types": "./dist/types/index.d.ts",
|
|
15
16
|
"import": "./dist/esm/index.js",
|
|
16
|
-
"require": "./dist/cjs/index.js"
|
|
17
|
-
"types": "./dist/types/index.d.ts"
|
|
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",
|