@doist/todoist-api-typescript 2.0.0 → 2.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.
package/README.md CHANGED
@@ -24,7 +24,7 @@ api.getTasks()
24
24
 
25
25
  ### Documentation
26
26
 
27
- For more detailed reference documentation, have a look at the [API documentation with TypeScript examples](https://developer.todoist.com/rest/v1/?javascript).
27
+ For more detailed reference documentation, have a look at the [API documentation with TypeScript examples](https://developer.todoist.com/rest/v2/?javascript).
28
28
 
29
29
  ## Development and Testing
30
30
 
@@ -5,29 +5,29 @@ export declare class TodoistApi {
5
5
  constructor(authToken: string, baseUrl?: string);
6
6
  private restApiBase;
7
7
  private syncApiBase;
8
- getTask(id: number): Promise<Task>;
8
+ getTask(id: string): Promise<Task>;
9
9
  getTasks(args?: GetTasksArgs): Promise<Task[]>;
10
10
  addTask(args: AddTaskArgs, requestId?: string): Promise<Task>;
11
11
  quickAddTask(args: QuickAddTaskArgs): Promise<Task>;
12
- updateTask(id: number, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
13
- closeTask(id: number, requestId?: string): Promise<boolean>;
14
- reopenTask(id: number, requestId?: string): Promise<boolean>;
15
- deleteTask(id: number, requestId?: string): Promise<boolean>;
16
- getProject(id: number): Promise<Project>;
12
+ updateTask(id: string, args: UpdateTaskArgs, requestId?: string): Promise<Task>;
13
+ closeTask(id: string, requestId?: string): Promise<boolean>;
14
+ reopenTask(id: string, requestId?: string): Promise<boolean>;
15
+ deleteTask(id: string, requestId?: string): Promise<boolean>;
16
+ getProject(id: string): Promise<Project>;
17
17
  getProjects(): Promise<Project[]>;
18
18
  addProject(args: AddProjectArgs, requestId?: string): Promise<Project>;
19
- updateProject(id: number, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
20
- deleteProject(id: number, requestId?: string): Promise<boolean>;
21
- getProjectCollaborators(projectId: number): Promise<User[]>;
19
+ updateProject(id: string, args: UpdateProjectArgs, requestId?: string): Promise<Project>;
20
+ deleteProject(id: string, requestId?: string): Promise<boolean>;
21
+ getProjectCollaborators(projectId: string): Promise<User[]>;
22
22
  getSections(projectId?: number): Promise<Section[]>;
23
- getSection(id: number): Promise<Section>;
23
+ getSection(id: string): Promise<Section>;
24
24
  addSection(args: AddSectionArgs, requestId?: string): Promise<Section>;
25
- updateSection(id: number, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
26
- deleteSection(id: number, requestId?: string): Promise<boolean>;
25
+ updateSection(id: string, args: UpdateSectionArgs, requestId?: string): Promise<Section>;
26
+ deleteSection(id: string, requestId?: string): Promise<boolean>;
27
27
  /**
28
28
  * Fetches a personal label
29
29
  */
30
- getLabel(id: number): Promise<Label>;
30
+ getLabel(id: string): Promise<Label>;
31
31
  /**
32
32
  * Fetches the personal labels
33
33
  */
@@ -39,17 +39,17 @@ export declare class TodoistApi {
39
39
  /**
40
40
  * Updates a personal label
41
41
  */
42
- updateLabel(id: number, args: UpdateLabelArgs, requestId?: string): Promise<Label>;
42
+ updateLabel(id: string, args: UpdateLabelArgs, requestId?: string): Promise<Label>;
43
43
  /**
44
44
  * Deletes a personal label
45
45
  */
46
- deleteLabel(id: number, requestId?: string): Promise<boolean>;
46
+ deleteLabel(id: string, requestId?: string): Promise<boolean>;
47
47
  getSharedLabels(): Promise<string[]>;
48
48
  renameSharedLabel(args: RenameSharedLabelArgs): Promise<void>;
49
49
  removeSharedLabel(args: RemoveSharedLabelArgs): Promise<void>;
50
50
  getComments(args: GetTaskCommentsArgs | GetProjectCommentsArgs): Promise<Comment[]>;
51
- getComment(id: number): Promise<Comment>;
51
+ getComment(id: string): Promise<Comment>;
52
52
  addComment(args: AddTaskCommentArgs | AddProjectCommentArgs, requestId?: string): Promise<Comment>;
53
- updateComment(id: number, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
54
- deleteComment(id: number, requestId?: string): Promise<boolean>;
53
+ updateComment(id: string, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
54
+ deleteComment(id: string, requestId?: string): Promise<boolean>;
55
55
  }
@@ -37,7 +37,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.TodoistApi = void 0;
40
- var entities_1 = require("./types/entities");
40
+ var runtypes_1 = require("runtypes");
41
41
  var restClient_1 = require("./restClient");
42
42
  var taskConverters_1 = require("./utils/taskConverters");
43
43
  var endpoints_1 = require("./consts/endpoints");
@@ -66,8 +66,8 @@ var TodoistApi = /** @class */ (function () {
66
66
  return __generator(this, function (_a) {
67
67
  switch (_a.label) {
68
68
  case 0:
69
- entities_1.Int.check(id);
70
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(id)), this.authToken)];
69
+ runtypes_1.String.check(id);
70
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken)];
71
71
  case 1:
72
72
  response = _a.sent();
73
73
  return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
@@ -121,8 +121,8 @@ var TodoistApi = /** @class */ (function () {
121
121
  return __generator(this, function (_a) {
122
122
  switch (_a.label) {
123
123
  case 0:
124
- entities_1.Int.check(id);
125
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(id)), this.authToken, args, requestId)];
124
+ runtypes_1.String.check(id);
125
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, args, requestId)];
126
126
  case 1:
127
127
  response = _a.sent();
128
128
  return [2 /*return*/, (0, validators_1.validateTask)(response.data)];
@@ -136,8 +136,8 @@ var TodoistApi = /** @class */ (function () {
136
136
  return __generator(this, function (_a) {
137
137
  switch (_a.label) {
138
138
  case 0:
139
- entities_1.Int.check(id);
140
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(id), endpoints_1.ENDPOINT_REST_TASK_CLOSE), this.authToken, undefined, requestId)];
139
+ runtypes_1.String.check(id);
140
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_CLOSE), this.authToken, undefined, requestId)];
141
141
  case 1:
142
142
  response = _a.sent();
143
143
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -151,8 +151,8 @@ var TodoistApi = /** @class */ (function () {
151
151
  return __generator(this, function (_a) {
152
152
  switch (_a.label) {
153
153
  case 0:
154
- entities_1.Int.check(id);
155
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(id), endpoints_1.ENDPOINT_REST_TASK_REOPEN), this.authToken, undefined, requestId)];
154
+ runtypes_1.String.check(id);
155
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id, endpoints_1.ENDPOINT_REST_TASK_REOPEN), this.authToken, undefined, requestId)];
156
156
  case 1:
157
157
  response = _a.sent();
158
158
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -166,8 +166,8 @@ var TodoistApi = /** @class */ (function () {
166
166
  return __generator(this, function (_a) {
167
167
  switch (_a.label) {
168
168
  case 0:
169
- entities_1.Int.check(id);
170
- return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, String(id)), this.authToken, undefined, requestId)];
169
+ runtypes_1.String.check(id);
170
+ return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, undefined, requestId)];
171
171
  case 1:
172
172
  response = _a.sent();
173
173
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -181,8 +181,8 @@ var TodoistApi = /** @class */ (function () {
181
181
  return __generator(this, function (_a) {
182
182
  switch (_a.label) {
183
183
  case 0:
184
- entities_1.Int.check(id);
185
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, String(id)), this.authToken)];
184
+ runtypes_1.String.check(id);
185
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken)];
186
186
  case 1:
187
187
  response = _a.sent();
188
188
  return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
@@ -222,8 +222,8 @@ var TodoistApi = /** @class */ (function () {
222
222
  return __generator(this, function (_a) {
223
223
  switch (_a.label) {
224
224
  case 0:
225
- entities_1.Int.check(id);
226
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, String(id)), this.authToken, args, requestId)];
225
+ runtypes_1.String.check(id);
226
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, args, requestId)];
227
227
  case 1:
228
228
  response = _a.sent();
229
229
  return [2 /*return*/, (0, validators_1.validateProject)(response.data)];
@@ -237,8 +237,8 @@ var TodoistApi = /** @class */ (function () {
237
237
  return __generator(this, function (_a) {
238
238
  switch (_a.label) {
239
239
  case 0:
240
- entities_1.Int.check(id);
241
- return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, String(id)), this.authToken, requestId)];
240
+ runtypes_1.String.check(id);
241
+ return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, requestId)];
242
242
  case 1:
243
243
  response = _a.sent();
244
244
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -252,8 +252,8 @@ var TodoistApi = /** @class */ (function () {
252
252
  return __generator(this, function (_a) {
253
253
  switch (_a.label) {
254
254
  case 0:
255
- entities_1.Int.check(projectId);
256
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, String(projectId), endpoints_1.ENDPOINT_REST_PROJECT_COLLABORATORS), this.authToken)];
255
+ runtypes_1.String.check(projectId);
256
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, projectId, endpoints_1.ENDPOINT_REST_PROJECT_COLLABORATORS), this.authToken)];
257
257
  case 1:
258
258
  response = _a.sent();
259
259
  return [2 /*return*/, (0, validators_1.validateUserArray)(response.data)];
@@ -280,8 +280,8 @@ var TodoistApi = /** @class */ (function () {
280
280
  return __generator(this, function (_a) {
281
281
  switch (_a.label) {
282
282
  case 0:
283
- entities_1.Int.check(id);
284
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, String(id)), this.authToken)];
283
+ runtypes_1.String.check(id);
284
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken)];
285
285
  case 1:
286
286
  response = _a.sent();
287
287
  return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
@@ -308,8 +308,8 @@ var TodoistApi = /** @class */ (function () {
308
308
  return __generator(this, function (_a) {
309
309
  switch (_a.label) {
310
310
  case 0:
311
- entities_1.Int.check(id);
312
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, String(id)), this.authToken, args, requestId)];
311
+ runtypes_1.String.check(id);
312
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, args, requestId)];
313
313
  case 1:
314
314
  response = _a.sent();
315
315
  return [2 /*return*/, (0, validators_1.validateSection)(response.data)];
@@ -323,8 +323,8 @@ var TodoistApi = /** @class */ (function () {
323
323
  return __generator(this, function (_a) {
324
324
  switch (_a.label) {
325
325
  case 0:
326
- entities_1.Int.check(id);
327
- return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, String(id)), this.authToken, undefined, requestId)];
326
+ runtypes_1.String.check(id);
327
+ return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_SECTIONS, id), this.authToken, undefined, requestId)];
328
328
  case 1:
329
329
  response = _a.sent();
330
330
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -341,8 +341,8 @@ var TodoistApi = /** @class */ (function () {
341
341
  return __generator(this, function (_a) {
342
342
  switch (_a.label) {
343
343
  case 0:
344
- entities_1.Int.check(id);
345
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, String(id)), this.authToken)];
344
+ runtypes_1.String.check(id);
345
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken)];
346
346
  case 1:
347
347
  response = _a.sent();
348
348
  return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
@@ -391,8 +391,8 @@ var TodoistApi = /** @class */ (function () {
391
391
  return __generator(this, function (_a) {
392
392
  switch (_a.label) {
393
393
  case 0:
394
- entities_1.Int.check(id);
395
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, String(id)), this.authToken, args, requestId)];
394
+ runtypes_1.String.check(id);
395
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, args, requestId)];
396
396
  case 1:
397
397
  response = _a.sent();
398
398
  return [2 /*return*/, (0, validators_1.validateLabel)(response.data)];
@@ -409,8 +409,8 @@ var TodoistApi = /** @class */ (function () {
409
409
  return __generator(this, function (_a) {
410
410
  switch (_a.label) {
411
411
  case 0:
412
- entities_1.Int.check(id);
413
- return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, String(id)), this.authToken, undefined, requestId)];
412
+ runtypes_1.String.check(id);
413
+ return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_LABELS, id), this.authToken, undefined, requestId)];
414
414
  case 1:
415
415
  response = _a.sent();
416
416
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -474,8 +474,8 @@ var TodoistApi = /** @class */ (function () {
474
474
  return __generator(this, function (_a) {
475
475
  switch (_a.label) {
476
476
  case 0:
477
- entities_1.Int.check(id);
478
- return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, String(id)), this.authToken)];
477
+ runtypes_1.String.check(id);
478
+ return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken)];
479
479
  case 1:
480
480
  response = _a.sent();
481
481
  return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
@@ -502,8 +502,8 @@ var TodoistApi = /** @class */ (function () {
502
502
  return __generator(this, function (_a) {
503
503
  switch (_a.label) {
504
504
  case 0:
505
- entities_1.Int.check(id);
506
- return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, String(id)), this.authToken, args, requestId)];
505
+ runtypes_1.String.check(id);
506
+ return [4 /*yield*/, (0, restClient_1.request)('POST', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, args, requestId)];
507
507
  case 1:
508
508
  response = _a.sent();
509
509
  return [2 /*return*/, (0, validators_1.validateComment)(response.data)];
@@ -517,8 +517,8 @@ var TodoistApi = /** @class */ (function () {
517
517
  return __generator(this, function (_a) {
518
518
  switch (_a.label) {
519
519
  case 0:
520
- entities_1.Int.check(id);
521
- return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, String(id)), this.authToken, undefined, requestId)];
520
+ runtypes_1.String.check(id);
521
+ return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_COMMENTS, id), this.authToken, undefined, requestId)];
522
522
  case 1:
523
523
  response = _a.sent();
524
524
  return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
@@ -1,7 +1,7 @@
1
1
  import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment } from '../types';
2
2
  export declare const DEFAULT_AUTH_TOKEN = "AToken";
3
3
  export declare const DEFAULT_REQUEST_ID = "ARequestID";
4
- export declare const INVALID_ENTITY_ID: number;
4
+ export declare const INVALID_ENTITY_ID = 1234;
5
5
  export declare const DEFAULT_DUE_DATE: {
6
6
  isRecurring: boolean;
7
7
  string: string;
@@ -32,11 +32,12 @@ export declare const INVALID_TASK: {
32
32
  createdAt: string;
33
33
  url: string;
34
34
  creatorId: string;
35
- assigneeId?: string | undefined;
36
- assignerId?: string | undefined;
37
- parentId?: string | undefined;
38
- sectionId?: string | undefined;
35
+ assigneeId?: string | null | undefined;
36
+ assignerId?: string | null | undefined;
37
+ parentId?: string | null | undefined;
38
+ sectionId?: string | null | undefined;
39
39
  };
40
+ export declare const TASK_WITH_OPTIONALS_AS_NULL: Task;
40
41
  export declare const DEFAULT_PROJECT: Project;
41
42
  export declare const INVALID_PROJECT: {
42
43
  name: number;
@@ -50,8 +51,9 @@ export declare const INVALID_PROJECT: {
50
51
  isInboxProject: boolean;
51
52
  isTeamInbox: boolean;
52
53
  viewStyle: string;
53
- parentId?: string | undefined;
54
+ parentId?: string | null | undefined;
54
55
  };
56
+ export declare const PROJECT_WITH_OPTIONALS_AS_NULL: Project;
55
57
  export declare const DEFAULT_SECTION: Section;
56
58
  export declare const INVALID_SECTION: {
57
59
  projectId: undefined;
@@ -77,36 +79,39 @@ export declare const DEFAULT_ATTACHMENT: Attachment;
77
79
  export declare const INVALID_ATTACHMENT: {
78
80
  uploadState: string;
79
81
  resourceType: string;
80
- fileName?: string | undefined;
81
- fileSize?: number | undefined;
82
- fileType?: string | undefined;
83
- fileUrl?: string | undefined;
84
- fileDuration?: number | undefined;
85
- image?: string | undefined;
86
- imageWidth?: number | undefined;
87
- imageHeight?: number | undefined;
88
- url?: string | undefined;
89
- title?: string | undefined;
82
+ fileName?: string | null | undefined;
83
+ fileSize?: number | null | undefined;
84
+ fileType?: string | null | undefined;
85
+ fileUrl?: string | null | undefined;
86
+ fileDuration?: number | null | undefined;
87
+ image?: string | null | undefined;
88
+ imageWidth?: number | null | undefined;
89
+ imageHeight?: number | null | undefined;
90
+ url?: string | null | undefined;
91
+ title?: string | null | undefined;
90
92
  };
91
93
  export declare const DEFAULT_COMMENT: Comment;
92
94
  export declare const INVALID_COMMENT: {
93
95
  attachment: {
94
96
  uploadState: string;
95
97
  resourceType: string;
96
- fileName?: string | undefined;
97
- fileSize?: number | undefined;
98
- fileType?: string | undefined;
99
- fileUrl?: string | undefined;
100
- fileDuration?: number | undefined;
101
- image?: string | undefined;
102
- imageWidth?: number | undefined;
103
- imageHeight?: number | undefined;
104
- url?: string | undefined;
105
- title?: string | undefined;
98
+ fileName?: string | null | undefined;
99
+ fileSize?: number | null | undefined;
100
+ fileType?: string | null | undefined;
101
+ fileUrl?: string | null | undefined;
102
+ fileDuration?: number | null | undefined;
103
+ image?: string | null | undefined;
104
+ imageWidth?: number | null | undefined;
105
+ imageHeight?: number | null | undefined;
106
+ url?: string | null | undefined;
107
+ title?: string | null | undefined;
106
108
  };
107
109
  id: string;
108
110
  content: string;
109
111
  postedAt: string;
110
- taskId?: string | undefined;
111
- projectId?: string | undefined;
112
+ taskId?: string | null | undefined;
113
+ projectId?: string | null | undefined;
112
114
  };
115
+ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: Comment;
116
+ export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: Comment;
117
+ 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.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.INVALID_PROJECT = exports.DEFAULT_PROJECT = exports.INVALID_TASK = exports.DEFAULT_TASK = exports.DEFAULT_QUICK_ADD_RESPONSE = exports.INVALID_DUE_DATE = 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.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.INVALID_DUE_DATE = 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';
@@ -37,7 +37,7 @@ var DEFAULT_COMMENT_ID = '4';
37
37
  var DEFAULT_COMMENT_CONTENT = 'A comment';
38
38
  exports.DEFAULT_AUTH_TOKEN = 'AToken';
39
39
  exports.DEFAULT_REQUEST_ID = 'ARequestID';
40
- exports.INVALID_ENTITY_ID = 'invalid/entity/id';
40
+ exports.INVALID_ENTITY_ID = 1234;
41
41
  exports.DEFAULT_DUE_DATE = {
42
42
  isRecurring: false,
43
43
  string: 'a date string',
@@ -85,6 +85,7 @@ exports.DEFAULT_TASK = {
85
85
  creatorId: DEFAULT_CREATOR,
86
86
  };
87
87
  exports.INVALID_TASK = __assign(__assign({}, exports.DEFAULT_TASK), { due: exports.INVALID_DUE_DATE });
88
+ exports.TASK_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_TASK), { due: null, assigneeId: null, assignerId: null, parentId: null, sectionId: null });
88
89
  exports.DEFAULT_PROJECT = {
89
90
  id: DEFAULT_PROJECT_ID,
90
91
  name: DEFAULT_PROJECT_NAME,
@@ -100,6 +101,7 @@ exports.DEFAULT_PROJECT = {
100
101
  url: "https://todoist.com/showProject?id=123",
101
102
  };
102
103
  exports.INVALID_PROJECT = __assign(__assign({}, exports.DEFAULT_PROJECT), { name: 123 });
104
+ exports.PROJECT_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_PROJECT), { parentId: null });
103
105
  exports.DEFAULT_SECTION = {
104
106
  id: DEFAULT_SECTION_ID,
105
107
  name: DEFAULT_SECTION_NAME,
@@ -136,3 +138,6 @@ exports.DEFAULT_COMMENT = {
136
138
  postedAt: DEFAULT_DATE,
137
139
  };
138
140
  exports.INVALID_COMMENT = __assign(__assign({}, exports.DEFAULT_COMMENT), { attachment: exports.INVALID_ATTACHMENT });
141
+ exports.COMMENT_WITH_OPTIONALS_AS_NULL_TASK = __assign(__assign({}, exports.DEFAULT_COMMENT), { projectId: null, attachment: null });
142
+ 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 }) });
143
+ exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.DEFAULT_COMMENT), { taskId: null, attachment: null });
@@ -1,7 +1,7 @@
1
1
  import { Boolean, Number as NumberRunType, String, Array, Record, Static, Partial, Literal, Union } from 'runtypes';
