@doist/todoist-api-typescript 4.0.0-alpha.6 → 4.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.
package/README.md CHANGED
@@ -2,9 +2,6 @@
2
2
 
3
3
  This is the official TypeScript API client for the Todoist REST API.
4
4
 
5
- > [!IMPORTANT]
6
- > This library is currently being migrated from the Todoist REST API to the Todoist Sync API. As a result, parts of the documentation may be outdated. However, the client API remains consistent with the latest stable release, [v3.0.3](https://github.com/Doist/todoist-api-typescript/releases/tag/v3.0.3). Please note that some client methods may return unexpected data or encounter failures during this transition.
7
-
8
5
  ## Installation
9
6
 
10
7
  ```
@@ -27,7 +24,19 @@ api.getTasks()
27
24
 
28
25
  ### Documentation
29
26
 
30
- For more detailed reference documentation, have a look at the [API documentation with TypeScript examples](https://developer.todoist.com/rest/v2/?javascript).
27
+ For more detailed reference documentation, have a look at the [Todoist API v1 Documentation](https://todoist.com/api/v1).
28
+
29
+ ### Migration Guide
30
+
31
+ If you're migrating from an older version of the Todoist API (v9), please refer to the [official migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9) for detailed information about the changes and breaking updates.
32
+
33
+ Key changes in v1 include:
34
+
35
+ - Updated endpoint structure
36
+ - New pagination system
37
+ - Unified error response format
38
+ - Object renames (e.g., items → tasks, notes → comments)
39
+ - URL renames and endpoint signature changes
31
40
 
32
41
  ## Development and Testing
33
42
 
@@ -1,8 +1,8 @@
1
1
  import { Project, Label, Section, Comment } from './types/entities';
2
2
  import type { Task } from './types/entities';
3
- import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs, GetProjectsArgs, GetProjectCollaboratorsArgs, GetLabelsArgs, GetLabelsResponse, GetTasksResponse, GetProjectsResponse, GetProjectCollaboratorsResponse, GetSectionsArgs, GetSectionsResponse, GetSharedLabelsResponse, GetCommentsResponse, type MoveTaskArgs } from './types/requests';
3
+ import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskArgs, GetProjectCommentsArgs, GetTaskCommentsArgs, GetTasksArgs, GetTasksByFilterArgs, UpdateCommentArgs, UpdateLabelArgs, UpdateProjectArgs, UpdateSectionArgs, UpdateTaskArgs, QuickAddTaskArgs, GetSharedLabelsArgs, RenameSharedLabelArgs, RemoveSharedLabelArgs, GetProjectsArgs, GetProjectCollaboratorsArgs, GetLabelsArgs, GetLabelsResponse, GetTasksResponse, GetProjectsResponse, GetProjectCollaboratorsResponse, GetSectionsArgs, GetSectionsResponse, GetSharedLabelsResponse, GetCommentsResponse, type MoveTaskArgs } from './types/requests';
4
4
  /**
5
- * A client for interacting with the Todoist Sync API.
5
+ * A client for interacting with the Todoist API v1.
6
6
  * This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
7
7
  *
8
8
  * @example
@@ -19,6 +19,8 @@ import { AddCommentArgs, AddLabelArgs, AddProjectArgs, AddSectionArgs, AddTaskAr
19
19
  * });
20
20
  * ```
21
21
  *
22
+ * For more information about the Todoist API v1, see the [official documentation](https://todoist.com/api/v1).
23
+ * If you're migrating from v9, please refer to the [migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9).
22
24
  */
23
25
  export declare class TodoistApi {
24
26
  private authToken;
@@ -46,6 +48,13 @@ export declare class TodoistApi {
46
48
  * @returns A promise that resolves to an array of tasks.
47
49
  */
48
50
  getTasks(args?: GetTasksArgs): Promise<GetTasksResponse>;
51
+ /**
52
+ * Retrieves tasks filtered by a filter string.
53
+ *
54
+ * @param args - Parameters for filtering tasks, including the query string and optional language.
55
+ * @returns A promise that resolves to a paginated response of tasks.
56
+ */
57
+ getTasksByFilter(args: GetTasksByFilterArgs): Promise<GetTasksResponse>;
49
58
  /**
50
59
  * Creates a new task with the provided parameters.
51
60
  *
@@ -69,7 +69,7 @@ function generatePath() {
69
69
  return segments.join('/');
70
70
  }
71
71
  /**
72
- * A client for interacting with the Todoist Sync API.
72
+ * A client for interacting with the Todoist API v1.
73
73
  * This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
74
74
  *
75
75
  * @example
@@ -86,6 +86,8 @@ function generatePath() {
86
86
  * });
87
87
  * ```
88
88
  *
89
+ * For more information about the Todoist API v1, see the [official documentation](https://todoist.com/api/v1).
90
+ * If you're migrating from v9, please refer to the [migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9).
89
91
  */
90
92
  var TodoistApi = /** @class */ (function () {
91
93
  function TodoistApi(
@@ -144,6 +146,28 @@ var TodoistApi = /** @class */ (function () {
144
146
  });
145
147
  });
146
148
  };
149
+ /**
150
+ * Retrieves tasks filtered by a filter string.
151
+ *
152
+ * @param args - Parameters for filtering tasks, including the query string and optional language.
153
+ * @returns A promise that resolves to a paginated response of tasks.
154
+ */
155
+ TodoistApi.prototype.getTasksByFilter = function (args) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ var _a, results, nextCursor;
158
+ return __generator(this, function (_b) {
159
+ switch (_b.label) {
160
+ case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS_FILTER, this.authToken, args)];
161
+ case 1:
162
+ _a = (_b.sent()).data, results = _a.results, nextCursor = _a.nextCursor;
163
+ return [2 /*return*/, {
164
+ results: (0, validators_1.validateTaskArray)(results),
165
+ nextCursor: nextCursor,
166
+ }];
167
+ }
168
+ });
169
+ });
170
+ };
147
171
  /**
148
172
  * Creates a new task with the provided parameters.
149
173
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Permission scopes that can be requested during OAuth2 authorization.
3
- * @see {@link https://developer.todoist.com/guides/#step-1-authorization-request}
3
+ * @see {@link https://todoist.com/api/v1/docs#tag/Authorization}
4
4
  */
