@doist/todoist-api-typescript 4.0.4 → 5.0.1

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,4 @@
1
- import { Project, Label, Section, Comment } from './types/entities';
2
- import type { Task } from './types/entities';
1
+ import { PersonalProject, WorkspaceProject, Label, Section, Comment, Task } from './types/entities';
3
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 } from './types/requests';
4
3
  /**
5
4
  * A client for interacting with the Todoist API v1.
@@ -59,7 +58,7 @@ export declare class TodoistApi {
59
58
  * Creates a new task with the provided parameters.
60
59
  *
61
60
  * @param args - Task creation parameters such as content, due date, or priority.
62
- * @param requestId - Optional unique identifier for idempotency.
61
+ * @param requestId - Optional custom identifier for the request.
63
62
  * @returns A promise that resolves to the created task.
64
63
  */
65
64
  addTask(args: AddTaskArgs, requestId?: string): Promise<Task>;
@@ -75,7 +74,7 @@ export declare class TodoistApi {
75
74
  *
76
75
  * @param id - The unique identifier of the task to update.
77
76
  * @param args - Update parameters such as content, priority, or due date.
78
- * @param requestId - Optional unique identifier for idempotency.
77
+ * @param requestId - Optional custom identifier for the request.
79
78
  * @returns A promise that resolves to the updated task.
80
79
  */
81
80
  updateTask(id: string, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
@@ -84,7 +83,7 @@ export declare class TodoistApi {
84
83
  *
85
84
  * @param ids - The unique identifier of the tasks to be moved.
86
85
  * @param args - The paramets that should contain only one of projectId, sectionId, or parentId
87
- * @param requestId - Optional unique identifier for idempotency.
86
+ * @param requestId - Optional custom identifier for the request.
88
87
  * @returns - A promise that resolves to an array of the updated tasks.
89
88
  */
90
89
  moveTasks(ids: string[], args: MoveTaskArgs, requestId?: string): Promise<Task[]>;
@@ -92,7 +91,7 @@ export declare class TodoistApi {
92
91
  * Closes (completes) a task by its ID.
93
92
  *
94
93
  * @param id - The unique identifier of the task to close.
95
- * @param requestId - Optional unique identifier for idempotency.
94
+ * @param requestId - Optional custom identifier for the request.
96
95
  * @returns A promise that resolves to `true` if successful.
97
96
  */
98
97
  closeTask(id: string, requestId?: string): Promise<boolean>;
@@ -100,7 +99,7 @@ export declare class TodoistApi {
100
99
  * Reopens a previously closed (completed) task by its ID.
101
100
  *
102
101
  * @param id - The unique identifier of the task to reopen.
103
- * @param requestId - Optional unique identifier for idempotency.
102
+ * @param requestId - Optional custom identifier for the request.
104
103
  * @returns A promise that resolves to `true` if successful.
105
104
  */
106
105
  reopenTask(id: string, requestId?: string): Promise<boolean>;
@@ -108,7 +107,7 @@ export declare class TodoistApi {
108
107
  * Deletes a task by its ID.
109
108
  *
110
109
  * @param id - The unique identifier of the task to delete.
111
- * @param requestId - Optional unique identifier for idempotency.
110
+ * @param requestId - Optional custom identifier for the request.
112
111
  * @returns A promise that resolves to `true` if successful.
113
112
  */
114
113
  deleteTask(id: string, requestId?: string): Promise<boolean>;
@@ -118,7 +117,7 @@ export declare class TodoistApi {
118
117
  * @param id - The unique identifier of the project.
119
118
  * @returns A promise that resolves to the requested project.
120
119
  */
121
- getProject(id: string): Promise<Project>;
120
+ getProject(id: string): Promise<PersonalProject | WorkspaceProject>;
122
121
  /**
123
122
  * Retrieves all projects with optional filters.
124
123
  *
@@ -130,24 +129,24 @@ export declare class TodoistApi {
130
129
  * Creates a new project with the provided parameters.
131
130
  *
132
131
  * @param args - Project creation parameters such as name or color.
133
- * @param requestId - Optional unique identifier for idempotency.
132
+ * @param requestId - Optional custom identifier for the request.
134
133
  * @returns A promise that resolves to the created project.
135
134
  */
136
- addProject(args: AddProjectArgs, requestId?: string): Promise<Project>;
135
+ addProject(args: AddProjectArgs, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
137
136
  /**
138
137
  * Updates an existing project by its ID with the provided parameters.
139
138
  *
140
139
  * @param id - The unique identifier of the project to update.
141
140
  * @param args - Update parameters such as name or color.
142
- * @param requestId - Optional unique identifier for idempotency.
141
+ * @param requestId - Optional custom identifier for the request.
143
142
  * @returns A promise that resolves to the updated project.
144
143
  */
145
- updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
144
+ updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise<PersonalProject | WorkspaceProject>;
146
145
  /**
147
146
  * Deletes a project by its ID.
148
147
  *
149
148
  * @param id - The unique identifier of the project to delete.
150
- * @param requestId - Optional unique identifier for idempotency.
149
+ * @param requestId - Optional custom identifier for the request.
151
150
  * @returns A promise that resolves to `true` if successful.
152
151
  */
153
152
  deleteProject(id: string, requestId?: string): Promise<boolean>;
@@ -177,7 +176,7 @@ export declare class TodoistApi {
177
176
  * Creates a new section within a project.
178
177
  *
179
178
  * @param args - Section creation parameters such as name or project ID.
180
- * @param requestId - Optional unique identifier for idempotency.
179
+ * @param requestId - Optional custom identifier for the request.
181
180
  * @returns A promise that resolves to the created section.
182
181
  */
183
182
  addSection(args: AddSectionArgs, requestId?: string): Promise<Section>;
@@ -186,7 +185,7 @@ export declare class TodoistApi {
186
185
  *
187
186
  * @param id - The unique identifier of the section to update.
188
187
  * @param args - Update parameters such as name or project ID.
189
- * @param requestId - Optional unique identifier for idempotency.
188
+ * @param requestId - Optional custom identifier for the request.
190
189
  * @returns A promise that resolves to the updated section.
191
190
  */
192
191
  updateSection(id: string, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
@@ -194,7 +193,7 @@ export declare class TodoistApi {
194
193
  * Deletes a section by its ID.
195
194
  *
196
195
  * @param id - The unique identifier of the section to delete.
197
- * @param requestId - Optional unique identifier for idempotency.
196
+ * @param requestId - Optional custom identifier for the request.
198
197
  * @returns A promise that resolves to `true` if successful.
199
198
  */
200
199
  deleteSection(id: string, requestId?: string): Promise<boolean>;
@@ -216,7 +215,7 @@ export declare class TodoistApi {
216
215
  * Adds a new label.
217
216
  *
218
217
  * @param args - Label creation parameters such as name.
219
- * @param requestId - Optional unique identifier for idempotency.
218
+ * @param requestId - Optional custom identifier for the request.
220
219
  * @returns A promise that resolves to the created label.
221
220
  */
222
221
  addLabel(args: AddLabelArgs, requestId?: string): Promise<Label>;
@@ -225,7 +224,7 @@ export declare class TodoistApi {
225
224
  *
226
225
  * @param id - The unique identifier of the label to update.
227
226
  * @param args - Update parameters such as name or color.
228
- * @param requestId - Optional unique identifier for idempotency.
227
+ * @param requestId - Optional custom identifier for the request.
229
228
  * @returns A promise that resolves to the updated label.
230
229
  */
231
230
  updateLabel(id: string, args: UpdateLabelArgs, requestId?: string): Promise<Label>;
@@ -233,7 +232,7 @@ export declare class TodoistApi {
233
232
  * Deletes a label by its ID.
234
233
  *
235
234
  * @param id - The unique identifier of the label to delete.
236
- * @param requestId - Optional unique identifier for idempotency.
235
+ * @param requestId - Optional custom identifier for the request.
237
236
  * @returns A promise that resolves to `true` if successful.
238
237
  */
239
238
  deleteLabel(id: string, requestId?: string): Promise<boolean>;
@@ -276,7 +275,7 @@ export declare class TodoistApi {
276
275
  * Adds a comment to a task or project.
277
276
  *
278
277
  * @param args - Parameters for creating the comment, such as content and the target task or project ID.
279
- * @param requestId - Optional unique identifier for idempotency.
278
+ * @param requestId - Optional custom identifier for the request.
280
279
  * @returns A promise that resolves to the created comment.
281
280
  */
282
281
  addComment(args: AddCommentArgs, requestId?: string): Promise<Comment>;
@@ -285,7 +284,7 @@ export declare class TodoistApi {
285
284
  *
286
285
  * @param id - The unique identifier of the comment to update.
287
286
  * @param args - Update parameters such as new content.
288
- * @param requestId - Optional unique identifier for idempotency.
287
+ * @param requestId - Optional custom identifier for the request.
289
288
  * @returns A promise that resolves to the updated comment.
290
289
  */
291
290
  updateComment(id: string, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
@@ -293,7 +292,7 @@ export declare class TodoistApi {
293
292
  * Deletes a comment by its ID.
294
293
  *
295
294
  * @param id - The unique identifier of the comment to delete.
296
- * @param requestId - Optional unique identifier for idempotency.
295
+ * @param requestId - Optional custom identifier for the request.
297
296
  * @returns A promise that resolves to `true` if successful.
298
297
  */
299
298
  deleteComment(id: string, requestId?: string): Promise<boolean>;
@@ -49,13 +49,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.TodoistApi = void 0;
51
51
  var restClient_1 = require("./restClient");
52
- var taskConverters_1 = require("./utils/taskConverters");
53
52
  var endpoints_1 = require("./consts/endpoints");
54
53
  var validators_1 = require("./utils/validators");
55
54
  var zod_1 = require("zod");
56
55
  var uuid_1 = require("uuid");
57
56
  var types_1 = require("./types");
58
- var projectConverter_1 = require("./utils/projectConverter");
59
57
  var MAX_COMMAND_COUNT = 100;
60
58
  /**
61
59
  * Joins path segments using `/` separator.
@@ -111,7 +109,7 @@ var TodoistApi = /** @class */ (function () {
111
109
  */
112
110
  TodoistApi.prototype.getTask = function (id) {
113
111
  return __awaiter(this, void 0, void 0, function () {
114
- var response, task;
112
+ var response;
115
113
  return __generator(this, function (_a) {
116
114
  switch (_a.label) {
117
115
  case 0:
@@ -119,8 +117,7 @@ var TodoistApi = /** @class */ (function () {
119
117
  return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken)];
120
118
  case 1:
121
119
  response = _a.sent();
122
- task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
123
- return [2 /*return*/, (0, validators_1.validateTask)(task)];
120
+ return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
124
121
  }
125
122
  });
126
123
  });
@@ -134,13 +131,12 @@ var TodoistApi = /** @class */ (function () {
134
131
  TodoistApi.prototype.getTasks = function (args) {
135
132
  if (args === void 0) { args = {}; }
136
133
  return __awaiter(this, void 0, void 0, function () {
137
- var _a, rawResults, nextCursor, results;
134
+ var _a, results, nextCursor;
138
135
  return __generator(this, function (_b) {
139
136
  switch (_b.label) {
140
137
  case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args)];
141
138
  case 1:
142
- _a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
143
- results = rawResults.map(taskConverters_1.getTaskFromRawTaskResponse);
139
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
144
140
  return [2 /*return*/, {
145
141
  results: (0, validators_1.validateTaskArray)(results),
146
142
  nextCursor: nextCursor,
@@ -157,13 +153,12 @@ var TodoistApi = /** @class */ (function () {
157
153
  */
158
154
  TodoistApi.prototype.getTasksByFilter = function (args) {
159
155
  return __awaiter(this, void 0, void 0, function () {
160
- var _a, rawResults, nextCursor, results;
156
+ var _a, results, nextCursor;
161
157
  return __generator(this, function (_b) {
162
158
  switch (_b.label) {
163
159
  case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS_FILTER, this.authToken, args)];
164
160
  case 1:
165
- _a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
166
- results = rawResults.map(taskConverters_1.getTaskFromRawTaskResponse);
161
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
167
162
  return [2 /*return*/, {
168
163
  results: (0, validators_1.validateTaskArray)(results),
169
164
  nextCursor: nextCursor,
@@ -176,19 +171,18 @@ var TodoistApi = /** @class */ (function () {
176
171
  * Creates a new task with the provided parameters.
177
172
  *
178
173
  * @param args - Task creation parameters such as content, due date, or priority.
179
- * @param requestId - Optional unique identifier for idempotency.
174
+ * @param requestId - Optional custom identifier for the request.
180
175
  * @returns A promise that resolves to the created task.
181
176
  */
182
177
  TodoistApi.prototype.addTask = function (args, requestId) {
183
178
  return __awaiter(this, void 0, void 0, function () {
184
- var response, task;
179
+ var response;
185
180
  return __generator(this, function (_a) {
186
181
  switch (_a.label) {
187
182
  case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args, requestId)];
188
183
  case 1:
189
184
  response = _a.sent();
190
- task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
191
- return [2 /*return*/, (0, validators_1.validateTask)(task)];
185
+ return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
192
186
  }
193
187
  });
194
188
  });
@@ -201,14 +195,13 @@ var TodoistApi = /** @class */ (function () {
201
195
  */
202
196
  TodoistApi.prototype.quickAddTask = function (args) {
203
197
  return __awaiter(this, void 0, void 0, function () {
204
- var response, task;
198
+ var response;
205
199
  return __generator(this, function (_a) {
206
200
  switch (_a.label) {
207
201
  case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_SYNC_QUICK_ADD, this.authToken, args)];
208
202
  case 1:
209
203
  response = _a.sent();
210
- task = (0, taskConverters_1.getTaskFromQuickAddResponse)(response.data);
211
- return [2 /*return*/, (0, validators_1.validateTask)(task)];
204
+ return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
212
205
  }
213
206
  });
214
207
  });
@@ -218,12 +211,12 @@ var TodoistApi = /** @class */ (function () {
218
211
  *
219
212
  * @param id - The unique identifier of the task to update.
220
213
  * @param args - Update parameters such as content, priority, or due date.
221
- * @param requestId - Optional unique identifier for idempotency.
214
+ * @param requestId - Optional custom identifier for the request.
222
215
  * @returns A promise that resolves to the updated task.
223
216
  */
224
217
  TodoistApi.prototype.updateTask = function (id, args, requestId) {
225
218
  return __awaiter(this, void 0, void 0, function () {
226
- var response, task;
219
+ var response;
227
220
  return __generator(this, function (_a) {
228
221
  switch (_a.label) {
229
222
  case 0:
@@ -231,8 +224,7 @@ var TodoistApi = /** @class */ (function () {
231
224
  return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, args, requestId)];
232
225
  case 1:
233
226
  response = _a.sent();
234
- task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
235
- return [2 /*return*/, (0, validators_1.validateTask)(task)];
227
+ return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
236
228
  }
237
229
  });
238
230
  });
@@ -242,13 +234,13 @@ var TodoistApi = /** @class */ (function () {
242
234
  *
243
235
  * @param ids - The unique identifier of the tasks to be moved.
244
236
  * @param args - The paramets that should contain only one of projectId, sectionId, or parentId
245
- * @param requestId - Optional unique identifier for idempotency.
237
+ * @param requestId - Optional custom identifier for the request.
246
238
  * @returns - A promise that resolves to an array of the updated tasks.
247
239
  */
248
240
  TodoistApi.prototype.moveTasks = function (ids, args, requestId) {
249
241
  var _a;
250
242
  return __awaiter(this, void 0, void 0, function () {
251
- var uuid, commands, syncRequest, response, syncTasks, tasks;
243
+ var uuid, commands, syncRequest, response, syncTasks;
252
244
  return __generator(this, function (_b) {
253
245
  switch (_b.label) {
254
246
  case 0:
@@ -284,8 +276,7 @@ var TodoistApi = /** @class */ (function () {
284
276
  if (!syncTasks.length) {
285
277
  throw new types_1.TodoistRequestError('Tasks not found', 404);
286
278
  }
287
- tasks = syncTasks.map(taskConverters_1.getTaskFromQuickAddResponse);
288
- return [2 /*return*/, (0, validators_1.validateTaskArray)(tasks)];
279
+ return [2 /*return*/, (0, validators_1.validateTaskArray)(syncTasks)];
289
280
  }
290
281
  });
291
282
  });
@@ -294,7 +285,7 @@ var TodoistApi = /** @class */ (function () {
294
285
  * Closes (completes) a task by its ID.
295
286
  *
296
287
  * @param id - The unique identifier of the task to close.
297
- * @param requestId - Optional unique identifier for idempotency.
288
+ * @param requestId - Optional custom identifier for the request.
298
289
  * @returns A promise that resolves to `true` if successful.
299
290
  */
300
291
  TodoistApi.prototype.closeTask = function (id, requestId) {
@@ -316,7 +307,7 @@ var TodoistApi = /** @class */ (function () {
316
307
  * Reopens a previously closed (completed) task by its ID.
317
308
  *
318
309
  * @param id - The unique identifier of the task to reopen.
319
- * @param requestId - Optional unique identifier for idempotency.
310
+ * @param requestId - Optional custom identifier for the request.
320
311
  * @returns A promise that resolves to `true` if successful.
321
312
  */
322
313
  TodoistApi.prototype.reopenTask = function (id, requestId) {
@@ -338,7 +329,7 @@ var TodoistApi = /** @class */ (function () {
338
329
  * Deletes a task by its ID.
339
330
  *
340
331
  * @param id - The unique identifier of the task to delete.
341
- * @param requestId - Optional unique identifier for idempotency.
332
+ * @param requestId - Optional custom identifier for the request.
342
333
  * @returns A promise that resolves to `true` if successful.
343
334
  */
344
335
  TodoistApi.prototype.deleteTask = function (id, requestId) {
@@ -364,7 +355,7 @@ var TodoistApi = /** @class */ (function () {
364
355
  */
365
356
  TodoistApi.prototype.getProject = function (id) {
366
357
  return __awaiter(this, void 0, void 0, function () {
367
- var response, project;
358
+ var response;
368
359
  return __generator(this, function (_a) {
369
360
  switch (_a.label) {
370
361
  case 0:
@@ -372,8 +363,7 @@ var TodoistApi = /** @class */ (function () {
372
363
  return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken)];
373
364
  case 1:
374
365
  response = _a.sent();
375
- project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
376
- return [2 /*return*/, (0, validators_1.validateProject)(project)];
366
+ return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
377
367
  }
378
368
  });
379
369
  });
@@ -387,13 +377,12 @@ var TodoistApi = /** @class */ (function () {
387
377
  TodoistApi.prototype.getProjects = function (args) {
388
378
  if (args === void 0) { args = {}; }
389
379
  return __awaiter(this, void 0, void 0, function () {
390
- var _a, rawResults, nextCursor, results;
380
+ var _a, results, nextCursor;
391
381
  return __generator(this, function (_b) {
392
382
  switch (_b.label) {
393
383
  case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args)];
394
384
  case 1:
395
- _a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
396
- results = rawResults.map(projectConverter_1.getProjectFromRawProjectResponse);
385
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
397
386
  return [2 /*return*/, {
398
387
  results: (0, validators_1.validateProjectArray)(results),
399
388
  nextCursor: nextCursor,
@@ -406,19 +395,18 @@ var TodoistApi = /** @class */ (function () {
406
395
  * Creates a new project with the provided parameters.
407
396
  *
408
397
  * @param args - Project creation parameters such as name or color.
409
- * @param requestId - Optional unique identifier for idempotency.
398
+ * @param requestId - Optional custom identifier for the request.
410
399
  * @returns A promise that resolves to the created project.
411
400
  */
412
401
  TodoistApi.prototype.addProject = function (args, requestId) {
413
402
  return __awaiter(this, void 0, void 0, function () {
414
- var response, project;
403
+ var response;
415
404
  return __generator(this, function (_a) {
416
405
  switch (_a.label) {
417
406
  case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args, requestId)];
418
407
  case 1:
419
408
  response = _a.sent();
420
- project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
421
- return [2 /*return*/, (0, validators_1.validateProject)(project)];
409
+ return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
422
410
  }
423
411
  });
424
412
  });
@@ -428,12 +416,12 @@ var TodoistApi = /** @class */ (function () {
428
416
  *
429
417
  * @param id - The unique identifier of the project to update.
430
418
  * @param args - Update parameters such as name or color.
431
- * @param requestId - Optional unique identifier for idempotency.
419
+ * @param requestId - Optional custom identifier for the request.
432
420
  * @returns A promise that resolves to the updated project.
433
421
  */
434
422
  TodoistApi.prototype.updateProject = function (id, args, requestId) {
435
423
  return __awaiter(this, void 0, void 0, function () {
436
- var response, project;
424
+ var response;
437
425
  return __generator(this, function (_a) {
438
426
  switch (_a.label) {
439
427
  case 0:
@@ -441,8 +429,7 @@ var TodoistApi = /** @class */ (function () {
441
429
  return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, args, requestId)];
442
430
  case 1:
443
431
  response = _a.sent();
444
- project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
445
- return [2 /*return*/, (0, validators_1.validateProject)(project)];
432
+ return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
446
433
  }
447
434
  });
448
435
  });
@@ -451,7 +438,7 @@ var TodoistApi = /** @class */ (function () {
451
438
  * Deletes a project by its ID.
452
439
  *
453
440
  * @param id - The unique identifier of the project to delete.
454
- * @param requestId - Optional unique identifier for idempotency.
441
+ * @param requestId - Optional custom identifier for the request.
455
442
  * @returns A promise that resolves to `true` if successful.
456
443
  */
457
444
  TodoistApi.prototype.deleteProject = function (id, requestId) {
@@ -542,7 +529,7 @@ var TodoistApi = /** @class */ (function () {
542
529
  * Creates a new section within a project.
543
530
  *
544
531
  * @param args - Section creation parameters such as name or project ID.
545
- * @param requestId - Optional unique identifier for idempotency.
532
+ * @param requestId - Optional custom identifier for the request.
546
533
  * @returns A promise that resolves to the created section.
547
534
  */
548
535
  TodoistApi.prototype.addSection = function (args, requestId) {
@@ -563,7 +550,7 @@ var TodoistApi = /** @class */ (function () {
563
550
  *
564
551
  * @param id - The unique identifier of the section to update.
565
552
  * @param args - Update parameters such as name or project ID.
566
- * @param requestId - Optional unique identifier for idempotency.
553
+ * @param requestId - Optional custom identifier for the request.
567
554
  * @returns A promise that resolves to the updated section.
568
555
  */
569
556
  TodoistApi.prototype.updateSection = function (id, args, requestId) {
@@ -585,7 +572,7 @@ var TodoistApi = /** @class */ (function () {
585
572
  * Deletes a section by its ID.
586
573
  *
587
574
  * @param id - The unique identifier of the section to delete.
588
- * @param requestId - Optional unique identifier for idempotency.
575
+ * @param requestId - Optional custom identifier for the request.
589
576
  * @returns A promise that resolves to `true` if successful.
590
577
  */
591
578
  TodoistApi.prototype.deleteSection = function (id, requestId) {
@@ -651,7 +638,7 @@ var TodoistApi = /** @class */ (function () {
651
638
  * Adds a new label.
652
639
  *
653
640
  * @param args - Label creation parameters such as name.
654
- * @param requestId - Optional unique identifier for idempotency.
641
+ * @param requestId - Optional custom identifier for the request.
655
642
  * @returns A promise that resolves to the created label.
656
643
  */
657
644
  TodoistApi.prototype.addLabel = function (args, requestId) {
@@ -672,7 +659,7 @@ var TodoistApi = /** @class */ (function () {
672
659
  *
673
660
  * @param id - The unique identifier of the label to update.
674
661
  * @param args - Update parameters such as name or color.
675
- * @param requestId - Optional unique identifier for idempotency.
662
+ * @param requestId - Optional custom identifier for the request.
676
663
  * @returns A promise that resolves to the updated label.
677
664
  */
678
665
  TodoistApi.prototype.updateLabel = function (id, args, requestId) {
@@ -694,7 +681,7 @@ var TodoistApi = /** @class */ (function () {
694
681
  * Deletes a label by its ID.
695
682
  *
696
683
  * @param id - The unique identifier of the label to delete.
697
- * @param requestId - Optional unique identifier for idempotency.
684
+ * @param requestId - Optional custom identifier for the request.
698
685
  * @returns A promise that resolves to `true` if successful.
699
686
  */
700
687
  TodoistApi.prototype.deleteLabel = function (id, requestId) {
@@ -816,7 +803,7 @@ var TodoistApi = /** @class */ (function () {
816
803
  * Adds a comment to a task or project.
817
804
  *
818
805
  * @param args - Parameters for creating the comment, such as content and the target task or project ID.
819
- * @param requestId - Optional unique identifier for idempotency.
806
+ * @param requestId - Optional custom identifier for the request.
820
807
  * @returns A promise that resolves to the created comment.
821
808
  */
822
809
  TodoistApi.prototype.addComment = function (args, requestId) {
@@ -837,7 +824,7 @@ var TodoistApi = /** @class */ (function () {
837
824
  *
838
825
  * @param id - The unique identifier of the comment to update.
839
826
  * @param args - Update parameters such as new content.
840
- * @param requestId - Optional unique identifier for idempotency.
827
+ * @param requestId - Optional custom identifier for the request.
841
828
  * @returns A promise that resolves to the updated comment.
842
829
  */
843
830
  TodoistApi.prototype.updateComment = function (id, args, requestId) {
@@ -859,7 +846,7 @@ var TodoistApi = /** @class */ (function () {
859
846
  * Deletes a comment by its ID.
860
847
  *
861
848
  * @param id - The unique identifier of the comment to delete.
862
- * @param requestId - Optional unique identifier for idempotency.
849
+ * @param requestId - Optional custom identifier for the request.
863
850
  * @returns A promise that resolves to `true` if successful.
864
851
  */
865
852
  TodoistApi.prototype.deleteComment = function (id, requestId) {
@@ -1,3 +1,4 @@
1
+ export declare const TODOIST_WEB_URI = "https://app.todoist.com/app";
1
2
  export declare const API_VERSION = "v1";
2
3
  export declare const API_BASE_URI = "/api/v1/";
3
4
  export declare function getSyncBaseUri(domainBase?: string): string;
@@ -1,8 +1,9 @@
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.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_FILTER = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.API_BASE_URI = exports.API_VERSION = void 0;
3
+ exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = 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_FILTER = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
4
4
  var BASE_URI = 'https://api.todoist.com';
5
5
  var TODOIST_URI = 'https://todoist.com';
6
+ exports.TODOIST_WEB_URI = 'https://app.todoist.com/app';
6
7
  // The API version is not configurable, to ensure
7
8
  // compatibility between the API and the client.
8
9
  exports.API_VERSION = 'v1';
@@ -1,4 +1,12 @@
1
- import { Label, Project, QuickAddTaskResponse, Section, Task, User, RawComment, Attachment, Duration, Deadline, RawTask, RawProject } from '../types';
1
+ import { Label, Section, Task, User, Attachment, Duration, Deadline, RawComment, PersonalProject } from '../types';
2
+ export declare const DEFAULT_TASK_ID = "1234";
3
+ export declare const DEFAULT_TASK_CONTENT = "This is a task";
4
+ export declare const DEFAULT_TASK_DESCRIPTION = "A description";
5
+ export declare const DEFAULT_TASK_PRIORITY = 1;
6
+ export declare const DEFAULT_ORDER = 3;
7
+ export declare const DEFAULT_PROJECT_ID = "123";
8
+ export declare const DEFAULT_PROJECT_NAME = "This is a project";
9
+ export declare const DEFAULT_PROJECT_VIEW_STYLE = "list";
2
10
  export declare const DEFAULT_AUTH_TOKEN = "AToken";
3
11
  export declare const DEFAULT_REQUEST_ID = "ARequestID";
4
12
  export declare const INVALID_ENTITY_ID = 1234;
@@ -11,15 +19,19 @@ export declare const DEFAULT_DUE_DATE: {
11
19
  };
12
20
  export declare const DEFAULT_DURATION: Duration;
13
21
  export declare const DEFAULT_DEADLINE: Deadline;
14
- export declare const DEFAULT_QUICK_ADD_RESPONSE: QuickAddTaskResponse;
15
22
  export declare const DEFAULT_TASK: Task;
16
23
  export declare const INVALID_TASK: {
17
24
  due: string;
25
+ url: string;
26
+ labels: string[];
18
27
  id: string;
28
+ userId: string;
19
29
  projectId: string;
20
30
  sectionId: string | null;
21
31
  parentId: string | null;
22
- labels: string[];
32
+ addedByUid: string | null;
33
+ assignedByUid: string | null;
34
+ responsibleUid: string | null;
23
35
  deadline: {
24
36
  date: string;
25
37
  lang: string;
@@ -28,38 +40,48 @@ export declare const INVALID_TASK: {
28
40
  amount: number;
29
41
  unit: "minute" | "day";
30
42
  } | null;
43
+ checked: boolean;
44
+ isDeleted: boolean;
45
+ addedAt: string | null;
46
+ completedAt: string | null;
47
+ updatedAt: string | null;
31
48
  priority: number;
49
+ childOrder: number;
32
50
  content: string;
33
51
  description: string;
34
- assignerId: string | null;
35
- assigneeId: string | null;
36
- order: number;
37
- isCompleted: boolean;
38
- creatorId: string;
39
- createdAt: string;
40
- url: string;
52
+ noteCount: number;
53
+ dayOrder: number;
54
+ isCollapsed: boolean;
41
55
  };
42
- export declare const TASK_WITH_OPTIONALS_AS_NULL: RawTask;
43
- export declare const DEFAULT_PROJECT: Project;
56
+ export declare const TASK_WITH_OPTIONALS_AS_NULL: Task;
57
+ export declare const DEFAULT_PROJECT: PersonalProject;
44
58
  export declare const INVALID_PROJECT: {
45
59
  name: number;
60
+ url: string;
46
61
  id: string;
47
62
  parentId: string | null;
48
- order: number | null;
49
- url: string;
63
+ isDeleted: boolean;
64
+ updatedAt: string | null;
65
+ childOrder: number;
66
+ description: string;
67
+ isCollapsed: boolean;
68
+ canAssignTasks: boolean;
50
69
  color: string;
70
+ createdAt: string | null;
71
+ isArchived: boolean;
51
72
  isFavorite: boolean;
73
+ isFrozen: boolean;
52
74
  viewStyle: string;
75
+ defaultOrder: number;
53
76
  isShared: boolean;
54
- isInboxProject: boolean;
55
- isTeamInbox: boolean;
77
+ inboxProject: boolean;
56
78
  };
57
- export declare const PROJECT_WITH_OPTIONALS_AS_NULL: Project;
79
+ export declare const PROJECT_WITH_OPTIONALS_AS_NULL: PersonalProject;
58
80
  export declare const DEFAULT_SECTION: Section;
59
81
  export declare const INVALID_SECTION: {
60
82
  projectId: undefined;
61
- userId: string;
62
83
  id: string;
84
+ userId: string;
63
85
  isDeleted: boolean;
64
86
  addedAt: string;
65
87
  updatedAt: string;
@@ -73,9 +95,9 @@ export declare const DEFAULT_LABEL: Label;
73
95
  export declare const INVALID_LABEL: {
74
96
  isFavorite: string;
75
97
  id: string;
76
- order: number | null;
77
98
  color: string;
78
99
  name: string;
100
+ order: number | null;
79
101
  };
80
102
  export declare const DEFAULT_USER: User;
81
103
  export declare const INVALID_USER: {
@@ -231,5 +253,3 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
231
253
  projectId?: string | undefined;
232
254
  itemId?: string | undefined;
233
255
  };
234
- export declare const RAW_DEFAULT_TASK: RawTask;
235
- export declare const RAW_DEFAULT_PROJECT: RawProject;