@doist/todoist-sdk 9.1.0-next.1 → 9.1.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.
Files changed (124) hide show
  1. package/dist/cjs/authentication.js +1 -0
  2. package/dist/cjs/clients/activity-client.js +63 -0
  3. package/dist/cjs/clients/app-client.js +347 -0
  4. package/dist/cjs/clients/backup-client.js +65 -0
  5. package/dist/cjs/clients/base-client.js +30 -0
  6. package/dist/cjs/clients/comment-client.js +92 -0
  7. package/dist/cjs/clients/email-client.js +43 -0
  8. package/dist/cjs/clients/folder-client.js +80 -0
  9. package/dist/cjs/clients/id-mapping-client.js +39 -0
  10. package/dist/cjs/clients/insights-client.js +88 -0
  11. package/dist/cjs/clients/label-client.js +127 -0
  12. package/dist/cjs/clients/productivity-client.js +27 -0
  13. package/dist/cjs/clients/project-client.js +232 -0
  14. package/dist/cjs/clients/reminder-client.js +198 -0
  15. package/dist/cjs/clients/section-client.js +118 -0
  16. package/dist/cjs/clients/task-client.js +255 -0
  17. package/dist/cjs/clients/template-client.js +89 -0
  18. package/dist/cjs/clients/ui-extension-client.js +109 -0
  19. package/dist/cjs/clients/upload-client.js +102 -0
  20. package/dist/cjs/clients/workspace-client.js +367 -0
  21. package/dist/cjs/consts/endpoints.js +66 -6
  22. package/dist/cjs/test-utils/test-defaults.js +77 -1
  23. package/dist/cjs/todoist-api.js +422 -1665
  24. package/dist/cjs/transport/http-client.js +1 -0
  25. package/dist/cjs/transport/sync-request.js +75 -0
  26. package/dist/cjs/types/apps/types.js +253 -0
  27. package/dist/cjs/types/index.js +2 -1
  28. package/dist/cjs/types/sync/commands/index.js +0 -1
  29. package/dist/cjs/types/sync/resource-types.js +0 -1
  30. package/dist/cjs/types/sync/response.js +10 -12
  31. package/dist/cjs/types/ui-extensions/index.js +18 -0
  32. package/dist/cjs/types/ui-extensions/types.js +77 -0
  33. package/dist/cjs/utils/headers.js +16 -0
  34. package/dist/cjs/utils/request-helpers.js +21 -0
  35. package/dist/cjs/utils/validators.js +45 -33
  36. package/dist/esm/authentication.js +1 -0
  37. package/dist/esm/clients/activity-client.js +59 -0
  38. package/dist/esm/clients/app-client.js +343 -0
  39. package/dist/esm/clients/backup-client.js +61 -0
  40. package/dist/esm/clients/base-client.js +26 -0
  41. package/dist/esm/clients/comment-client.js +88 -0
  42. package/dist/esm/clients/email-client.js +39 -0
  43. package/dist/esm/clients/folder-client.js +76 -0
  44. package/dist/esm/clients/id-mapping-client.js +35 -0
  45. package/dist/esm/clients/insights-client.js +84 -0
  46. package/dist/esm/clients/label-client.js +123 -0
  47. package/dist/esm/clients/productivity-client.js +23 -0
  48. package/dist/esm/clients/project-client.js +228 -0
  49. package/dist/esm/clients/reminder-client.js +194 -0
  50. package/dist/esm/clients/section-client.js +114 -0
  51. package/dist/esm/clients/task-client.js +251 -0
  52. package/dist/esm/clients/template-client.js +85 -0
  53. package/dist/esm/clients/ui-extension-client.js +105 -0
  54. package/dist/esm/clients/upload-client.js +98 -0
  55. package/dist/esm/clients/workspace-client.js +363 -0
  56. package/dist/esm/consts/endpoints.js +51 -5
  57. package/dist/esm/test-utils/test-defaults.js +75 -0
  58. package/dist/esm/todoist-api.js +425 -1668
  59. package/dist/esm/transport/http-client.js +1 -0
  60. package/dist/esm/transport/sync-request.js +72 -0
  61. package/dist/esm/types/apps/types.js +248 -0
  62. package/dist/esm/types/index.js +2 -1
  63. package/dist/esm/types/sync/commands/index.js +0 -1
  64. package/dist/esm/types/sync/resource-types.js +0 -1
  65. package/dist/esm/types/sync/response.js +0 -2
  66. package/dist/esm/types/ui-extensions/types.js +74 -0
  67. package/dist/esm/utils/headers.js +13 -0
  68. package/dist/esm/utils/request-helpers.js +17 -0
  69. package/dist/esm/utils/validators.js +14 -2
  70. package/dist/types/authentication.d.ts +1 -1
  71. package/dist/types/clients/activity-client.d.ts +12 -0
  72. package/dist/types/clients/app-client.d.ts +37 -0
  73. package/dist/types/clients/backup-client.d.ts +14 -0
  74. package/dist/types/clients/base-client.d.ts +21 -0
  75. package/dist/types/clients/comment-client.d.ts +15 -0
  76. package/dist/types/clients/email-client.d.ts +13 -0
  77. package/dist/types/clients/folder-client.d.ts +16 -0
  78. package/dist/types/clients/id-mapping-client.d.ts +13 -0
  79. package/dist/types/clients/insights-client.d.ts +18 -0
  80. package/dist/types/clients/label-client.d.ts +19 -0
  81. package/dist/types/clients/productivity-client.d.ts +12 -0
  82. package/dist/types/clients/project-client.d.ts +26 -0
  83. package/dist/types/clients/reminder-client.d.ts +25 -0
  84. package/dist/types/clients/section-client.d.ts +18 -0
  85. package/dist/types/clients/task-client.d.ts +25 -0
  86. package/dist/types/clients/template-client.d.ts +17 -0
  87. package/dist/types/clients/ui-extension-client.d.ts +18 -0
  88. package/dist/types/clients/upload-client.d.ts +17 -0
  89. package/dist/types/clients/workspace-client.d.ts +43 -0
  90. package/dist/types/consts/endpoints.d.ts +24 -5
  91. package/dist/types/test-utils/test-defaults.d.ts +16 -1
  92. package/dist/types/todoist-api.d.ts +238 -28
  93. package/dist/types/transport/sync-request.d.ts +27 -0
  94. package/dist/types/types/apps/index.d.ts +2 -0
  95. package/dist/types/types/apps/requests.d.ts +89 -0
  96. package/dist/types/types/apps/types.d.ts +414 -0
  97. package/dist/types/types/http.d.ts +8 -1
  98. package/dist/types/types/index.d.ts +2 -1
  99. package/dist/types/types/sync/commands/index.d.ts +0 -9
  100. package/dist/types/types/sync/resource-types.d.ts +1 -1
  101. package/dist/types/types/sync/resources/user.d.ts +2 -2
  102. package/dist/types/types/sync/resources/view-options.d.ts +6 -6
  103. package/dist/types/types/sync/response.d.ts +6 -31
  104. package/dist/types/types/sync/user-preferences.d.ts +1 -1
  105. package/dist/types/types/tasks/requests.d.ts +0 -1
  106. package/dist/types/types/ui-extensions/index.d.ts +2 -0
  107. package/dist/types/types/ui-extensions/requests.d.ts +108 -0
  108. package/dist/types/types/ui-extensions/types.d.ts +185 -0
  109. package/dist/types/utils/headers.d.ts +7 -0
  110. package/dist/types/utils/request-helpers.d.ts +13 -0
  111. package/dist/types/utils/validators.d.ts +231 -55
  112. package/package.json +1 -1
  113. package/dist/cjs/types/goals/types.js +0 -29
  114. package/dist/esm/types/goals/types.js +0 -26
  115. package/dist/types/types/goals/requests.d.ts +0 -33
  116. package/dist/types/types/goals/types.d.ts +0 -41
  117. package/dist/types/types/sync/commands/goals.d.ts +0 -33
  118. /package/dist/cjs/types/{goals → apps}/index.js +0 -0
  119. /package/dist/cjs/types/{goals → apps}/requests.js +0 -0
  120. /package/dist/cjs/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
  121. /package/dist/esm/types/{goals → apps}/index.js +0 -0
  122. /package/dist/esm/types/{goals → apps}/requests.js +0 -0
  123. /package/dist/{types/types/goals/index.d.ts → esm/types/ui-extensions/index.js} +0 -0
  124. /package/dist/esm/types/{sync/commands/goals.js → ui-extensions/requests.js} +0 -0
