@doist/todoist-api-typescript 2.1.2 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { Task, Project, Label, User, Section, Comment } from './types/entities';
2
- import { AddLabelArgs, AddProjectArgs, AddSectionArgs, AddProjectCommentArgs, AddTaskArgs, AddTaskCommentArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/requests';
2
+ import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs } from './types/requests';
3
3
  export declare class TodoistApi {
4
4
  authToken: string;
5
5
  constructor(authToken: string, baseUrl?: string);
@@ -44,12 +44,12 @@ export declare class TodoistApi {
44
44
  * Deletes a personal label
45
45
  */
46
46
  deleteLabel(id: string, requestId?: string): Promise<boolean>;
47
- getSharedLabels(): Promise<string[]>;
47
+ getSharedLabels(args?: GetSharedLabelsArgs): 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
51
  getComment(id: string): Promise<Comment>;
52
- addComment(args: AddTaskCommentArgs | AddProjectCommentArgs, requestId?: string): Promise<Comment>;
52
+ addComment(args: AddCommentArgs, requestId?: string): Promise<Comment>;
53
53
  updateComment(id: string, args: UpdateCommentArgs, requestId?: string): Promise<Comment>;
54
54
  deleteComment(id: string, requestId?: string): Promise<boolean>;
55
55
  }
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -418,12 +418,12 @@ var TodoistApi = /** @class */ (function () {
418
418
  });
419
419
  });
420
420
  };
