@doist/todoist-api-typescript 5.6.1 → 5.6.4

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,5 +1,5 @@
1
1
  import { PersonalProject, WorkspaceProject, Label, Section, Comment, Task, CurrentUser, ProductivityStats } from './types/entities';
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, SearchCompletedTasksArgs } from './types/requests';
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, SearchCompletedTasksArgs, GetActivityLogsArgs, GetActivityLogsResponse } from './types/requests';
3
3
  /**
4
4
  * A client for interacting with the Todoist API v1.
5
5
  * This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
@@ -352,4 +352,11 @@ export declare class TodoistApi {
352
352
  * @returns A promise that resolves to the productivity stats.
353
353
  */
354
354
  getProductivityStats(): Promise<ProductivityStats>;
355
+ /**
356
+ * Retrieves activity logs with optional filters.
357
+ *
358
+ * @param args - Optional filter parameters for activity logs.
359
+ * @returns A promise that resolves to a paginated response of activity events.
360
+ */
361
+ getActivityLogs(args?: GetActivityLogsArgs): Promise<GetActivityLogsResponse>;
355
362
  }
@@ -51,6 +51,8 @@ exports.TodoistApi = void 0;
51
51
  var restClient_1 = require("./restClient");
52
52
  var endpoints_1 = require("./consts/endpoints");
53
53
  var validators_1 = require("./utils/validators");
54
+ var urlHelpers_1 = require("./utils/urlHelpers");
55
+ var activity_helpers_1 = require("./utils/activity-helpers");
54
56
  var zod_1 = require("zod");
55
57
  var uuid_1 = require("uuid");
56
58
  var types_1 = require("./types");
@@ -1032,6 +1034,37 @@ var TodoistApi = /** @class */ (function () {
1032
1034
  });
1033
1035
  });
1034
1036
  };
1037
+ /**
1038
+ * Retrieves activity logs with optional filters.
1039
+ *
1040
+ * @param args - Optional filter parameters for activity logs.
1041
+ * @returns A promise that resolves to a paginated response of activity events.
1042
+ */
1043
+ TodoistApi.prototype.getActivityLogs = function () {
1044
+ return __awaiter(this, arguments, void 0, function (args) {
1045
+ var processedArgs, _a, results, nextCursor, normalizedResults;
1046
+ if (args === void 0) { args = {}; }
1047
+ return __generator(this, function (_b) {
1048
+ switch (_b.label) {
1049
+ case 0:
1050
+ processedArgs = __assign(__assign(__assign(__assign({}, args), (args.since instanceof Date && { since: (0, urlHelpers_1.formatDateToYYYYMMDD)(args.since) })), (args.until instanceof Date && { until: (0, urlHelpers_1.formatDateToYYYYMMDD)(args.until) })), (args.objectType && { objectType: (0, activity_helpers_1.normalizeObjectTypeForApi)(args.objectType) }));
1051
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_ACTIVITIES, this.authToken, processedArgs)
1052
+ // Convert legacy API object types back to modern SDK types
1053
+ ];
1054
+ case 1:
1055
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
1056
+ normalizedResults = results.map(function (event) {
1057
+ var normalizedType = (0, activity_helpers_1.denormalizeObjectTypeFromApi)(event.objectType);
1058
+ return __assign(__assign({}, event), { objectType: normalizedType || event.objectType });
1059
+ });
1060
+ return [2 /*return*/, {
1061
+ results: (0, validators_1.validateActivityEventArray)(normalizedResults),
1062
+ nextCursor: nextCursor,
1063
+ }];
1064
+ }
1065
+ });
1066
+ });
1067
+ };
1035
1068
  return TodoistApi;
1036
1069
  }());
1037
1070
  exports.TodoistApi = TodoistApi;
@@ -21,6 +21,7 @@ export declare const ENDPOINT_REST_PROJECTS_ARCHIVED: string;
21
21
  export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
22
22
  export declare const ENDPOINT_REST_USER = "user";
23
23
  export declare const ENDPOINT_REST_PRODUCTIVITY: string;
