@doist/todoist-api-typescript 4.0.0-alpha.6 → 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,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;
@@ -59,8 +59,15 @@ export declare const DEFAULT_SECTION: Section;
59
59
  export declare const INVALID_SECTION: {
60
60
  projectId: undefined;
61
61
  id: string;
62
- order: number;
63
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;
64
71
  };
65
72
  export declare const DEFAULT_LABEL: Label;
66
73
  export declare const INVALID_LABEL: {
@@ -91,10 +98,67 @@ export declare const INVALID_ATTACHMENT: {
91
98
  imageHeight?: number | null | undefined;
92
99
  title?: string | null | undefined;
93
100
  };
94
- 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
+ };
95
128
  export declare const INVALID_COMMENT: {
96
- attachment: {
97
- 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: {
98
162
  resourceType: string;
99
163
  url?: string | null | undefined;
100
164
  fileName?: string | null | undefined;
@@ -102,17 +166,68 @@ export declare const INVALID_COMMENT: {
102
166
  fileType?: string | null | undefined;
103
167
  fileUrl?: string | null | undefined;
104
168
  fileDuration?: number | null | undefined;
169
+ uploadState?: "pending" | "completed" | null | undefined;
105
170
  image?: string | null | undefined;
106
171
  imageWidth?: number | null | undefined;
107
172
  imageHeight?: number | null | undefined;
108
173
  title?: string | null | undefined;
109
- };
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;
110
184
  id: string;
111
- projectId: string | null;
112
185
  content: string;
113
- taskId: string | null;
186
+ isDeleted: boolean;
114
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;
115
233
  };
116
- export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: Comment;
117
- export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: Comment;
118
- 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;
@@ -117,9 +118,16 @@ exports.INVALID_PROJECT = __assign(__assign({}, exports.DEFAULT_PROJECT), { name
117
118
  exports.PROJECT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_PROJECT), { parentId: null });
118
119
  exports.DEFAULT_SECTION = {
119
120
  id: DEFAULT_SECTION_ID,
120
- name: DEFAULT_SECTION_NAME,
121
- order: DEFAULT_ORDER,
121
+ userId: DEFAULT_USER_ID,
122
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,
123
131
  };
124
132
  exports.INVALID_SECTION = __assign(__assign({}, exports.DEFAULT_SECTION), { projectId: undefined });
125
133
  exports.DEFAULT_LABEL = {
@@ -143,15 +151,34 @@ exports.DEFAULT_ATTACHMENT = {
143
151
  uploadState: 'completed',
144
152
  };
145
153
  exports.INVALID_ATTACHMENT = __assign(__assign({}, exports.DEFAULT_ATTACHMENT), { uploadState: 'something random' });
146
- exports.DEFAULT_COMMENT = {
154
+ exports.DEFAULT_RAW_COMMENT = {
147
155
  id: DEFAULT_COMMENT_ID,
156
+ postedUid: DEFAULT_USER_ID,
148
157
  content: DEFAULT_COMMENT_CONTENT,
149
- taskId: null,
150
- projectId: DEFAULT_PROJECT_ID,
151
- attachment: exports.DEFAULT_ATTACHMENT,
158
+ fileAttachment: exports.DEFAULT_ATTACHMENT,
159
+ uidsToNotify: null,
160
+ isDeleted: false,
152
161
  postedAt: DEFAULT_DATE,
162
+ reactions: DEFAULT_COMMENT_REACTIONS,
163
+ itemId: DEFAULT_TASK_ID,
153
164
  };
154
- exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: exports.INVALID_ATTACHMENT });
155
- exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.DEFAULT_COMMENT), { projectId: null, attachment: null });
156
- 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 }) });
157
- 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 });
@@ -238,19 +238,40 @@ export interface Project extends z.infer<typeof ProjectSchema> {
238
238
  export type ProjectViewStyle = 'list' | 'board' | 'calendar';
239
239
  export declare const SectionSchema: z.ZodObject<{
240
240
  id: z.ZodString;
241
- order: z.ZodNumber;
242
- name: z.ZodString;
241
+ userId: z.ZodString;
243
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;
244
251
  }, "strip", z.ZodTypeAny, {
245
252
  id: string;
246
253
  projectId: string;
247
- order: number;
248
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;
249
263
  }, {
250
264
  id: string;
251
265
  projectId: string;
252
- order: number;
253
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;
254
275
  }>;
255
276
  /**
256
277
  * Represents a section within a project, used to group tasks.
@@ -330,13 +351,167 @@ export declare const AttachmentSchema: z.ZodObject<z.objectUtil.extendShape<{
330
351
  */
331
352
  export interface Attachment extends z.infer<typeof AttachmentSchema> {
332
353
  }
333
- 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<{
334
509
  id: z.ZodString;
335
- taskId: z.ZodNullable<z.ZodString>;
336
- projectId: z.ZodNullable<z.ZodString>;
510
+ itemId: z.ZodOptional<z.ZodString>;
511
+ projectId: z.ZodOptional<z.ZodString>;
337
512
  content: z.ZodString;
338
513
  postedAt: z.ZodString;
339
- attachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
514
+ fileAttachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
340
515
  resourceType: z.ZodString;
341
516
  }, {
342
517
  fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -377,13 +552,113 @@ export declare const CommentSchema: z.ZodObject<{
377
552
  imageHeight?: number | null | undefined;
378
553
  title?: string | null | undefined;
379
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;
380
559
  }, "strip", z.ZodTypeAny, {
381
560
  id: string;
382
- projectId: string | null;
383
561
  content: string;
384
- 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;
385
660
  postedAt: string;
386
- attachment: {
661
+ fileAttachment: {
387
662
  resourceType: string;
388
663
  url?: string | null | undefined;
389
664
  fileName?: string | null | undefined;
@@ -397,13 +672,16 @@ export declare const CommentSchema: z.ZodObject<{
397
672
  imageHeight?: number | null | undefined;
398
673
  title?: string | null | undefined;
399
674
  } | null;
675
+ postedUid: string;
676
+ uidsToNotify: string[] | null;
677
+ reactions: Record<string, string[]> | null;
678
+ projectId?: string | undefined;
400
679
  }, {
401
680
  id: string;
402
- projectId: string | null;
403
681
  content: string;
404
- taskId: string | null;
682
+ isDeleted: boolean;
405
683
  postedAt: string;
406
- attachment: {
684
+ fileAttachment: {
407
685
  resourceType: string;
408
686
  url?: string | null | undefined;
409
687
  fileName?: string | null | undefined;
@@ -417,6 +695,11 @@ export declare const CommentSchema: z.ZodObject<{
417
695
  imageHeight?: number | null | undefined;
418
696
  title?: string | null | undefined;
419
697
  } | null;
698
+ postedUid: string;
699
+ uidsToNotify: string[] | null;
700
+ reactions: Record<string, string[]> | null;
701
+ projectId?: string | undefined;
702
+ itemId?: string | undefined;
420
703
  }>;
421
704
  /**
422
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({
@@ -56,9 +78,16 @@ exports.ProjectSchema = zod_1.z.object({
56
78
  });
57
79
  exports.SectionSchema = zod_1.z.object({
58
80
  id: zod_1.z.string(),
59
- order: zod_1.z.number().int(),
60
- name: zod_1.z.string(),
81
+ userId: zod_1.z.string(),
61
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(),
62
91
  });
63
92
  exports.LabelSchema = zod_1.z.object({
64
93
  id: zod_1.z.string(),
@@ -84,13 +113,31 @@ exports.AttachmentSchema = zod_1.z
84
113
  url: zod_1.z.string().nullable().optional(),
85
114
  title: zod_1.z.string().nullable().optional(),
86
115
  });
87
- exports.CommentSchema = zod_1.z.object({
116
+ exports.RawCommentSchema = zod_1.z
117
+ .object({
88
118
  id: zod_1.z.string(),
89
- taskId: zod_1.z.string().nullable(),
90
- projectId: zod_1.z.string().nullable(),
119
+ itemId: zod_1.z.string().optional(),
120
+ projectId: zod_1.z.string().optional(),
91
121
  content: zod_1.z.string(),
92
122
  postedAt: zod_1.z.string(),
93
- 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 });
94
141
  });
95
142
  exports.UserSchema = zod_1.z.object({
96
143
  id: zod_1.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "4.0.0-alpha.6",
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",