@@ -0,0 +1,363 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { z } from 'zod';
13
+ import { ENDPOINT_REST_WORKSPACES, ENDPOINT_WORKSPACE_INVITATIONS, ENDPOINT_WORKSPACE_INVITATIONS_ALL, ENDPOINT_WORKSPACE_INVITATIONS_DELETE, ENDPOINT_WORKSPACE_JOIN, ENDPOINT_WORKSPACE_LOGO, ENDPOINT_WORKSPACE_MEMBERS, ENDPOINT_WORKSPACE_PLAN_DETAILS, ENDPOINT_WORKSPACE_USERS, getWorkspaceActiveProjectsEndpoint, getWorkspaceArchivedProjectsEndpoint, getWorkspaceInvitationAcceptEndpoint, getWorkspaceInvitationRejectEndpoint, getWorkspaceInviteUsersEndpoint, getWorkspaceUserEndpoint, getWorkspaceUserTasksEndpoint, } from '../consts/endpoints.js';
14
+ import { isSuccess, request } from '../transport/http-client.js';
15
+ import { uploadMultipartFile } from '../utils/multipart-upload.js';
16
+ import { generatePath } from '../utils/request-helpers.js';
17
+ import { validateJoinWorkspaceResult, validateMemberActivityInfoArray, validateProject, validateWorkspace, validateWorkspaceArray, validateWorkspaceInvitation, validateWorkspaceInvitationArray, validateWorkspacePlanDetails, validateWorkspaceUserArray, validateWorkspaceUserTaskArray, } from '../utils/validators.js';
18
+ import { BaseClient } from './base-client.js';
19
+ /**
20
+ * Internal sub-client handling all workspace-domain endpoints —
21
+ * workspaces, invitations, users, plans, logos, and workspace project
22
+ * pagination.
23
+ *
24
+ * Instantiated by `TodoistApi`; every public workspace method on
25
+ * `TodoistApi` delegates here. See `todoist-api.ts` for user-facing
26
+ * JSDoc.
27
+ */
28
+ export class WorkspaceClient extends BaseClient {
29
+ async getWorkspaceInvitations(args, requestId) {
30
+ const response = await request({
31
+ httpMethod: 'GET',
32
+ baseUri: this.syncApiBase,
33
+ relativePath: ENDPOINT_WORKSPACE_INVITATIONS,
34
+ apiToken: this.authToken,
35
+ customFetch: this.customFetch,
36
+ payload: { workspace_id: args.workspaceId },
37
+ requestId: requestId,
38
+ });
39
+ return response.data;
40
+ }
41
+ async getAllWorkspaceInvitations(args = {}, requestId) {
42
+ const queryParams = {};
43
+ if (args.workspaceId) {
44
+ queryParams.workspace_id = args.workspaceId;
45
+ }
46
+ const response = await request({
47
+ httpMethod: 'GET',
48
+ baseUri: this.syncApiBase,
49
+ relativePath: ENDPOINT_WORKSPACE_INVITATIONS_ALL,
50
+ apiToken: this.authToken,
51
+ customFetch: this.customFetch,
52
+ payload: queryParams,
53
+ requestId: requestId,
54
+ });
55
+ return validateWorkspaceInvitationArray(response.data);
56
+ }
57
+ async deleteWorkspaceInvitation(args, requestId) {
58
+ const response = await request({
59
+ httpMethod: 'POST',
60
+ baseUri: this.syncApiBase,
61
+ relativePath: ENDPOINT_WORKSPACE_INVITATIONS_DELETE,
62
+ apiToken: this.authToken,
63
+ customFetch: this.customFetch,
64
+ payload: {
65
+ workspace_id: args.workspaceId,
66
+ user_email: args.userEmail,
67
+ },
68
+ requestId: requestId,
69
+ });
70
+ return validateWorkspaceInvitation(response.data);
71
+ }
72
+ async acceptWorkspaceInvitation(args, requestId) {
73
+ const response = await request({
74
+ httpMethod: 'PUT',
75
+ baseUri: this.syncApiBase,
76
+ relativePath: getWorkspaceInvitationAcceptEndpoint(args.inviteCode),
77
+ apiToken: this.authToken,
78
+ customFetch: this.customFetch,
79
+ requestId: requestId,
80
+ });
81
+ return validateWorkspaceInvitation(response.data);
82
+ }
83
+ async rejectWorkspaceInvitation(args, requestId) {
84
+ const response = await request({
85
+ httpMethod: 'PUT',
86
+ baseUri: this.syncApiBase,
87
+ relativePath: getWorkspaceInvitationRejectEndpoint(args.inviteCode),
88
+ apiToken: this.authToken,
89
+ customFetch: this.customFetch,
90
+ requestId: requestId,
91
+ });
92
+ return validateWorkspaceInvitation(response.data);
93
+ }
94
+ async joinWorkspace(args, requestId) {
95
+ const response = await request({
96
+ httpMethod: 'POST',
97
+ baseUri: this.syncApiBase,
98
+ relativePath: ENDPOINT_WORKSPACE_JOIN,
99
+ apiToken: this.authToken,
100
+ customFetch: this.customFetch,
101
+ payload: {
102
+ invite_code: args.inviteCode,
103
+ workspace_id: args.workspaceId,
104
+ },
105
+ requestId: requestId,
106
+ });
107
+ return validateJoinWorkspaceResult(response.data);
108
+ }
109
+ async uploadWorkspaceLogo(args, requestId) {
110
+ if (args.delete) {
111
+ // Delete logo
112
+ const data = await uploadMultipartFile({
113
+ baseUrl: this.syncApiBase,
114
+ authToken: this.authToken,
115
+ endpoint: ENDPOINT_WORKSPACE_LOGO,
116
+ file: Buffer.alloc(0), // Empty buffer for delete
117
+ fileName: 'delete',
118
+ additionalFields: {
119
+ workspace_id: args.workspaceId,
120
+ delete: true,
121
+ },
122
+ requestId: requestId,
123
+ customFetch: this.customFetch,
124
+ });
125
+ return data;
126
+ }
127
+ if (!args.file) {
128
+ throw new Error('file is required when not deleting logo');
129
+ }
130
+ // Validate buffer is not empty if it's a Buffer
131
+ if (Buffer.isBuffer(args.file) && args.file.length === 0) {
132
+ throw new Error('Cannot upload empty image file');
133
+ }
134
+ const additionalFields = {
135
+ workspace_id: args.workspaceId,
136
+ };
137
+ const data = await uploadMultipartFile({
138
+ baseUrl: this.syncApiBase,
139
+ authToken: this.authToken,
140
+ endpoint: ENDPOINT_WORKSPACE_LOGO,
141
+ file: args.file,
142
+ fileName: args.fileName,
143
+ additionalFields: additionalFields,
144
+ requestId: requestId,
145
+ customFetch: this.customFetch,
146
+ });
147
+ return data;
148
+ }
149
+ async getWorkspacePlanDetails(args, requestId) {
150
+ const response = await request({
151
+ httpMethod: 'GET',
152
+ baseUri: this.syncApiBase,
153
+ relativePath: ENDPOINT_WORKSPACE_PLAN_DETAILS,
154
+ apiToken: this.authToken,
155
+ customFetch: this.customFetch,
156
+ payload: { workspace_id: args.workspaceId },
157
+ requestId: requestId,
158
+ });
159
+ return validateWorkspacePlanDetails(response.data);
160
+ }
161
+ async getWorkspaceUsers(args = {}, requestId) {
162
+ const queryParams = {};
163
+ if (args.workspaceId !== undefined && args.workspaceId !== null) {
164
+ queryParams.workspace_id = args.workspaceId;
165
+ }
166
+ if (args.cursor) {
167
+ queryParams.cursor = args.cursor;
168
+ }
169
+ if (args.limit) {
170
+ queryParams.limit = args.limit;
171
+ }
172
+ const response = await request({
173
+ httpMethod: 'GET',
174
+ baseUri: this.syncApiBase,
175
+ relativePath: ENDPOINT_WORKSPACE_USERS,
176
+ apiToken: this.authToken,
177
+ customFetch: this.customFetch,
178
+ payload: queryParams,
179
+ requestId: requestId,
180
+ });
181
+ return {
182
+ hasMore: response.data.hasMore || false,
183
+ nextCursor: response.data.nextCursor,
184
+ workspaceUsers: validateWorkspaceUserArray(response.data.workspaceUsers || []),
185
+ };
186
+ }
187
+ async getWorkspaces(requestId) {
188
+ const response = await request({
189
+ httpMethod: 'GET',
190
+ baseUri: this.syncApiBase,
191
+ relativePath: ENDPOINT_REST_WORKSPACES,
192
+ apiToken: this.authToken,
193
+ customFetch: this.customFetch,
194
+ requestId: requestId,
195
+ });
196
+ return validateWorkspaceArray(response.data);
197
+ }
198
+ async getWorkspace(id, requestId) {
199
+ z.string().parse(id);
200
+ const response = await request({
201
+ httpMethod: 'GET',
202
+ baseUri: this.syncApiBase,
203
+ relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
204
+ apiToken: this.authToken,
205
+ customFetch: this.customFetch,
206
+ requestId: requestId,
207
+ });
208
+ return validateWorkspace(response.data);
209
+ }
210
+ async addWorkspace(args, requestId) {
211
+ const response = await request({
212
+ httpMethod: 'POST',
213
+ baseUri: this.syncApiBase,
214
+ relativePath: ENDPOINT_REST_WORKSPACES,
215
+ apiToken: this.authToken,
216
+ customFetch: this.customFetch,
217
+ payload: args,
218
+ requestId: requestId,
219
+ });
220
+ return validateWorkspace(response.data);
221
+ }
222
+ async updateWorkspace(id, args, requestId) {
223
+ z.string().parse(id);
224
+ const response = await request({
225
+ httpMethod: 'POST',
226
+ baseUri: this.syncApiBase,
227
+ relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
228
+ apiToken: this.authToken,
229
+ customFetch: this.customFetch,
230
+ payload: args,
231
+ requestId: requestId,
232
+ });
233
+ return validateWorkspace(response.data);
234
+ }
235
+ async deleteWorkspace(id, requestId) {
236
+ z.string().parse(id);
237
+ const response = await request({
238
+ httpMethod: 'DELETE',
239
+ baseUri: this.syncApiBase,
240
+ relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
241
+ apiToken: this.authToken,
242
+ customFetch: this.customFetch,
243
+ requestId: requestId,
244
+ });
245
+ return isSuccess(response);
246
+ }
247
+ async getWorkspaceMembersActivity(args, requestId) {
248
+ const { workspaceId } = args, queryParams = __rest(args, ["workspaceId"]);
249
+ const { data } = await request({
250
+ httpMethod: 'GET',
251
+ baseUri: this.syncApiBase,
252
+ relativePath: ENDPOINT_WORKSPACE_MEMBERS,
253
+ apiToken: this.authToken,
254
+ customFetch: this.customFetch,
255
+ payload: Object.assign({ workspaceId }, queryParams),
256
+ requestId: requestId,
257
+ });
258
+ return {
259
+ members: validateMemberActivityInfoArray(data.members),
260
+ };
261
+ }
262
+ async getWorkspaceUserTasks(args, requestId) {
263
+ const { workspaceId, userId } = args, queryParams = __rest(args, ["workspaceId", "userId"]);
264
+ const { data } = await request({
265
+ httpMethod: 'GET',
266
+ baseUri: this.syncApiBase,
267
+ relativePath: getWorkspaceUserTasksEndpoint(workspaceId, userId),
268
+ apiToken: this.authToken,
269
+ customFetch: this.customFetch,
270
+ payload: queryParams,
271
+ requestId: requestId,
272
+ });
273
+ return {
274
+ tasks: validateWorkspaceUserTaskArray(data.tasks),
275
+ };
276
+ }
277
+ async inviteWorkspaceUsers(args, requestId) {
278
+ const { workspaceId } = args, payload = __rest(args, ["workspaceId"]);
279
+ const { data } = await request({
280
+ httpMethod: 'POST',
281
+ baseUri: this.syncApiBase,
282
+ relativePath: getWorkspaceInviteUsersEndpoint(workspaceId),
283
+ apiToken: this.authToken,
284
+ customFetch: this.customFetch,
285
+ payload: payload,
286
+ requestId: requestId,
287
+ });
288
+ return data;
289
+ }
290
+ async updateWorkspaceUser(args, requestId) {
291
+ const { workspaceId, userId } = args, payload = __rest(args, ["workspaceId", "userId"]);
292
+ const response = await request({
293
+ httpMethod: 'POST',
294
+ baseUri: this.syncApiBase,
295
+ relativePath: getWorkspaceUserEndpoint(workspaceId, userId),
296
+ apiToken: this.authToken,
297
+ customFetch: this.customFetch,
298
+ payload: payload,
299
+ requestId: requestId,
300
+ });
301
+ return validateJoinWorkspaceResult(response.data);
302
+ }
303
+ async removeWorkspaceUser(args, requestId) {
304
+ const { workspaceId, userId } = args;
305
+ const response = await request({
306
+ httpMethod: 'DELETE',
307
+ baseUri: this.syncApiBase,
308
+ relativePath: getWorkspaceUserEndpoint(workspaceId, userId),
309
+ apiToken: this.authToken,
310
+ customFetch: this.customFetch,
311
+ requestId: requestId,
312
+ });
313
+ return isSuccess(response);
314
+ }
315
+ async getWorkspaceActiveProjects(args, requestId) {
316
+ var _a;
317
+ const queryParams = {};
318
+ if (args.cursor) {
319
+ queryParams.cursor = args.cursor;
320
+ }
321
+ if (args.limit) {
322
+ queryParams.limit = args.limit;
323
+ }
324
+ const response = await request({
325
+ httpMethod: 'GET',
326
+ baseUri: this.syncApiBase,
327
+ relativePath: getWorkspaceActiveProjectsEndpoint(args.workspaceId),
328
+ apiToken: this.authToken,
329
+ customFetch: this.customFetch,
330
+ payload: queryParams,
331
+ requestId: requestId,
332
+ });
333
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
334
+ const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => validateProject(project));
335
+ return Object.assign(Object.assign({}, response.data), {
336
+ // oxlint-disable-next-line no-unsafe-assignment
337
+ results: validatedProjects || [] });
338
+ }
339
+ async getWorkspaceArchivedProjects(args, requestId) {
340
+ var _a;
341
+ const queryParams = {};
342
+ if (args.cursor) {
343
+ queryParams.cursor = args.cursor;
344
+ }
345
+ if (args.limit) {
346
+ queryParams.limit = args.limit;
347
+ }
348
+ const response = await request({
349
+ httpMethod: 'GET',
350
+ baseUri: this.syncApiBase,
351
+ relativePath: getWorkspaceArchivedProjectsEndpoint(args.workspaceId),
352
+ apiToken: this.authToken,
353
+ customFetch: this.customFetch,
354
+ payload: queryParams,
355
+ requestId: requestId,
356
+ });
357
+ // oxlint-disable-next-line no-unsafe-assignment, no-unsafe-call, no-unsafe-member-access
358
+ const validatedProjects = (_a = response.data.results) === null || _a === void 0 ? void 0 : _a.map((project) => validateProject(project));
359
+ return Object.assign(Object.assign({}, response.data), {
360
+ // oxlint-disable-next-line no-unsafe-assignment
361
+ results: validatedProjects || [] });
362
+ }
363
+ }
@@ -67,11 +67,6 @@ export const ENDPOINT_GET_TOKEN = 'access_token';
67
67
  export const ENDPOINT_REVOKE = 'revoke';
