@doist/todoist-api-typescript 5.8.0 → 5.9.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 +1 -1
- package/dist/authentication.js +27 -6
- package/dist/consts/endpoints.d.ts +11 -0
- package/dist/consts/endpoints.js +27 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rest-client.d.ts +16 -0
- package/dist/{restClient.js → rest-client.js} +23 -15
- package/dist/{testUtils → test-utils}/mocks.js +1 -1
- package/dist/{testUtils/testDefaults.js → test-utils/test-defaults.js} +4 -4
- package/dist/{TodoistApi.d.ts → todoist-api.d.ts} +91 -2
- package/dist/{TodoistApi.js → todoist-api.js} +734 -98
- package/dist/types/entities.d.ts +119 -0
- package/dist/types/entities.js +64 -6
- package/dist/types/http.d.ts +1 -1
- package/dist/types/requests.d.ts +137 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/multipart-upload.d.ts +50 -0
- package/dist/utils/multipart-upload.js +171 -0
- package/dist/utils/validators.d.ts +7 -1
- package/dist/utils/validators.js +27 -0
- package/package.json +1 -1
- package/dist/restClient.d.ts +0 -5
- /package/dist/{testUtils → test-utils}/asserts.d.ts +0 -0
- /package/dist/{testUtils → test-utils}/asserts.js +0 -0
- /package/dist/{testUtils → test-utils}/mocks.d.ts +0 -0
- /package/dist/{testUtils/testDefaults.d.ts → test-utils/test-defaults.d.ts} +0 -0
- /package/dist/utils/{urlHelpers.d.ts → url-helpers.d.ts} +0 -0
- /package/dist/utils/{urlHelpers.js → url-helpers.js} +0 -0
package/README.md
CHANGED
package/dist/authentication.js
CHANGED
|
@@ -41,7 +41,7 @@ exports.getAuthorizationUrl = getAuthorizationUrl;
|
|
|
41
41
|
exports.getAuthToken = getAuthToken;
|
|
42
42
|
exports.revokeAuthToken = revokeAuthToken;
|
|
43
43
|
exports.revokeToken = revokeToken;
|
|
44
|
-
var
|
|
44
|
+
var rest_client_1 = require("./rest-client");
|
|
45
45
|
var uuid_1 = require("uuid");
|
|
46
46
|
var types_1 = require("./types");
|
|
47
47
|
var endpoints_1 = require("./consts/endpoints");
|
|
@@ -115,7 +115,13 @@ function getAuthToken(args, baseUrl) {
|
|
|
115
115
|
var _a;
|
|
116
116
|
return __generator(this, function (_b) {
|
|
117
117
|
switch (_b.label) {
|
|
118
|
-
case 0: return [4 /*yield*/, (0,
|
|
118
|
+
case 0: return [4 /*yield*/, (0, rest_client_1.request)({
|
|
119
|
+
httpMethod: 'POST',
|
|
120
|
+
baseUri: (0, endpoints_1.getAuthBaseUri)(baseUrl),
|
|
121
|
+
relativePath: endpoints_1.ENDPOINT_GET_TOKEN,
|
|
122
|
+
apiToken: undefined,
|
|
123
|
+
payload: args,
|
|
124
|
+
})];
|
|
119
125
|
case 1:
|
|
120
126
|
response = _b.sent();
|
|
121
127
|
if (response.status !== 200 || !((_a = response.data) === null || _a === void 0 ? void 0 : _a.accessToken)) {
|
|
@@ -147,10 +153,16 @@ function revokeAuthToken(args, baseUrl) {
|
|
|
147
153
|
var response;
|
|
148
154
|
return __generator(this, function (_a) {
|
|
149
155
|
switch (_a.label) {
|
|
150
|
-
case 0: return [4 /*yield*/, (0,
|
|
156
|
+
case 0: return [4 /*yield*/, (0, rest_client_1.request)({
|
|
157
|
+
httpMethod: 'POST',
|
|
158
|
+
baseUri: (0, endpoints_1.getSyncBaseUri)(baseUrl),
|
|
159
|
+
relativePath: endpoints_1.ENDPOINT_REVOKE_TOKEN,
|
|
160
|
+
apiToken: undefined,
|
|
161
|
+
payload: args,
|
|
162
|
+
})];
|
|
151
163
|
case 1:
|
|
152
164
|
response = _a.sent();
|
|
153
|
-
return [2 /*return*/, (0,
|
|
165
|
+
return [2 /*return*/, (0, rest_client_1.isSuccess)(response)];
|
|
154
166
|
}
|
|
155
167
|
});
|
|
156
168
|
});
|
|
@@ -189,10 +201,19 @@ function revokeToken(args, baseUrl) {
|
|
|
189
201
|
token: token,
|
|
190
202
|
token_type_hint: 'access_token',
|
|
191
203
|
};
|
|
192
|
-
return [4 /*yield*/, (0,
|
|
204
|
+
return [4 /*yield*/, (0, rest_client_1.request)({
|
|
205
|
+
httpMethod: 'POST',
|
|
206
|
+
baseUri: (0, endpoints_1.getSyncBaseUri)(baseUrl),
|
|
207
|
+
relativePath: endpoints_1.ENDPOINT_REVOKE,
|
|
208
|
+
apiToken: undefined,
|
|
209
|
+
payload: requestBody,
|
|
210
|
+
requestId: undefined,
|
|
211
|
+
hasSyncCommands: false,
|
|
212
|
+
customHeaders: customHeaders,
|
|
213
|
+
})];
|
|
193
214
|
case 1:
|
|
194
215
|
response = _a.sent();
|
|
195
|
-
return [2 /*return*/, (0,
|
|
216
|
+
return [2 /*return*/, (0, rest_client_1.isSuccess)(response)];
|
|
196
217
|
}
|
|
197
218
|
});
|
|
198
219
|
});
|
|
@@ -32,3 +32,14 @@ export declare const ENDPOINT_AUTHORIZATION = "authorize";
|
|
|
32
32
|
export declare const ENDPOINT_GET_TOKEN = "access_token";
|
|
33
33
|
export declare const ENDPOINT_REVOKE_TOKEN = "access_tokens/revoke";
|
|
34
34
|
export declare const ENDPOINT_REVOKE = "revoke";
|
|
35
|
+
export declare const ENDPOINT_WORKSPACE_INVITATIONS = "workspaces/invitations";
|
|
36
|
+
export declare const ENDPOINT_WORKSPACE_INVITATIONS_ALL = "workspaces/invitations/all";
|
|
37
|
+
export declare const ENDPOINT_WORKSPACE_INVITATIONS_DELETE = "workspaces/invitations/delete";
|
|
38
|
+
export declare const ENDPOINT_WORKSPACE_JOIN = "workspaces/join";
|
|
39
|
+
export declare const ENDPOINT_WORKSPACE_LOGO = "workspaces/logo";
|
|
40
|
+
export declare const ENDPOINT_WORKSPACE_PLAN_DETAILS = "workspaces/plan_details";
|
|
41
|
+
export declare const ENDPOINT_WORKSPACE_USERS = "workspaces/users";
|
|
42
|
+
export declare function getWorkspaceInvitationAcceptEndpoint(inviteCode: string): string;
|
|
43
|
+
export declare function getWorkspaceInvitationRejectEndpoint(inviteCode: string): string;
|
|
44
|
+
export declare function getWorkspaceActiveProjectsEndpoint(workspaceId: number): string;
|
|
45
|
+
export declare function getWorkspaceArchivedProjectsEndpoint(workspaceId: number): string;
|
package/dist/consts/endpoints.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENDPOINT_REVOKE = exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = 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_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
3
|
+
exports.ENDPOINT_WORKSPACE_USERS = exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = exports.ENDPOINT_WORKSPACE_LOGO = exports.ENDPOINT_WORKSPACE_JOIN = exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = exports.ENDPOINT_WORKSPACE_INVITATIONS = exports.ENDPOINT_REVOKE = exports.ENDPOINT_REVOKE_TOKEN = exports.ENDPOINT_GET_TOKEN = exports.ENDPOINT_AUTHORIZATION = exports.ENDPOINT_SYNC = exports.ENDPOINT_SYNC_QUICK_ADD = exports.PROJECT_UNARCHIVE = exports.PROJECT_ARCHIVE = exports.ENDPOINT_REST_UPLOADS = exports.ENDPOINT_REST_ACTIVITIES = exports.ENDPOINT_REST_PRODUCTIVITY = exports.ENDPOINT_REST_USER = exports.ENDPOINT_REST_PROJECT_COLLABORATORS = exports.ENDPOINT_REST_PROJECTS_ARCHIVED = exports.ENDPOINT_REST_PROJECTS = exports.ENDPOINT_REST_TASK_MOVE = 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_TASKS_COMPLETED_SEARCH = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE = exports.ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE = exports.ENDPOINT_REST_TASKS_FILTER = exports.ENDPOINT_REST_TASKS = exports.API_BASE_URI = exports.API_VERSION = exports.TODOIST_WEB_URI = void 0;
|
|
4
4
|
exports.getSyncBaseUri = getSyncBaseUri;
|
|
5
5
|
exports.getAuthBaseUri = getAuthBaseUri;
|
|
6
|
+
exports.getWorkspaceInvitationAcceptEndpoint = getWorkspaceInvitationAcceptEndpoint;
|
|
7
|
+
exports.getWorkspaceInvitationRejectEndpoint = getWorkspaceInvitationRejectEndpoint;
|
|
8
|
+
exports.getWorkspaceActiveProjectsEndpoint = getWorkspaceActiveProjectsEndpoint;
|
|
9
|
+
exports.getWorkspaceArchivedProjectsEndpoint = getWorkspaceArchivedProjectsEndpoint;
|
|
6
10
|
var BASE_URI = 'https://api.todoist.com';
|
|
7
11
|
var TODOIST_URI = 'https://todoist.com';
|
|
8
12
|
exports.TODOIST_WEB_URI = 'https://app.todoist.com/app';
|
|
@@ -48,3 +52,25 @@ exports.ENDPOINT_AUTHORIZATION = 'authorize';
|
|
|
48
52
|
exports.ENDPOINT_GET_TOKEN = 'access_token';
|
|
49
53
|
exports.ENDPOINT_REVOKE_TOKEN = 'access_tokens/revoke';
|
|
50
54
|
exports.ENDPOINT_REVOKE = 'revoke';
|
|
55
|
+
// Workspace endpoints
|
|
56
|
+
exports.ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
|
|
57
|
+
exports.ENDPOINT_WORKSPACE_INVITATIONS_ALL = 'workspaces/invitations/all';
|
|
58
|
+
exports.ENDPOINT_WORKSPACE_INVITATIONS_DELETE = 'workspaces/invitations/delete';
|
|
59
|
+
exports.ENDPOINT_WORKSPACE_JOIN = 'workspaces/join';
|
|
60
|
+
exports.ENDPOINT_WORKSPACE_LOGO = 'workspaces/logo';
|
|
61
|
+
exports.ENDPOINT_WORKSPACE_PLAN_DETAILS = 'workspaces/plan_details';
|
|
62
|
+
exports.ENDPOINT_WORKSPACE_USERS = 'workspaces/users';
|
|
63
|
+
// Workspace invitation actions (require invite_code parameter)
|
|
64
|
+
function getWorkspaceInvitationAcceptEndpoint(inviteCode) {
|
|
65
|
+
return "workspaces/invitations/".concat(inviteCode, "/accept");
|
|
66
|
+
}
|
|
67
|
+
function getWorkspaceInvitationRejectEndpoint(inviteCode) {
|
|
68
|
+
return "workspaces/invitations/".concat(inviteCode, "/reject");
|
|
69
|
+
}
|
|
70
|
+
// Workspace projects (require workspace_id parameter)
|
|
71
|
+
function getWorkspaceActiveProjectsEndpoint(workspaceId) {
|
|
72
|
+
return "workspaces/".concat(workspaceId, "/projects/active");
|
|
73
|
+
}
|
|
74
|
+
function getWorkspaceArchivedProjectsEndpoint(workspaceId) {
|
|
75
|
+
return "workspaces/".concat(workspaceId, "/projects/archived");
|
|
76
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./todoist-api"), exports);
|
|
18
18
|
__exportStar(require("./authentication"), exports);
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { HttpMethod } from './types/http';
|
|
3
|
+
type RequestArgs = {
|
|
4
|
+
httpMethod: HttpMethod;
|
|
5
|
+
baseUri: string;
|
|
6
|
+
relativePath: string;
|
|
7
|
+
apiToken?: string;
|
|
8
|
+
payload?: Record<string, unknown>;
|
|
9
|
+
requestId?: string;
|
|
10
|
+
hasSyncCommands?: boolean;
|
|
11
|
+
customHeaders?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export declare function paramsSerializer(params: Record<string, unknown>): string;
|
|
14
|
+
export declare function isSuccess(response: AxiosResponse): boolean;
|
|
15
|
+
export declare function request<T>(args: RequestArgs): Promise<AxiosResponse<T>>;
|
|
16
|
+
export {};
|
|
@@ -91,7 +91,8 @@ function getRetryDelay(retryCount) {
|
|
|
91
91
|
function isAxiosError(error) {
|
|
92
92
|
return Boolean(error === null || error === void 0 ? void 0 : error.isAxiosError);
|
|
93
93
|
}
|
|
94
|
-
function getTodoistRequestError(
|
|
94
|
+
function getTodoistRequestError(args) {
|
|
95
|
+
var error = args.error, originalStack = args.originalStack;
|
|
95
96
|
var requestError = new errors_1.TodoistRequestError(error.message);
|
|
96
97
|
requestError.stack = isAxiosError(error) && originalStack ? originalStack.stack : error.stack;
|
|
97
98
|
if (isAxiosError(error) && error.response) {
|
|
@@ -100,14 +101,16 @@ function getTodoistRequestError(error, originalStack) {
|
|
|
100
101
|
}
|
|
101
102
|
return requestError;
|
|
102
103
|
}
|
|
103
|
-
function getRequestConfiguration(
|
|
104
|
+
function getRequestConfiguration(args) {
|
|
105
|
+
var baseURL = args.baseURL, apiToken = args.apiToken, requestId = args.requestId, customHeaders = args.customHeaders;
|
|
104
106
|
var authHeader = apiToken ? { Authorization: getAuthHeader(apiToken) } : undefined;
|
|
105
107
|
var requestIdHeader = requestId ? { 'X-Request-Id': requestId } : undefined;
|
|
106
108
|
var headers = __assign(__assign(__assign(__assign({}, defaultHeaders), authHeader), requestIdHeader), customHeaders);
|
|
107
109
|
return { baseURL: baseURL, headers: headers };
|
|
108
110
|
}
|
|
109
|
-
function getAxiosClient(
|
|
110
|
-
var
|
|
111
|
+
function getAxiosClient(args) {
|
|
112
|
+
var baseURL = args.baseURL, apiToken = args.apiToken, requestId = args.requestId, customHeaders = args.customHeaders;
|
|
113
|
+
var configuration = getRequestConfiguration({ baseURL: baseURL, apiToken: apiToken, requestId: requestId, customHeaders: customHeaders });
|
|
111
114
|
var client = (0, axios_case_converter_1.default)(axios_1.default.create(configuration), {
|
|
112
115
|
caseFunctions: {
|
|
113
116
|
camel: processing_helpers_1.customCamelCase,
|
|
@@ -123,28 +126,31 @@ function getAxiosClient(baseURL, apiToken, requestId, customHeaders) {
|
|
|
123
126
|
function isSuccess(response) {
|
|
124
127
|
return response.status >= 200 && response.status < 300;
|
|
125
128
|
}
|
|
126
|
-
function request(
|
|
129
|
+
function request(args) {
|
|
127
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
var originalStack, axiosClient, _a, error_1;
|
|
131
|
+
var httpMethod, baseUri, relativePath, apiToken, payload, initialRequestId, hasSyncCommands, customHeaders, originalStack, requestId, axiosClient, _a, error_1;
|
|
129
132
|
return __generator(this, function (_b) {
|
|
130
133
|
switch (_b.label) {
|
|
131
134
|
case 0:
|
|
135
|
+
httpMethod = args.httpMethod, baseUri = args.baseUri, relativePath = args.relativePath, apiToken = args.apiToken, payload = args.payload, initialRequestId = args.requestId, hasSyncCommands = args.hasSyncCommands, customHeaders = args.customHeaders;
|
|
132
136
|
originalStack = new Error();
|
|
133
137
|
_b.label = 1;
|
|
134
138
|
case 1:
|
|
135
|
-
_b.trys.push([1,
|
|
139
|
+
_b.trys.push([1, 11, , 12]);
|
|
140
|
+
requestId = initialRequestId;
|
|
136
141
|
// Sync api don't allow a request id in the CORS
|
|
137
142
|
if (httpMethod === 'POST' && !requestId && !baseUri.includes(endpoints_1.API_BASE_URI)) {
|
|
138
143
|
requestId = (0, uuid_1.v4)();
|
|
139
144
|
}
|
|
140
|
-
axiosClient = getAxiosClient(baseUri, apiToken, requestId, customHeaders);
|
|
145
|
+
axiosClient = getAxiosClient({ baseURL: baseUri, apiToken: apiToken, requestId: requestId, customHeaders: customHeaders });
|
|
141
146
|
_a = httpMethod;
|
|
142
147
|
switch (_a) {
|
|
143
148
|
case 'GET': return [3 /*break*/, 2];
|
|
144
149
|
case 'POST': return [3 /*break*/, 4];
|
|
145
|
-
case '
|
|
150
|
+
case 'PUT': return [3 /*break*/, 6];
|
|
151
|
+
case 'DELETE': return [3 /*break*/, 8];
|
|
146
152
|
}
|
|
147
|
-
return [3 /*break*/,
|
|
153
|
+
return [3 /*break*/, 10];
|
|
148
154
|
case 2: return [4 /*yield*/, axiosClient.get(relativePath, {
|
|
149
155
|
params: payload,
|
|
150
156
|
paramsSerializer: {
|
|
@@ -154,16 +160,18 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
154
160
|
case 3: return [2 /*return*/, _b.sent()];
|
|
155
161
|
case 4: return [4 /*yield*/, axiosClient.post(relativePath, hasSyncCommands ? JSON.stringify(payload) : payload)];
|
|
156
162
|
case 5: return [2 /*return*/, _b.sent()];
|
|
157
|
-
case 6: return [4 /*yield*/, axiosClient.
|
|
163
|
+
case 6: return [4 /*yield*/, axiosClient.put(relativePath, hasSyncCommands ? JSON.stringify(payload) : payload)];
|
|
158
164
|
case 7: return [2 /*return*/, _b.sent()];
|
|
159
|
-
case 8: return [
|
|
160
|
-
case 9:
|
|
165
|
+
case 8: return [4 /*yield*/, axiosClient.delete(relativePath)];
|
|
166
|
+
case 9: return [2 /*return*/, _b.sent()];
|
|
167
|
+
case 10: return [3 /*break*/, 12];
|
|
168
|
+
case 11:
|
|
161
169
|
error_1 = _b.sent();
|
|
162
170
|
if (!isAxiosError(error_1) && !(error_1 instanceof Error)) {
|
|
163
171
|
throw new Error('An unknown error occurred during the request');
|
|
164
172
|
}
|
|
165
|
-
throw getTodoistRequestError(error_1, originalStack);
|
|
166
|
-
case
|
|
173
|
+
throw getTodoistRequestError({ error: error_1, originalStack: originalStack });
|
|
174
|
+
case 12: return [2 /*return*/];
|
|
167
175
|
}
|
|
168
176
|
});
|
|
169
177
|
});
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.setupRestClientMock = setupRestClientMock;
|
|
37
|
-
var restClient = __importStar(require("../
|
|
37
|
+
var restClient = __importStar(require("../rest-client"));
|
|
38
38
|
function setupRestClientMock(responseData, status) {
|
|
39
39
|
if (status === void 0) { status = 200; }
|
|
40
40
|
var response = { status: status, data: responseData };
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
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_DEADLINE = exports.DEFAULT_DURATION = exports.DEFAULT_DUE_DATE = exports.INVALID_ENTITY_ID = exports.DEFAULT_REQUEST_ID = exports.DEFAULT_AUTH_TOKEN = exports.DEFAULT_PROJECT_VIEW_STYLE = exports.DEFAULT_PROJECT_NAME = exports.DEFAULT_PROJECT_ID = exports.DEFAULT_ORDER = exports.DEFAULT_TASK_PRIORITY = exports.DEFAULT_TASK_DESCRIPTION = exports.DEFAULT_TASK_CONTENT = exports.DEFAULT_TASK_ID = void 0;
|
|
15
|
-
var
|
|
15
|
+
var url_helpers_1 = require("../utils/url-helpers");
|
|
16
16
|
exports.DEFAULT_TASK_ID = '1234';
|
|
17
17
|
exports.DEFAULT_TASK_CONTENT = 'This is a task';
|
|
18
18
|
exports.DEFAULT_TASK_DESCRIPTION = 'A description';
|
|
@@ -44,9 +44,9 @@ var DEFAULT_IS_DELETED = false;
|
|
|
44
44
|
var DEFAULT_IS_FROZEN = false;
|
|
45
45
|
var DEFAULT_IS_COLLAPSED = false;
|
|
46
46
|
// URL constants using the helper functions
|
|
47
|
-
var DEFAULT_TASK_URL = (0,
|
|
48
|
-
var DEFAULT_PROJECT_URL = (0,
|
|
49
|
-
var DEFAULT_SECTION_URL = (0,
|
|
47
|
+
var DEFAULT_TASK_URL = (0, url_helpers_1.getTaskUrl)(exports.DEFAULT_TASK_ID, exports.DEFAULT_TASK_CONTENT);
|
|
48
|
+
var DEFAULT_PROJECT_URL = (0, url_helpers_1.getProjectUrl)(exports.DEFAULT_PROJECT_ID, exports.DEFAULT_PROJECT_NAME);
|
|
49
|
+
var DEFAULT_SECTION_URL = (0, url_helpers_1.getSectionUrl)(DEFAULT_SECTION_ID, DEFAULT_SECTION_NAME);
|
|
50
50
|
exports.DEFAULT_AUTH_TOKEN = 'AToken';
|
|
51
51
|
exports.DEFAULT_REQUEST_ID = 'ARequestID';
|
|
52
52
|
exports.INVALID_ENTITY_ID = 1234;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Attachment, PersonalProject, WorkspaceProject, Label, Section, Comment, Task, CurrentUser, ProductivityStats } from './types/entities';
|
|
2
|
-
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, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, SearchCompletedTasksArgs, GetActivityLogsArgs, GetActivityLogsResponse, UploadFileArgs, DeleteUploadArgs } from './types/requests';
|
|
1
|
+
import { Attachment, PersonalProject, WorkspaceProject, Label, Section, Comment, Task, CurrentUser, ProductivityStats, WorkspaceInvitation, WorkspacePlanDetails, JoinWorkspaceResult } from './types/entities';
|
|
2
|
+
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, GetCompletedTasksByCompletionDateArgs, GetCompletedTasksByDueDateArgs, GetCompletedTasksResponse, GetArchivedProjectsArgs, GetArchivedProjectsResponse, SearchCompletedTasksArgs, GetActivityLogsArgs, GetActivityLogsResponse, UploadFileArgs, DeleteUploadArgs, GetWorkspaceInvitationsArgs, DeleteWorkspaceInvitationArgs, WorkspaceInvitationActionArgs, JoinWorkspaceArgs, WorkspaceLogoArgs, GetWorkspacePlanDetailsArgs, GetWorkspaceUsersArgs, GetWorkspaceUsersResponse, GetWorkspaceProjectsArgs, WorkspaceInvitationsResponse, AllWorkspaceInvitationsResponse, WorkspaceLogoResponse } from './types/requests';
|
|
3
3
|
/**
|
|
4
4
|
* A client for interacting with the Todoist API v1.
|
|
5
5
|
* This class provides methods to manage tasks, projects, sections, labels, and comments in Todoist.
|
|
@@ -422,4 +422,93 @@ export declare class TodoistApi {
|
|
|
422
422
|
* ```
|
|
423
423
|
*/
|
|
424
424
|
deleteUpload(args: DeleteUploadArgs, requestId?: string): Promise<boolean>;
|
|
425
|
+
/**
|
|
426
|
+
* Gets pending invitations for a workspace.
|
|
427
|
+
*
|
|
428
|
+
* @param args - Arguments including workspace ID.
|
|
429
|
+
* @param requestId - Optional request ID for idempotency.
|
|
430
|
+
* @returns Array of email addresses with pending invitations.
|
|
431
|
+
*/
|
|
432
|
+
getWorkspaceInvitations(args: GetWorkspaceInvitationsArgs, requestId?: string): Promise<WorkspaceInvitationsResponse>;
|
|
433
|
+
/**
|
|
434
|
+
* Gets all workspace invitations (admin only).
|
|
435
|
+
*
|
|
436
|
+
* @param requestId - Optional request ID for idempotency.
|
|
437
|
+
* @returns Array of email addresses with pending invitations.
|
|
438
|
+
*/
|
|
439
|
+
getAllWorkspaceInvitations(args?: {
|
|
440
|
+
workspaceId?: number;
|
|
441
|
+
}, requestId?: string): Promise<AllWorkspaceInvitationsResponse>;
|
|
442
|
+
/**
|
|
443
|
+
* Deletes a workspace invitation (admin only).
|
|
444
|
+
*
|
|
445
|
+
* @param args - Arguments including workspace ID and user email.
|
|
446
|
+
* @param requestId - Optional request ID for idempotency.
|
|
447
|
+
* @returns The deleted invitation.
|
|
448
|
+
*/
|
|
449
|
+
deleteWorkspaceInvitation(args: DeleteWorkspaceInvitationArgs, requestId?: string): Promise<WorkspaceInvitation>;
|
|
450
|
+
/**
|
|
451
|
+
* Accepts a workspace invitation.
|
|
452
|
+
*
|
|
453
|
+
* @param args - Arguments including invite code.
|
|
454
|
+
* @param requestId - Optional request ID for idempotency.
|
|
455
|
+
* @returns The accepted invitation.
|
|
456
|
+
*/
|
|
457
|
+
acceptWorkspaceInvitation(args: WorkspaceInvitationActionArgs, requestId?: string): Promise<WorkspaceInvitation>;
|
|
458
|
+
/**
|
|
459
|
+
* Rejects a workspace invitation.
|
|
460
|
+
*
|
|
461
|
+
* @param args - Arguments including invite code.
|
|
462
|
+
* @param requestId - Optional request ID for idempotency.
|
|
463
|
+
* @returns The rejected invitation.
|
|
464
|
+
*/
|
|
465
|
+
rejectWorkspaceInvitation(args: WorkspaceInvitationActionArgs, requestId?: string): Promise<WorkspaceInvitation>;
|
|
466
|
+
/**
|
|
467
|
+
* Joins a workspace via invitation link or domain auto-join.
|
|
468
|
+
*
|
|
469
|
+
* @param args - Arguments including invite code or workspace ID.
|
|
470
|
+
* @param requestId - Optional request ID for idempotency.
|
|
471
|
+
* @returns Workspace user information.
|
|
472
|
+
*/
|
|
473
|
+
joinWorkspace(args: JoinWorkspaceArgs, requestId?: string): Promise<JoinWorkspaceResult>;
|
|
474
|
+
/**
|
|
475
|
+
* Uploads or updates a workspace logo.
|
|
476
|
+
*
|
|
477
|
+
* @param args - Arguments including workspace ID, file, and options.
|
|
478
|
+
* @param requestId - Optional request ID for idempotency.
|
|
479
|
+
* @returns Logo information or null if deleted.
|
|
480
|
+
*/
|
|
481
|
+
uploadWorkspaceLogo(args: WorkspaceLogoArgs, requestId?: string): Promise<WorkspaceLogoResponse>;
|
|
482
|
+
/**
|
|
483
|
+
* Gets workspace plan and billing details.
|
|
484
|
+
*
|
|
485
|
+
* @param args - Arguments including workspace ID.
|
|
486
|
+
* @param requestId - Optional request ID for idempotency.
|
|
487
|
+
* @returns Workspace plan details.
|
|
488
|
+
*/
|
|
489
|
+
getWorkspacePlanDetails(args: GetWorkspacePlanDetailsArgs, requestId?: string): Promise<WorkspacePlanDetails>;
|
|
490
|
+
/**
|
|
491
|
+
* Gets workspace users with pagination.
|
|
492
|
+
*
|
|
493
|
+
* @param args - Arguments including optional workspace ID, cursor, and limit.
|
|
494
|
+
* @param requestId - Optional request ID for idempotency.
|
|
495
|
+
* @returns Paginated list of workspace users.
|
|
496
|
+
*/
|
|
497
|
+
getWorkspaceUsers(args?: GetWorkspaceUsersArgs, requestId?: string): Promise<GetWorkspaceUsersResponse>;
|
|
498
|
+
/**
|
|
499
|
+
* Gets active projects in a workspace with pagination.
|
|
500
|
+
*
|
|
501
|
+
* @param args - Arguments including workspace ID, cursor, and limit.
|
|
502
|
+
* @param requestId - Optional request ID for idempotency.
|
|
503
|
+
* @returns Paginated list of active workspace projects.
|
|
504
|
+
*/
|
|
505
|
+
getWorkspaceActiveProjects(args: GetWorkspaceProjectsArgs, requestId?: string): Promise<GetProjectsResponse>;
|
|
506
|
+
/**
|
|
507
|
+
* Gets archived projects in a workspace with pagination.
|
|
508
|
+
*
|
|
509
|
+
* @param args - Arguments including workspace ID, cursor, and limit.
|
|
510
|
+
* @param requestId - Optional request ID for idempotency.
|
|
511
|
+
* @returns Paginated list of archived workspace projects.
|
|
512
|
+
*/
|
|
513
|
+
getWorkspaceArchivedProjects(args: GetWorkspaceProjectsArgs, requestId?: string): Promise<GetProjectsResponse>;
|
|
425
514
|
}
|