@doist/todoist-api-typescript 4.0.0-alpha.7 → 4.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 +13 -4
- package/dist/TodoistApi.d.ts +11 -2
- package/dist/TodoistApi.js +51 -17
- package/dist/authentication.d.ts +6 -5
- package/dist/authentication.js +2 -1
- package/dist/consts/endpoints.d.ts +3 -2
- package/dist/consts/endpoints.js +3 -2
- package/dist/testUtils/testDefaults.d.ts +28 -26
- package/dist/testUtils/testDefaults.js +72 -2
- package/dist/types/entities.d.ts +285 -81
- package/dist/types/entities.js +47 -1
- package/dist/types/requests.d.ts +82 -33
- package/dist/utils/projectConverter.d.ts +2 -0
- package/dist/utils/projectConverter.js +25 -0
- package/dist/utils/taskConverters.d.ts +2 -1
- package/dist/utils/taskConverters.js +28 -4
- package/dist/utils/validators.js +12 -0
- package/package.json +2 -2
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
|
|
27
|
+
For more detailed reference documentation, have a look at the [Todoist API v1 Documentation](https://todoist.com/api/v1/docs).
|
|
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
|
|
package/dist/TodoistApi.d.ts
CHANGED
|
@@ -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
|
|
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
|
*
|
package/dist/TodoistApi.js
CHANGED
|
@@ -55,6 +55,7 @@ var validators_1 = require("./utils/validators");
|
|
|
55
55
|
var zod_1 = require("zod");
|
|
56
56
|
var uuid_1 = require("uuid");
|
|
57
57
|
var types_1 = require("./types");
|
|
58
|
+
var projectConverter_1 = require("./utils/projectConverter");
|
|
58
59
|
var MAX_COMMAND_COUNT = 100;
|
|
59
60
|
/**
|
|
60
61
|
* Joins path segments using `/` separator.
|
|
@@ -69,7 +70,7 @@ function generatePath() {
|
|
|
69
70
|
return segments.join('/');
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
|
-
* A client for interacting with the Todoist
|
|
73
|
+
* A client for interacting with the Todoist API v1.
|
|
73
74
|
* This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
|
|
74
75
|
*
|
|
75
76
|
* @example
|
|
@@ -86,6 +87,8 @@ function generatePath() {
|
|
|
86
87
|
* });
|
|
87
88
|
* ```
|
|
88
89
|
*
|
|
90
|
+
* For more information about the Todoist API v1, see the [official documentation](https://todoist.com/api/v1).
|
|
91
|
+
* If you're migrating from v9, please refer to the [migration guide](https://todoist.com/api/v1/docs#tag/Migrating-from-v9).
|
|
89
92
|
*/
|
|
90
93
|
var TodoistApi = /** @class */ (function () {
|
|
91
94
|
function TodoistApi(
|
|
@@ -108,7 +111,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
108
111
|
*/
|
|
109
112
|
TodoistApi.prototype.getTask = function (id) {
|
|
110
113
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
-
var response;
|
|
114
|
+
var response, task;
|
|
112
115
|
return __generator(this, function (_a) {
|
|
113
116
|
switch (_a.label) {
|
|
114
117
|
case 0:
|
|
@@ -116,7 +119,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
116
119
|
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken)];
|
|
117
120
|
case 1:
|
|
118
121
|
response = _a.sent();
|
|
119
|
-
|
|
122
|
+
task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
|
|
123
|
+
return [2 /*return*/, (0, validators_1.validateTask)(task)];
|
|
120
124
|
}
|
|
121
125
|
});
|
|
122
126
|
});
|
|
@@ -130,12 +134,36 @@ var TodoistApi = /** @class */ (function () {
|
|
|
130
134
|
TodoistApi.prototype.getTasks = function (args) {
|
|
131
135
|
if (args === void 0) { args = {}; }
|
|
132
136
|
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
-
var _a,
|
|
137
|
+
var _a, rawResults, nextCursor, results;
|
|
134
138
|
return __generator(this, function (_b) {
|
|
135
139
|
switch (_b.label) {
|
|
136
140
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args)];
|
|
137
141
|
case 1:
|
|
138
|
-
_a = (_b.sent()).data,
|
|
142
|
+
_a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
|
|
143
|
+
results = rawResults.map(taskConverters_1.getTaskFromRawTaskResponse);
|
|
144
|
+
return [2 /*return*/, {
|
|
145
|
+
results: (0, validators_1.validateTaskArray)(results),
|
|
146
|
+
nextCursor: nextCursor,
|
|
147
|
+
}];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Retrieves tasks filtered by a filter string.
|
|
154
|
+
*
|
|
155
|
+
* @param args - Parameters for filtering tasks, including the query string and optional language.
|
|
156
|
+
* @returns A promise that resolves to a paginated response of tasks.
|
|
157
|
+
*/
|
|
158
|
+
TodoistApi.prototype.getTasksByFilter = function (args) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
160
|
+
var _a, rawResults, nextCursor, results;
|
|
161
|
+
return __generator(this, function (_b) {
|
|
162
|
+
switch (_b.label) {
|
|
163
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS_FILTER, this.authToken, args)];
|
|
164
|
+
case 1:
|
|
165
|
+
_a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
|
|
166
|
+
results = rawResults.map(taskConverters_1.getTaskFromRawTaskResponse);
|
|
139
167
|
return [2 /*return*/, {
|
|
140
168
|
results: (0, validators_1.validateTaskArray)(results),
|
|
141
169
|
nextCursor: nextCursor,
|
|
@@ -153,13 +181,14 @@ var TodoistApi = /** @class */ (function () {
|
|
|
153
181
|
*/
|
|
154
182
|
TodoistApi.prototype.addTask = function (args, requestId) {
|
|
155
183
|
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
-
var response;
|
|
184
|
+
var response, task;
|
|
157
185
|
return __generator(this, function (_a) {
|
|
158
186
|
switch (_a.label) {
|
|
159
187
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_TASKS, this.authToken, args, requestId)];
|
|
160
188
|
case 1:
|
|
161
189
|
response = _a.sent();
|
|
162
|
-
|
|
190
|
+
task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
|
|
191
|
+
return [2 /*return*/, (0, validators_1.validateTask)(task)];
|
|
163
192
|
}
|
|
164
193
|
});
|
|
165
194
|
});
|
|
@@ -194,7 +223,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
194
223
|
*/
|
|
195
224
|
TodoistApi.prototype.updateTask = function (id, args, requestId) {
|
|
196
225
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
|
-
var response;
|
|
226
|
+
var response, task;
|
|
198
227
|
return __generator(this, function (_a) {
|
|
199
228
|
switch (_a.label) {
|
|
200
229
|
case 0:
|
|
@@ -202,7 +231,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
202
231
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_TASKS, id), this.authToken, args, requestId)];
|
|
203
232
|
case 1:
|
|
204
233
|
response = _a.sent();
|
|
205
|
-
|
|
234
|
+
task = (0, taskConverters_1.getTaskFromRawTaskResponse)(response.data);
|
|
235
|
+
return [2 /*return*/, (0, validators_1.validateTask)(task)];
|
|
206
236
|
}
|
|
207
237
|
});
|
|
208
238
|
});
|
|
@@ -334,7 +364,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
334
364
|
*/
|
|
335
365
|
TodoistApi.prototype.getProject = function (id) {
|
|
336
366
|
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
var response;
|
|
367
|
+
var response, project;
|
|
338
368
|
return __generator(this, function (_a) {
|
|
339
369
|
switch (_a.label) {
|
|
340
370
|
case 0:
|
|
@@ -342,7 +372,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
342
372
|
return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken)];
|
|
343
373
|
case 1:
|
|
344
374
|
response = _a.sent();
|
|
345
|
-
|
|
375
|
+
project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
|
|
376
|
+
return [2 /*return*/, (0, validators_1.validateProject)(project)];
|
|
346
377
|
}
|
|
347
378
|
});
|
|
348
379
|
});
|
|
@@ -356,12 +387,13 @@ var TodoistApi = /** @class */ (function () {
|
|
|
356
387
|
TodoistApi.prototype.getProjects = function (args) {
|
|
357
388
|
if (args === void 0) { args = {}; }
|
|
358
389
|
return __awaiter(this, void 0, void 0, function () {
|
|
359
|
-
var _a,
|
|
390
|
+
var _a, rawResults, nextCursor, results;
|
|
360
391
|
return __generator(this, function (_b) {
|
|
361
392
|
switch (_b.label) {
|
|
362
393
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args)];
|
|
363
394
|
case 1:
|
|
364
|
-
_a = (_b.sent()).data,
|
|
395
|
+
_a = (_b.sent()).data, rawResults = _a.results, nextCursor = _a.nextCursor;
|
|
396
|
+
results = rawResults.map(projectConverter_1.getProjectFromRawProjectResponse);
|
|
365
397
|
return [2 /*return*/, {
|
|
366
398
|
results: (0, validators_1.validateProjectArray)(results),
|
|
367
399
|
nextCursor: nextCursor,
|
|
@@ -379,13 +411,14 @@ var TodoistApi = /** @class */ (function () {
|
|
|
379
411
|
*/
|
|
380
412
|
TodoistApi.prototype.addProject = function (args, requestId) {
|
|
381
413
|
return __awaiter(this, void 0, void 0, function () {
|
|
382
|
-
var response;
|
|
414
|
+
var response, project;
|
|
383
415
|
return __generator(this, function (_a) {
|
|
384
416
|
switch (_a.label) {
|
|
385
417
|
case 0: return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, endpoints_1.ENDPOINT_REST_PROJECTS, this.authToken, args, requestId)];
|
|
386
418
|
case 1:
|
|
387
419
|
response = _a.sent();
|
|
388
|
-
|
|
420
|
+
project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
|
|
421
|
+
return [2 /*return*/, (0, validators_1.validateProject)(project)];
|
|
389
422
|
}
|
|
390
423
|
});
|
|
391
424
|
});
|
|
@@ -400,7 +433,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
400
433
|
*/
|
|
401
434
|
TodoistApi.prototype.updateProject = function (id, args, requestId) {
|
|
402
435
|
return __awaiter(this, void 0, void 0, function () {
|
|
403
|
-
var response;
|
|
436
|
+
var response, project;
|
|
404
437
|
return __generator(this, function (_a) {
|
|
405
438
|
switch (_a.label) {
|
|
406
439
|
case 0:
|
|
@@ -408,7 +441,8 @@ var TodoistApi = /** @class */ (function () {
|
|
|
408
441
|
return [4 /*yield*/, (0, restClient_1.request)('POST', this.syncApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, args, requestId)];
|
|
409
442
|
case 1:
|
|
410
443
|
response = _a.sent();
|
|
411
|
-
|
|
444
|
+
project = (0, projectConverter_1.getProjectFromRawProjectResponse)(response.data);
|
|
445
|
+
return [2 /*return*/, (0, validators_1.validateProject)(project)];
|
|
412
446
|
}
|
|
413
447
|
});
|
|
414
448
|
});
|
package/dist/authentication.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Permission scopes that can be requested during OAuth2 authorization.
|
|
3
|
-
* @see {@link https://
|
|
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://
|
|
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://
|
|
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://
|
|
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://
|
|
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>;
|
package/dist/authentication.js
CHANGED
|
@@ -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://
|
|
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 = "
|
|
2
|
-
export declare const API_BASE_URI = "/api/
|
|
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";
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -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 = '
|
|
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, RawComment, Attachment, Duration, Deadline } from '../types';
|
|
1
|
+
import { Label, Project, QuickAddTaskResponse, Section, Task, User, RawComment, Attachment, Duration, Deadline, RawTask, RawProject } 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;
|
|
@@ -16,30 +16,30 @@ export declare const DEFAULT_TASK: Task;
|
|
|
16
16
|
export declare const INVALID_TASK: {
|
|
17
17
|
due: string;
|
|
18
18
|
id: string;
|
|
19
|
-
assignerId: string | null;
|
|
20
|
-
assigneeId: string | null;
|
|
21
19
|
projectId: string;
|
|
22
20
|
sectionId: string | null;
|
|
23
21
|
parentId: string | null;
|
|
24
|
-
|
|
22
|
+
labels: string[];
|
|
23
|
+
deadline: {
|
|
24
|
+
date: string;
|
|
25
|
+
lang: string;
|
|
26
|
+
} | null;
|
|
27
|
+
duration: {
|
|
28
|
+
amount: number;
|
|
29
|
+
unit: "minute" | "day";
|
|
30
|
+
} | null;
|
|
31
|
+
priority: number;
|
|
25
32
|
content: string;
|
|
26
33
|
description: string;
|
|
34
|
+
assignerId: string | null;
|
|
35
|
+
assigneeId: string | null;
|
|
36
|
+
order: number;
|
|
27
37
|
isCompleted: boolean;
|
|
28
|
-
labels: string[];
|
|
29
|
-
priority: number;
|
|
30
38
|
creatorId: string;
|
|
31
39
|
createdAt: string;
|
|
32
40
|
url: string;
|
|
33
|
-
duration: {
|
|
34
|
-
amount: number;
|
|
35
|
-
unit: "minute" | "day";
|
|
36
|
-
} | null;
|
|
37
|
-
deadline: {
|
|
38
|
-
date: string;
|
|
39
|
-
lang: string;
|
|
40
|
-
} | null;
|
|
41
41
|
};
|
|
42
|
-
export declare const TASK_WITH_OPTIONALS_AS_NULL:
|
|
42
|
+
export declare const TASK_WITH_OPTIONALS_AS_NULL: RawTask;
|
|
43
43
|
export declare const DEFAULT_PROJECT: Project;
|
|
44
44
|
export declare const INVALID_PROJECT: {
|
|
45
45
|
name: number;
|
|
@@ -48,26 +48,26 @@ export declare const INVALID_PROJECT: {
|
|
|
48
48
|
order: number | null;
|
|
49
49
|
url: string;
|
|
50
50
|
color: string;
|
|
51
|
-
isShared: boolean;
|
|
52
51
|
isFavorite: boolean;
|
|
52
|
+
viewStyle: string;
|
|
53
|
+
isShared: boolean;
|
|
53
54
|
isInboxProject: boolean;
|
|
54
55
|
isTeamInbox: boolean;
|
|
55
|
-
viewStyle: string;
|
|
56
56
|
};
|
|
57
57
|
export declare const PROJECT_WITH_OPTIONALS_AS_NULL: Project;
|
|
58
58
|
export declare const DEFAULT_SECTION: Section;
|
|
59
59
|
export declare const INVALID_SECTION: {
|
|
60
60
|
projectId: undefined;
|
|
61
|
-
id: string;
|
|
62
|
-
name: string;
|
|
63
61
|
userId: string;
|
|
62
|
+
id: string;
|
|
63
|
+
isDeleted: boolean;
|
|
64
64
|
addedAt: string;
|
|
65
65
|
updatedAt: string;
|
|
66
|
+
isCollapsed: boolean;
|
|
67
|
+
isArchived: boolean;
|
|
68
|
+
name: string;
|
|
66
69
|
archivedAt: string | null;
|
|
67
70
|
sectionOrder: number;
|
|
68
|
-
isArchived: boolean;
|
|
69
|
-
isDeleted: boolean;
|
|
70
|
-
isCollapsed: boolean;
|
|
71
71
|
};
|
|
72
72
|
export declare const DEFAULT_LABEL: Label;
|
|
73
73
|
export declare const INVALID_LABEL: {
|
|
@@ -103,8 +103,8 @@ export declare const DEFAULT_COMMENT: {
|
|
|
103
103
|
taskId: string | undefined;
|
|
104
104
|
itemId: undefined;
|
|
105
105
|
id: string;
|
|
106
|
-
content: string;
|
|
107
106
|
isDeleted: boolean;
|
|
107
|
+
content: string;
|
|
108
108
|
postedAt: string;
|
|
109
109
|
fileAttachment: {
|
|
110
110
|
resourceType: string;
|
|
@@ -155,8 +155,8 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_TASK: {
|
|
|
155
155
|
taskId: string | undefined;
|
|
156
156
|
itemId: undefined;
|
|
157
157
|
id: string;
|
|
158
|
-
content: string;
|
|
159
158
|
isDeleted: boolean;
|
|
159
|
+
content: string;
|
|
160
160
|
postedAt: string;
|
|
161
161
|
fileAttachment: {
|
|
162
162
|
resourceType: string;
|
|
@@ -182,8 +182,8 @@ export declare const COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL: {
|
|
|
182
182
|
taskId: string | undefined;
|
|
183
183
|
itemId: undefined;
|
|
184
184
|
id: string;
|
|
185
|
-
content: string;
|
|
186
185
|
isDeleted: boolean;
|
|
186
|
+
content: string;
|
|
187
187
|
postedAt: string;
|
|
188
188
|
fileAttachment: {
|
|
189
189
|
resourceType: string;
|
|
@@ -208,8 +208,8 @@ export declare const RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: RawComment;
|
|
|
208
208
|
export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
|
|
209
209
|
taskId: undefined;
|
|
210
210
|
id: string;
|
|
211
|
-
content: string;
|
|
212
211
|
isDeleted: boolean;
|
|
212
|
+
content: string;
|
|
213
213
|
postedAt: string;
|
|
214
214
|
fileAttachment: {
|
|
215
215
|
resourceType: string;
|
|
@@ -231,3 +231,5 @@ export declare const COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT: {
|
|
|
231
231
|
projectId?: string | undefined;
|
|
232
232
|
itemId?: string | undefined;
|
|
233
233
|
};
|
|
234
|
+
export declare const RAW_DEFAULT_TASK: RawTask;
|
|
235
|
+
export declare const RAW_DEFAULT_PROJECT: RawProject;
|
|
@@ -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.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;
|
|
14
|
+
exports.RAW_DEFAULT_PROJECT = exports.RAW_DEFAULT_TASK = 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';
|
|
@@ -100,7 +100,31 @@ exports.DEFAULT_TASK = {
|
|
|
100
100
|
deadline: exports.DEFAULT_DEADLINE,
|
|
101
101
|
};
|
|
102
102
|
exports.INVALID_TASK = __assign(__assign({}, exports.DEFAULT_TASK), { due: '2020-01-31' });
|
|
103
|
-
exports.TASK_WITH_OPTIONALS_AS_NULL =
|
|
103
|
+
exports.TASK_WITH_OPTIONALS_AS_NULL = {
|
|
104
|
+
userId: DEFAULT_CREATOR,
|
|
105
|
+
id: DEFAULT_TASK_ID,
|
|
106
|
+
projectId: DEFAULT_PROJECT_ID,
|
|
107
|
+
sectionId: null,
|
|
108
|
+
parentId: null,
|
|
109
|
+
addedByUid: DEFAULT_CREATOR,
|
|
110
|
+
assignedByUid: null,
|
|
111
|
+
responsibleUid: null,
|
|
112
|
+
labels: [],
|
|
113
|
+
deadline: null,
|
|
114
|
+
duration: null,
|
|
115
|
+
checked: false,
|
|
116
|
+
isDeleted: false,
|
|
117
|
+
addedAt: DEFAULT_DATE,
|
|
118
|
+
completedAt: null,
|
|
119
|
+
updatedAt: DEFAULT_DATE,
|
|
120
|
+
due: null,
|
|
121
|
+
priority: DEFAULT_TASK_PRIORITY,
|
|
122
|
+
childOrder: DEFAULT_ORDER,
|
|
123
|
+
content: DEFAULT_TASK_CONTENT,
|
|
124
|
+
description: DEFAULT_TASK_DESCRIPTION,
|
|
125
|
+
dayOrder: DEFAULT_ORDER,
|
|
126
|
+
isCollapsed: false,
|
|
127
|
+
};
|
|
104
128
|
exports.DEFAULT_PROJECT = {
|
|
105
129
|
id: DEFAULT_PROJECT_ID,
|
|
106
130
|
name: DEFAULT_PROJECT_NAME,
|
|
@@ -182,3 +206,49 @@ exports.RAW_COMMENT_WITH_ATTACHMENT_WITH_OPTIONALS_AS_NULL = __assign(__assign({
|
|
|
182
206
|
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
207
|
exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.DEFAULT_RAW_COMMENT), { itemId: undefined, projectId: DEFAULT_PROJECT_ID });
|
|
184
208
|
exports.COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT = __assign(__assign({}, exports.RAW_COMMENT_WITH_OPTIONALS_AS_NULL_PROJECT), { taskId: undefined });
|
|
209
|
+
exports.RAW_DEFAULT_TASK = {
|
|
210
|
+
userId: DEFAULT_CREATOR,
|
|
211
|
+
id: DEFAULT_TASK_ID,
|
|
212
|
+
projectId: DEFAULT_PROJECT_ID,
|
|
213
|
+
sectionId: DEFAULT_SECTION_ID,
|
|
214
|
+
parentId: DEFAULT_PARENT_ID,
|
|
215
|
+
addedByUid: DEFAULT_CREATOR,
|
|
216
|
+
assignedByUid: DEFAULT_CREATOR,
|
|
217
|
+
responsibleUid: DEFAULT_ASSIGNEE,
|
|
218
|
+
labels: DEFAULT_LABELS,
|
|
219
|
+
deadline: exports.DEFAULT_DEADLINE,
|
|
220
|
+
duration: exports.DEFAULT_DURATION,
|
|
221
|
+
checked: false,
|
|
222
|
+
isDeleted: false,
|
|
223
|
+
addedAt: DEFAULT_DATE,
|
|
224
|
+
completedAt: null,
|
|
225
|
+
updatedAt: DEFAULT_DATE,
|
|
226
|
+
due: exports.DEFAULT_DUE_DATE,
|
|
227
|
+
priority: DEFAULT_TASK_PRIORITY,
|
|
228
|
+
childOrder: DEFAULT_ORDER,
|
|
229
|
+
content: DEFAULT_TASK_CONTENT,
|
|
230
|
+
description: DEFAULT_TASK_DESCRIPTION,
|
|
231
|
+
dayOrder: DEFAULT_ORDER,
|
|
232
|
+
isCollapsed: false,
|
|
233
|
+
};
|
|
234
|
+
exports.RAW_DEFAULT_PROJECT = {
|
|
235
|
+
id: DEFAULT_PROJECT_ID,
|
|
236
|
+
canAssignTasks: true,
|
|
237
|
+
childOrder: DEFAULT_ORDER,
|
|
238
|
+
color: DEFAULT_ENTITY_COLOR,
|
|
239
|
+
createdAt: DEFAULT_DATE,
|
|
240
|
+
isArchived: false,
|
|
241
|
+
isDeleted: false,
|
|
242
|
+
isFavorite: false,
|
|
243
|
+
isFrozen: false,
|
|
244
|
+
name: DEFAULT_PROJECT_NAME,
|
|
245
|
+
updatedAt: DEFAULT_DATE,
|
|
246
|
+
viewStyle: DEFAULT_PROJECT_VIEW_STYLE,
|
|
247
|
+
defaultOrder: DEFAULT_ORDER,
|
|
248
|
+
description: '',
|
|
249
|
+
publicAccess: false,
|
|
250
|
+
parentId: DEFAULT_PROJECT_ID,
|
|
251
|
+
inboxProject: false,
|
|
252
|
+
isCollapsed: false,
|
|
253
|
+
isShared: false,
|
|
254
|
+
};
|