68
68
  export const ENDPOINT_REGISTER = 'register';
69
69
  export const ENDPOINT_REST_FOLDERS = 'folders';
70
- export const ENDPOINT_REST_GOALS = 'goals';
71
- export const ENDPOINT_REST_GOALS_SEARCH = ENDPOINT_REST_GOALS + '/search';
72
- export const GOAL_COMPLETE = 'complete';
73
- export const GOAL_UNCOMPLETE = 'uncomplete';
74
- export const GOAL_TASKS = 'items';
75
70
  // Workspace endpoints
76
71
  export const ENDPOINT_REST_WORKSPACES = 'workspaces';
77
72
  export const ENDPOINT_WORKSPACE_INVITATIONS = 'workspaces/invitations';
@@ -126,3 +121,54 @@ export function getWorkspaceActiveProjectsEndpoint(workspaceId) {
126
121
  export function getWorkspaceArchivedProjectsEndpoint(workspaceId) {
127
122
  return `workspaces/${workspaceId}/projects/archived`;
128
123
  }
124
+ // App management endpoints (dev:app_console scope)
125
+ export const ENDPOINT_REST_APPS = 'apps';
126
+ export const ENDPOINT_REST_APPS_INSTALLATIONS = 'apps/installations';
127
+ export const ENDPOINT_REST_APPS_UI_EXTENSIONS = 'apps/ui_extensions';
128
+ export const ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED = 'apps/ui_extensions/installed';
129
+ export const ENDPOINT_REST_USER_AUTHORIZATIONS = 'user/authorizations';
130
+ export const ENDPOINT_REST_USER_AUTHORIZATIONS_DELETE = 'user/authorizations/delete';
131
+ /** Available app icon sizes (small 60x60, medium 300x300, large 600x600). */
132
+ export const APP_ICON_SIZES = ['small', 'medium', 'large'];
133
+ export function getAppEndpoint(appId) {
134
+ return `apps/${appId}`;
135
+ }
136
+ export function getAppSecretsEndpoint(appId) {
137
+ return `apps/${appId}/secrets`;
138
+ }
139
+ export function getAppClientSecretEndpoint(appId) {
140
+ return `apps/${appId}/client_secret`;
141
+ }
142
+ export function getAppTokensEndpoint(appId) {
143
+ return `apps/${appId}/tokens`;
144
+ }
145
+ export function getAppTestTokenEndpoint(appId) {
146
+ return `apps/${appId}/test_token`;
147
+ }
148
+ export function getAppDistributionTokenEndpoint(appId) {
149
+ return `apps/${appId}/distribution_token`;
150
+ }
151
+ export function getAppVerificationTokenEndpoint(appId) {
152
+ return `apps/${appId}/verification_token`;
153
+ }
154
+ export function getAppWebhookEndpoint(appId) {
155
+ return `apps/${appId}/webhook`;
156
+ }
157
+ export function getAppIconEndpoint(appId, size) {
158
+ return size === 'medium' ? `apps/${appId}/icon` : `apps/${appId}/icon/${size}`;
159
+ }
160
+ export function getAppInstallationEndpoint(installationId) {
161
+ return `apps/installations/${installationId}`;
162
+ }
163
+ export function getAppByDistributionTokenEndpoint(distributionToken) {
164
+ return `apps/by_distribution_token/${distributionToken}`;
165
+ }
166
+ export function getUiExtensionEndpoint(uiExtensionId) {
167
+ return `apps/ui_extensions/${uiExtensionId}`;
168
+ }
169
+ export function getUiExtensionIconEndpoint(uiExtensionId) {
170
+ return `apps/ui_extensions/${uiExtensionId}/icon`;
171
+ }
172
+ export function getUiExtensionsByIntegrationEndpoint(integrationId) {
173
+ return `apps/ui_extensions/integration/${integrationId}`;
174
+ }
@@ -277,6 +277,81 @@ export const DEFAULT_COLLABORATOR_STATE = {
277
277
  state: 'active',
278
278
  isDeleted: false,
279
279
  };
280
+ export const DEFAULT_APP_ID = '42';
281
+ export const DEFAULT_INSTALLATION_ID = '1001';
282
+ export const DEFAULT_UI_EXTENSION_ID = '2002';
283
+ export const DEFAULT_DISTRIBUTION_TOKEN = 'dist-token-abc';
284
+ export const DEFAULT_ACCESS_TOKEN_ID = '3003';
285
+ export const DEFAULT_APP = {
286
+ id: DEFAULT_APP_ID,
287
+ status: 'public',
288
+ displayName: 'Sample App',
289
+ userId: DEFAULT_USER_ID,
290
+ createdAt: defaultDate(),
291
+ serviceUrl: 'https://example.com',
292
+ oauthRedirectUri: 'https://example.com/callback',
293
+ description: 'A sample app',
294
+ iconSm: 'https://example.com/icon-sm.png',
295
+ iconMd: 'https://example.com/icon-md.png',
296
+ iconLg: 'https://example.com/icon-lg.png',
297
+ appTokenScopes: ['data:read', 'task:add'],
298
+ };
299
+ export const DEFAULT_APP_WITH_USER_COUNT = Object.assign(Object.assign({}, DEFAULT_APP), { userCount: 12 });
300
+ export const DEFAULT_APP_SECRETS = {
301
+ clientId: 'client-id-xyz',
302
+ clientSecret: 'client-secret-xyz',
303
+ };
304
+ export const DEFAULT_APP_VERIFICATION_TOKEN = {
305
+ verificationToken: 'verif-token-abc',
306
+ };
307
+ export const DEFAULT_APP_TEST_TOKEN = {
308
+ accessToken: 'test-token-xyz',
309
+ };
310
+ export const DEFAULT_APP_DISTRIBUTION_TOKEN = {
311
+ distributionToken: DEFAULT_DISTRIBUTION_TOKEN,
312
+ };
313
+ export const DEFAULT_APP_WEBHOOK = {
314
+ status: 'active',
315
+ callbackUrl: 'https://example.com/webhook',
316
+ version: '1',
317
+ events: ['item:added', 'item:completed'],
318
+ };
319
+ export const DEFAULT_APP_INSTALLATION = {
320
+ id: DEFAULT_INSTALLATION_ID,
321
+ creator: DEFAULT_USER_ID,
322
+ createdTs: 1700000000,
323
+ installationType: 'user',
324
+ appTokenScopesValidated: true,
325
+ integration: DEFAULT_APP,
326
+ };
327
+ export const DEFAULT_USER_AUTHORIZATION = {
328
+ accessTokenId: DEFAULT_ACCESS_TOKEN_ID,
329
+ scope: ['data:read', 'task:add'],
330
+ scopeDescriptions: ['Read data', 'Add tasks'],
331
+ createdAt: new Date('2025-01-01T00:00:00Z'),
332
+ app: {
333
+ id: DEFAULT_APP_ID,
334
+ displayName: 'Sample App',
335
+ description: 'A sample app',
336
+ serviceUrl: 'https://example.com',
337
+ iconMd: 'https://example.com/icon-md.png',
338
+ },
339
+ };
340
+ export const DEFAULT_UI_EXTENSION = {
341
+ id: DEFAULT_UI_EXTENSION_ID,
342
+ integrationId: DEFAULT_APP_ID,
343
+ extensionId: 'ext-guid-1',
344
+ extensionType: 'context-menu',
345
+ contextType: 'task',
346
+ url: 'https://example.com/extension',
347
+ icon: 'https://example.com/icon.png',
348
+ name: 'My Extension',
349
+ description: 'Does things in the task context menu',
350
+ width: 400,
351
+ height: 600,
352
+ defVersion: 2,
353
+ minimumCardistVersion: '0.60',
354
+ };
280
355
  export const DEFAULT_NOTE = {
281
356
  id: DEFAULT_COMMENT_ID,
282
357
  projectId: DEFAULT_PROJECT_ID,