421
- TodoistApi.prototype.getSharedLabels = function () {
421
+ TodoistApi.prototype.getSharedLabels = function (args) {
422
422
  return __awaiter(this, void 0, void 0, function () {
423
423
  var response;
424
424
  return __generator(this, function (_a) {
425
425
  switch (_a.label) {
426
- case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED, this.authToken)];
426
+ case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, endpoints_1.ENDPOINT_REST_LABELS_SHARED, this.authToken, args)];
427
427
  case 1:
428
428
  response = _a.sent();
429
429
  return [2 /*return*/, response.data];
@@ -1,14 +1,14 @@
1
- export declare type Permission = 'task:add' | 'data:read' | 'data:read_write' | 'data:delete' | 'project:delete';
2
- export declare type AuthTokenResponse = {
1
+ export type Permission = 'task:add' | 'data:read' | 'data:read_write' | 'data:delete' | 'project:delete';
2
+ export type AuthTokenResponse = {
3
3
  accessToken: string;
4
- state: string;
4
+ tokenType: string;
5
5
  };
6
- export declare type AuthTokenRequestArgs = {
6
+ export type AuthTokenRequestArgs = {
7
7
  clientId: string;
8
8
  clientSecret: string;
9
9
  code: string;
10
10
  };
11
- export declare type RevokeAuthTokenRequestArgs = {
11
+ export type RevokeAuthTokenRequestArgs = {
12
12
  clientId: string;
13
13
  clientSecret: string;
14
14
  accessToken: string;
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
29
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
30
  if (y = 0, t) op = [op[0] & 2, t.value];
31
31
  switch (op[0]) {
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
18
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
19
  if (y = 0, t) op = [op[0] & 2, t.value];
20
20
  switch (op[0]) {
@@ -1,4 +1,4 @@
1
- import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment } from '../types';
1
+ import { Label, Project, QuickAddTaskResponse, Section, Task, User, Comment, Attachment, Duration } 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;
@@ -7,6 +7,7 @@ export declare const DEFAULT_DUE_DATE: {
7
7
  string: string;
8
8
  date: string;
9
9
  };
10
+ export declare const DEFAULT_DURATION: Duration;
10
11
  export declare const INVALID_DUE_DATE: {
11
12
  isRecurring: string;
12
13
  string: string;
@@ -32,6 +33,10 @@ export declare const INVALID_TASK: {
32
33
  createdAt: string;
33
34
  url: string;
34
35
  creatorId: string;
36
+ duration: {
37
+ amount: number;
38
+ unit: "minute" | "day";
39
+ } | null;
35
40
  assigneeId?: string | null | undefined;
36
41
  assignerId?: string | null | undefined;
37
42
  parentId?: string | null | undefined;
@@ -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.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_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';
@@ -43,6 +43,10 @@ exports.DEFAULT_DUE_DATE = {
43
43
  string: 'a date string',
44
44
  date: DEFAULT_DATE,
45
45
  };
46
+ exports.DEFAULT_DURATION = {
47
+ amount: 10,
48
+ unit: 'minute',
49
+ };
46
50
  exports.INVALID_DUE_DATE = __assign(__assign({}, exports.DEFAULT_DUE_DATE), { isRecurring: 'false' });
47
51
  exports.DEFAULT_QUICK_ADD_RESPONSE = {
48
52
  id: DEFAULT_TASK_ID,
@@ -58,6 +62,7 @@ exports.DEFAULT_QUICK_ADD_RESPONSE = {
58
62
  checked: false,
59
63
  addedAt: DEFAULT_DATE,
60
64
  addedByUid: DEFAULT_CREATOR,
65
+ duration: exports.DEFAULT_DURATION,
61
66
  due: {
62
67
  date: DEFAULT_DATE,
63
68
  timezone: null,
@@ -83,9 +88,10 @@ exports.DEFAULT_TASK = {
83
88
  due: exports.DEFAULT_DUE_DATE,
84
89
  assigneeId: DEFAULT_ASSIGNEE,
85
90
  creatorId: DEFAULT_CREATOR,
91
+ duration: exports.DEFAULT_DURATION,
86
92
  };
87
93
  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 });
94
+ exports.TASK_WITH_OPTIONALS_AS_NULL = __assign(__assign({}, exports.DEFAULT_TASK), { due: null, assigneeId: null, assignerId: null, parentId: null, sectionId: null, duration: null });
89
95
  exports.DEFAULT_PROJECT = {
90
96
  id: DEFAULT_PROJECT_ID,
91
97
  name: DEFAULT_PROJECT_NAME,
@@ -1,12 +1,12 @@
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
- export declare type TodoistEntity = {
3
+ export type TodoistEntity = {
4
4
  id: string;
5
5
  };
6
- export declare type OrderedEntity = TodoistEntity & {
6
+ export type OrderedEntity = TodoistEntity & {
7
7
  order: number;
8
8
  };
9
- export declare type EntityInHierarchy = OrderedEntity & {
9
+ export type EntityInHierarchy = OrderedEntity & {
10
10
  parentId?: string | null;
11
11
  };
12
12
  export declare const DueDate: import("runtypes").Intersect<[Record<{
@@ -16,8 +16,14 @@ export declare const DueDate: import("runtypes").Intersect<[Record<{
16
16
  }, false>, Partial<{
17
17
  datetime: Union<[String, Literal<null>]>;
18
18
  timezone: Union<[String, Literal<null>]>;
19
+ lang: Union<[String, Literal<null>]>;
19
20
  }, false>]>;
20
- export declare type DueDate = Static<typeof DueDate>;
21
+ export type DueDate = Static<typeof DueDate>;
22
+ export declare const Duration: Record<{
23
+ amount: import("runtypes").Constraint<NumberRunType, number, unknown>;
24
+ unit: Union<[Literal<"minute">, Literal<"day">]>;
25
+ }, false>;
26
+ export type Duration = Static<typeof Duration>;
21
27
  export declare const Task: import("runtypes").Intersect<[Record<{
22
28
  id: String;
23
29
  order: import("runtypes").Constraint<NumberRunType, number, unknown>;
@@ -31,6 +37,10 @@ export declare const Task: import("runtypes").Intersect<[Record<{
31
37
  createdAt: String;
32
38
  url: String;
33
39
  creatorId: String;
40
+ duration: Union<[Record<{
41
+ amount: import("runtypes").Constraint<NumberRunType, number, unknown>;
42
+ unit: Union<[Literal<"minute">, Literal<"day">]>;
43
+ }, false>, Literal<null>]>;
34
44
  }, false>, Partial<{
35
45
  due: Union<[import("runtypes").Intersect<[Record<{
36
46
  isRecurring: Boolean;
@@ -39,13 +49,14 @@ export declare const Task: import("runtypes").Intersect<[Record<{
39
49
  }, false>, Partial<{
40
50
  datetime: Union<[String, Literal<null>]>;
41
51
  timezone: Union<[String, Literal<null>]>;
52
+ lang: Union<[String, Literal<null>]>;
42
53
  }, false>]>, Literal<null>]>;
43
54
  assigneeId: Union<[String, Literal<null>]>;
44
55
  assignerId: Union<[String, Literal<null>]>;
45
56
  parentId: Union<[String, Literal<null>]>;
46
57
  sectionId: Union<[String, Literal<null>]>;
47
58
  }, false>]>;
48
- export declare type Task = Static<typeof Task>;
59
+ export type Task = Static<typeof Task>;
49
60
  export declare const Project: import("runtypes").Intersect<[Record<{
50
61
  id: String;
51
62
  name: String;
@@ -61,14 +72,15 @@ export declare const Project: import("runtypes").Intersect<[Record<{
61
72
  }, false>, Partial<{
62
73
  parentId: Union<[String, Literal<null>]>;
63
74
  }, false>]>;
64
- export declare type Project = Static<typeof Project>;
75
+ export type Project = Static<typeof Project>;
76
+ export type ProjectViewStyle = 'list' | 'board';
65
77
  export declare const Section: Record<{
66
78
  id: String;
67
79
  order: import("runtypes").Constraint<NumberRunType, number, unknown>;
68
80
  name: String;
69
81
  projectId: String;
70
82
  }, false>;
71
- export declare type Section = Static<typeof Section>;
83
+ export type Section = Static<typeof Section>;
72
84
  export declare const Label: Record<{
73
85
  id: String;
74
86
  order: import("runtypes").Constraint<NumberRunType, number, unknown>;
@@ -76,7 +88,7 @@ export declare const Label: Record<{
76
88
  color: String;
77
89
  isFavorite: Boolean;
78
90
  }, false>;
79
- export declare type Label = Static<typeof Label>;
91
+ export type Label = Static<typeof Label>;
80
92
  export declare const Attachment: import("runtypes").Intersect<[Record<{
81
93
  resourceType: String;
82
94
  }, false>, Partial<{
@@ -92,7 +104,7 @@ export declare const Attachment: import("runtypes").Intersect<[Record<{
92
104
  url: Union<[String, Literal<null>]>;
93
105
  title: Union<[String, Literal<null>]>;
94
106
  }, false>]>;
95
- export declare type Attachment = Static<typeof Attachment>;
107
+ export type Attachment = Static<typeof Attachment>;
96
108
  export declare const Comment: import("runtypes").Intersect<[Record<{
97
109
  id: String;
98
110
  content: String;
@@ -116,14 +128,14 @@ export declare const Comment: import("runtypes").Intersect<[Record<{
116
128
  title: Union<[String, Literal<null>]>;
117
129
  }, false>]>, Literal<null>]>;
118
130
  }, false>]>;
119
- export declare type Comment = Static<typeof Comment>;
131
+ export type Comment = Static<typeof Comment>;
120
132
  export declare const User: Record<{
121
133
  id: String;
122
134
  name: String;
123
135
  email: String;
124
136
  }, false>;
125
- export declare type User = Static<typeof User>;
126
- export declare type Color = {
137
+ export type User = Static<typeof User>;
138
+ export type Color = {
127
139
  /**
128
140
  * @deprecated No longer used
129
141
  */
@@ -149,7 +161,7 @@ export declare type Color = {
149
161
  */
150
162
  value: string;
151
163
  };
152
- export declare type QuickAddTaskResponse = {
164
+ export type QuickAddTaskResponse = {
153
165
  id: string;
154
166
  projectId: string;
155
167
  content: string;
@@ -163,6 +175,7 @@ export declare type QuickAddTaskResponse = {
163
175
  checked: boolean;
164
176
  addedAt: string;
165
177
  addedByUid: string | null;
178
+ duration: Duration | null;
166
179
  due: {
167
180
  date: string;
168
181
  timezone: string | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.User = exports.Comment = exports.Attachment = exports.Label = exports.Section = exports.Project = exports.Task = exports.DueDate = exports.Int = void 0;
3
+ exports.User = exports.Comment = exports.Attachment = exports.Label = exports.Section = exports.Project = exports.Task = exports.Duration = exports.DueDate = exports.Int = void 0;
4
4
  var runtypes_1 = require("runtypes");
5
5
  exports.Int = runtypes_1.Number.withConstraint(function (n) { return Number.isInteger(n) || "".concat(n, " is not a valid entity id. Should be a string"); });
6
6
  exports.DueDate = (0, runtypes_1.Record)({
@@ -10,7 +10,12 @@ exports.DueDate = (0, runtypes_1.Record)({
10
10
  }).And((0, runtypes_1.Partial)({
11
11
  datetime: runtypes_1.String.Or(runtypes_1.Null),
12
12
  timezone: runtypes_1.String.Or(runtypes_1.Null),
13
+ lang: runtypes_1.String.Or(runtypes_1.Null),
13
14
  }));
15
+ exports.Duration = (0, runtypes_1.Record)({
16
+ amount: runtypes_1.Number.withConstraint(function (n) { return n > 0 || 'Value should be greater than zero'; }),
17
+ unit: (0, runtypes_1.Union)((0, runtypes_1.Literal)('minute'), (0, runtypes_1.Literal)('day')),
18
+ });
14
19
  exports.Task = (0, runtypes_1.Record)({
15
20
  id: runtypes_1.String,
16
21
  order: exports.Int,
@@ -24,6 +29,7 @@ exports.Task = (0, runtypes_1.Record)({
24
29
  createdAt: runtypes_1.String,
25
30
  url: runtypes_1.String,
26
31
  creatorId: runtypes_1.String,
32
+ duration: exports.Duration.Or(runtypes_1.Null),
27
33
  }).And((0, runtypes_1.Partial)({
28
34
  due: exports.DueDate.Or(runtypes_1.Null),
29
35
  assigneeId: runtypes_1.String.Or(runtypes_1.Null),
@@ -1 +1 @@
1
- export declare type HttpMethod = 'POST' | 'GET' | 'DELETE';
1
+ export type HttpMethod = 'POST' | 'GET' | 'DELETE';
@@ -1,4 +1,6 @@
1
- export declare type AddTaskArgs = {
1
+ import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
2
+ import type { Duration, ProjectViewStyle } from './entities';
3
+ export type AddTaskArgs = {
2
4
  content: string;
3
5
  description?: string;
4
6
  projectId?: string;
@@ -7,19 +9,23 @@ export declare type AddTaskArgs = {
7
9
  order?: number;
8
10
  labels?: string[];
9
11
  priority?: number;
10
- dueString?: string;
11
12
  dueLang?: string;
13
+ assigneeId?: string;
14
+ dueString?: string;
15
+ } & RequireOneOrNone<{
12
16
  dueDate?: string;
13
17
  dueDatetime?: string;
14
- assigneeId?: string;
15
- };
16
- export declare type QuickAddTaskArgs = {
18
+ }> & RequireAllOrNone<{
19
+ duration?: Duration['amount'];
20
+ durationUnit?: Duration['unit'];
21
+ }>;
22
+ export type QuickAddTaskArgs = {
17
23
  text: string;
18
24
  note?: string;
19
25
  reminder?: string;
20
26
  autoReminder?: boolean;
21
27
  };
22
- export declare type GetTasksArgs = {
28
+ export type GetTasksArgs = {
23
29
  projectId?: string;
24
30
  sectionId?: string;
25
31
  label?: string;
@@ -27,60 +33,63 @@ export declare type GetTasksArgs = {
27
33
  lang?: string;
28
34
  ids?: string[];
29
35
  };
30
- export declare type UpdateTaskArgs = {
36
+ export type UpdateTaskArgs = {
31
37
  content?: string;
32
38
  description?: string;
33
39
  labels?: string[];
34
40
  priority?: number;
35
- dueString?: string | null;
36
41
  dueLang?: string | null;
37
- dueDate?: string | null;
38
- dueDatetime?: string | null;
39
42
  assigneeId?: string | null;
40
- };
41
- export declare type ProjectViewStyle = 'list' | 'board';
42
- export declare type AddProjectArgs = {
43
+ dueString?: string;
44
+ } & RequireOneOrNone<{
45
+ dueDate?: string;
46
+ dueDatetime?: string;
47
+ }> & RequireAllOrNone<{
48
+ duration?: Duration['amount'];
49
+ durationUnit?: Duration['unit'];
50
+ }>;
51
+ export type AddProjectArgs = {
43
52
  name: string;
44
53
  parentId?: string;
45
54
  color?: string;
46
55
  isFavorite?: boolean;
47
56
  viewStyle?: ProjectViewStyle;
48
57
  };
49
- export declare type UpdateProjectArgs = {
58
+ export type UpdateProjectArgs = {
50
59
  name?: string;
51
60
  color?: string;
52
61
  isFavorite?: boolean;
53
62
  viewStyle?: ProjectViewStyle;
54
63
  };
55
- export declare type AddSectionArgs = {
64
+ export type AddSectionArgs = {
56
65
  name: string;
57
66
  projectId: string;
58
67
  order?: number;
59
68
  };
60
- export declare type UpdateSectionArgs = {
69
+ export type UpdateSectionArgs = {
61
70
  name: string;
62
71
  };
63
- export declare type AddLabelArgs = {
72
+ export type AddLabelArgs = {
64
73
  name: string;
65
74
  order?: number;
66
75
  color?: string;
67
76
  isFavorite?: boolean;
68
77
  };
69
- export declare type UpdateLabelArgs = {
78
+ export type UpdateLabelArgs = {
70
79
  name?: string;
71
80
  order?: number;
72
81
  color?: string;
73
82
  isFavorite?: boolean;
74
83
  };
75
- export declare type GetTaskCommentsArgs = {
84
+ export type GetTaskCommentsArgs = {
76
85
  taskId: string;
77
86
  projectId?: never;
78
87
  };
79
- export declare type GetProjectCommentsArgs = {
88
+ export type GetProjectCommentsArgs = {
80
89
  projectId: string;
81
90
  taskId?: never;
82
91
  };
83
- declare type AddCommentArgs = {
92
+ export type AddCommentArgs = {
84
93
  content: string;
85
94
  attachment?: {
86
95
  fileName?: string;
@@ -88,23 +97,20 @@ declare type AddCommentArgs = {
88
97
  fileType?: string;
89
98
  resourceType?: string;
90
99
  };
91
- };
92
- export declare type AddTaskCommentArgs = AddCommentArgs & {
93
- taskId: string;
94
- projectId?: never;
95
- };
96
- export declare type AddProjectCommentArgs = AddCommentArgs & {
97
- projectId: string;
98
- taskId?: never;
99
- };
100
- export declare type UpdateCommentArgs = {
100
+ } & RequireExactlyOne<{
101
+ taskId?: string;
102
+ projectId?: string;
103
+ }>;
104
+ export type UpdateCommentArgs = {
101
105
  content: string;
102
106
  };
103
- export declare type RenameSharedLabelArgs = {
107
+ export type GetSharedLabelsArgs = {
108
+ omitPersonal?: boolean;
109
+ };
110
+ export type RenameSharedLabelArgs = {
104
111
  name: string;
105
112
  newName: string;
106
113
  };
107
- export declare type RemoveSharedLabelArgs = {
114
+ export type RemoveSharedLabelArgs = {
108
115
  name: string;
109
116
  };
110
- export {};
@@ -1,5 +1,5 @@
1
1
  import { Task } from '../types';
2
- export declare type TaskWithSanitizedContent = Task & {
2
+ export type TaskWithSanitizedContent = Task & {
3
3
  sanitizedContent: string;
4
4
  };
5
5
  export declare function getSanitizedContent(input: string): string;
@@ -20,9 +20,9 @@ function getTaskFromQuickAddResponse(responseData) {
20
20
  var _a;
21
21
  var due = responseData.due
22
22
  ? __assign(__assign({ isRecurring: responseData.due.isRecurring, string: responseData.due.string, date: responseData.due.date }, (responseData.due.timezone !== null && { datetime: responseData.due.date })), (responseData.due.timezone !== null && { timezone: responseData.due.timezone })) : undefined;
23
- var task = __assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId: responseData.sectionId ? responseData.sectionId : undefined, isCompleted: responseData.checked, labels: responseData.labels, priority: responseData.priority, commentCount: 0, createdAt: responseData.addedAt, url: getTaskUrlFromQuickAddResponse(responseData), creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '' }, (due !== undefined && { due: due })), (responseData.parentId !== null && { parentId: responseData.parentId })), (responseData.responsibleUid !== null && {
23
+ var task = __assign(__assign(__assign(__assign({ id: responseData.id, order: responseData.childOrder, content: responseData.content, description: responseData.description, projectId: responseData.projectId, sectionId: responseData.sectionId ? responseData.sectionId : undefined, isCompleted: responseData.checked, labels: responseData.labels, priority: responseData.priority, commentCount: 0, createdAt: responseData.addedAt, url: getTaskUrlFromQuickAddResponse(responseData), creatorId: (_a = responseData.addedByUid) !== null && _a !== void 0 ? _a : '' }, (due !== undefined && { due: due })), (responseData.parentId !== null && { parentId: responseData.parentId })), (responseData.responsibleUid !== null && {
24
24
  assigneeId: responseData.responsibleUid,
25
- }));
25
+ })), { duration: responseData.duration });
26
26
  return task;
27
27
  }
28
28
  exports.getTaskFromQuickAddResponse = getTaskFromQuickAddResponse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "2.1.2",
3
+ "version": "3.0.0",
4
4
  "description": "A typescript wrapper for the Todoist REST API.",
5
5
  "author": "Doist developers",
6
6
  "repository": "git@github.com:doist/todoist-api-typescript.git",
@@ -32,27 +32,28 @@
32
32
  "uuid": "^9.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@doist/eslint-config": "8.0.1",
35
+ "@doist/eslint-config": "8.1.3",
36
36
  "@doist/prettier-config": "3.0.5",
37
37
  "@types/axios": "0.14.0",
38
- "@types/jest": "27.5.2",
38
+ "@types/jest": "29.4.0",
39
39
  "@types/uuid": "8.3.4",
40
- "@typescript-eslint/eslint-plugin": "5.42.0",
41
- "@typescript-eslint/parser": "5.42.0",
42
- "eslint": "8.26.0",
43
- "eslint-config-prettier": "8.5.0",
40
+ "@typescript-eslint/eslint-plugin": "5.54.1",
41
+ "@typescript-eslint/parser": "5.54.1",
42
+ "eslint": "8.35.0",
43
+ "eslint-config-prettier": "8.7.0",
44
44
  "eslint-import-resolver-webpack": "0.13.2",
45
- "eslint-plugin-import": "2.26.0",
45
+ "eslint-plugin-import": "2.27.5",
46
46
  "eslint-plugin-prettier": "4.2.1",
47
- "husky": "8.0.1",
48
- "jest": "28.1.3",
49
- "lint-staged": "13.0.3",
47
+ "husky": "8.0.3",
48
+ "jest": "29.5.0",
49
+ "lint-staged": "13.1.4",
50
50
  "npm-run-all": "4.1.5",
51
- "prettier": "2.7.1",
51
+ "prettier": "2.8.4",
52
52
  "rimraf": "3.0.2",
53
- "ts-jest": "28.0.8",
53
+ "ts-jest": "29.0.5",
54
54
  "ts-node": "10.9.1",
55
- "typescript": "4.8.4"
55
+ "type-fest": "^4.5.0",
56
+ "typescript": "4.9.5"
56
57
  },
57
58
  "prettier": "@doist/prettier-config",
58
59
  "husky": {