@doist/todoist-api-typescript 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TodoistApi.d.ts +13 -1
- package/dist/TodoistApi.js +36 -0
- package/dist/consts/endpoints.d.ts +2 -0
- package/dist/consts/endpoints.js +3 -1
- package/dist/types/entities.d.ts +126 -1
- package/dist/types/entities.js +90 -1
- package/dist/utils/validators.d.ts +3 -1
- package/dist/utils/validators.js +8 -0
- package/package.json +2 -2
package/dist/TodoistApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PersonalProject, WorkspaceProject, Label, Section, Comment, Task } from './types/entities';
|
|
1
|
+
import { PersonalProject, WorkspaceProject, Label, Section, Comment, Task, CurrentUser, ProductivityStats } from './types/entities';
|
|
2
2
|
import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs, GetProjectsArgs, GetProjectCollaboratorsArgs, GetLabelsArgs, GetLabelsResponse, GetTasksResponse, GetProjectsResponse, GetProjectCollaboratorsResponse, GetSectionsArgs, GetSectionsResponse, GetSharedLabelsResponse, GetCommentsResponse, type MoveTaskArgs, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse } from './types/requests';
|
|
3
3
|
/**
|
|
4
4
|
* A client for interacting with the Todoist API v1.
|
|
@@ -33,6 +33,12 @@ export declare class TodoistApi {
|
|
|
33
33
|
* Optional custom API base URL. If not provided, defaults to Todoist's standard API endpoint
|
|
34
34
|
*/
|
|
35
35
|
baseUrl?: string);
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves information about the authenticated user.
|
|
38
|
+
*
|
|
39
|
+
* @returns A promise that resolves to the current user's information.
|
|
40
|
+
*/
|
|
41
|
+
getUser(): Promise<CurrentUser>;
|
|
36
42
|
/**
|
|
37
43
|
* Retrieves a single active (non-completed) task by its ID.
|
|
38
44
|
*
|
|
@@ -333,4 +339,10 @@ export declare class TodoistApi {
|
|
|
333
339
|
* @returns A promise that resolves to `true` if successful.
|
|
334
340
|
*/
|
|
335
341
|
deleteComment(id: string, requestId?: string): Promise<boolean>;
|
|
342
|
+
/**
|
|
343
|
+
* Retrieves productivity stats for the authenticated user.
|
|
344
|
+
*
|
|
345
|
+
* @returns A promise that resolves to the productivity stats.
|
|
346
|
+
*/
|
|
347
|
+
getProductivityStats(): Promise<ProductivityStats>;
|
|
336
348
|
}
|
package/dist/TodoistApi.js
CHANGED
|
@@ -101,6 +101,24 @@ var TodoistApi = /** @class */ (function () {
|
|
|
101
101
|
this.authToken = authToken;
|
|
102
102
|
this.syncApiBase = (0, endpoints_1.getSyncBaseUri)(baseUrl);
|
|
103
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Retrieves information about the authenticated user.
|
|
106
|
+
*
|
|
107
|
+
* @returns A promise that resolves to the current user's information.
|
|
108
|
+
*/
|
|
109
|
+
TodoistApi.prototype.getUser = function () {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
var response;
|
|
112
|
+
return __generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_USER, this.authToken)];
|
|
115
|
+
case 1:
|
|
116
|
+
response = _a.sent();
|
|
117
|
+
return [2 /*return*/, (0, validators_1.validateCurrentUser)(response.data)];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
};
|
|
104
122
|
/**
|
|
105
123
|
* Retrieves a single active (non-completed) task by its ID.
|
|
106
124
|
*
|
|
@@ -974,6 +992,24 @@ var TodoistApi = /** @class */ (function () {
|
|
|
974
992
|
});
|
|
975
993
|
});
|
|
976
994
|
};
|
|
995
|
+
/**
|
|
996
|
+
* Retrieves productivity stats for the authenticated user.
|
|
997
|
+
*
|
|
998
|
+
* @returns A promise that resolves to the productivity stats.
|
|
999
|
+
*/
|
|
1000
|
+
TodoistApi.prototype.getProductivityStats = function () {
|
|
1001
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1002
|
+
var response;
|
|
1003
|
+
return __generator(this, function (_a) {
|
|
1004
|
+
switch (_a.label) {
|
|
1005
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PRODUCTIVITY, this.authToken)];
|
|
1006
|
+
case 1:
|
|
1007
|
+
response = _a.sent();
|
|
1008
|
+
return [2 /*return*/, (0, validators_1.validateProductivityStats)(response.data)];
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
});
|
|
1012
|
+
};
|
|
977
1013
|
return TodoistApi;
|
|
978
1014
|
}());
|
|
979
1015
|
exports.TodoistApi = TodoistApi;
|
|
@@ -18,6 +18,8 @@ export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
|
|
|
18
18
|
export declare const ENDPOINT_REST_PROJECTS = "projects";
|
|
19
19
|
export declare const ENDPOINT_REST_PROJECTS_ARCHIVED: string;
|
|
20
20
|
export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
|
|
21
|
+
export declare const ENDPOINT_REST_USER = "user";
|
|
22
|
+
export declare const ENDPOINT_REST_PRODUCTIVITY: string;
|
|
21
23
|
export declare const PROJECT_ARCHIVE = "archive";
|
|
22
24
|
export declare const PROJECT_UNARCHIVE = "unarchive";
|
|
23
25
|
export declare const ENDPOINT_SYNC_QUICK_ADD: string;
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
3
|
+
exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
4
4
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
5
5
|
exports.getAuthBaseUri = getAuthBaseUri;
|
|
6
6
|
var BASE_URI = 'https://api.todoist.com';
|
|
@@ -34,6 +34,8 @@ exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
|
|
|
34
34
|
exports.ENDPOINT_REST_PROJECTS = 'projects';
|
|
35
35
|
exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS + '/archived';
|
|
36
36
|
exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
|
|
37
|
+
exports.ENDPOINT_REST_USER = 'user';
|
|
38
|
+
exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_TASKS + '/completed/stats';
|
|
37
39
|
exports.PROJECT_ARCHIVE = 'archive';
|
|
38
40
|
exports.PROJECT_UNARCHIVE = 'unarchive';
|
|
39
41
|
exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_TASKS + '/quick';
|
package/dist/types/entities.d.ts
CHANGED
|
@@ -528,10 +528,135 @@ export declare const UserSchema: z.ZodObject<{
|
|
|
528
528
|
email: z.ZodString;
|
|
529
529
|
}, z.core.$strip>;
|
|
530
530
|
/**
|
|
531
|
-
* Represents a user in Todoist.
|
|
531
|
+
* Represents a user in Todoist (simplified for collaborators).
|
|
532
532
|
* @see https://todoist.com/api/v1/docs#tag/User
|
|
533
533
|
*/
|
|
534
534
|
export type User = z.infer<typeof UserSchema>;
|
|
535
|
+
export declare const TimezoneInfoSchema: z.ZodObject<{
|
|
536
|
+
gmtString: z.ZodString;
|
|
537
|
+
hours: z.ZodNumber;
|
|
538
|
+
isDst: z.ZodNumber;
|
|
539
|
+
minutes: z.ZodNumber;
|
|
540
|
+
timezone: z.ZodString;
|
|
541
|
+
}, z.core.$strip>;
|
|
542
|
+
export declare const CurrentUserSchema: z.ZodObject<{
|
|
543
|
+
id: z.ZodString;
|
|
544
|
+
email: z.ZodString;
|
|
545
|
+
fullName: z.ZodString;
|
|
546
|
+
avatarBig: z.ZodNullable<z.ZodString>;
|
|
547
|
+
avatarMedium: z.ZodNullable<z.ZodString>;
|
|
548
|
+
avatarS640: z.ZodNullable<z.ZodString>;
|
|
549
|
+
avatarSmall: z.ZodNullable<z.ZodString>;
|
|
550
|
+
businessAccountId: z.ZodNullable<z.ZodString>;
|
|
551
|
+
isPremium: z.ZodBoolean;
|
|
552
|
+
dateFormat: z.ZodNumber;
|
|
553
|
+
timeFormat: z.ZodNumber;
|
|
554
|
+
weeklyGoal: z.ZodNumber;
|
|
555
|
+
dailyGoal: z.ZodNumber;
|
|
556
|
+
completedCount: z.ZodNumber;
|
|
557
|
+
completedToday: z.ZodNumber;
|
|
558
|
+
karma: z.ZodNumber;
|
|
559
|
+
karmaTrend: z.ZodString;
|
|
560
|
+
lang: z.ZodString;
|
|
561
|
+
nextWeek: z.ZodNumber;
|
|
562
|
+
startDay: z.ZodNumber;
|
|
563
|
+
startPage: z.ZodString;
|
|
564
|
+
tzInfo: z.ZodObject<{
|
|
565
|
+
gmtString: z.ZodString;
|
|
566
|
+
hours: z.ZodNumber;
|
|
567
|
+
isDst: z.ZodNumber;
|
|
568
|
+
minutes: z.ZodNumber;
|
|
569
|
+
timezone: z.ZodString;
|
|
570
|
+
}, z.core.$strip>;
|
|
571
|
+
inboxProjectId: z.ZodString;
|
|
572
|
+
daysOff: z.ZodArray<z.ZodNumber>;
|
|
573
|
+
weekendStartDay: z.ZodNumber;
|
|
574
|
+
}, z.core.$strip>;
|
|
575
|
+
/**
|
|
576
|
+
* Represents the current authenticated user with detailed information.
|
|
577
|
+
* @see https://todoist.com/api/v1/docs#tag/User
|
|
578
|
+
*/
|
|
579
|
+
export type CurrentUser = z.infer<typeof CurrentUserSchema>;
|
|
580
|
+
export declare const ProductivityStatsSchema: z.ZodObject<{
|
|
581
|
+
completedCount: z.ZodNumber;
|
|
582
|
+
daysItems: z.ZodArray<z.ZodObject<{
|
|
583
|
+
items: z.ZodArray<z.ZodObject<{
|
|
584
|
+
id: z.ZodString;
|
|
585
|
+
completed: z.ZodNumber;
|
|
586
|
+
}, z.core.$strip>>;
|
|
587
|
+
totalCompleted: z.ZodNumber;
|
|
588
|
+
date: z.ZodString;
|
|
589
|
+
}, z.core.$strip>>;
|
|
590
|
+
goals: z.ZodObject<{
|
|
591
|
+
currentDailyStreak: z.ZodObject<{
|
|
592
|
+
count: z.ZodNumber;
|
|
593
|
+
start: z.ZodString;
|
|
594
|
+
end: z.ZodString;
|
|
595
|
+
}, z.core.$strip>;
|
|
596
|
+
currentWeeklyStreak: z.ZodObject<{
|
|
597
|
+
count: z.ZodNumber;
|
|
598
|
+
start: z.ZodString;
|
|
599
|
+
end: z.ZodString;
|
|
600
|
+
}, z.core.$strip>;
|
|
601
|
+
dailyGoal: z.ZodNumber;
|
|
602
|
+
ignoreDays: z.ZodArray<z.ZodNumber>;
|
|
603
|
+
karmaDisabled: z.ZodNumber;
|
|
604
|
+
lastDailyStreak: z.ZodObject<{
|
|
605
|
+
count: z.ZodNumber;
|
|
606
|
+
start: z.ZodString;
|
|
607
|
+
end: z.ZodString;
|
|
608
|
+
}, z.core.$strip>;
|
|
609
|
+
lastWeeklyStreak: z.ZodObject<{
|
|
610
|
+
count: z.ZodNumber;
|
|
611
|
+
start: z.ZodString;
|
|
612
|
+
end: z.ZodString;
|
|
613
|
+
}, z.core.$strip>;
|
|
614
|
+
maxDailyStreak: z.ZodObject<{
|
|
615
|
+
count: z.ZodNumber;
|
|
616
|
+
start: z.ZodString;
|
|
617
|
+
end: z.ZodString;
|
|
618
|
+
}, z.core.$strip>;
|
|
619
|
+
maxWeeklyStreak: z.ZodObject<{
|
|
620
|
+
count: z.ZodNumber;
|
|
621
|
+
start: z.ZodString;
|
|
622
|
+
end: z.ZodString;
|
|
623
|
+
}, z.core.$strip>;
|
|
624
|
+
user: z.ZodString;
|
|
625
|
+
userId: z.ZodString;
|
|
626
|
+
vacationMode: z.ZodNumber;
|
|
627
|
+
weeklyGoal: z.ZodNumber;
|
|
628
|
+
}, z.core.$strip>;
|
|
629
|
+
karma: z.ZodNumber;
|
|
630
|
+
karmaGraphData: z.ZodArray<z.ZodObject<{
|
|
631
|
+
date: z.ZodString;
|
|
632
|
+
karmaAvg: z.ZodNumber;
|
|
633
|
+
}, z.core.$strip>>;
|
|
634
|
+
karmaLastUpdate: z.ZodNumber;
|
|
635
|
+
karmaTrend: z.ZodString;
|
|
636
|
+
karmaUpdateReasons: z.ZodArray<z.ZodObject<{
|
|
637
|
+
time: z.ZodString;
|
|
638
|
+
newKarma: z.ZodNumber;
|
|
639
|
+
positiveKarma: z.ZodNumber;
|
|
640
|
+
negativeKarma: z.ZodNumber;
|
|
641
|
+
positiveKarmaReasons: z.ZodArray<z.ZodAny>;
|
|
642
|
+
negativeKarmaReasons: z.ZodArray<z.ZodAny>;
|
|
643
|
+
}, z.core.$strip>>;
|
|
644
|
+
projectColors: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
645
|
+
weekItems: z.ZodArray<z.ZodObject<{
|
|
646
|
+
items: z.ZodArray<z.ZodObject<{
|
|
647
|
+
id: z.ZodString;
|
|
648
|
+
completed: z.ZodNumber;
|
|
649
|
+
}, z.core.$strip>>;
|
|
650
|
+
totalCompleted: z.ZodNumber;
|
|
651
|
+
from: z.ZodString;
|
|
652
|
+
to: z.ZodString;
|
|
653
|
+
}, z.core.$strip>>;
|
|
654
|
+
}, z.core.$strip>;
|
|
655
|
+
/**
|
|
656
|
+
* Represents the Productivity stats for the authenticated user.
|
|
657
|
+
* @see https://developer.todoist.com/api/v1/#tag/User/operation/get_productivity_stats_api_v1_tasks_completed_stats_get
|
|
658
|
+
*/
|
|
659
|
+
export type ProductivityStats = z.infer<typeof ProductivityStatsSchema>;
|
|
535
660
|
export declare const ColorSchema: z.ZodObject<{
|
|
536
661
|
id: z.ZodNumber;
|
|
537
662
|
key: z.ZodString;
|
package/dist/types/entities.js
CHANGED
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.ColorSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
|
|
25
|
+
exports.ColorSchema = exports.ProductivityStatsSchema = exports.CurrentUserSchema = exports.TimezoneInfoSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.WorkspaceProjectSchema = exports.PersonalProjectSchema = exports.BaseProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
|
|
26
26
|
var zod_1 = require("zod");
|
|
27
27
|
var urlHelpers_1 = require("../utils/urlHelpers");
|
|
28
28
|
exports.DueDateSchema = zod_1.z
|
|
@@ -191,6 +191,95 @@ exports.UserSchema = zod_1.z.object({
|
|
|
191
191
|
name: zod_1.z.string(),
|
|
192
192
|
email: zod_1.z.string(),
|
|
193
193
|
});
|
|
194
|
+
exports.TimezoneInfoSchema = zod_1.z.object({
|
|
195
|
+
gmtString: zod_1.z.string(),
|
|
196
|
+
hours: zod_1.z.number().int(),
|
|
197
|
+
isDst: zod_1.z.number().int(),
|
|
198
|
+
minutes: zod_1.z.number().int(),
|
|
199
|
+
timezone: zod_1.z.string(),
|
|
200
|
+
});
|
|
201
|
+
exports.CurrentUserSchema = zod_1.z.object({
|
|
202
|
+
id: zod_1.z.string(),
|
|
203
|
+
email: zod_1.z.string(),
|
|
204
|
+
fullName: zod_1.z.string(),
|
|
205
|
+
avatarBig: zod_1.z.string().nullable(),
|
|
206
|
+
avatarMedium: zod_1.z.string().nullable(),
|
|
207
|
+
avatarS640: zod_1.z.string().nullable(),
|
|
208
|
+
avatarSmall: zod_1.z.string().nullable(),
|
|
209
|
+
businessAccountId: zod_1.z.string().nullable(),
|
|
210
|
+
isPremium: zod_1.z.boolean(),
|
|
211
|
+
dateFormat: zod_1.z.number().int(),
|
|
212
|
+
timeFormat: zod_1.z.number().int(),
|
|
213
|
+
weeklyGoal: zod_1.z.number().int(),
|
|
214
|
+
dailyGoal: zod_1.z.number().int(),
|
|
215
|
+
completedCount: zod_1.z.number().int(),
|
|
216
|
+
completedToday: zod_1.z.number().int(),
|
|
217
|
+
karma: zod_1.z.number(),
|
|
218
|
+
karmaTrend: zod_1.z.string(),
|
|
219
|
+
lang: zod_1.z.string(),
|
|
220
|
+
nextWeek: zod_1.z.number().int(),
|
|
221
|
+
startDay: zod_1.z.number().int(),
|
|
222
|
+
startPage: zod_1.z.string(),
|
|
223
|
+
tzInfo: exports.TimezoneInfoSchema,
|
|
224
|
+
inboxProjectId: zod_1.z.string(),
|
|
225
|
+
daysOff: zod_1.z.array(zod_1.z.number().int()),
|
|
226
|
+
weekendStartDay: zod_1.z.number().int(),
|
|
227
|
+
});
|
|
228
|
+
var StreakSchema = zod_1.z.object({
|
|
229
|
+
count: zod_1.z.number(),
|
|
230
|
+
start: zod_1.z.string(),
|
|
231
|
+
end: zod_1.z.string(),
|
|
232
|
+
});
|
|
233
|
+
var CompletedItemSchema = zod_1.z.object({
|
|
234
|
+
id: zod_1.z.string(),
|
|
235
|
+
completed: zod_1.z.number(),
|
|
236
|
+
});
|
|
237
|
+
var ItemsWithDateSchema = zod_1.z.object({
|
|
238
|
+
items: zod_1.z.array(CompletedItemSchema),
|
|
239
|
+
totalCompleted: zod_1.z.number(),
|
|
240
|
+
});
|
|
241
|
+
var KarmaUpdateSchema = zod_1.z.object({
|
|
242
|
+
time: zod_1.z.string(),
|
|
243
|
+
newKarma: zod_1.z.number(),
|
|
244
|
+
positiveKarma: zod_1.z.number(),
|
|
245
|
+
negativeKarma: zod_1.z.number(),
|
|
246
|
+
positiveKarmaReasons: zod_1.z.array(zod_1.z.any()),
|
|
247
|
+
negativeKarmaReasons: zod_1.z.array(zod_1.z.any()),
|
|
248
|
+
});
|
|
249
|
+
exports.ProductivityStatsSchema = zod_1.z.object({
|
|
250
|
+
completedCount: zod_1.z.number(),
|
|
251
|
+
daysItems: zod_1.z.array(ItemsWithDateSchema.extend({
|
|
252
|
+
date: zod_1.z.string(),
|
|
253
|
+
})),
|
|
254
|
+
goals: zod_1.z.object({
|
|
255
|
+
currentDailyStreak: StreakSchema,
|
|
256
|
+
currentWeeklyStreak: StreakSchema,
|
|
257
|
+
dailyGoal: zod_1.z.number(),
|
|
258
|
+
ignoreDays: zod_1.z.array(zod_1.z.number()),
|
|
259
|
+
karmaDisabled: zod_1.z.number(),
|
|
260
|
+
lastDailyStreak: StreakSchema,
|
|
261
|
+
lastWeeklyStreak: StreakSchema,
|
|
262
|
+
maxDailyStreak: StreakSchema,
|
|
263
|
+
maxWeeklyStreak: StreakSchema,
|
|
264
|
+
user: zod_1.z.string(),
|
|
265
|
+
userId: zod_1.z.string(),
|
|
266
|
+
vacationMode: zod_1.z.number(),
|
|
267
|
+
weeklyGoal: zod_1.z.number(),
|
|
268
|
+
}),
|
|
269
|
+
karma: zod_1.z.number(),
|
|
270
|
+
karmaGraphData: zod_1.z.array(zod_1.z.object({
|
|
271
|
+
date: zod_1.z.string(),
|
|
272
|
+
karmaAvg: zod_1.z.number(),
|
|
273
|
+
})),
|
|
274
|
+
karmaLastUpdate: zod_1.z.number(),
|
|
275
|
+
karmaTrend: zod_1.z.string(),
|
|
276
|
+
karmaUpdateReasons: zod_1.z.array(KarmaUpdateSchema),
|
|
277
|
+
projectColors: zod_1.z.record(zod_1.z.string(), zod_1.z.string()),
|
|
278
|
+
weekItems: zod_1.z.array(ItemsWithDateSchema.extend({
|
|
279
|
+
from: zod_1.z.string(),
|
|
280
|
+
to: zod_1.z.string(),
|
|
281
|
+
})),
|
|
282
|
+
});
|
|
194
283
|
exports.ColorSchema = zod_1.z.object({
|
|
195
284
|
/** @deprecated No longer used */
|
|
196
285
|
id: zod_1.z.number(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Task, type Section, type Label, type Comment, type User, type WorkspaceProject, type PersonalProject } from '../types/entities';
|
|
1
|
+
import { type Task, type Section, type Label, type Comment, type User, type CurrentUser, type ProductivityStats, type WorkspaceProject, type PersonalProject } from '../types/entities';
|
|
2
2
|
export declare function validateTask(input: unknown): Task;
|
|
3
3
|
export declare function validateTaskArray(input: unknown[]): Task[];
|
|
4
4
|
/**
|
|
@@ -28,3 +28,5 @@ export declare function validateComment(input: unknown): Comment;
|
|
|
28
28
|
export declare function validateCommentArray(input: unknown[]): Comment[];
|
|
29
29
|
export declare function validateUser(input: unknown): User;
|
|
30
30
|
export declare function validateUserArray(input: unknown[]): User[];
|
|
31
|
+
export declare function validateProductivityStats(input: unknown): ProductivityStats;
|
|
32
|
+
export declare function validateCurrentUser(input: unknown): CurrentUser;
|
package/dist/utils/validators.js
CHANGED
|
@@ -14,6 +14,8 @@ exports.validateComment = validateComment;
|
|
|
14
14
|
exports.validateCommentArray = validateCommentArray;
|
|
15
15
|
exports.validateUser = validateUser;
|
|
16
16
|
exports.validateUserArray = validateUserArray;
|
|
17
|
+
exports.validateProductivityStats = validateProductivityStats;
|
|
18
|
+
exports.validateCurrentUser = validateCurrentUser;
|
|
17
19
|
var entities_1 = require("../types/entities");
|
|
18
20
|
function validateTask(input) {
|
|
19
21
|
return entities_1.TaskSchema.parse(input);
|
|
@@ -75,3 +77,9 @@ function validateUser(input) {
|
|
|
75
77
|
function validateUserArray(input) {
|
|
76
78
|
return input.map(validateUser);
|
|
77
79
|
}
|
|
80
|
+
function validateProductivityStats(input) {
|
|
81
|
+
return entities_1.ProductivityStatsSchema.parse(input);
|
|
82
|
+
}
|
|
83
|
+
function validateCurrentUser(input) {
|
|
84
|
+
return entities_1.CurrentUserSchema.parse(input);
|
|
85
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "A typescript wrapper for the Todoist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"repository": "git@github.com:doist/todoist-api-typescript.git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"format-fix": "npx prettier --write \"./**/*.{ts,tsx,json,md,yml,babelrc,html}\"",
|
|
16
16
|
"lint": "eslint ./src --ext ts,tsx --fix",
|
|
17
17
|
"lint-check": "eslint ./src --ext ts,tsx",
|
|
18
|
-
"ts-compile-check": "npx tsc -p tsconfig.json",
|
|
18
|
+
"ts-compile-check": "npx tsc -p tsconfig.typecheck.json",
|
|
19
19
|
"audit": "npm audit --audit-level=moderate",
|
|
20
20
|
"test": "jest",
|
|
21
21
|
"build": "npx tsc -p tsconfig.json",
|