2
2
  export declare const Int: import("runtypes").Constraint<NumberRunType, number, unknown>;
3
3
  export declare type TodoistEntity = {
4
- id: number;
4
+ id: string;
5
5
  };
6
6
  export declare type OrderedEntity = TodoistEntity & {
7
7
  order: number;
@@ -14,8 +14,8 @@ export declare const DueDate: import("runtypes").Intersect<[Record<{
14
14
  string: String;
15
15
  date: String;
16
16
  }, false>, Partial<{
17
- datetime: String;
18
- timezone: String;
17
+ datetime: Union<[String, Literal<null>]>;
18
+ timezone: Union<[String, Literal<null>]>;
19
19
  }, false>]>;
20
20
  export declare type DueDate = Static<typeof DueDate>;
21
21
  export declare const Task: import("runtypes").Intersect<[Record<{
@@ -32,18 +32,18 @@ export declare const Task: import("runtypes").Intersect<[Record<{
32
32
  url: String;
33
33
  creatorId: String;
34
34
  }, false>, Partial<{
35
- due: import("runtypes").Intersect<[Record<{
35
+ due: Union<[import("runtypes").Intersect<[Record<{
36
36
  isRecurring: Boolean;
37
37
  string: String;
38
38
  date: String;
39
39
  }, false>, Partial<{
40
- datetime: String;
41
- timezone: String;
42
- }, false>]>;
43
- assigneeId: String;
44
- assignerId: String;
45
- parentId: String;
46
- sectionId: String;
40
+ datetime: Union<[String, Literal<null>]>;
41
+ timezone: Union<[String, Literal<null>]>;
42
+ }, false>]>, Literal<null>]>;
43
+ assigneeId: Union<[String, Literal<null>]>;
44
+ assignerId: Union<[String, Literal<null>]>;
45
+ parentId: Union<[String, Literal<null>]>;
46
+ sectionId: Union<[String, Literal<null>]>;
47
47
  }, false>]>;
48
48
  export declare type Task = Static<typeof Task>;
49
49
  export declare const Project: import("runtypes").Intersect<[Record<{
@@ -59,7 +59,7 @@ export declare const Project: import("runtypes").Intersect<[Record<{
59
59
  order: import("runtypes").Constraint<NumberRunType, number, unknown>;
60
60
  viewStyle: String;
61
61
  }, false>, Partial<{
62
- parentId: String;
62
+ parentId: Union<[String, Literal<null>]>;
63
63
  }, false>]>;
64
64
  export declare type Project = Static<typeof Project>;
65
65
  export declare const Section: Record<{
@@ -80,17 +80,17 @@ export declare type Label = Static<typeof Label>;
80
80
  export declare const Attachment: import("runtypes").Intersect<[Record<{
81
81
  resourceType: String;
82
82
  }, false>, Partial<{
83
- fileName: String;
84
- fileSize: import("runtypes").Constraint<NumberRunType, number, unknown>;
85
- fileType: String;
86
- fileUrl: String;
87
- fileDuration: import("runtypes").Constraint<NumberRunType, number, unknown>;
88
- uploadState: Union<[Literal<"pending">, Literal<"completed">]>;
89
- image: String;
90
- imageWidth: import("runtypes").Constraint<NumberRunType, number, unknown>;
91
- imageHeight: import("runtypes").Constraint<NumberRunType, number, unknown>;
92
- url: String;
93
- title: String;
83
+ fileName: Union<[String, Literal<null>]>;
84
+ fileSize: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
85
+ fileType: Union<[String, Literal<null>]>;
86
+ fileUrl: Union<[String, Literal<null>]>;
87
+ fileDuration: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
88
+ uploadState: Union<[Union<[Literal<"pending">, Literal<"completed">]>, Literal<null>]>;
89
+ image: Union<[String, Literal<null>]>;
90
+ imageWidth: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
91
+ imageHeight: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
92
+ url: Union<[String, Literal<null>]>;
93
+ title: Union<[String, Literal<null>]>;
94
94
  }, false>]>;
95
95
  export declare type Attachment = Static<typeof Attachment>;
96
96
  export declare const Comment: import("runtypes").Intersect<[Record<{
@@ -98,23 +98,23 @@ export declare const Comment: import("runtypes").Intersect<[Record<{
98
98
  content: String;
99
99
  postedAt: String;
100
100
  }, false>, Partial<{
101
- taskId: String;
102
- projectId: String;
103
- attachment: import("runtypes").Intersect<[Record<{
101
+ taskId: Union<[String, Literal<null>]>;
102
+ projectId: Union<[String, Literal<null>]>;
103
+ attachment: Union<[import("runtypes").Intersect<[Record<{
104
104
  resourceType: String;
105
105
  }, false>, Partial<{
106
- fileName: String;
107
- fileSize: import("runtypes").Constraint<NumberRunType, number, unknown>;
108
- fileType: String;
109
- fileUrl: String;
110
- fileDuration: import("runtypes").Constraint<NumberRunType, number, unknown>;
111
- uploadState: Union<[Literal<"pending">, Literal<"completed">]>;
112
- image: String;
113
- imageWidth: import("runtypes").Constraint<NumberRunType, number, unknown>;
114
- imageHeight: import("runtypes").Constraint<NumberRunType, number, unknown>;
115
- url: String;
116
- title: String;
117
- }, false>]>;
106
+ fileName: Union<[String, Literal<null>]>;
107
+ fileSize: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
108
+ fileType: Union<[String, Literal<null>]>;
109
+ fileUrl: Union<[String, Literal<null>]>;
110
+ fileDuration: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
111
+ uploadState: Union<[Union<[Literal<"pending">, Literal<"completed">]>, Literal<null>]>;
112
+ image: Union<[String, Literal<null>]>;
113
+ imageWidth: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
114
+ imageHeight: Union<[import("runtypes").Constraint<NumberRunType, number, unknown>, Literal<null>]>;
115
+ url: Union<[String, Literal<null>]>;
116
+ title: Union<[String, Literal<null>]>;
117
+ }, false>]>, Literal<null>]>;
118
118
  }, false>]>;
119
119
  export declare type Comment = Static<typeof Comment>;
120
120
  export declare const User: Record<{
@@ -123,7 +123,8 @@ export declare const User: Record<{
123
123
  email: String;
124
124
  }, false>;
125
125
  export declare type User = Static<typeof User>;
126
- export declare type Color = TodoistEntity & {
126
+ export declare type Color = {
127
+ id: number;
127
128
  name: string;
128
129
  value: string;
129
130
  };
@@ -8,8 +8,8 @@ exports.DueDate = (0, runtypes_1.Record)({
8
8
  string: runtypes_1.String,
9
9
  date: runtypes_1.String,
10
10
  }).And((0, runtypes_1.Partial)({
11
- datetime: runtypes_1.String,
12
- timezone: runtypes_1.String,
11
+ datetime: runtypes_1.String.Or(runtypes_1.Null),
12
+ timezone: runtypes_1.String.Or(runtypes_1.Null),
13
13
  }));
14
14
  exports.Task = (0, runtypes_1.Record)({
15
15
  id: runtypes_1.String,
@@ -25,11 +25,11 @@ exports.Task = (0, runtypes_1.Record)({
25
25
  url: runtypes_1.String,
26
26
  creatorId: runtypes_1.String,
27
27
  }).And((0, runtypes_1.Partial)({
28
- due: exports.DueDate,
29
- assigneeId: runtypes_1.String,
30
- assignerId: runtypes_1.String,
31
- parentId: runtypes_1.String,
32
- sectionId: runtypes_1.String,
28
+ due: exports.DueDate.Or(runtypes_1.Null),
29
+ assigneeId: runtypes_1.String.Or(runtypes_1.Null),
30
+ assignerId: runtypes_1.String.Or(runtypes_1.Null),
31
+ parentId: runtypes_1.String.Or(runtypes_1.Null),
32
+ sectionId: runtypes_1.String.Or(runtypes_1.Null),
33
33
  }));
34
34
  exports.Project = (0, runtypes_1.Record)({
35
35
  id: runtypes_1.String,
@@ -44,7 +44,7 @@ exports.Project = (0, runtypes_1.Record)({
44
44
  order: exports.Int,
45
45
  viewStyle: runtypes_1.String,
46
46
  }).And((0, runtypes_1.Partial)({
47
- parentId: runtypes_1.String,
47
+ parentId: runtypes_1.String.Or(runtypes_1.Null),
48
48
  }));
49
49
  exports.Section = (0, runtypes_1.Record)({
50
50
  id: runtypes_1.String,
@@ -62,26 +62,26 @@ exports.Label = (0, runtypes_1.Record)({
62
62
  exports.Attachment = (0, runtypes_1.Record)({
63
63
  resourceType: runtypes_1.String,
64
64
  }).And((0, runtypes_1.Partial)({
65
- fileName: runtypes_1.String,
66
- fileSize: exports.Int,
67
- fileType: runtypes_1.String,
68
- fileUrl: runtypes_1.String,
69
- fileDuration: exports.Int,
70
- uploadState: (0, runtypes_1.Union)((0, runtypes_1.Literal)('pending'), (0, runtypes_1.Literal)('completed')),
71
- image: runtypes_1.String,
72
- imageWidth: exports.Int,
73
- imageHeight: exports.Int,
74
- url: runtypes_1.String,
75
- title: runtypes_1.String,
65
+ fileName: runtypes_1.String.Or(runtypes_1.Null),
66
+ fileSize: exports.Int.Or(runtypes_1.Null),
67
+ fileType: runtypes_1.String.Or(runtypes_1.Null),
68
+ fileUrl: runtypes_1.String.Or(runtypes_1.Null),
69
+ fileDuration: exports.Int.Or(runtypes_1.Null),
70
+ uploadState: (0, runtypes_1.Union)((0, runtypes_1.Literal)('pending'), (0, runtypes_1.Literal)('completed')).Or(runtypes_1.Null),
71
+ image: runtypes_1.String.Or(runtypes_1.Null),
72
+ imageWidth: exports.Int.Or(runtypes_1.Null),
73
+ imageHeight: exports.Int.Or(runtypes_1.Null),
74
+ url: runtypes_1.String.Or(runtypes_1.Null),
75
+ title: runtypes_1.String.Or(runtypes_1.Null),
76
76
  }));
77
77
  exports.Comment = (0, runtypes_1.Record)({
78
78
  id: runtypes_1.String,
79
79
  content: runtypes_1.String,
80
80
  postedAt: runtypes_1.String,
81
81
  }).And((0, runtypes_1.Partial)({
82
- taskId: runtypes_1.String,
83
- projectId: runtypes_1.String,
84
- attachment: exports.Attachment,
82
+ taskId: runtypes_1.String.Or(runtypes_1.Null),
83
+ projectId: runtypes_1.String.Or(runtypes_1.Null),
84
+ attachment: exports.Attachment.Or(runtypes_1.Null),
85
85
  }));
86
86
  exports.User = (0, runtypes_1.Record)({
87
87
  id: runtypes_1.String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
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",
@@ -37,8 +37,8 @@
37
37
  "@types/axios": "0.14.0",
38
38
  "@types/jest": "27.5.2",
39
39
  "@types/uuid": "8.3.4",
40
- "@typescript-eslint/eslint-plugin": "5.36.1",
41
- "@typescript-eslint/parser": "5.36.1",
40
+ "@typescript-eslint/eslint-plugin": "5.36.2",
41
+ "@typescript-eslint/parser": "5.36.2",
42
42
  "eslint": "8.23.0",
43
43
  "eslint-config-prettier": "8.5.0",
44
44
  "eslint-import-resolver-webpack": "0.13.2",