@doist/todoist-api-typescript 4.0.0-alpha.5 → 4.0.0-alpha.7

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
- export declare const API_VERSION = "v9.217";
2
- export declare const API_BASE_URI = "/api/v9.217/";
1
+ export declare const API_VERSION = "v9.220";
2
+ export declare const API_BASE_URI = "/api/v9.220/";
3
3
  export declare function getSyncBaseUri(domainBase?: string): string;
4
4
  export declare function getAuthBaseUri(domainBase?: string): string;
5
5
  export declare const ENDPOINT_REST_TASKS = "tasks";
@@ -5,7 +5,7 @@ var BASE_URI = 'https://api.todoist.com';
5
5
  var TODOIST_URI = 'https://todoist.com';
6
6
  // The API version is not configurable, to ensure
7
7
  // compatibility between the API and the client.
8
- exports.API_VERSION = 'v9.217';
8
+ exports.API_VERSION = 'v9.220';
9
9
  exports.API_BASE_URI = "/api/".concat(exports.API_VERSION, "/");
10
10
  var API_AUTHORIZATION_BASE_URI = '/oauth/';
11
11
  function getSyncBaseUri(domainBase) {
@@ -1,4 +1,4 @@
1
- import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment, Duration, Deadline } from '../types';
1
+ import { Label, Project, QuickAddTaskResponse, Section, Task, User, RawComment, Attachment, Duration, Deadline } from '../types';
2
2
  export declare const DEFAULT_AUTH_TOKEN = "AToken";
3
3
  export declare const DEFAULT_REQUEST_ID = "ARequestID";
4
4
  export declare const INVALID_ENTITY_ID = 1234;
