@doist/todoist-api-typescript 5.2.1 → 5.3.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,5 +1,5 @@
1
1
  import { PersonalProject, WorkspaceProject, Label, Section, Comment, Task } 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 } 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 } 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.
@@ -139,6 +139,13 @@ export declare class TodoistApi {
139
139
  * @returns A promise that resolves to an array of projects.
140
140
  */
141
141
  getProjects(args?: GetProjectsArgs): Promise<GetProjectsResponse>;
142
+ /**
143
+ * Retrieves all archived projects with optional filters.
144
+ *
145
+ * @param args - Optional filters for retrieving archived projects.
146
+ * @returns A promise that resolves to an array of archived projects.
147
+ */
148
+ getArchivedProjects(args?: GetArchivedProjectsArgs): Promise<GetArchivedProjectsResponse>;
142
149
  /**
143
150
  * Creates a new project with the provided parameters.
144
151
  *
@@ -434,6 +434,29 @@ var TodoistApi = /** @class */ (function () {
434
434
  });
435
435
  });
436
436
  };
437
+ /**
438
+ * Retrieves all archived projects with optional filters.
439
+ *
440
+ * @param args - Optional filters for retrieving archived projects.
441
+ * @returns A promise that resolves to an array of archived projects.
442
+ */
443
+ TodoistApi.prototype.getArchivedProjects = function () {
444
+ return __awaiter(this, arguments, void 0, function (args) {
445
+ var _a, results, nextCursor;
446
+ if (args === void 0) { args = {}; }
447
+ return __generator(this, function (_b) {
448
+ switch (_b.label) {
449
+ case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS_ARCHIVED, this.authToken, args)];
450
+ case 1:
451
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
452
+ return [2 /*return*/, {
453
+ results: (0, validators_1.validateProjectArray)(results),
454
+ nextCursor: nextCursor,
455
+ }];
456
+ }
457
+ });
458
+ });
459
+ };
437
460
  /**
438
461
  * Creates a new project with the provided parameters.
439
462
  *
@@ -7,7 +7,6 @@ export declare const ENDPOINT_REST_TASKS = "tasks";
7
7
  export declare const ENDPOINT_REST_TASKS_FILTER: string;
8
8
  export declare const ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE: string;
9
9
  export declare const ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE: string;
10
- export declare const ENDPOINT_REST_PROJECTS = "projects";
11
10
  export declare const ENDPOINT_REST_SECTIONS = "sections";
12
11
  export declare const ENDPOINT_REST_LABELS = "labels";
13
12
  export declare const ENDPOINT_REST_LABELS_SHARED: string;
@@ -16,6 +15,8 @@ export declare const ENDPOINT_REST_LABELS_SHARED_REMOVE: string;
16
15
  export declare const ENDPOINT_REST_COMMENTS = "comments";
17
16
  export declare const ENDPOINT_REST_TASK_CLOSE = "close";
18
17
  export declare const ENDPOINT_REST_TASK_REOPEN = "reopen";
18
+ export declare const ENDPOINT_REST_PROJECTS = "projects";
19
+ export declare const ENDPOINT_REST_PROJECTS_ARCHIVED: string;
19
20
  export declare const ENDPOINT_REST_PROJECT_COLLABORATORS = "collaborators";
20
21
  export declare const PROJECT_ARCHIVE = "archive";
21
22
  export declare const PROJECT_UNARCHIVE = "unarchive";
@@ -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_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_PROJECTS = 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_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';
@@ -23,7 +23,6 @@ exports.ENDPOINT_REST_TASKS = 'tasks';
23
23
  exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS + '/filter';
24
24
  exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS + '/completed/by_completion_date';
25
25
  exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS + '/completed/by_due_date';
26
- exports.ENDPOINT_REST_PROJECTS = 'projects';
27
26
  exports.ENDPOINT_REST_SECTIONS = 'sections';
28
27
  exports.ENDPOINT_REST_LABELS = 'labels';
29
28
  exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS + '/shared';
@@ -32,6 +31,8 @@ exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED
32
31
  exports.ENDPOINT_REST_COMMENTS = 'comments';
33
32
  exports.ENDPOINT_REST_TASK_CLOSE = 'close';
34
33
  exports.ENDPOINT_REST_TASK_REOPEN = 'reopen';
34
+ exports.ENDPOINT_REST_PROJECTS = 'projects';
35
+ exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS + '/archived';
35
36
  exports.ENDPOINT_REST_PROJECT_COLLABORATORS = 'collaborators';
36
37
  exports.PROJECT_ARCHIVE = 'archive';
37
38
  exports.PROJECT_UNARCHIVE = 'unarchive';
@@ -199,7 +199,7 @@ export declare const PersonalProjectSchema: z.ZodPipe<z.ZodObject<{
199
199
  isCollapsed: z.ZodBoolean;
200
200
  isShared: z.ZodBoolean;
201
201
  parentId: z.ZodNullable<z.ZodString>;
202
- inboxProject: z.ZodBoolean;
202
+ inboxProject: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
203
203
  }, z.core.$strip>, z.ZodTransform<{
204
204
  url: string;
205
205
  id: string;
@@ -101,7 +101,7 @@ exports.BaseProjectSchema = zod_1.z.object({
101
101
  */
102
102
  exports.PersonalProjectSchema = exports.BaseProjectSchema.extend({
103
103
  parentId: zod_1.z.string().nullable(),
104
- inboxProject: zod_1.z.boolean(),
104
+ inboxProject: zod_1.z.boolean().optional().default(false),
105
105
  }).transform(function (data) {
106
106
  return __assign(__assign({}, data), { url: (0, urlHelpers_1.getProjectUrl)(data.id, data.name) });
107
107
  });
@@ -157,6 +157,22 @@ export type GetProjectsResponse = {
157
157
  results: (PersonalProject | WorkspaceProject)[];
158
158
  nextCursor: string | null;
159
159
  };
160
+ /**
161
+ * Arguments for retrieving archived projects.
162
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_archived_projects_api_v1_projects_archived_get
163
+ */
164
+ export type GetArchivedProjectsArgs = {
165
+ cursor?: string | null;
166
+ limit?: number;
167
+ };
168
+ /**
169
+ * Response from retrieving archived projects.
170
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_archived_projects_api_v1_projects_archived_get
171
+ */
172
+ export type GetArchivedProjectsResponse = {
173
+ results: (PersonalProject | WorkspaceProject)[];
174
+ nextCursor: string | null;
175
+ };
160
176
  /**
161
177
  * Arguments for creating a new project.
162
178
  * @see https://todoist.com/api/v1/docs#tag/Projects/operation/create_project_api_v1_projects_post
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "5.2.1",
3
+ "version": "5.3.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",