24
+ export declare const ENDPOINT_REST_ACTIVITIES = "activities";
24
25
  export declare const PROJECT_ARCHIVE = "archive";
25
26
  export declare const PROJECT_UNARCHIVE = "unarchive";
26
27
  export declare const ENDPOINT_SYNC_QUICK_ADD: string;
@@ -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_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_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;
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_ACTIVITIES = 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_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
4
  exports.getSyncBaseUri = getSyncBaseUri;
5
5
  exports.getAuthBaseUri = getAuthBaseUri;
6
6
  var BASE_URI = 'https://api.todoist.com';
@@ -37,6 +37,7 @@ exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS + '/arc
37
37
  exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
38
38
  exports.ENDPOINT_REST_USER = 'user';
39
39
  exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_TASKS + '/completed/stats';
40
+ exports.ENDPOINT_REST_ACTIVITIES = 'activities';
40
41
  exports.PROJECT_ARCHIVE = 'archive';
41
42
  exports.PROJECT_UNARCHIVE = 'unarchive';
42
43
  exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_TASKS + '/quick';
@@ -670,3 +670,47 @@ export declare const ColorSchema: z.ZodObject<{
670
670
  * @see https://todoist.com/api/v1/docs#tag/Colors
671
671
  */
672
672
  export type Color = z.infer<typeof ColorSchema>;
673
+ /**
674
+ * @deprecated Use 'task' instead. This will be removed in the next major version.
675
+ */
676
+ type DeprecatedItem = 'item';
677
+ /**
678
+ * @deprecated Use 'comment' instead. This will be removed in the next major version.
679
+ */
680
+ type DeprecatedNote = 'note';
681
+ /**
682
+ * Type hints for known object types. Accepts any string for forward compatibility.
683
+ * Supports both modern naming ('task', 'comment') and legacy naming ('item', 'note').
684
+ *
685
+ * **Note**: The legacy values 'item' and 'note' are deprecated. Use 'task' and 'comment' instead.
686
+ */
687
+ export type ActivityObjectType = 'task' | 'comment' | 'project' | DeprecatedItem | DeprecatedNote | (string & Record<string, never>);
688
+ /**
689
+ * Type hints for known event types. Accepts any string for forward compatibility.
690
+ */
691
+ export type ActivityEventType = 'added' | 'updated' | 'deleted' | 'completed' | 'uncompleted' | 'archived' | 'unarchived' | 'shared' | 'left' | (string & Record<string, never>);
692
+ /**
693
+ * Flexible object containing event-specific data.
694
+ * Uses z.record to accept any properties for forward compatibility.
695
+ */
696
+ export declare const ActivityEventExtraDataSchema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
697
+ export type ActivityEventExtraData = z.infer<typeof ActivityEventExtraDataSchema>;
698
+ /**
699
+ * Activity log event schema. Accepts unknown fields for forward compatibility.
700
+ */
701
+ export declare const ActivityEventSchema: z.ZodObject<{
702
+ objectType: z.ZodString;
703
+ objectId: z.ZodString;
704
+ eventType: z.ZodString;
705
+ eventDate: z.ZodString;
706
+ id: z.ZodNullable<z.ZodString>;
707
+ parentProjectId: z.ZodNullable<z.ZodString>;
708
+ parentItemId: z.ZodNullable<z.ZodString>;
709
+ initiatorId: z.ZodNullable<z.ZodString>;
710
+ extraData: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>;
711
+ }, z.core.$catchall<z.ZodAny>>;
712
+ /**
713
+ * Represents an activity log event in Todoist.
714
+ */
715
+ export type ActivityEvent = z.infer<typeof ActivityEventSchema>;
716
+ export {};
@@ -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.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;
25
+ exports.ActivityEventSchema = exports.ActivityEventExtraDataSchema = 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
@@ -296,3 +296,24 @@ exports.ColorSchema = zod_1.z.object({
296
296
  */
297
297
  value: zod_1.z.string(),
298
298
  });
299
+ /**
300
+ * Flexible object containing event-specific data.
301
+ * Uses z.record to accept any properties for forward compatibility.
302
+ */
303
+ exports.ActivityEventExtraDataSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullable();
304
+ /**
305
+ * Activity log event schema. Accepts unknown fields for forward compatibility.
306
+ */
307
+ exports.ActivityEventSchema = zod_1.z
308
+ .object({
309
+ objectType: zod_1.z.string(),
310
+ objectId: zod_1.z.string(),
311
+ eventType: zod_1.z.string(),
312
+ eventDate: zod_1.z.string(),
313
+ id: zod_1.z.string().nullable(),
314
+ parentProjectId: zod_1.z.string().nullable(),
315
+ parentItemId: zod_1.z.string().nullable(),
316
+ initiatorId: zod_1.z.string().nullable(),
317
+ extraData: exports.ActivityEventExtraDataSchema,
318
+ })
319
+ .catchall(zod_1.z.any());
@@ -1,5 +1,5 @@
1
1
  import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
2
- import type { Comment, Duration, Label, PersonalProject, ProjectViewStyle, Section, Task, User, WorkspaceProject } from './entities';
2
+ import type { ActivityEvent, ActivityEventType, ActivityObjectType, Comment, Duration, Label, PersonalProject, ProjectViewStyle, Section, Task, User, WorkspaceProject } from './entities';
3
3
  /**
4
4
  * Arguments for creating a new task.
5
5
  * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/create_task_api_v1_tasks_post
@@ -380,3 +380,102 @@ export type AddCommentArgs = {
380
380
  export type UpdateCommentArgs = {
381
381
  content: string;
382
382
  };
383
+ /**
384
+ * Arguments for retrieving activity logs.
385
+ */
386
+ type GetActivityLogsArgsBase = {
387
+ /**
388
+ * Type of object to filter by (e.g., 'task', 'comment', 'project').
389
+ * Accepts both modern naming ('task', 'comment') and legacy naming ('item', 'note').
390
+ */
391
+ objectType?: ActivityObjectType;
392
+ /**
393
+ * Type of event to filter by (e.g., 'added', 'updated', 'deleted', 'completed', 'uncompleted', 'archived', 'unarchived', 'shared', 'left').
394
+ */
395
+ eventType?: ActivityEventType;
396
+ /**
397
+ * Filter by the ID of a specific object.
398
+ */
399
+ objectId?: string;
400
+ /**
401
+ * Filter events by parent project ID.
402
+ */
403
+ parentProjectId?: string;
404
+ /**
405
+ * Filter events by parent task ID.
406
+ */
407
+ parentItemId?: string;
408
+ /**
409
+ * When true, includes the parent object data in the response.
410
+ */
411
+ includeParentObject?: boolean;
412
+ /**
413
+ * When true, includes child object data in the response.
414
+ */
415
+ includeChildObjects?: boolean;
416
+ /**
417
+ * Filter by the user ID who initiated the event.
418
+ */
419
+ initiatorId?: string;
420
+ /**
421
+ * When true, filters for events with no initiator (system-generated events).
422
+ * When false, filters for events with an initiator.
423
+ * When null or undefined, no filtering on initiator is applied.
424
+ */
425
+ initiatorIdNull?: boolean | null;
426
+ /**
427
+ * When true, ensures the last state of objects is included in the response.
428
+ */
429
+ ensureLastState?: boolean;
430
+ /**
431
+ * When true, includes comment annotations in the response.
432
+ */
433
+ annotateNotes?: boolean;
434
+ /**
435
+ * When true, includes parent object annotations in the response.
436
+ */
437
+ annotateParents?: boolean;
438
+ /**
439
+ * Pagination cursor for retrieving the next page of results.
440
+ */
441
+ cursor?: string | null;
442
+ /**
443
+ * Maximum number of results to return per page.
444
+ */
445
+ limit?: number;
446
+ };
447
+ type GetActivityLogsArgsWithDate = GetActivityLogsArgsBase & {
448
+ /**
449
+ * Start date for filtering events (inclusive).
450
+ */
451
+ since?: Date;
452
+ /**
453
+ * End date for filtering events (inclusive).
454
+ */
455
+ until?: Date;
456
+ };
457
+ /**
458
+ * @deprecated String dates (YYYY-MM-DD format) are deprecated. Use Date objects instead.
459
+ * This type will be removed in the next major version.
460
+ */
461
+ type GetActivityLogsArgsWithString = GetActivityLogsArgsBase & {
462
+ /**
463
+ * Start date for filtering events in YYYY-MM-DD format (inclusive).
464
+ * @deprecated Use Date object instead. String format will be removed in the next major version.
465
+ */
466
+ since?: string;
467
+ /**
468
+ * End date for filtering events in YYYY-MM-DD format (inclusive).
469
+ * @deprecated Use Date object instead. String format will be removed in the next major version.
470
+ */
471
+ until?: string;
472
+ };
473
+ export type GetActivityLogsArgs = GetActivityLogsArgsWithDate | GetActivityLogsArgsWithString;
474
+ /**
475
+ * Response from retrieving activity logs.
476
+ */
477
+ export type GetActivityLogsResponse = {
478
+ results: ActivityEvent[];
479
+ nextCursor: string | null;
480
+ };
481
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Converts modern SDK object type naming to legacy API naming.
3
+ * Maps 'task' -> 'item' and 'comment' -> 'note' for API requests.
4
+ * Other values pass through unchanged.
5
+ *
6
+ * @internal
7
+ * @param objectType The object type using modern naming.
8
+ * @returns The object type using legacy API naming.
9
+ */
10
+ export declare function normalizeObjectTypeForApi(objectType: string | undefined): string | undefined;
11
+ /**
12
+ * Converts legacy API object type naming to modern SDK naming.
13
+ * Maps 'item' -> 'task' and 'note' -> 'comment' for SDK responses.
14
+ * Other values pass through unchanged.
15
+ *
16
+ * @internal
17
+ * @param objectType The object type using legacy API naming.
18
+ * @returns The object type using modern SDK naming.
19
+ */
20
+ export declare function denormalizeObjectTypeFromApi(objectType: string | undefined): string | undefined;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeObjectTypeForApi = normalizeObjectTypeForApi;
4
+ exports.denormalizeObjectTypeFromApi = denormalizeObjectTypeFromApi;
5
+ /**
6
+ * Converts modern SDK object type naming to legacy API naming.
7
+ * Maps 'task' -> 'item' and 'comment' -> 'note' for API requests.
8
+ * Other values pass through unchanged.
9
+ *
10
+ * @internal
11
+ * @param objectType The object type using modern naming.
12
+ * @returns The object type using legacy API naming.
13
+ */
14
+ function normalizeObjectTypeForApi(objectType) {
15
+ if (!objectType)
16
+ return objectType;
17
+ if (objectType === 'task')
18
+ return 'item';
19
+ if (objectType === 'comment')
20
+ return 'note';
21
+ return objectType;
22
+ }
23
+ /**
24
+ * Converts legacy API object type naming to modern SDK naming.
25
+ * Maps 'item' -> 'task' and 'note' -> 'comment' for SDK responses.
26
+ * Other values pass through unchanged.
27
+ *
28
+ * @internal
29
+ * @param objectType The object type using legacy API naming.
30
+ * @returns The object type using modern SDK naming.
31
+ */
32
+ function denormalizeObjectTypeFromApi(objectType) {
33
+ if (!objectType)
34
+ return objectType;
35
+ if (objectType === 'item')
36
+ return 'task';
37
+ if (objectType === 'note')
38
+ return 'comment';
39
+ return objectType;
40
+ }
@@ -1,3 +1,3 @@
1
1
  export * from './colors';
2
2
  export * from './sanitization';
3
- export * from './urlHelpers';
3
+ export { getTaskUrl, getProjectUrl, getSectionUrl } from './urlHelpers';
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.getSectionUrl = exports.getProjectUrl = exports.getTaskUrl = void 0;
17
18
  __exportStar(require("./colors"), exports);
18
19
  __exportStar(require("./sanitization"), exports);
19
- __exportStar(require("./urlHelpers"), exports);
20
+ var urlHelpers_1 = require("./urlHelpers");
21
+ Object.defineProperty(exports, "getTaskUrl", { enumerable: true, get: function () { return urlHelpers_1.getTaskUrl; } });
22
+ Object.defineProperty(exports, "getProjectUrl", { enumerable: true, get: function () { return urlHelpers_1.getProjectUrl; } });
23
+ Object.defineProperty(exports, "getSectionUrl", { enumerable: true, get: function () { return urlHelpers_1.getSectionUrl; } });
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Formats a Date object to YYYY-MM-DD string format.
3
+ *
4
+ * @internal
5
+ * @param date The Date object to format.
6
+ * @returns The formatted date string in YYYY-MM-DD format.
7
+ */
8
+ export declare function formatDateToYYYYMMDD(date: Date): string;
1
9
  /**
2
10
  * Generate the URL for a given task.
3
11
  *
@@ -1,9 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatDateToYYYYMMDD = formatDateToYYYYMMDD;
3
4
  exports.getTaskUrl = getTaskUrl;
4
5
  exports.getProjectUrl = getProjectUrl;
5
6
  exports.getSectionUrl = getSectionUrl;
6
7
  var endpoints_1 = require("../consts/endpoints");
8
+ /**
9
+ * Formats a Date object to YYYY-MM-DD string format.
10
+ *
11
+ * @internal
12
+ * @param date The Date object to format.
13
+ * @returns The formatted date string in YYYY-MM-DD format.
14
+ */
15
+ function formatDateToYYYYMMDD(date) {
16
+ var year = date.getFullYear();
17
+ var month = String(date.getMonth() + 1).padStart(2, '0');
18
+ var day = String(date.getDate()).padStart(2, '0');
19
+ return "".concat(year, "-").concat(month, "-").concat(day);
20
+ }
7
21
  /**
8
22
  * Generate the URL for a given task.
9
23
  *
@@ -1,4 +1,4 @@
1
- import { type Task, type Section, type Label, type Comment, type User, type CurrentUser, type ProductivityStats, 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, type ActivityEvent } from '../types/entities';
2
2
  export declare function validateTask(input: unknown): Task;
3
3
  export declare function validateTaskArray(input: unknown[]): Task[];
4
4
  /**
@@ -30,3 +30,5 @@ export declare function validateUser(input: unknown): User;
30
30
  export declare function validateUserArray(input: unknown[]): User[];
31
31
  export declare function validateProductivityStats(input: unknown): ProductivityStats;
32
32
  export declare function validateCurrentUser(input: unknown): CurrentUser;
33
+ export declare function validateActivityEvent(input: unknown): ActivityEvent;
34
+ export declare function validateActivityEventArray(input: unknown[]): ActivityEvent[];
@@ -16,6 +16,8 @@ exports.validateUser = validateUser;
16
16
  exports.validateUserArray = validateUserArray;
17
17
  exports.validateProductivityStats = validateProductivityStats;
18
18
  exports.validateCurrentUser = validateCurrentUser;
19
+ exports.validateActivityEvent = validateActivityEvent;
20
+ exports.validateActivityEventArray = validateActivityEventArray;
19
21
  var entities_1 = require("../types/entities");
20
22
  function validateTask(input) {
21
23
  return entities_1.TaskSchema.parse(input);
@@ -83,3 +85,9 @@ function validateProductivityStats(input) {
83
85
  function validateCurrentUser(input) {
84
86
  return entities_1.CurrentUserSchema.parse(input);
85
87
  }
88
+ function validateActivityEvent(input) {
89
+ return entities_1.ActivityEventSchema.parse(input);
90
+ }
91
+ function validateActivityEventArray(input) {
92
+ return input.map(validateActivityEvent);
93
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "5.6.1",
3
+ "version": "5.6.4",
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",