@@ -27,7 +27,6 @@ export declare const INVALID_TASK: {
27
27
  isCompleted: boolean;
28
28
  labels: string[];
29
29
  priority: number;
30
- commentCount: number;
31
30
  creatorId: string;
32
31
  createdAt: string;
33
32
  url: string;
@@ -47,7 +46,6 @@ export declare const INVALID_PROJECT: {
47
46
  id: string;
48
47
  parentId: string | null;
49
48
  order: number | null;
50
- commentCount: number;
51
49
  url: string;
52
50
  color: string;
53
51
  isShared: boolean;
@@ -61,8 +59,15 @@ export declare const DEFAULT_SECTION: Section;
61
59
  export declare const INVALID_SECTION: {
62
60
  projectId: undefined;
63
61
  id: string;
64
- order: number;
65
62
  name: string;
63
+ userId: string;
64
+ addedAt: string;
65
+ updatedAt: string;
66
+ archivedAt: string | null;
67
+ sectionOrder: number;
68
+ isArchived: boolean;
69
+ isDeleted: boolean;
70
+ isCollapsed: boolean;
66
71
  };
67
72
  export declare const DEFAULT_LABEL: Label;
68
73
  export declare const INVALID_LABEL: {
@@ -93,10 +98,67 @@ export declare const INVALID_ATTACHMENT: {
93
98
  imageHeight?: number | null | undefined;
94
99
  title?: string | null | undefined;
95
100
  };
96
- export declare const DEFAULT_COMMENT: Comment;
101
+ export declare const DEFAULT_RAW_COMMENT: RawComment;
102
+ export declare const DEFAULT_COMMENT: {
103
+ taskId: string | undefined;
104
+ itemId: undefined;
105
+ id: string;
106
+ content: string;
107
+ isDeleted: boolean;
108
+ postedAt: string;
109
+ fileAttachment: {
110
+ resourceType: string;
111
+ url?: string | null | undefined;
112
+ fileName?: string | null | undefined;
113
+ fileSize?: number | null | undefined;
114
+ fileType?: string | null | undefined;
115
+ fileUrl?: string | null | undefined;
116
+ fileDuration?: number | null | undefined;
117
+ uploadState?: "pending" | "completed" | null | undefined;
118
+ image?: string | null | undefined;
119
+ imageWidth?: number | null | undefined;
120
+ imageHeight?: number | null | undefined;
121
+ title?: string | null | undefined;
122
+ } | null;
123
+ postedUid: string;
124
+ uidsToNotify: string[] | null;
125
+ reactions: Record<string, string[]> | null;
126
+ projectId?: string | undefined;
127
+ };
97
128
  export declare const INVALID_COMMENT: {
98
- attachment: {
99
- uploadState: string;
129
+ isDeleted: string;
130
+ id: string;
131
+ content: string;
132
+ postedAt: string;
133
+ fileAttachment: {
134
+ resourceType: string;
135
+ url?: string | null | undefined;
136
+ fileName?: string | null | undefined;
137
+ fileSize?: number | null | undefined;
138
+ fileType?: string | null | undefined;
139
+ fileUrl?: string | null | undefined;
140
+ fileDuration?: number | null | undefined;
141
+ uploadState?: "pending" | "completed" | null | undefined;
142
+ image?: string | null | undefined;
143
+ imageWidth?: number | null | undefined;
144
+ imageHeight?: number | null | undefined;
145
+ title?: string | null | undefined;
146
+ } | null;
147
+ postedUid: string;
148
+ uidsToNotify: string[] | null;
149
+ reactions: Record<string, string[]> | null;
150
+ projectId?: string | undefined;
151
+ itemId?: string | undefined;
152
+ };
153
+ export declare const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK: RawComment;
154
+ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: {
155
+ taskId: string | undefined;
156
+ itemId: undefined;
157
+ id: string;
158
+ content: string;
159
+ isDeleted: boolean;
160
+ postedAt: string;
161
+ fileAttachment: {
100
162
  resourceType: string;
101
163
  url?: string | null | undefined;
102
164
  fileName?: string | null | undefined;
@@ -104,17 +166,68 @@ export declare const INVALID_COMMENT: {
104
166
  fileType?: string | null | undefined;
105
167
  fileUrl?: string | null | undefined;
106
168
  fileDuration?: number | null | undefined;
169
+ uploadState?: "pending" | "completed" | null | undefined;
107
170
  image?: string | null | undefined;
108
171
  imageWidth?: number | null | undefined;
109
172
  imageHeight?: number | null | undefined;
110
173
  title?: string | null | undefined;
111
- };
174
+ } | null;
175
+ postedUid: string;
176
+ uidsToNotify: string[] | null;
177
+ reactions: Record<string, string[]> | null;
178
+ projectId?: string | undefined;
179
+ };
180
+ export declare const RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: RawComment;
181
+ export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: {
182
+ taskId: string | undefined;
183
+ itemId: undefined;
112
184
  id: string;
113
- projectId: string | null;
114
185
  content: string;
115
- taskId: string | null;
186
+ isDeleted: boolean;
116
187
  postedAt: string;
188
+ fileAttachment: {
189
+ resourceType: string;
190
+ url?: string | null | undefined;
191
+ fileName?: string | null | undefined;
192
+ fileSize?: number | null | undefined;
193
+ fileType?: string | null | undefined;
194
+ fileUrl?: string | null | undefined;
195
+ fileDuration?: number | null | undefined;
196
+ uploadState?: "pending" | "completed" | null | undefined;
197
+ image?: string | null | undefined;
198
+ imageWidth?: number | null | undefined;
199
+ imageHeight?: number | null | undefined;
200
+ title?: string | null | undefined;
201
+ } | null;
202
+ postedUid: string;
203
+ uidsToNotify: string[] | null;
204
+ reactions: Record<string, string[]> | null;
205
+ projectId?: string | undefined;
206
+ };
207
+ export declare const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: RawComment;
208
+ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
209
+ taskId: undefined;
210
+ id: string;
211
+ content: string;
212
+ isDeleted: boolean;
213
+ postedAt: string;
214
+ fileAttachment: {
215
+ resourceType: string;
216
+ url?: string | null | undefined;
217
+ fileName?: string | null | undefined;
218
+ fileSize?: number | null | undefined;
219
+ fileType?: string | null | undefined;
220
+ fileUrl?: string | null | undefined;
221
+ fileDuration?: number | null | undefined;
222
+ uploadState?: "pending" | "completed" | null | undefined;
223
+ image?: string | null | undefined;
224
+ imageWidth?: number | null | undefined;
225
+ imageHeight?: number | null | undefined;
226
+ title?: string | null | undefined;
227
+ } | null;
228
+ postedUid: string;
229
+ uidsToNotify: string[] | null;
230
+ reactions: Record<string, string[]> | null;
231
+ projectId?: string | undefined;
232
+ itemId?: string | undefined;
117
233
  };
118
- export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: Comment;
119
- export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: Comment;
120
- export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: Comment;
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.DEFAULT_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = void 0;
14
+ exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK = exports.INVALID_COMMENT = exports.DEFAULT_COMMENT = exports.DEFAULT_RAW_COMMENT = exports.INVALID_ATTACHMENT = exports.DEFAULT_ATTACHMENT = exports.INVALID_USER = exports.DEFAULT_USER = exports.INVALID_LABEL = exports.DEFAULT_LABEL = exports.INVALID_SECTION = exports.DEFAULT_SECTION = exports.PROJECT_WITH_OPTIONALS_AS_NULL = exports.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.TASK_WITH_OPTIONALS_AS_NULL = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.DEFAULT_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = void 0;
15
15
  var DEFAULT_TASK_ID = '1234';
16
16
  var DEFAULT_TASK_CONTENT = 'This is a task';
17
17
  var DEFAULT_TASK_DESCRIPTION = 'A description';
@@ -35,6 +35,7 @@ var DEFAULT_USER_NAME = 'A User';
35
35
  var DEFAULT_USER_EMAIL = 'atestuser@doist.com';
36
36
  var DEFAULT_COMMENT_ID = '4';
37
37
  var DEFAULT_COMMENT_CONTENT = 'A comment';
38
+ var DEFAULT_COMMENT_REACTIONS = { '👍': ['1234', '5678'] };
38
39
  exports.DEFAULT_AUTH_TOKEN = 'AToken';
39
40
  exports.DEFAULT_REQUEST_ID = 'ARequestID';
40
41
  exports.INVALID_ENTITY_ID = 1234;
@@ -89,7 +90,6 @@ exports.DEFAULT_TASK = {
89
90
  isCompleted: false,
90
91
  labels: DEFAULT_LABELS,
91
92
  priority: DEFAULT_TASK_PRIORITY,
92
- commentCount: 0,
93
93
  createdAt: DEFAULT_DATE,
94
94
  url: 'https://todoist.com/showTask?id=1234',
95
95
  due: exports.DEFAULT_DUE_DATE,
@@ -107,7 +107,6 @@ exports.DEFAULT_PROJECT = {
107
107
  color: DEFAULT_ENTITY_COLOR,
108
108
  order: DEFAULT_ORDER,
109
109
  parentId: DEFAULT_PROJECT_ID,
110
- commentCount: 0,
111
110
  isFavorite: false,
112
111
  isShared: false,
113
112
  isInboxProject: false,
@@ -119,9 +118,16 @@ exports.INVALID_PROJECT = __assign(__assign({}, exports.DEFAULT_PROJECT), { name
119
118
  exports.PROJECT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_PROJECT), { parentId: null });
120
119
  exports.DEFAULT_SECTION = {
121
120
  id: DEFAULT_SECTION_ID,
122
- name: DEFAULT_SECTION_NAME,
123
- order: DEFAULT_ORDER,
121
+ userId: DEFAULT_USER_ID,
124
122
  projectId: DEFAULT_PROJECT_ID,
123
+ addedAt: '2025-03-28T14:01:23.334881Z',
124
+ updatedAt: '2025-03-28T14:01:23.334885Z',
125
+ archivedAt: null,
126
+ name: DEFAULT_SECTION_NAME,
127
+ sectionOrder: DEFAULT_ORDER,
128
+ isArchived: false,
129
+ isDeleted: false,
130
+ isCollapsed: false,
125
131
  };
126
132
  exports.INVALID_SECTION = __assign(__assign({}, exports.DEFAULT_SECTION), { projectId: undefined });
127
133
  exports.DEFAULT_LABEL = {
@@ -145,15 +151,34 @@ exports.DEFAULT_ATTACHMENT = {
145
151
  uploadState: 'completed',
146
152
  };
147
153
  exports.INVALID_ATTACHMENT = __assign(__assign({}, exports.DEFAULT_ATTACHMENT), { uploadState: 'something random' });
148
- exports.DEFAULT_COMMENT = {
154
+ exports.DEFAULT_RAW_COMMENT = {
149
155
  id: DEFAULT_COMMENT_ID,
156
+ postedUid: DEFAULT_USER_ID,
150
157
  content: DEFAULT_COMMENT_CONTENT,
151
- taskId: null,
152
- projectId: DEFAULT_PROJECT_ID,
153
- attachment: exports.DEFAULT_ATTACHMENT,
158
+ fileAttachment: exports.DEFAULT_ATTACHMENT,
159
+ uidsToNotify: null,
160
+ isDeleted: false,
154
161
  postedAt: DEFAULT_DATE,
162
+ reactions: DEFAULT_COMMENT_REACTIONS,
163
+ itemId: DEFAULT_TASK_ID,
155
164
  };
156
- exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: exports.INVALID_ATTACHMENT });
157
- exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.DEFAULT_COMMENT), { projectId: null, attachment: null });
158
- exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: __assign(__assign({}, exports.DEFAULT_ATTACHMENT), { fileName: null, fileSize: null, fileType: null, fileDuration: null, uploadState: null, image: null, imageWidth: null, imageHeight: null, url: null, title: null }) });
159
- exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.DEFAULT_COMMENT), { taskId: null, attachment: null });
165
+ exports.DEFAULT_COMMENT = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { taskId: exports.DEFAULT_RAW_COMMENT.itemId, itemId: undefined });
166
+ exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { isDeleted: 'true' });
167
+ exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { fileAttachment: null, uidsToNotify: null, reactions: null });
168
+ exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK), { taskId: exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_TASK.itemId, itemId: undefined });
169
+ exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { fileAttachment: {
170
+ resourceType: 'file',
171
+ fileName: null,
172
+ fileSize: null,
173
+ fileType: null,
174
+ fileDuration: null,
175
+ uploadState: null,
176
+ image: null,
177
+ imageWidth: null,
178
+ imageHeight: null,
179
+ url: null,
180
+ title: null,
181
+ } });
182
+ exports.COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL), { taskId: exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL.itemId, itemId: undefined });
183
+ exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { itemId: undefined, projectId: DEFAULT_PROJECT_ID });
184
+ exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT), { taskId: undefined });
@@ -72,7 +72,6 @@ export declare const TaskSchema: z.ZodObject<{
72
72
  isCompleted: z.ZodBoolean;
73
73
  labels: z.ZodArray<z.ZodString, "many">;
74
74
  priority: z.ZodNumber;
75
- commentCount: z.ZodNumber;
76
75
  creatorId: z.ZodString;
77
76
  createdAt: z.ZodString;
78
77
  due: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
@@ -132,7 +131,6 @@ export declare const TaskSchema: z.ZodObject<{
132
131
  isCompleted: boolean;
133
132
  labels: string[];
134
133
  priority: number;
135
- commentCount: number;
136
134
  creatorId: string;
137
135
  createdAt: string;
138
136
  due: {
@@ -165,7 +163,6 @@ export declare const TaskSchema: z.ZodObject<{
165
163
  isCompleted: boolean;
166
164
  labels: string[];
167
165
  priority: number;
168
- commentCount: number;
169
166
  creatorId: string;
170
167
  createdAt: string;
171
168
  due: {
@@ -198,7 +195,6 @@ export declare const ProjectSchema: z.ZodObject<{
198
195
  order: z.ZodNullable<z.ZodNumber>;
199
196
  color: z.ZodString;
200
197
  name: z.ZodString;
201
- commentCount: z.ZodNumber;
202
198
  isShared: z.ZodBoolean;
203
199
  isFavorite: z.ZodBoolean;
204
200
  isInboxProject: z.ZodBoolean;
@@ -209,7 +205,6 @@ export declare const ProjectSchema: z.ZodObject<{
209
205
  id: string;
210
206
  parentId: string | null;
211
207
  order: number | null;
212
- commentCount: number;
213
208
  url: string;
214
209
  color: string;
215
210
  name: string;
@@ -222,7 +217,6 @@ export declare const ProjectSchema: z.ZodObject<{
222
217
  id: string;
223
218
  parentId: string | null;
224
219
  order: number | null;
225
- commentCount: number;
226
220
  url: string;
227
221
  color: string;
228
222
  name: string;
@@ -244,19 +238,40 @@ export interface Project extends z.infer<typeof ProjectSchema> {
244
238
  export type ProjectViewStyle = 'list' | 'board' | 'calendar';
245
239
  export declare const SectionSchema: z.ZodObject<{
246
240
  id: z.ZodString;
247
- order: z.ZodNumber;
248
- name: z.ZodString;
241
+ userId: z.ZodString;
249
242
  projectId: z.ZodString;
243
+ addedAt: z.ZodString;
244
+ updatedAt: z.ZodString;
245
+ archivedAt: z.ZodNullable<z.ZodString>;
246
+ name: z.ZodString;
247
+ sectionOrder: z.ZodNumber;
248
+ isArchived: z.ZodBoolean;
249
+ isDeleted: z.ZodBoolean;
250
+ isCollapsed: z.ZodBoolean;
250
251
  }, "strip", z.ZodTypeAny, {
251
252
  id: string;
252
253
  projectId: string;
253
- order: number;
254
254
  name: string;
255
+ userId: string;
256
+ addedAt: string;
257
+ updatedAt: string;
258
+ archivedAt: string | null;
259
+ sectionOrder: number;
260
+ isArchived: boolean;
261
+ isDeleted: boolean;
262
+ isCollapsed: boolean;
255
263
  }, {
256
264
  id: string;
257
265
  projectId: string;
258
- order: number;
259
266
  name: string;
267
+ userId: string;
268
+ addedAt: string;
269
+ updatedAt: string;
270
+ archivedAt: string | null;
271
+ sectionOrder: number;
272
+ isArchived: boolean;
273
+ isDeleted: boolean;
274
+ isCollapsed: boolean;
260
275
  }>;
261
276
  /**
262
277
  * Represents a section within a project, used to group tasks.
@@ -336,13 +351,167 @@ export declare const AttachmentSchema: z.ZodObject<z.objectUtil.extendShape<{
336
351
  */
337
352
  export interface Attachment extends z.infer<typeof AttachmentSchema> {
338
353
  }
339
- export declare const CommentSchema: z.ZodObject<{
354
+ export declare const RawCommentSchema: z.ZodEffects<z.ZodObject<{
355
+ id: z.ZodString;
356
+ itemId: z.ZodOptional<z.ZodString>;
357
+ projectId: z.ZodOptional<z.ZodString>;
358
+ content: z.ZodString;
359
+ postedAt: z.ZodString;
360
+ fileAttachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
361
+ resourceType: z.ZodString;
362
+ }, {
363
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
365
+ fileType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
366
+ fileUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
367
+ fileDuration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
368
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodEnum<["pending", "completed"]>>>;
369
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
370
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
371
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
372
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
373
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
374
+ }>, "strip", z.ZodTypeAny, {
375
+ resourceType: string;
376
+ url?: string | null | undefined;
377
+ fileName?: string | null | undefined;
378
+ fileSize?: number | null | undefined;
379
+ fileType?: string | null | undefined;
380
+ fileUrl?: string | null | undefined;
381
+ fileDuration?: number | null | undefined;
382
+ uploadState?: "pending" | "completed" | null | undefined;
383
+ image?: string | null | undefined;
384
+ imageWidth?: number | null | undefined;
385
+ imageHeight?: number | null | undefined;
386
+ title?: string | null | undefined;
387
+ }, {
388
+ resourceType: string;
389
+ url?: string | null | undefined;
390
+ fileName?: string | null | undefined;
391
+ fileSize?: number | null | undefined;
392
+ fileType?: string | null | undefined;
393
+ fileUrl?: string | null | undefined;
394
+ fileDuration?: number | null | undefined;
395
+ uploadState?: "pending" | "completed" | null | undefined;
396
+ image?: string | null | undefined;
397
+ imageWidth?: number | null | undefined;
398
+ imageHeight?: number | null | undefined;
399
+ title?: string | null | undefined;
400
+ }>>;
401
+ postedUid: z.ZodString;
402
+ uidsToNotify: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
403
+ reactions: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
404
+ isDeleted: z.ZodBoolean;
405
+ }, "strip", z.ZodTypeAny, {
406
+ id: string;
407
+ content: string;
408
+ isDeleted: boolean;
409
+ postedAt: string;
410
+ fileAttachment: {
411
+ resourceType: string;
412
+ url?: string | null | undefined;
413
+ fileName?: string | null | undefined;
414
+ fileSize?: number | null | undefined;
415
+ fileType?: string | null | undefined;
416
+ fileUrl?: string | null | undefined;
417
+ fileDuration?: number | null | undefined;
418
+ uploadState?: "pending" | "completed" | null | undefined;
419
+ image?: string | null | undefined;
420
+ imageWidth?: number | null | undefined;
421
+ imageHeight?: number | null | undefined;
422
+ title?: string | null | undefined;
423
+ } | null;
424
+ postedUid: string;
425
+ uidsToNotify: string[] | null;
426
+ reactions: Record<string, string[]> | null;
427
+ projectId?: string | undefined;
428
+ itemId?: string | undefined;
429
+ }, {
430
+ id: string;
431
+ content: string;
432
+ isDeleted: boolean;
433
+ postedAt: string;
434
+ fileAttachment: {
435
+ resourceType: string;
436
+ url?: string | null | undefined;
437
+ fileName?: string | null | undefined;
438
+ fileSize?: number | null | undefined;
439
+ fileType?: string | null | undefined;
440
+ fileUrl?: string | null | undefined;
441
+ fileDuration?: number | null | undefined;
442
+ uploadState?: "pending" | "completed" | null | undefined;
443
+ image?: string | null | undefined;
444
+ imageWidth?: number | null | undefined;
445
+ imageHeight?: number | null | undefined;
446
+ title?: string | null | undefined;
447
+ } | null;
448
+ postedUid: string;
449
+ uidsToNotify: string[] | null;
450
+ reactions: Record<string, string[]> | null;
451
+ projectId?: string | undefined;
452
+ itemId?: string | undefined;
453
+ }>, {
454
+ id: string;
455
+ content: string;
456
+ isDeleted: boolean;
457
+ postedAt: string;
458
+ fileAttachment: {
459
+ resourceType: string;
460
+ url?: string | null | undefined;
461
+ fileName?: string | null | undefined;
462
+ fileSize?: number | null | undefined;
463
+ fileType?: string | null | undefined;
464
+ fileUrl?: string | null | undefined;
465
+ fileDuration?: number | null | undefined;
466
+ uploadState?: "pending" | "completed" | null | undefined;
467
+ image?: string | null | undefined;
468
+ imageWidth?: number | null | undefined;
469
+ imageHeight?: number | null | undefined;
470
+ title?: string | null | undefined;
471
+ } | null;
472
+ postedUid: string;
473
+ uidsToNotify: string[] | null;
474
+ reactions: Record<string, string[]> | null;
475
+ projectId?: string | undefined;
476
+ itemId?: string | undefined;
477
+ }, {
478
+ id: string;
479
+ content: string;
480
+ isDeleted: boolean;
481
+ postedAt: string;
482
+ fileAttachment: {
483
+ resourceType: string;
484
+ url?: string | null | undefined;
485
+ fileName?: string | null | undefined;
486
+ fileSize?: number | null | undefined;
487
+ fileType?: string | null | undefined;
488
+ fileUrl?: string | null | undefined;
489
+ fileDuration?: number | null | undefined;
490
+ uploadState?: "pending" | "completed" | null | undefined;
491
+ image?: string | null | undefined;
492
+ imageWidth?: number | null | undefined;
493
+ imageHeight?: number | null | undefined;
494
+ title?: string | null | undefined;
495
+ } | null;
496
+ postedUid: string;
497
+ uidsToNotify: string[] | null;
498
+ reactions: Record<string, string[]> | null;
499
+ projectId?: string | undefined;
500
+ itemId?: string | undefined;
501
+ }>;
502
+ /**
503
+ * Represents the raw comment data as received from the API before transformation.
504
+ * @see https://developer.todoist.com/sync/v9/#notes
505
+ */
506
+ export interface RawComment extends z.infer<typeof RawCommentSchema> {
507
+ }
508
+ export declare const CommentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
340
509
  id: z.ZodString;
341
- taskId: z.ZodNullable<z.ZodString>;
342
- projectId: z.ZodNullable<z.ZodString>;
510
+ itemId: z.ZodOptional<z.ZodString>;
511
+ projectId: z.ZodOptional<z.ZodString>;
343
512
  content: z.ZodString;
344
513
  postedAt: z.ZodString;
345
- attachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
514
+ fileAttachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
346
515
  resourceType: z.ZodString;
347
516
  }, {
348
517
  fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -383,13 +552,113 @@ export declare const CommentSchema: z.ZodObject<{
383
552
  imageHeight?: number | null | undefined;
384
553
  title?: string | null | undefined;
385
554
  }>>;
555
+ postedUid: z.ZodString;
556
+ uidsToNotify: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
557
+ reactions: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
558
+ isDeleted: z.ZodBoolean;
386
559
  }, "strip", z.ZodTypeAny, {
387
560
  id: string;
388
- projectId: string | null;
389
561
  content: string;
390
- taskId: string | null;
562
+ isDeleted: boolean;
563
+ postedAt: string;
564
+ fileAttachment: {
565
+ resourceType: string;
566
+ url?: string | null | undefined;
567
+ fileName?: string | null | undefined;
568
+ fileSize?: number | null | undefined;
569
+ fileType?: string | null | undefined;
570
+ fileUrl?: string | null | undefined;
571
+ fileDuration?: number | null | undefined;
572
+ uploadState?: "pending" | "completed" | null | undefined;
573
+ image?: string | null | undefined;
574
+ imageWidth?: number | null | undefined;
575
+ imageHeight?: number | null | undefined;
576
+ title?: string | null | undefined;
577
+ } | null;
578
+ postedUid: string;
579
+ uidsToNotify: string[] | null;
580
+ reactions: Record<string, string[]> | null;
581
+ projectId?: string | undefined;
582
+ itemId?: string | undefined;
583
+ }, {
584
+ id: string;
585
+ content: string;
586
+ isDeleted: boolean;
587
+ postedAt: string;
588
+ fileAttachment: {
589
+ resourceType: string;
590
+ url?: string | null | undefined;
591
+ fileName?: string | null | undefined;
592
+ fileSize?: number | null | undefined;
593
+ fileType?: string | null | undefined;
594
+ fileUrl?: string | null | undefined;
595
+ fileDuration?: number | null | undefined;
596
+ uploadState?: "pending" | "completed" | null | undefined;
597
+ image?: string | null | undefined;
598
+ imageWidth?: number | null | undefined;
599
+ imageHeight?: number | null | undefined;
600
+ title?: string | null | undefined;
601
+ } | null;
602
+ postedUid: string;
603
+ uidsToNotify: string[] | null;
604
+ reactions: Record<string, string[]> | null;
605
+ projectId?: string | undefined;
606
+ itemId?: string | undefined;
607
+ }>, {
608
+ id: string;
609
+ content: string;
610
+ isDeleted: boolean;
611
+ postedAt: string;
612
+ fileAttachment: {
613
+ resourceType: string;
614
+ url?: string | null | undefined;
615
+ fileName?: string | null | undefined;
616
+ fileSize?: number | null | undefined;
617
+ fileType?: string | null | undefined;
618
+ fileUrl?: string | null | undefined;
619
+ fileDuration?: number | null | undefined;
620
+ uploadState?: "pending" | "completed" | null | undefined;
621
+ image?: string | null | undefined;
622
+ imageWidth?: number | null | undefined;
623
+ imageHeight?: number | null | undefined;
624
+ title?: string | null | undefined;
625
+ } | null;
626
+ postedUid: string;
627
+ uidsToNotify: string[] | null;
628
+ reactions: Record<string, string[]> | null;
629
+ projectId?: string | undefined;
630
+ itemId?: string | undefined;
631
+ }, {
632
+ id: string;
633
+ content: string;
634
+ isDeleted: boolean;
635
+ postedAt: string;
636
+ fileAttachment: {
637
+ resourceType: string;
638
+ url?: string | null | undefined;
639
+ fileName?: string | null | undefined;
640
+ fileSize?: number | null | undefined;
641
+ fileType?: string | null | undefined;
642
+ fileUrl?: string | null | undefined;
643
+ fileDuration?: number | null | undefined;
644
+ uploadState?: "pending" | "completed" | null | undefined;
645
+ image?: string | null | undefined;
646
+ imageWidth?: number | null | undefined;
647
+ imageHeight?: number | null | undefined;
648
+ title?: string | null | undefined;
649
+ } | null;
650
+ postedUid: string;
651
+ uidsToNotify: string[] | null;
652
+ reactions: Record<string, string[]> | null;
653
+ projectId?: string | undefined;
654
+ itemId?: string | undefined;
655
+ }>, {
656
+ taskId: string | undefined;
657
+ id: string;
658
+ content: string;
659
+ isDeleted: boolean;
391
660
  postedAt: string;
392
- attachment: {
661
+ fileAttachment: {
393
662
  resourceType: string;
394
663
  url?: string | null | undefined;
395
664
  fileName?: string | null | undefined;
@@ -403,13 +672,16 @@ export declare const CommentSchema: z.ZodObject<{
403
672
  imageHeight?: number | null | undefined;
404
673
  title?: string | null | undefined;
405
674
  } | null;
675
+ postedUid: string;
676
+ uidsToNotify: string[] | null;
677
+ reactions: Record<string, string[]> | null;
678
+ projectId?: string | undefined;
406
679
  }, {
407
680
  id: string;
408
- projectId: string | null;
409
681
  content: string;
410
- taskId: string | null;
682
+ isDeleted: boolean;
411
683
  postedAt: string;
412
- attachment: {
684
+ fileAttachment: {
413
685
  resourceType: string;
414
686
  url?: string | null | undefined;
415
687
  fileName?: string | null | undefined;
@@ -423,6 +695,11 @@ export declare const CommentSchema: z.ZodObject<{
423
695
  imageHeight?: number | null | undefined;
424
696
  title?: string | null | undefined;
425
697
  } | null;
698
+ postedUid: string;
699
+ uidsToNotify: string[] | null;
700
+ reactions: Record<string, string[]> | null;
701
+ projectId?: string | undefined;
702
+ itemId?: string | undefined;
426
703
  }>;
427
704
  /**
428
705
  * Represents a comment on a task or project in Todoist.
@@ -1,6 +1,28 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
2
24
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ColorSchema = exports.UserSchema = exports.CommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.ProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
25
+ exports.ColorSchema = exports.UserSchema = exports.CommentSchema = exports.RawCommentSchema = exports.AttachmentSchema = exports.LabelSchema = exports.SectionSchema = exports.ProjectSchema = exports.TaskSchema = exports.DeadlineSchema = exports.DurationSchema = exports.DueDateSchema = void 0;
4
26
  var zod_1 = require("zod");
5
27
  exports.DueDateSchema = zod_1.z
6
28
  .object({
@@ -34,7 +56,6 @@ exports.TaskSchema = zod_1.z.object({
34
56
  isCompleted: zod_1.z.boolean(),
35
57
  labels: zod_1.z.array(zod_1.z.string()),
36
58
  priority: zod_1.z.number().int(),
37
- commentCount: zod_1.z.number().int(),
38
59
  creatorId: zod_1.z.string(),
39
60
  createdAt: zod_1.z.string(),
40
61
  due: exports.DueDateSchema.nullable(),
@@ -48,7 +69,6 @@ exports.ProjectSchema = zod_1.z.object({
48
69
  order: zod_1.z.number().int().nullable(),
49
70
  color: zod_1.z.string(),
50
71
  name: zod_1.z.string(),
51
- commentCount: zod_1.z.number().int(),
52
72
  isShared: zod_1.z.boolean(),
53
73
  isFavorite: zod_1.z.boolean(),
54
74
  isInboxProject: zod_1.z.boolean(),
@@ -58,9 +78,16 @@ exports.ProjectSchema = zod_1.z.object({
58
78
  });
59
79
  exports.SectionSchema = zod_1.z.object({
60
80
  id: zod_1.z.string(),
61
- order: zod_1.z.number().int(),
62
- name: zod_1.z.string(),
81
+ userId: zod_1.z.string(),
63
82
  projectId: zod_1.z.string(),
83
+ addedAt: zod_1.z.string(),
84
+ updatedAt: zod_1.z.string(),
85
+ archivedAt: zod_1.z.string().nullable(),
86
+ name: zod_1.z.string(),
87
+ sectionOrder: zod_1.z.number().int(),
88
+ isArchived: zod_1.z.boolean(),
89
+ isDeleted: zod_1.z.boolean(),
90
+ isCollapsed: zod_1.z.boolean(),
64
91
  });
65
92
  exports.LabelSchema = zod_1.z.object({
66
93
  id: zod_1.z.string(),
@@ -86,13 +113,31 @@ exports.AttachmentSchema = zod_1.z
86
113
  url: zod_1.z.string().nullable().optional(),
87
114
  title: zod_1.z.string().nullable().optional(),
88
115
  });
89
- exports.CommentSchema = zod_1.z.object({
116
+ exports.RawCommentSchema = zod_1.z
117
+ .object({
90
118
  id: zod_1.z.string(),
91
- taskId: zod_1.z.string().nullable(),
92
- projectId: zod_1.z.string().nullable(),
119
+ itemId: zod_1.z.string().optional(),
120
+ projectId: zod_1.z.string().optional(),
93
121
  content: zod_1.z.string(),
94
122
  postedAt: zod_1.z.string(),
95
- attachment: exports.AttachmentSchema.nullable(),
123
+ fileAttachment: exports.AttachmentSchema.nullable(),
124
+ postedUid: zod_1.z.string(),
125
+ uidsToNotify: zod_1.z.array(zod_1.z.string()).nullable(),
126
+ reactions: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())).nullable(),
127
+ isDeleted: zod_1.z.boolean(),
128
+ })
129
+ .refine(function (data) {
130
+ // At least one of itemId or projectId must be present
131
+ return ((data.itemId !== undefined && data.projectId === undefined) ||
132
+ (data.itemId === undefined && data.projectId !== undefined));
133
+ }, {
134
+ message: 'Exactly one of itemId or projectId must be provided',
135
+ });
136
+ exports.CommentSchema = exports.RawCommentSchema.transform(function (data) {
137
+ var itemId = data.itemId, rest = __rest(data, ["itemId"]);
138
+ return __assign(__assign({}, rest), {
139
+ // Map itemId to taskId for backwards compatibility
140
+ taskId: itemId });
96
141
  });
97
142
  exports.UserSchema = zod_1.z.object({
98
143
  id: zod_1.z.string(),
@@ -17,7 +17,6 @@ function getTaskFromQuickAddResponse(responseData) {
17
17
  isCompleted: responseData.checked,
18
18
  labels: responseData.labels,
19
19
  priority: responseData.priority,
20
- commentCount: 0, // Will always be 0 for a quick add
21
20
  createdAt: responseData.addedAt,
22
21
  url: getTaskUrlFromQuickAddResponse(responseData),
23
22
  creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "4.0.0-alpha.5",
3
+ "version": "4.0.0-alpha.7",
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",