5
5
  export type Permission = 'task:add' | 'data:read' | 'data:read_write' | 'data:delete' | 'project:delete';
6
6
  /**
7
7
  * Parameters required to exchange an authorization code for an access token.
8
- * @see https://developer.todoist.com/guides/#step-3-token-exchange
8
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/OAuth
9
9
  */
10
10
  export type AuthTokenRequestArgs = {
11
11
  clientId: string;
@@ -14,7 +14,7 @@ export type AuthTokenRequestArgs = {
14
14
  };
15
15
  /**
16
16
  * Response from a successful OAuth2 token exchange.
17
- * @see https://developer.todoist.com/guides/#step-3-token-exchange
17
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/OAuth
18
18
  */
19
19
  export type AuthTokenResponse = {
20
20
  accessToken: string;
@@ -22,7 +22,7 @@ export type AuthTokenResponse = {
22
22
  };
23
23
  /**
24
24
  * Parameters required to revoke an access token.
25
- * @see https://developer.todoist.com/rest/v2/#authorization
25
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/operation/revoke_access_token_api_api_v1_access_tokens_delete
26
26
  */
27
27
  export type RevokeAuthTokenRequestArgs = {
28
28
  clientId: string;
@@ -57,7 +57,7 @@ export declare function getAuthStateParameter(): string;
57
57
  * ```
58
58
  *
59
59
  * @returns The full authorization URL to redirect users to
60
- * @see https://developer.todoist.com/guides/#step-1-authorization-request
60
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/OAuth
61
61
  */
62
62
  export declare function getAuthorizationUrl(clientId: string, permissions: Permission[], state: string, baseUrl?: string): string;
63
63
  /**
@@ -89,5 +89,6 @@ export declare function getAuthToken(args: AuthTokenRequestArgs, baseUrl?: strin
89
89
  * ```
90
90
  *
91
91
  * @returns True if revocation was successful
92
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/operation/revoke_access_token_api_api_v1_access_tokens_delete
92
93
  */
93
94
  export declare function revokeAuthToken(args: RevokeAuthTokenRequestArgs, baseUrl?: string): Promise<boolean>;
@@ -72,7 +72,7 @@ exports.getAuthStateParameter = getAuthStateParameter;
72
72
  * ```
73
73
  *
74
74
  * @returns The full authorization URL to redirect users to
75
- * @see https://developer.todoist.com/guides/#step-1-authorization-request
75
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/OAuth
76
76
  */
77
77
  function getAuthorizationUrl(clientId, permissions, state, baseUrl) {
78
78
  if (!(permissions === null || permissions === void 0 ? void 0 : permissions.length)) {
@@ -128,6 +128,7 @@ exports.getAuthToken = getAuthToken;
128
128
  * ```
129
129
  *
130
130
  * @returns True if revocation was successful
131
+ * @see https://todoist.com/api/v1/docs#tag/Authorization/operation/revoke_access_token_api_api_v1_access_tokens_delete
131
132
  */
132
133
  function revokeAuthToken(args, baseUrl) {
133
134
  return __awaiter(this, void 0, void 0, function () {
@@ -1,8 +1,9 @@
1
- export declare const API_VERSION = "v9.220";
2
- export declare const API_BASE_URI = "/api/v9.220/";
1
+ export declare const API_VERSION = "v1";
2
+ export declare const API_BASE_URI = "/api/v1/";
3
3
  export declare function getSyncBaseUri(domainBase?: string): string;
4
4
  export declare function getAuthBaseUri(domainBase?: string): string;
5
5
  export declare const ENDPOINT_REST_TASKS = "tasks";
6
+ export declare const ENDPOINT_REST_TASKS_FILTER: string;
6
7
  export declare const ENDPOINT_REST_PROJECTS = "projects";
7
8
  export declare const ENDPOINT_REST_SECTIONS = "sections";
8
9
  export declare const ENDPOINT_REST_LABELS = "labels";
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.API_BASE_URI = exports.API_VERSION = void 0;
3
+ exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_TASK_REOPEN = exports.ENDPOINT_REST_TASK_CLOSE = exports.ENDPOINT_REST_COMMENTS = exports.ENDPOINT_REST_LABELS_SHARED_REMOVE = exports.ENDPOINT_REST_LABELS_SHARED_RENAME = exports.ENDPOINT_REST_LABELS_SHARED = exports.ENDPOINT_REST_LABELS = exports.ENDPOINT_REST_SECTIONS = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.getAuthBaseUri = exports.getSyncBaseUri = exports.API_BASE_URI = exports.API_VERSION = void 0;
4
4
  var BASE_URI = 'https://api.todoist.com';
5
5
  var TODOIST_URI = 'https://todoist.com';
6
6
  // The API version is not configurable, to ensure
7
7
  // compatibility between the API and the client.
8
- exports.API_VERSION = 'v9.220';
8
+ exports.API_VERSION = 'v1';
9
9
  exports.API_BASE_URI = "/api/".concat(exports.API_VERSION, "/");
10
10
  var API_AUTHORIZATION_BASE_URI = '/oauth/';
11
11
  function getSyncBaseUri(domainBase) {
@@ -19,6 +19,7 @@ function getAuthBaseUri(domainBase) {
19
19
  }
20
20
  exports.getAuthBaseUri = getAuthBaseUri;
21
21
  exports.ENDPOINT_REST_TASKS = 'tasks';
22
+ exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS + '/filter';
22
23
  exports.ENDPOINT_REST_PROJECTS = 'projects';
23
24
  exports.ENDPOINT_REST_SECTIONS = 'sections';
24
25
  exports.ENDPOINT_REST_LABELS = 'labels';
@@ -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 });
@@ -24,7 +24,7 @@ export declare const DueDateSchema: z.ZodObject<z.objectUtil.extendShape<{
24
24
  }>;
25
25
  /**
26
26
  * Represents a due date for a task.
27
- * @see https://developer.todoist.com/sync/v9/#due-dates
27
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/get_tasks_api_v1_tasks_get
28
28
  */
29
29
  export interface DueDate extends z.infer<typeof DueDateSchema> {
30
30
  }
@@ -39,8 +39,8 @@ export declare const DurationSchema: z.ZodObject<{
39
39
  unit: "minute" | "day";
40
40
  }>;
41
41
  /**
42
- * Represents the duration of a task.
43
- * @see https://developer.todoist.com/sync/v9/#deadlines
42
+ * Represents a duration for a task deadline.
43
+ * @see https://todoist.com/api/v1/docs#tag/Tasks
44
44
  */
45
45
  export interface Duration extends z.infer<typeof DurationSchema> {
46
46
  }
@@ -184,8 +184,8 @@ export declare const TaskSchema: z.ZodObject<{
184
184
  } | null;
185
185
  }>;
186
186
  /**
187
- * A task is a unit of work. It can be a simple to-do item or a more complex task with subtasks, comments, and attachments.
188
- * @see https://developer.todoist.com/sync/v9/#items
187
+ * Represents a task in Todoist.
188
+ * @see https://todoist.com/api/v1/docs#tag/Tasks
189
189
  */
190
190
  export interface Task extends z.infer<typeof TaskSchema> {
191
191
  }
@@ -227,34 +227,55 @@ export declare const ProjectSchema: z.ZodObject<{
227
227
  viewStyle: string;
228
228
  }>;
229
229
  /**
230
- * Represents a project in Todoist, which can contain multiple tasks.
231
- * @see https://developer.todoist.com/sync/v9/#projects
230
+ * Represents a project in Todoist.
231
+ * @see https://todoist.com/api/v1/docs#tag/Projects
232
232
  */
233
233
  export interface Project extends z.infer<typeof ProjectSchema> {
234
234
  }
235
235
  /**
236
- * @see https://developer.todoist.com/sync/v9/#projects
236
+ * @see https://todoist.com/api/v1/docs#tag/Projects
237
237
  */
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
- * Represents a section within a project, used to group tasks.
257
- * @see https://developer.todoist.com/sync/v9/#sections
277
+ * Represents a section in a Todoist project.
278
+ * @see https://todoist.com/api/v1/docs#tag/Sections
258
279
  */
259
280
  export interface Section extends z.infer<typeof SectionSchema> {
260
281
  }
@@ -278,8 +299,8 @@ export declare const LabelSchema: z.ZodObject<{
278
299
  isFavorite: boolean;
279
300
  }>;
280
301
  /**
281
- * Represents a label in Todoist, which is used to categorize tasks.
282
- * @see https://developer.todoist.com/sync/v9/#labels
302
+ * Represents a label in Todoist.
303
+ * @see https://todoist.com/api/v1/docs#tag/Labels
283
304
  */
284
305
  export interface Label extends z.infer<typeof LabelSchema> {
285
306
  }
@@ -325,18 +346,18 @@ export declare const AttachmentSchema: z.ZodObject<z.objectUtil.extendShape<{
325
346
  title?: string | null | undefined;
326
347
  }>;
327
348
  /**
328
- * Represents an attachment associated with a comment in Todoist.
329
- * @see https://developer.todoist.com/sync/v9/#file-attachments
349
+ * Represents a file attachment in a comment.
350
+ * @see https://todoist.com/api/v1/docs#tag/Sync/Comments/File-Attachments
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<{
334
355
  id: z.ZodString;
335
- taskId: z.ZodNullable<z.ZodString>;
336
- projectId: z.ZodNullable<z.ZodString>;
356
+ itemId: z.ZodOptional<z.ZodString>;
357
+ projectId: z.ZodOptional<z.ZodString>;
337
358
  content: z.ZodString;
338
359
  postedAt: z.ZodString;
339
- attachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
360
+ fileAttachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
340
361
  resourceType: z.ZodString;
341
362
  }, {
342
363
  fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -377,13 +398,267 @@ export declare const CommentSchema: z.ZodObject<{
377
398
  imageHeight?: number | null | undefined;
378
399
  title?: string | null | undefined;
379
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;
380
405
  }, "strip", z.ZodTypeAny, {
381
406
  id: string;
382
- projectId: string | null;
383
407
  content: string;
384
- taskId: string | null;
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 a raw comment response from the API.
504
+ * @see https://todoist.com/api/v1/docs#tag/Comments
505
+ */
506
+ export interface RawComment extends z.infer<typeof RawCommentSchema> {
507
+ }
508
+ export declare const CommentSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
509
+ id: z.ZodString;
510
+ itemId: z.ZodOptional<z.ZodString>;
511
+ projectId: z.ZodOptional<z.ZodString>;
512
+ content: z.ZodString;
513
+ postedAt: z.ZodString;
514
+ fileAttachment: z.ZodNullable<z.ZodObject<z.objectUtil.extendShape<{
515
+ resourceType: z.ZodString;
516
+ }, {
517
+ fileName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
518
+ fileSize: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
519
+ fileType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
520
+ fileUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
521
+ fileDuration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
522
+ uploadState: z.ZodOptional<z.ZodNullable<z.ZodEnum<["pending", "completed"]>>>;
523
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
+ imageWidth: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
525
+ imageHeight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
526
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
527
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
528
+ }>, "strip", z.ZodTypeAny, {
529
+ resourceType: string;
530
+ url?: string | null | undefined;
531
+ fileName?: string | null | undefined;
532
+ fileSize?: number | null | undefined;
533
+ fileType?: string | null | undefined;
534
+ fileUrl?: string | null | undefined;
535
+ fileDuration?: number | null | undefined;
536
+ uploadState?: "pending" | "completed" | null | undefined;
537
+ image?: string | null | undefined;
538
+ imageWidth?: number | null | undefined;
539
+ imageHeight?: number | null | undefined;
540
+ title?: string | null | undefined;
541
+ }, {
542
+ resourceType: string;
543
+ url?: string | null | undefined;
544
+ fileName?: string | null | undefined;
545
+ fileSize?: number | null | undefined;
546
+ fileType?: string | null | undefined;
547
+ fileUrl?: string | null | undefined;
548
+ fileDuration?: number | null | undefined;
549
+ uploadState?: "pending" | "completed" | null | undefined;
550
+ image?: string | null | undefined;
551
+ imageWidth?: number | null | undefined;
552
+ imageHeight?: number | null | undefined;
553
+ title?: string | null | undefined;
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;
559
+ }, "strip", z.ZodTypeAny, {
560
+ id: string;
561
+ content: string;
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,10 +695,15 @@ 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
- * Represents a comment on a task or project in Todoist.
423
- * @see https://developer.todoist.com/sync/v9/#notes
705
+ * Represents a comment in Todoist.
706
+ * @see https://todoist.com/api/v1/docs#tag/Comments
424
707
  */
425
708
  export interface Comment extends z.infer<typeof CommentSchema> {
426
709
  }
@@ -439,7 +722,7 @@ export declare const UserSchema: z.ZodObject<{
439
722
  }>;
440
723
  /**
441
724
  * Represents a user in Todoist.
442
- * @see https://developer.todoist.com/sync/v9/#user
725
+ * @see https://todoist.com/api/v1/docs#tag/User
443
726
  */
444
727
  export interface User extends z.infer<typeof UserSchema> {
445
728
  }
@@ -474,8 +757,8 @@ export declare const ColorSchema: z.ZodObject<{
474
757
  hexValue: string;
475
758
  }>;
476
759
  /**
477
- * Represents a color in Todoist, used for projects, labels, or other visual elements.
478
- * @see https://developer.todoist.com/guides/#colors
760
+ * Represents a color in Todoist.
761
+ * @see https://todoist.com/api/v1/docs#tag/Colors
479
762
  */
480
763
  export interface Color extends z.infer<typeof ColorSchema> {
481
764
  }
@@ -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(),
@@ -1,7 +1,8 @@
1
1
  import type { RequireAllOrNone, RequireOneOrNone, RequireExactlyOne } from 'type-fest';
2
2
  import type { Comment, Deadline, DueDate, Duration, Label, Project, ProjectViewStyle, Section, Task, User } from './entities';
3
3
  /**
4
- * @see https://developer.todoist.com/rest/v2/#create-a-new-task
4
+ * Arguments for creating a new task.
5
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/create_task_api_v1_tasks_post
5
6
  */
6
7
  export type AddTaskArgs = {
7
8
  content: string;
@@ -25,27 +26,38 @@ export type AddTaskArgs = {
25
26
  durationUnit?: Duration['unit'];
26
27
  }>;
27
28
  /**
28
- * @see https://developer.todoist.com/rest/v2/#tasks
29
+ * Arguments for retrieving tasks.
30
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/get_tasks_api_v1_tasks_get
29
31
  */
30
32
  export type GetTasksArgs = {
31
33
  projectId?: string;
32
34
  sectionId?: string;
35
+ parentId?: string;
33
36
  label?: string;
34
- filter?: string;
35
- lang?: string;
36
37
  ids?: string[];
37
38
  cursor?: string | null;
38
39
  limit?: number;
39
40
  };
40
41
  /**
41
- * @see https://developer.todoist.com/rest/v2/#tasks
42
+ * Arguments for retrieving tasks by filter.
43
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/get_tasks_by_filter_api_v1_tasks_filter_get
44
+ */
45
+ export type GetTasksByFilterArgs = {
46
+ query: string;
47
+ lang?: string;
48
+ cursor?: string | null;
49
+ limit?: number;
50
+ };
51
+ /**
52
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/get_tasks_api_v1_tasks_get
42
53
  */
43
54
  export type GetTasksResponse = {
44
55
  results: Task[];
45
56
  nextCursor: string | null;
46
57
  };
47
58
  /**
48
- * @see https://developer.todoist.com/rest/v2/#update-a-task
59
+ * Arguments for updating a task.
60
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/update_task_api_v1_tasks__task_id__post
49
61
  */
50
62
  export type UpdateTaskArgs = {
51
63
  content?: string;
@@ -65,7 +77,8 @@ export type UpdateTaskArgs = {
65
77
  durationUnit?: Duration['unit'];
66
78
  }>;
67
79
  /**
68
- * @see https://developer.todoist.com/rest/v2/#quick-add-task
80
+ * Arguments for quick adding a task.
81
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/quick_add_api_v1_tasks_quick_post
69
82
  */
70
83
  export type QuickAddTaskArgs = {
71
84
  text: string;
@@ -75,7 +88,8 @@ export type QuickAddTaskArgs = {
75
88
  meta?: boolean;
76
89
  };
77
90
  /**
78
- * @see https://developer.todoist.com/rest/v2/#quick-add-task
91
+ * Response from quick adding a task.
92
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/quick_add_api_v1_tasks_quick_post
79
93
  */
80
94
  export type SyncTask = {
81
95
  id: string;
@@ -97,11 +111,13 @@ export type SyncTask = {
97
111
  deadline: Deadline | null;
98
112
  };
99
113
  /**
100
- * @see https://developer.todoist.com/rest/v2/#quick-add-task
114
+ * Response from quick adding a task.
115
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/quick_add_api_v1_tasks_quick_post
101
116
  */
102
117
  export type QuickAddTaskResponse = SyncTask;
103
118
  /**
104
- * @see https://developer.todoist.com/sync/v9/#move-an-item
119
+ * Arguments for moving a task.
120
+ * @see https://todoist.com/api/v1/docs#tag/Tasks/operation/move_task_api_v1_tasks__task_id__move_post
105
121
  */
106
122
  export type MoveTaskArgs = RequireExactlyOne<{
107
123
  projectId?: string;
@@ -109,21 +125,24 @@ export type MoveTaskArgs = RequireExactlyOne<{
109
125
  parentId?: string;
110
126
  }>;
111
127
  /**
112
- * @see https://developer.todoist.com/rest/v2/#get-all-projects
128
+ * Arguments for retrieving projects.
129
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_projects_api_v1_projects_get
113
130
  */
114
131
  export type GetProjectsArgs = {
115
132
  cursor?: string | null;
116
133
  limit?: number;
117
134
  };
118
135
  /**
119
- * @see https://developer.todoist.com/rest/v2/#get-all-projects
136
+ * Response from retrieving projects.
137
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_projects_api_v1_projects_get
120
138
  */
121
139
  export type GetProjectsResponse = {
122
140
  results: Project[];
123
141
  nextCursor: string | null;
124
142
  };
125
143
  /**
126
- * @see https://developer.todoist.com/rest/v2/#create-a-new-project
144
+ * Arguments for creating a new project.
145
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/create_project_api_v1_projects_post
127
146
  */
128
147
  export type AddProjectArgs = {
129
148
  name: string;
@@ -133,7 +152,8 @@ export type AddProjectArgs = {
133
152
  viewStyle?: ProjectViewStyle;
134
153
  };
135
154
  /**
136
- * @see https://developer.todoist.com/rest/v2/#update-a-project
155
+ * Arguments for updating a project.
156
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/update_project_api_v1_projects__project_id__post
137
157
  */
138
158
  export type UpdateProjectArgs = {
139
159
  name?: string;
@@ -142,21 +162,24 @@ export type UpdateProjectArgs = {
142
162
  viewStyle?: ProjectViewStyle;
143
163
  };
144
164
  /**
145
- * @see https://developer.todoist.com/rest/v2/#get-all-collaborators
165
+ * Arguments for retrieving project collaborators.
166
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_project_collaborators_api_v1_projects__project_id__collaborators_get
146
167
  */
147
168
  export type GetProjectCollaboratorsArgs = {
148
169
  cursor?: string | null;
149
170
  limit?: number;
150
171
  };
151
172
  /**
152
- * @see https://developer.todoist.com/rest/v2/#get-all-collaborators
173
+ * Response from retrieving project collaborators.
174
+ * @see https://todoist.com/api/v1/docs#tag/Projects/operation/get_project_collaborators_api_v1_projects__project_id__collaborators_get
153
175
  */
154
176
  export type GetProjectCollaboratorsResponse = {
155
177
  results: User[];
156
178
  nextCursor: string | null;
157
179
  };
158
180
  /**
159
- * @see https://developer.todoist.com/rest/v2/#sections
181
+ * Arguments for retrieving sections.
182
+ * @see https://todoist.com/api/v1/docs#tag/Sections/operation/get_sections_api_v1_sections_get
160
183
  */
161
184
  export type GetSectionsArgs = {
162
185
  projectId: string | null;
@@ -164,14 +187,16 @@ export type GetSectionsArgs = {
164
187
  limit?: number;
165
188
  };
166
189
  /**
167
- * @see https://developer.todoist.com/rest/v2/#sections
190
+ * Response from retrieving sections.
191
+ * @see https://todoist.com/api/v1/docs#tag/Sections/operation/get_sections_api_v1_sections_get
168
192
  */
169
193
  export type GetSectionsResponse = {
170
194
  results: Section[];
171
195
  nextCursor: string | null;
172
196
  };
173
197
  /**
174
- * @see https://developer.todoist.com/rest/v2/#create-a-new-section
198
+ * Arguments for creating a new section.
199
+ * @see https://todoist.com/api/v1/docs#tag/Sections/operation/create_section_api_v1_sections_post
175
200
  */
176
201
  export type AddSectionArgs = {
177
202
  name: string;
@@ -179,27 +204,31 @@ export type AddSectionArgs = {
179
204
  order?: number | null;
180
205
  };
181
206
  /**
182
- * @see https://developer.todoist.com/rest/v2/#update-a-section
207
+ * Arguments for updating a section.
208
+ * @see https://todoist.com/api/v1/docs#tag/Sections/operation/update_section_api_v1_sections__section_id__post
183
209
  */
184
210
  export type UpdateSectionArgs = {
185
211
  name: string;
186
212
  };
187
213
  /**
188
- * @see https://developer.todoist.com/rest/v2/#get-all-personal-labels
214
+ * Arguments for retrieving labels.
215
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/get_labels_api_v1_labels_get
189
216
  */
190
217
  export type GetLabelsArgs = {
191
218
  cursor?: string | null;
192
219
  limit?: number;
193
220
  };
194
221
  /**
195
- * @see https://developer.todoist.com/rest/v2/#get-all-personal-labels
222
+ * Response from retrieving labels.
223
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/get_labels_api_v1_labels_get
196
224
  */
197
225
  export type GetLabelsResponse = {
198
226
  results: Label[];
199
227
  nextCursor: string | null;
200
228
  };
201
229
  /**
202
- * @see https://developer.todoist.com/rest/v2/#create-a-new-personal-label
230
+ * Arguments for creating a new label.
231
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/create_label_api_v1_labels_post
203
232
  */
204
233
  export type AddLabelArgs = {
205
234
  name: string;
@@ -208,7 +237,8 @@ export type AddLabelArgs = {
208
237
  isFavorite?: boolean;
209
238
  };
210
239
  /**
211
- * @see https://developer.todoist.com/rest/v2/#update-a-personal-label
240
+ * Arguments for updating a label.
241
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/update_label_api_v1_labels__label_id__post
212
242
  */
213
243
  export type UpdateLabelArgs = {
214
244
  name?: string;
@@ -217,7 +247,8 @@ export type UpdateLabelArgs = {
217
247
  isFavorite?: boolean;
218
248
  };
219
249
  /**
220
- * @see https://developer.todoist.com/rest/v2/#get-all-shared-labels
250
+ * Arguments for retrieving shared labels.
251
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/shared_labels_api_v1_labels_shared_get
221
252
  */
222
253
  export type GetSharedLabelsArgs = {
223
254
  omitPersonal?: boolean;
@@ -225,27 +256,41 @@ export type GetSharedLabelsArgs = {
225
256
  limit?: number;
226
257
  };
227
258
  /**
228
- * @see https://developer.todoist.com/rest/v2/#get-all-shared-labels
259
+ * Response from retrieving shared labels.
260
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/shared_labels_api_v1_labels_shared_get
229
261
  */
230
262
  export type GetSharedLabelsResponse = {
231
263
  results: string[];
232
264
  nextCursor: string | null;
233
265
  };
234
266
  /**
235
- * @see https://developer.todoist.com/rest/v2/#rename-shared-labels
267
+ * Arguments for renaming a shared label.
268
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/shared_labels_rename_api_v1_labels_shared_rename_post
236
269
  */
237
270
  export type RenameSharedLabelArgs = {
238
271
  name: string;
239
272
  newName: string;
240
273
  };
241
274
  /**
242
- * @see https://developer.todoist.com/rest/v2/#remove-shared-labels
275
+ * Arguments for removing a shared label.
276
+ * @see https://todoist.com/api/v1/docs#tag/Labels/operation/shared_labels_remove_api_v1_labels_shared_remove_post
243
277
  */
244
278
  export type RemoveSharedLabelArgs = {
245
279
  name: string;
246
280
  };
247
281
  /**
248
- * @see https://developer.todoist.com/rest/v2/#get-all-comments
282
+ * Arguments for retrieving comments.
283
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/get_comments_api_v1_comments_get
284
+ */
285
+ export type GetCommentsArgs = {
286
+ taskId: string;
287
+ projectId?: never;
288
+ cursor?: string | null;
289
+ limit?: number;
290
+ };
291
+ /**
292
+ * Arguments for retrieving task comments.
293
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/get_comments_api_v1_comments_get
249
294
  */
250
295
  export type GetTaskCommentsArgs = {
251
296
  taskId: string;
@@ -254,7 +299,8 @@ export type GetTaskCommentsArgs = {
254
299
  limit?: number;
255
300
  };
256
301
  /**
257
- * @see https://developer.todoist.com/rest/v2/#get-all-comments
302
+ * Arguments for retrieving project comments.
303
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/get_comments_api_v1_comments_get
258
304
  */
259
305
  export type GetProjectCommentsArgs = {
260
306
  projectId: string;
@@ -263,14 +309,16 @@ export type GetProjectCommentsArgs = {
263
309
  limit?: number;
264
310
  };
265
311
  /**
266
- * @see https://developer.todoist.com/rest/v2/#get-all-comments
312
+ * Response from retrieving comments.
313
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/get_comments_api_v1_comments_get
267
314
  */
268
315
  export type GetCommentsResponse = {
269
316
  results: Comment[];
270
317
  nextCursor: string | null;
271
318
  };
272
319
  /**
273
- * @see https://developer.todoist.com/rest/v2/#create-a-new-comment
320
+ * Arguments for creating a new comment.
321
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/create_comment_api_v1_comments_post
274
322
  */
275
323
  export type AddCommentArgs = {
276
324
  content: string;
@@ -285,7 +333,8 @@ export type AddCommentArgs = {
285
333
  projectId?: string;
286
334
  }>;
287
335
  /**
288
- * @see https://developer.todoist.com/rest/v2/#update-a-comment
336
+ * Arguments for updating a comment.
337
+ * @see https://todoist.com/api/v1/docs#tag/Comments/operation/update_comment_api_v1_comments__comment_id__post
289
338
  */
290
339
  export type UpdateCommentArgs = {
291
340
  content: string;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@doist/todoist-api-typescript",
3
- "version": "4.0.0-alpha.6",
3
+ "version": "4.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",
7
- "homepage": "https://developer.todoist.com/rest/v1/?javascript",
7
+ "homepage": "https://doist.github.io/todoist-api-typescript/",
8
8
  "license": "MIT",
9
9
  "main": "dist/index.js",
10
10
  "types": "dist/index.d.ts",