@doist/todoist-sdk 14.2.0 → 15.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.
Files changed (174) hide show
  1. package/dist/esm/types/sync/resources/index.js +1 -0
  2. package/dist/esm/types/sync/resources/labels.js +7 -0
  3. package/dist/esm/types/sync/resources/reminders.js +11 -0
  4. package/dist/esm/types/sync/response.js +3 -4
  5. package/dist/esm/utils/index.js +1 -1
  6. package/dist/esm/utils/url-helpers.js +151 -23
  7. package/dist/types/types/sync/resources/index.d.ts +1 -0
  8. package/dist/types/types/sync/resources/labels.d.ts +12 -0
  9. package/dist/types/types/sync/resources/reminders.d.ts +87 -0
  10. package/dist/types/types/sync/response.d.ts +8 -7
  11. package/dist/types/utils/index.d.ts +2 -1
  12. package/dist/types/utils/url-helpers.d.ts +88 -0
  13. package/package.json +5 -10
  14. package/dist/cjs/authentication.js +0 -317
  15. package/dist/cjs/clients/activity-client.js +0 -63
  16. package/dist/cjs/clients/app-client.js +0 -345
  17. package/dist/cjs/clients/backup-client.js +0 -47
  18. package/dist/cjs/clients/base-client.js +0 -31
  19. package/dist/cjs/clients/billing-client.js +0 -152
  20. package/dist/cjs/clients/comment-client.js +0 -91
  21. package/dist/cjs/clients/email-client.js +0 -43
  22. package/dist/cjs/clients/folder-client.js +0 -79
  23. package/dist/cjs/clients/id-mapping-client.js +0 -39
  24. package/dist/cjs/clients/insights-client.js +0 -87
  25. package/dist/cjs/clients/label-client.js +0 -126
  26. package/dist/cjs/clients/productivity-client.js +0 -27
  27. package/dist/cjs/clients/project-client.js +0 -235
  28. package/dist/cjs/clients/reminder-client.js +0 -198
  29. package/dist/cjs/clients/section-client.js +0 -117
  30. package/dist/cjs/clients/task-client.js +0 -254
  31. package/dist/cjs/clients/template-client.js +0 -88
  32. package/dist/cjs/clients/ui-extension-client.js +0 -107
  33. package/dist/cjs/clients/upload-client.js +0 -155
  34. package/dist/cjs/clients/view-options-client.js +0 -25
  35. package/dist/cjs/clients/workspace-client.js +0 -366
  36. package/dist/cjs/consts/endpoints.js +0 -224
  37. package/dist/cjs/index.js +0 -24
  38. package/dist/cjs/package.json +0 -1
  39. package/dist/cjs/test-utils/asserts.js +0 -11
  40. package/dist/cjs/test-utils/msw-setup.js +0 -97
  41. package/dist/cjs/test-utils/obsidian-fetch-adapter.js +0 -54
  42. package/dist/cjs/test-utils/test-defaults.js +0 -371
  43. package/dist/cjs/test-utils/transport-seam.js +0 -17
  44. package/dist/cjs/test-utils/webhook-fixtures.js +0 -32
  45. package/dist/cjs/todoist-api.js +0 -1711
  46. package/dist/cjs/transport/fetch-with-retry.js +0 -219
  47. package/dist/cjs/transport/http-client.js +0 -134
  48. package/dist/cjs/transport/http-dispatcher.js +0 -198
  49. package/dist/cjs/transport/sync-request.js +0 -83
  50. package/dist/cjs/types/activity/index.js +0 -18
  51. package/dist/cjs/types/activity/requests.js +0 -2
  52. package/dist/cjs/types/activity/types.js +0 -28
  53. package/dist/cjs/types/apps/index.js +0 -18
  54. package/dist/cjs/types/apps/requests.js +0 -2
  55. package/dist/cjs/types/apps/types.js +0 -254
  56. package/dist/cjs/types/backups/index.js +0 -18
  57. package/dist/cjs/types/backups/requests.js +0 -2
  58. package/dist/cjs/types/backups/types.js +0 -8
  59. package/dist/cjs/types/billing/index.js +0 -18
  60. package/dist/cjs/types/billing/requests.js +0 -2
  61. package/dist/cjs/types/billing/types.js +0 -92
  62. package/dist/cjs/types/comments/index.js +0 -18
  63. package/dist/cjs/types/comments/requests.js +0 -2
  64. package/dist/cjs/types/comments/types.js +0 -60
  65. package/dist/cjs/types/common.js +0 -10
  66. package/dist/cjs/types/emails/index.js +0 -17
  67. package/dist/cjs/types/emails/requests.js +0 -5
  68. package/dist/cjs/types/errors.js +0 -29
  69. package/dist/cjs/types/folders/index.js +0 -17
  70. package/dist/cjs/types/folders/requests.js +0 -2
  71. package/dist/cjs/types/http.js +0 -24
  72. package/dist/cjs/types/id-mappings/index.js +0 -18
  73. package/dist/cjs/types/id-mappings/requests.js +0 -20
  74. package/dist/cjs/types/id-mappings/types.js +0 -12
  75. package/dist/cjs/types/index.js +0 -40
  76. package/dist/cjs/types/insights/index.js +0 -18
  77. package/dist/cjs/types/insights/requests.js +0 -2
  78. package/dist/cjs/types/insights/types.js +0 -80
  79. package/dist/cjs/types/labels/index.js +0 -18
  80. package/dist/cjs/types/labels/requests.js +0 -2
  81. package/dist/cjs/types/labels/types.js +0 -11
  82. package/dist/cjs/types/productivity/index.js +0 -17
  83. package/dist/cjs/types/productivity/types.js +0 -68
  84. package/dist/cjs/types/projects/index.js +0 -18
  85. package/dist/cjs/types/projects/requests.js +0 -2
  86. package/dist/cjs/types/projects/types.js +0 -66
  87. package/dist/cjs/types/reminders/index.js +0 -17
  88. package/dist/cjs/types/reminders/requests.js +0 -95
  89. package/dist/cjs/types/sections/index.js +0 -18
  90. package/dist/cjs/types/sections/requests.js +0 -2
  91. package/dist/cjs/types/sections/types.js +0 -25
  92. package/dist/cjs/types/sync/commands/calendars.js +0 -2
  93. package/dist/cjs/types/sync/commands/filters.js +0 -2
  94. package/dist/cjs/types/sync/commands/folders.js +0 -2
  95. package/dist/cjs/types/sync/commands/index.js +0 -34
  96. package/dist/cjs/types/sync/commands/labels.js +0 -5
  97. package/dist/cjs/types/sync/commands/notes.js +0 -2
  98. package/dist/cjs/types/sync/commands/notifications.js +0 -2
  99. package/dist/cjs/types/sync/commands/others.js +0 -2
  100. package/dist/cjs/types/sync/commands/project-view-options.js +0 -2
  101. package/dist/cjs/types/sync/commands/projects.js +0 -2
  102. package/dist/cjs/types/sync/commands/reminders.js +0 -2
  103. package/dist/cjs/types/sync/commands/sections.js +0 -2
  104. package/dist/cjs/types/sync/commands/shared.js +0 -20
  105. package/dist/cjs/types/sync/commands/sharing.js +0 -2
  106. package/dist/cjs/types/sync/commands/tasks.js +0 -2
  107. package/dist/cjs/types/sync/commands/view-options.js +0 -2
  108. package/dist/cjs/types/sync/commands/workspace-filters.js +0 -2
  109. package/dist/cjs/types/sync/commands/workspaces.js +0 -2
  110. package/dist/cjs/types/sync/index.js +0 -22
  111. package/dist/cjs/types/sync/request.js +0 -2
  112. package/dist/cjs/types/sync/resource-types.js +0 -39
  113. package/dist/cjs/types/sync/resources/calendars.js +0 -27
  114. package/dist/cjs/types/sync/resources/collaborators.js +0 -21
  115. package/dist/cjs/types/sync/resources/completed-info.js +0 -24
  116. package/dist/cjs/types/sync/resources/filters.js +0 -14
  117. package/dist/cjs/types/sync/resources/folders.js +0 -12
  118. package/dist/cjs/types/sync/resources/index.js +0 -32
  119. package/dist/cjs/types/sync/resources/live-notifications.js +0 -38
  120. package/dist/cjs/types/sync/resources/notes.js +0 -21
  121. package/dist/cjs/types/sync/resources/reminders.js +0 -50
  122. package/dist/cjs/types/sync/resources/suggestions.js +0 -36
  123. package/dist/cjs/types/sync/resources/tooltips.js +0 -8
  124. package/dist/cjs/types/sync/resources/user-plan-limits.js +0 -20
  125. package/dist/cjs/types/sync/resources/user-settings.js +0 -40
  126. package/dist/cjs/types/sync/resources/user.js +0 -110
  127. package/dist/cjs/types/sync/resources/view-options.js +0 -86
  128. package/dist/cjs/types/sync/resources/workspace-filters.js +0 -19
  129. package/dist/cjs/types/sync/resources/workspaces.js +0 -72
  130. package/dist/cjs/types/sync/response.js +0 -54
  131. package/dist/cjs/types/sync/user-preferences.js +0 -71
  132. package/dist/cjs/types/tasks/index.js +0 -18
  133. package/dist/cjs/types/tasks/requests.js +0 -2
  134. package/dist/cjs/types/tasks/types.js +0 -59
  135. package/dist/cjs/types/templates/index.js +0 -17
  136. package/dist/cjs/types/templates/requests.js +0 -2
  137. package/dist/cjs/types/ui-extensions/index.js +0 -18
  138. package/dist/cjs/types/ui-extensions/requests.js +0 -2
  139. package/dist/cjs/types/ui-extensions/types.js +0 -77
  140. package/dist/cjs/types/uploads/index.js +0 -17
  141. package/dist/cjs/types/uploads/requests.js +0 -2
  142. package/dist/cjs/types/users/index.js +0 -17
  143. package/dist/cjs/types/users/types.js +0 -51
  144. package/dist/cjs/types/webhooks/comments.js +0 -96
  145. package/dist/cjs/types/webhooks/envelope.js +0 -26
  146. package/dist/cjs/types/webhooks/filters.js +0 -30
  147. package/dist/cjs/types/webhooks/index.js +0 -25
  148. package/dist/cjs/types/webhooks/labels.js +0 -54
  149. package/dist/cjs/types/webhooks/projects.js +0 -36
  150. package/dist/cjs/types/webhooks/reminders.js +0 -35
  151. package/dist/cjs/types/webhooks/sections.js +0 -53
  152. package/dist/cjs/types/webhooks/tasks.js +0 -68
  153. package/dist/cjs/types/webhooks/types.js +0 -55
  154. package/dist/cjs/types/workspaces/index.js +0 -18
  155. package/dist/cjs/types/workspaces/requests.js +0 -2
  156. package/dist/cjs/types/workspaces/types.js +0 -154
  157. package/dist/cjs/utils/activity-helpers.js +0 -58
  158. package/dist/cjs/utils/case-conversion.js +0 -69
  159. package/dist/cjs/utils/colors.js +0 -143
  160. package/dist/cjs/utils/file-response.js +0 -32
  161. package/dist/cjs/utils/headers.js +0 -16
  162. package/dist/cjs/utils/index.js +0 -31
  163. package/dist/cjs/utils/multipart-upload.js +0 -293
  164. package/dist/cjs/utils/processing-helpers.js +0 -18
  165. package/dist/cjs/utils/project-helpers.js +0 -20
  166. package/dist/cjs/utils/request-helpers.js +0 -21
  167. package/dist/cjs/utils/sanitization.js +0 -116
  168. package/dist/cjs/utils/sync-helpers.js +0 -22
  169. package/dist/cjs/utils/task-sorting.js +0 -281
  170. package/dist/cjs/utils/uncompletable-helpers.js +0 -60
  171. package/dist/cjs/utils/url-helpers.js +0 -74
  172. package/dist/cjs/utils/validators.js +0 -108
  173. package/dist/cjs/utils/view-options.js +0 -19
  174. package/dist/cjs/utils/webhook-parser.js +0 -60
@@ -1,1711 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TodoistApi = void 0;
4
- const activity_client_1 = require("./clients/activity-client");
5
- const app_client_1 = require("./clients/app-client");
6
- const backup_client_1 = require("./clients/backup-client");
7
- const billing_client_1 = require("./clients/billing-client");
8
- const comment_client_1 = require("./clients/comment-client");
9
- const email_client_1 = require("./clients/email-client");
10
- const folder_client_1 = require("./clients/folder-client");
11
- const id_mapping_client_1 = require("./clients/id-mapping-client");
12
- const insights_client_1 = require("./clients/insights-client");
13
- const label_client_1 = require("./clients/label-client");
14
- const productivity_client_1 = require("./clients/productivity-client");
15
- const project_client_1 = require("./clients/project-client");
16
- const reminder_client_1 = require("./clients/reminder-client");
17
- const section_client_1 = require("./clients/section-client");
18
- const task_client_1 = require("./clients/task-client");
19
- const template_client_1 = require("./clients/template-client");
20
- const ui_extension_client_1 = require("./clients/ui-extension-client");
21
- const upload_client_1 = require("./clients/upload-client");
22
- const view_options_client_1 = require("./clients/view-options-client");
23
- const workspace_client_1 = require("./clients/workspace-client");
24
- const endpoints_1 = require("./consts/endpoints");
25
- const http_client_1 = require("./transport/http-client");
26
- const sync_request_1 = require("./transport/sync-request");
27
- const validators_1 = require("./utils/validators");
28
- class TodoistApi {
29
- constructor(
30
- /**
31
- * Your Todoist API token.
32
- */
33
- authToken,
34
- /**
35
- * Optional configuration options
36
- */
37
- options) {
38
- if (typeof options === 'string') {
39
- throw new TypeError('Passing baseUrl as a string is no longer supported. Use an options object instead: new TodoistApi(token, { baseUrl })');
40
- }
41
- this.authToken = authToken;
42
- const opts = options || {};
43
- this.syncApiBase = (0, endpoints_1.getSyncBaseUri)(opts.baseUrl);
44
- this.customFetch = opts.customFetch;
45
- const clientDeps = {
46
- authToken: this.authToken,
47
- syncApiBase: this.syncApiBase,
48
- customFetch: this.customFetch,
49
- };
50
- this.taskClient = new task_client_1.TaskClient(clientDeps);
51
- this.projectClient = new project_client_1.ProjectClient(clientDeps);
52
- this.sectionClient = new section_client_1.SectionClient(clientDeps);
53
- this.labelClient = new label_client_1.LabelClient(clientDeps);
54
- this.commentClient = new comment_client_1.CommentClient(clientDeps);
55
- this.reminderClient = new reminder_client_1.ReminderClient(clientDeps);
56
- this.insightsClient = new insights_client_1.InsightsClient(clientDeps);
57
- this.folderClient = new folder_client_1.FolderClient(clientDeps);
58
- this.templateClient = new template_client_1.TemplateClient(clientDeps);
59
- this.uploadClient = new upload_client_1.UploadClient(clientDeps);
60
- this.backupClient = new backup_client_1.BackupClient(clientDeps);
61
- this.emailClient = new email_client_1.EmailClient(clientDeps);
62
- this.idMappingClient = new id_mapping_client_1.IdMappingClient(clientDeps);
63
- this.activityClient = new activity_client_1.ActivityClient(clientDeps);
64
- this.productivityClient = new productivity_client_1.ProductivityClient(clientDeps);
65
- this.workspaceClient = new workspace_client_1.WorkspaceClient(clientDeps);
66
- this.billingClient = new billing_client_1.BillingClient(clientDeps);
67
- this.appClient = new app_client_1.AppClient(clientDeps);
68
- this.uiExtensionClient = new ui_extension_client_1.UiExtensionClient(clientDeps);
69
- this.viewOptionsClient = new view_options_client_1.ViewOptionsClient(clientDeps);
70
- }
71
- /**
72
- * Executes a raw Sync API request.
73
- *
74
- * This method provides direct access to the Sync API, allowing you to send
75
- * strongly-typed commands and request specific resource types.
76
- *
77
- * @param request - The sync request payload containing commands and/or resource types.
78
- * @param requestId - Optional custom identifier for the request.
79
- * @returns A promise that resolves to the sync response.
80
- * @throws TodoistRequestError if the sync status contains errors.
81
- *
82
- * @example
83
- * ```typescript
84
- * import { createCommand } from '@doist/todoist-sdk'
85
- *
86
- * const response = await api.sync({
87
- * commands: [
88
- * createCommand('item_add', { content: 'Buy milk' }),
89
- * ],
90
- * resourceTypes: ['items'],
91
- * syncToken: '*',
92
- * })
93
- * ```
94
- */
95
- async sync(syncRequest, requestId) {
96
- var _a;
97
- return (0, sync_request_1.performSyncRequest)({
98
- authToken: this.authToken,
99
- syncApiBase: this.syncApiBase,
100
- customFetch: this.customFetch,
101
- }, syncRequest, { requestId, hasSyncCommands: Boolean((_a = syncRequest.commands) === null || _a === void 0 ? void 0 : _a.length) });
102
- }
103
- /**
104
- * Retrieves the authenticated user's active saved view options.
105
- *
106
- * @returns A promise that resolves to the active saved view options.
107
- */
108
- async getViewOptions() {
109
- return this.viewOptionsClient.getViewOptions();
110
- }
111
- /**
112
- * Sets saved options for a view.
113
- *
114
- * @param args - The saved view options to set.
115
- * @param requestId - Optional custom identifier for the request.
116
- * @returns A promise that resolves when the view options are saved.
117
- */
118
- async setViewOptions(args, requestId) {
119
- return this.viewOptionsClient.setViewOptions(args, requestId);
120
- }
121
- /**
122
- * Deletes the saved options for a view.
123
- *
124
- * @param args - The view whose saved options to delete.
125
- * @param requestId - Optional custom identifier for the request.
126
- * @returns A promise that resolves when the view options are deleted.
127
- */
128
- async deleteViewOptions(args, requestId) {
129
- return this.viewOptionsClient.deleteViewOptions(args, requestId);
130
- }
131
- /**
132
- * Retrieves information about the authenticated user.
133
- *
134
- * @returns A promise that resolves to the current user's information.
135
- */
136
- async getUser() {
137
- const response = await (0, http_client_1.request)({
138
- httpMethod: 'GET',
139
- baseUri: this.syncApiBase,
140
- relativePath: endpoints_1.ENDPOINT_REST_USER,
141
- apiToken: this.authToken,
142
- customFetch: this.customFetch,
143
- });
144
- return (0, validators_1.validateCurrentUser)(response.data);
145
- }
146
- /**
147
- * Retrieves a single active (non-completed) task by its ID.
148
- *
149
- * @param id - The unique identifier of the task.
150
- * @returns A promise that resolves to the requested task.
151
- */
152
- async getTask(id) {
153
- return this.taskClient.getTask(id);
154
- }
155
- /**
156
- * Retrieves a list of active tasks filtered by specific parameters.
157
- *
158
- * @param args - Filter parameters such as project ID, label ID, or due date.
159
- * @returns A promise that resolves to an array of tasks.
160
- */
161
- async getTasks(args = {}) {
162
- return this.taskClient.getTasks(args);
163
- }
164
- /**
165
- * Retrieves tasks filtered by a filter string.
166
- *
167
- * @param args - Parameters for filtering tasks, including the query string and optional language.
168
- * @returns A promise that resolves to a paginated response of tasks.
169
- */
170
- async getTasksByFilter(args) {
171
- return this.taskClient.getTasksByFilter(args);
172
- }
173
- /**
174
- * Retrieves completed tasks by completion date.
175
- *
176
- * @param args - Parameters for filtering, including required since, until.
177
- * @returns A promise that resolves to a paginated response of completed tasks.
178
- */
179
- async getCompletedTasksByCompletionDate(args) {
180
- return this.taskClient.getCompletedTasksByCompletionDate(args);
181
- }
182
- /**
183
- * Retrieves completed tasks by due date.
184
- *
185
- * @param args - Parameters for filtering, including required since, until.
186
- * @returns A promise that resolves to a paginated response of completed tasks.
187
- */
188
- async getCompletedTasksByDueDate(args) {
189
- return this.taskClient.getCompletedTasksByDueDate(args);
190
- }
191
- /**
192
- * Searches completed tasks by query string.
193
- *
194
- * @param args - Parameters for searching, including the query string.
195
- * @returns A promise that resolves to a paginated response of completed tasks.
196
- */
197
- async searchCompletedTasks(args) {
198
- return this.taskClient.searchCompletedTasks(args);
199
- }
200
- /**
201
- * Retrieves all completed tasks with optional filters.
202
- *
203
- * Uses offset-based pagination rather than cursor-based.
204
- *
205
- * @param args - Optional parameters including project ID, label, date range, and pagination.
206
- * @returns A promise that resolves to completed tasks with associated project and section data.
207
- */
208
- async getAllCompletedTasks(args = {}) {
209
- return this.taskClient.getAllCompletedTasks(args);
210
- }
211
- /**
212
- * Creates a new task with the provided parameters.
213
- *
214
- * @param args - Task creation parameters such as content, due date, or priority.
215
- * @param requestId - Optional custom identifier for the request.
216
- * @returns A promise that resolves to the created task.
217
- */
218
- async addTask(args, requestId) {
219
- return this.taskClient.addTask(args, requestId);
220
- }
221
- /**
222
- * Quickly adds a task using natural language processing for due dates.
223
- *
224
- * @param args - Quick add task parameters, including content and due date.
225
- * @returns A promise that resolves to the created task.
226
- */
227
- async quickAddTask(args) {
228
- return this.taskClient.quickAddTask(args);
229
- }
230
- /**
231
- * Updates an existing task by its ID with the provided parameters.
232
- *
233
- * @param id - The unique identifier of the task to update.
234
- * @param args - Update parameters such as content, priority, or due date. Pass
235
- * `dueString: null` (or `"no date"`) to clear the due date.
236
- * @param requestId - Optional custom identifier for the request.
237
- * @returns A promise that resolves to the updated task.
238
- */
239
- async updateTask(id, args, requestId) {
240
- return this.taskClient.updateTask(id, args, requestId);
241
- }
242
- /**
243
- * Moves existing tasks by their ID to either a different parent/section/project.
244
- *
245
- * @param ids - The unique identifier of the tasks to be moved.
246
- * @param args - The paramets that should contain only one of projectId, sectionId, or parentId
247
- * @param requestId - Optional custom identifier for the request.
248
- * @returns - A promise that resolves to an array of the updated tasks.
249
- */
250
- async moveTasks(ids, args, requestId) {
251
- return this.taskClient.moveTasks(ids, args, requestId);
252
- }
253
- /**
254
- * Moves a task by its ID to either a different parent/section/project.
255
- *
256
- * @param id - The unique identifier of the task to be moved.
257
- * @param args - The parameters that should contain exactly one of projectId, sectionId, or parentId
258
- * @param requestId - Optional custom identifier for the request.
259
- * @returns A promise that resolves to the updated task.
260
- */
261
- async moveTask(id, args, requestId) {
262
- return this.taskClient.moveTask(id, args, requestId);
263
- }
264
- /**
265
- * Closes (completes) a task by its ID.
266
- *
267
- * @param id - The unique identifier of the task to close.
268
- * @param requestId - Optional custom identifier for the request.
269
- * @returns A promise that resolves to `true` if successful.
270
- */
271
- async closeTask(id, requestId) {
272
- return this.taskClient.closeTask(id, requestId);
273
- }
274
- /**
275
- * Reopens a previously closed (completed) task by its ID.
276
- *
277
- * @param id - The unique identifier of the task to reopen.
278
- * @param requestId - Optional custom identifier for the request.
279
- * @returns A promise that resolves to `true` if successful.
280
- */
281
- async reopenTask(id, requestId) {
282
- return this.taskClient.reopenTask(id, requestId);
283
- }
284
- /**
285
- * Deletes a task by its ID.
286
- *
287
- * @param id - The unique identifier of the task to delete.
288
- * @param requestId - Optional custom identifier for the request.
289
- * @returns A promise that resolves to `true` if successful.
290
- */
291
- async deleteTask(id, requestId) {
292
- return this.taskClient.deleteTask(id, requestId);
293
- }
294
- /**
295
- * Retrieves a project by its ID.
296
- *
297
- * @param id - The unique identifier of the project.
298
- * @returns A promise that resolves to the requested project.
299
- */
300
- async getProject(id) {
301
- return this.projectClient.getProject(id);
302
- }
303
- /**
304
- * Retrieves all projects with optional filters.
305
- *
306
- * @param args - Optional filters for retrieving projects.
307
- * @returns A promise that resolves to an array of projects.
308
- */
309
- async getProjects(args = {}) {
310
- return this.projectClient.getProjects(args);
311
- }
312
- /**
313
- * Searches projects by name.
314
- *
315
- * @param args - Search parameters including the query string.
316
- * @returns A promise that resolves to a paginated response of projects.
317
- */
318
- async searchProjects(args) {
319
- return this.projectClient.searchProjects(args);
320
- }
321
- /**
322
- * Retrieves all archived projects with optional filters.
323
- *
324
- * @param args - Optional filters for retrieving archived projects.
325
- * @returns A promise that resolves to an array of archived projects.
326
- */
327
- async getArchivedProjects(args = {}) {
328
- return this.projectClient.getArchivedProjects(args);
329
- }
330
- /**
331
- * Creates a new project with the provided parameters.
332
- *
333
- * @param args - Project creation parameters such as name or color.
334
- * @param requestId - Optional custom identifier for the request.
335
- * @returns A promise that resolves to the created project.
336
- */
337
- async addProject(args, requestId) {
338
- return this.projectClient.addProject(args, requestId);
339
- }
340
- /**
341
- * Updates an existing project by its ID with the provided parameters.
342
- *
343
- * @param id - The unique identifier of the project to update.
344
- * @param args - Update parameters such as name or color.
345
- * @param requestId - Optional custom identifier for the request.
346
- * @returns A promise that resolves to the updated project.
347
- */
348
- async updateProject(id, args, requestId) {
349
- return this.projectClient.updateProject(id, args, requestId);
350
- }
351
- /**
352
- * Deletes a project by its ID.
353
- *
354
- * If the project is a workspace project, it must have been
355
- * archived first before it can be deleted, otherwise calling
356
- * this function will result in an error. Personal projects can
357
- * be deleted regardless of their archived status.
358
- *
359
- * @param id - The unique identifier of the project to delete.
360
- * @param requestId - Optional custom identifier for the request.
361
- * @returns A promise that resolves to `true` if successful.
362
- */
363
- async deleteProject(id, requestId) {
364
- return this.projectClient.deleteProject(id, requestId);
365
- }
366
- /**
367
- * Archives a project by its ID.
368
- *
369
- * @param id - The unique identifier of the project to archive.
370
- * @param requestId - Optional custom identifier for the request.
371
- * @returns A promise that resolves to the updated project.
372
- */
373
- async archiveProject(id, requestId) {
374
- return this.projectClient.archiveProject(id, requestId);
375
- }
376
- /**
377
- * Unarchives a project by its ID.
378
- *
379
- * @param id - The unique identifier of the project to unarchive.
380
- * @param requestId - Optional custom identifier for the request.
381
- * @returns A promise that resolves to the updated project.
382
- */
383
- async unarchiveProject(id, requestId) {
384
- return this.projectClient.unarchiveProject(id, requestId);
385
- }
386
- /**
387
- * Moves a project to a workspace.
388
- *
389
- * @param args - The arguments for moving the project.
390
- * @param requestId - Optional custom identifier for the request.
391
- * @returns A promise that resolves to the moved project.
392
- */
393
- async moveProjectToWorkspace(args, requestId) {
394
- return this.projectClient.moveProjectToWorkspace(args, requestId);
395
- }
396
- /**
397
- * Moves a project to personal.
398
- *
399
- * @param args - The arguments for moving the project.
400
- * @param requestId - Optional custom identifier for the request.
401
- * @returns A promise that resolves to the moved project.
402
- */
403
- async moveProjectToPersonal(args, requestId) {
404
- return this.projectClient.moveProjectToPersonal(args, requestId);
405
- }
406
- /**
407
- * Counts the number of archived projects.
408
- *
409
- * @param args - Optional parameters to filter the count.
410
- * @returns A promise that resolves to the count of archived projects.
411
- */
412
- async getArchivedProjectsCount(args = {}) {
413
- return this.projectClient.getArchivedProjectsCount(args);
414
- }
415
- /**
416
- * Retrieves the role-to-action permission mappings for projects.
417
- *
418
- * @returns A promise that resolves to the permission mappings.
419
- */
420
- async getProjectPermissions() {
421
- return this.projectClient.getProjectPermissions();
422
- }
423
- /**
424
- * Retrieves full project data including tasks, sections, collaborators, and notes.
425
- *
426
- * @param id - The unique identifier of the project.
427
- * @param args - Optional parameters.
428
- * @returns A promise that resolves to the full project data.
429
- */
430
- async getFullProject(id, args = {}) {
431
- return this.projectClient.getFullProject(id, args);
432
- }
433
- /**
434
- * Joins a workspace project.
435
- *
436
- * Only used for workspaces — this endpoint is used to join a workspace project
437
- * by a workspace user.
438
- *
439
- * @param id - The unique identifier of the workspace project to join.
440
- * @param requestId - Optional custom identifier for the request.
441
- * @returns A promise that resolves to the full project data after joining.
442
- */
443
- async joinProject(id, requestId) {
444
- return this.projectClient.joinProject(id, requestId);
445
- }
446
- /**
447
- * Retrieves a list of collaborators for a specific project.
448
- *
449
- * @param projectId - The unique identifier of the project.
450
- * @param args - Optional parameters to filter collaborators.
451
- * @returns A promise that resolves to an array of collaborators for the project.
452
- */
453
- async getProjectCollaborators(projectId, args = {}) {
454
- return this.projectClient.getProjectCollaborators(projectId, args);
455
- }
456
- // ── Insights ──
457
- /**
458
- * Retrieves activity statistics for a project.
459
- *
460
- * @param projectId - The unique identifier of the project.
461
- * @param args - Optional parameters including weeks and weekly counts flag.
462
- * @returns A promise that resolves to the project activity stats.
463
- */
464
- async getProjectActivityStats(projectId, args = {}) {
465
- return this.insightsClient.getProjectActivityStats(projectId, args);
466
- }
467
- /**
468
- * Retrieves the health status of a project.
469
- *
470
- * @param projectId - The unique identifier of the project.
471
- * @returns A promise that resolves to the project health data.
472
- */
473
- async getProjectHealth(projectId) {
474
- return this.insightsClient.getProjectHealth(projectId);
475
- }
476
- /**
477
- * Retrieves the health context for a project, including metrics and task details.
478
- *
479
- * @param projectId - The unique identifier of the project.
480
- * @returns A promise that resolves to the project health context.
481
- */
482
- async getProjectHealthContext(projectId) {
483
- return this.insightsClient.getProjectHealthContext(projectId);
484
- }
485
- /**
486
- * Retrieves progress information for a project.
487
- *
488
- * @param projectId - The unique identifier of the project.
489
- * @returns A promise that resolves to the project progress data.
490
- */
491
- async getProjectProgress(projectId) {
492
- return this.insightsClient.getProjectProgress(projectId);
493
- }
494
- /**
495
- * Retrieves insights for all projects in a workspace.
496
- *
497
- * @param workspaceId - The unique identifier of the workspace.
498
- * @param args - Optional parameters including project IDs filter.
499
- * @returns A promise that resolves to workspace insights data.
500
- */
501
- async getWorkspaceInsights(workspaceId, args = {}) {
502
- return this.insightsClient.getWorkspaceInsights(workspaceId, args);
503
- }
504
- /**
505
- * Triggers a health analysis for a project.
506
- *
507
- * @param projectId - The unique identifier of the project.
508
- * @param requestId - Optional custom identifier for the request.
509
- * @returns A promise that resolves to the updated project health data.
510
- */
511
- async analyzeProjectHealth(projectId, requestId) {
512
- return this.insightsClient.analyzeProjectHealth(projectId, requestId);
513
- }
514
- // ── Sections ──
515
- /**
516
- * Retrieves all sections within a specific project or matching criteria.
517
- *
518
- * @param args - Filter parameters such as project ID. If no projectId is provided,
519
- * all sections are returned.
520
- * @returns A promise that resolves to an array of sections.
521
- */
522
- async getSections(args) {
523
- return this.sectionClient.getSections(args);
524
- }
525
- /**
526
- * Searches sections by name.
527
- *
528
- * @param args - Search parameters including the query string.
529
- * @returns A promise that resolves to a paginated response of sections.
530
- */
531
- async searchSections(args) {
532
- return this.sectionClient.searchSections(args);
533
- }
534
- /**
535
- * Retrieves a single section by its ID.
536
- *
537
- * @param id - The unique identifier of the section.
538
- * @returns A promise that resolves to the requested section.
539
- */
540
- async getSection(id) {
541
- return this.sectionClient.getSection(id);
542
- }
543
- /**
544
- * Creates a new section within a project.
545
- *
546
- * @param args - Section creation parameters such as name or project ID.
547
- * @param requestId - Optional custom identifier for the request.
548
- * @returns A promise that resolves to the created section.
549
- */
550
- async addSection(args, requestId) {
551
- return this.sectionClient.addSection(args, requestId);
552
- }
553
- /**
554
- * Updates a section by its ID with the provided parameters.
555
- *
556
- * @param id - The unique identifier of the section to update.
557
- * @param args - Update parameters such as name or project ID.
558
- * @param requestId - Optional custom identifier for the request.
559
- * @returns A promise that resolves to the updated section.
560
- */
561
- async updateSection(id, args, requestId) {
562
- return this.sectionClient.updateSection(id, args, requestId);
563
- }
564
- /**
565
- * Deletes a section by its ID.
566
- *
567
- * @param id - The unique identifier of the section to delete.
568
- * @param requestId - Optional custom identifier for the request.
569
- * @returns A promise that resolves to `true` if successful.
570
- */
571
- async deleteSection(id, requestId) {
572
- return this.sectionClient.deleteSection(id, requestId);
573
- }
574
- /**
575
- * Archives a section by its ID.
576
- *
577
- * @param id - The unique identifier of the section to archive.
578
- * @param requestId - Optional custom identifier for the request.
579
- * @returns A promise that resolves to the updated section.
580
- */
581
- async archiveSection(id, requestId) {
582
- return this.sectionClient.archiveSection(id, requestId);
583
- }
584
- /**
585
- * Unarchives a section by its ID.
586
- *
587
- * @param id - The unique identifier of the section to unarchive.
588
- * @param requestId - Optional custom identifier for the request.
589
- * @returns A promise that resolves to the updated section.
590
- */
591
- async unarchiveSection(id, requestId) {
592
- return this.sectionClient.unarchiveSection(id, requestId);
593
- }
594
- /**
595
- * Retrieves a label by its ID.
596
- *
597
- * @param id - The unique identifier of the label.
598
- * @returns A promise that resolves to the requested label.
599
- */
600
- async getLabel(id) {
601
- return this.labelClient.getLabel(id);
602
- }
603
- /**
604
- * Retrieves all labels.
605
- *
606
- * @param args - Optional filter parameters.
607
- * @returns A promise that resolves to an array of labels.
608
- */
609
- async getLabels(args = {}) {
610
- return this.labelClient.getLabels(args);
611
- }
612
- /**
613
- * Searches labels by name.
614
- *
615
- * @param args - Search parameters including the query string.
616
- * @returns A promise that resolves to a paginated response of labels.
617
- */
618
- async searchLabels(args) {
619
- return this.labelClient.searchLabels(args);
620
- }
621
- /**
622
- * Adds a new label.
623
- *
624
- * @param args - Label creation parameters such as name.
625
- * @param requestId - Optional custom identifier for the request.
626
- * @returns A promise that resolves to the created label.
627
- */
628
- async addLabel(args, requestId) {
629
- return this.labelClient.addLabel(args, requestId);
630
- }
631
- /**
632
- * Updates an existing label by its ID.
633
- *
634
- * @param id - The unique identifier of the label to update.
635
- * @param args - Update parameters such as name or color.
636
- * @param requestId - Optional custom identifier for the request.
637
- * @returns A promise that resolves to the updated label.
638
- */
639
- async updateLabel(id, args, requestId) {
640
- return this.labelClient.updateLabel(id, args, requestId);
641
- }
642
- /**
643
- * Deletes a label by its ID.
644
- *
645
- * @param id - The unique identifier of the label to delete.
646
- * @param requestId - Optional custom identifier for the request.
647
- * @returns A promise that resolves to `true` if successful.
648
- */
649
- async deleteLabel(id, requestId) {
650
- return this.labelClient.deleteLabel(id, requestId);
651
- }
652
- /**
653
- * Retrieves a list of shared labels.
654
- *
655
- * @param args - Optional parameters to filter shared labels.
656
- * @returns A promise that resolves to an array of shared labels.
657
- */
658
- async getSharedLabels(args) {
659
- return this.labelClient.getSharedLabels(args);
660
- }
661
- /**
662
- * Renames an existing shared label.
663
- *
664
- * @param args - Parameters for renaming the shared label, including the current and new name.
665
- * @returns A promise that resolves to `true` if successful.
666
- */
667
- async renameSharedLabel(args) {
668
- return this.labelClient.renameSharedLabel(args);
669
- }
670
- /**
671
- * Removes a shared label.
672
- *
673
- * @param args - Parameters for removing the shared label.
674
- * @returns A promise that resolves to `true` if successful.
675
- */
676
- async removeSharedLabel(args) {
677
- return this.labelClient.removeSharedLabel(args);
678
- }
679
- /**
680
- * Retrieves all comments associated with a task or project.
681
- *
682
- * @param args - Parameters for retrieving comments, such as task ID or project ID.
683
- * @returns A promise that resolves to an array of comments.
684
- */
685
- async getComments(args) {
686
- return this.commentClient.getComments(args);
687
- }
688
- /**
689
- * Retrieves a specific comment by its ID.
690
- *
691
- * @param id - The unique identifier of the comment to retrieve.
692
- * @returns A promise that resolves to the requested comment.
693
- */
694
- async getComment(id) {
695
- return this.commentClient.getComment(id);
696
- }
697
- /**
698
- * Adds a comment to a task or project.
699
- *
700
- * @param args - Parameters for creating the comment, such as content and the target task or project ID.
701
- * @param requestId - Optional custom identifier for the request.
702
- * @returns A promise that resolves to the created comment.
703
- */
704
- async addComment(args, requestId) {
705
- return this.commentClient.addComment(args, requestId);
706
- }
707
- /**
708
- * Updates an existing comment by its ID.
709
- *
710
- * @param id - The unique identifier of the comment to update.
711
- * @param args - Update parameters such as new content.
712
- * @param requestId - Optional custom identifier for the request.
713
- * @returns A promise that resolves to the updated comment.
714
- */
715
- async updateComment(id, args, requestId) {
716
- return this.commentClient.updateComment(id, args, requestId);
717
- }
718
- /**
719
- * Deletes a comment by its ID.
720
- *
721
- * @param id - The unique identifier of the comment to delete.
722
- * @param requestId - Optional custom identifier for the request.
723
- * @returns A promise that resolves to `true` if successful.
724
- */
725
- async deleteComment(id, requestId) {
726
- return this.commentClient.deleteComment(id, requestId);
727
- }
728
- /**
729
- * Retrieves a paginated list of time-based reminders.
730
- *
731
- * @param args - Optional parameters including task ID filter and pagination.
732
- * @returns A promise that resolves to a paginated list of reminders.
733
- */
734
- async getReminders(args = {}) {
735
- return this.reminderClient.getReminders(args);
736
- }
737
- /**
738
- * Retrieves a paginated list of location-based reminders.
739
- *
740
- * @param args - Optional parameters including task ID filter and pagination.
741
- * @returns A promise that resolves to a paginated list of location reminders.
742
- */
743
- async getLocationReminders(args = {}) {
744
- return this.reminderClient.getLocationReminders(args);
745
- }
746
- /**
747
- * Retrieves a time-based reminder by its ID.
748
- *
749
- * @param id - The unique identifier of the reminder to retrieve.
750
- * @returns A promise that resolves to the requested reminder.
751
- */
752
- async getReminder(id) {
753
- return this.reminderClient.getReminder(id);
754
- }
755
- /**
756
- * Retrieves a location reminder by its ID.
757
- *
758
- * @param id - The unique identifier of the location reminder to retrieve.
759
- * @returns A promise that resolves to the requested reminder.
760
- */
761
- async getLocationReminder(id) {
762
- return this.reminderClient.getLocationReminder(id);
763
- }
764
- /**
765
- * Creates a time-based reminder for a task.
766
- *
767
- * @param args - Reminder creation parameters for relative or absolute reminders.
768
- * @param requestId - Optional custom identifier for the request.
769
- * @returns A promise that resolves to the created reminder.
770
- */
771
- async addReminder(args, requestId) {
772
- return this.reminderClient.addReminder(args, requestId);
773
- }
774
- /**
775
- * Creates a location reminder for a task.
776
- *
777
- * @param args - Location reminder creation parameters.
778
- * @param requestId - Optional custom identifier for the request.
779
- * @returns A promise that resolves to the created reminder.
780
- */
781
- async addLocationReminder(args, requestId) {
782
- return this.reminderClient.addLocationReminder(args, requestId);
783
- }
784
- /**
785
- * Updates an existing time-based reminder.
786
- *
787
- * @param id - The unique identifier of the reminder to update.
788
- * @param args - Reminder update parameters.
789
- * @param requestId - Optional custom identifier for the request.
790
- * @returns A promise that resolves to the updated reminder.
791
- */
792
- async updateReminder(id, args, requestId) {
793
- return this.reminderClient.updateReminder(id, args, requestId);
794
- }
795
- /**
796
- * Updates an existing location reminder.
797
- *
798
- * @param id - The unique identifier of the location reminder to update.
799
- * @param args - Location reminder update parameters.
800
- * @param requestId - Optional custom identifier for the request.
801
- * @returns A promise that resolves to the updated reminder.
802
- */
803
- async updateLocationReminder(id, args, requestId) {
804
- return this.reminderClient.updateLocationReminder(id, args, requestId);
805
- }
806
- /**
807
- * Deletes a time-based reminder by its ID.
808
- *
809
- * @param id - The unique identifier of the reminder to delete.
810
- * @param requestId - Optional custom identifier for the request.
811
- * @returns A promise that resolves to `true` if successful.
812
- */
813
- async deleteReminder(id, requestId) {
814
- return this.reminderClient.deleteReminder(id, requestId);
815
- }
816
- /**
817
- * Deletes a location reminder by its ID.
818
- *
819
- * @param id - The unique identifier of the location reminder to delete.
820
- * @param requestId - Optional custom identifier for the request.
821
- * @returns A promise that resolves to `true` if successful.
822
- */
823
- async deleteLocationReminder(id, requestId) {
824
- return this.reminderClient.deleteLocationReminder(id, requestId);
825
- }
826
- /**
827
- * Retrieves productivity stats for the authenticated user.
828
- *
829
- * @returns A promise that resolves to the productivity stats.
830
- */
831
- async getProductivityStats() {
832
- return this.productivityClient.getProductivityStats();
833
- }
834
- /**
835
- * Retrieves activity logs with optional filters.
836
- *
837
- * @param args - Optional filter parameters for activity logs.
838
- * @returns A promise that resolves to a paginated response of activity events.
839
- */
840
- async getActivityLogs(args = {}) {
841
- return this.activityClient.getActivityLogs(args);
842
- }
843
- /**
844
- * Uploads a file and returns attachment metadata.
845
- * This creates an upload record that can be referenced in tasks or comments.
846
- *
847
- * @param args - Upload parameters including file content, filename, and optional project ID.
848
- * @param requestId - Optional custom identifier for the request.
849
- * @returns A promise that resolves to the uploaded file's attachment metadata.
850
- *
851
- * @example
852
- * ```typescript
853
- * // Upload from a file path
854
- * const upload = await api.uploadFile({
855
- * file: '/path/to/document.pdf',
856
- * projectId: '12345'
857
- * })
858
- *
859
- * // Upload from a Buffer
860
- * const buffer = fs.readFileSync('/path/to/document.pdf')
861
- * const upload = await api.uploadFile({
862
- * file: buffer,
863
- * fileName: 'document.pdf', // Required for Buffer/Stream
864
- * projectId: '12345'
865
- * })
866
- *
867
- * // Use the returned fileUrl in a comment
868
- * await api.addComment({
869
- * content: 'See attached document',
870
- * taskId: '67890',
871
- * attachment: {
872
- * fileUrl: upload.fileUrl,
873
- * fileName: upload.fileName,
874
- * fileType: upload.fileType,
875
- * resourceType: upload.resourceType
876
- * }
877
- * })
878
- * ```
879
- */
880
- async uploadFile(args, requestId) {
881
- return this.uploadClient.uploadFile(args, requestId);
882
- }
883
- /**
884
- * Deletes an uploaded file by its URL.
885
- *
886
- * @param args - The file URL to delete.
887
- * @param requestId - Optional custom identifier for the request.
888
- * @returns A promise that resolves to `true` if deletion was successful.
889
- *
890
- * @example
891
- * ```typescript
892
- * await api.deleteUpload({
893
- * fileUrl: 'https://files.todoist.com/...'
894
- * })
895
- * ```
896
- */
897
- async deleteUpload(args, requestId) {
898
- return this.uploadClient.deleteUpload(args, requestId);
899
- }
900
- /**
901
- * Fetches the content of a file attachment from a Todoist comment.
902
- *
903
- * Accepts either a Comment object (extracts the file URL from its attachment)
904
- * or a direct file URL string. Returns the raw Response object so the caller
905
- * can read the body in the appropriate format (.arrayBuffer(), .text(), etc.).
906
- *
907
- * Only known Todoist attachment hosts are allowed: the authenticated
908
- * `files.todoist.com` origin (which receives the Bearer token) and the
909
- * attachment CDN origins (fetched without the token). Other URLs are rejected.
910
- *
911
- * @param commentOrUrl - A Comment object with a file attachment, or a file URL string.
912
- * @returns The raw fetch Response for the file content.
913
- * @throws Error if a Comment is provided without a file attachment or file URL,
914
- * or if the URL is not on a known Todoist attachment host.
915
- *
916
- * @example
917
- * ```typescript
918
- * // From a comment object
919
- * const comments = await api.getComments({ taskId: '12345' })
920
- * const comment = comments.results[0]
921
- * const response = await api.viewAttachment(comment)
922
- * const imageData = await response.arrayBuffer()
923
- *
924
- * // From a URL string
925
- * const response = await api.viewAttachment('https://files.todoist.com/...')
926
- * const text = await response.text()
927
- * ```
928
- */
929
- async viewAttachment(commentOrUrl) {
930
- return this.uploadClient.viewAttachment(commentOrUrl);
931
- }
932
- // ── Folders ──
933
- /**
934
- * Retrieves a paginated list of folders.
935
- *
936
- * @param args - Filter parameters such as workspace ID.
937
- * @returns A promise that resolves to a paginated response of folders.
938
- */
939
- async getFolders(args) {
940
- return this.folderClient.getFolders(args);
941
- }
942
- /**
943
- * Retrieves a single folder by its ID.
944
- *
945
- * @param id - The unique identifier of the folder.
946
- * @returns A promise that resolves to the requested folder.
947
- */
948
- async getFolder(id) {
949
- return this.folderClient.getFolder(id);
950
- }
951
- /**
952
- * Creates a new folder.
953
- *
954
- * @param args - Folder creation parameters including name and workspace ID.
955
- * @param requestId - Optional custom identifier for the request.
956
- * @returns A promise that resolves to the created folder.
957
- */
958
- async addFolder(args, requestId) {
959
- return this.folderClient.addFolder(args, requestId);
960
- }
961
- /**
962
- * Updates an existing folder by its ID.
963
- *
964
- * @param id - The unique identifier of the folder to update.
965
- * @param args - Update parameters such as name or default order.
966
- * @param requestId - Optional custom identifier for the request.
967
- * @returns A promise that resolves to the updated folder.
968
- */
969
- async updateFolder(id, args, requestId) {
970
- return this.folderClient.updateFolder(id, args, requestId);
971
- }
972
- /**
973
- * Deletes a folder by its ID.
974
- *
975
- * @param id - The unique identifier of the folder to delete.
976
- * @param requestId - Optional custom identifier for the request.
977
- * @returns A promise that resolves to `true` if successful.
978
- */
979
- async deleteFolder(id, requestId) {
980
- return this.folderClient.deleteFolder(id, requestId);
981
- }
982
- // ── Billing ──
983
- /**
984
- * Retrieves the current user's subscription state.
985
- *
986
- * Requires the `billing:read` scope.
987
- *
988
- * @returns A promise that resolves to the user's subscription info.
989
- */
990
- async getSubscriptionInfo() {
991
- return this.billingClient.getSubscriptionInfo();
992
- }
993
- /**
994
- * Starts a hosted cancellation flow for the current user's plan.
995
- *
996
- * Requires the `billing:read_write` scope.
997
- *
998
- * @param args - Optional cancellation reason details and return URL.
999
- * @param requestId - Optional custom identifier for the request.
1000
- * @returns A promise that resolves to the billing portal redirect URL.
1001
- */
1002
- async cancelPlan(args, requestId) {
1003
- return this.billingClient.cancelPlan(args, requestId);
1004
- }
1005
- /**
1006
- * Reactivates a previously canceled subscription.
1007
- *
1008
- * Requires the `billing:read_write` scope.
1009
- *
1010
- * @param requestId - Optional custom identifier for the request.
1011
- * @returns A promise that resolves to the fresh subscription info after reactivation.
1012
- */
1013
- async reactivatePlan(requestId) {
1014
- return this.billingClient.reactivatePlan(requestId);
1015
- }
1016
- /**
1017
- * Creates a Stripe checkout session to upgrade the current user to Pro.
1018
- *
1019
- * Requires the `billing:read_write` scope.
1020
- *
1021
- * @param args - Currency, billing cycle, redirect URLs, and optional promotion/trial details.
1022
- * @param requestId - Optional custom identifier for the request.
1023
- * @returns A promise that resolves to the checkout session URL.
1024
- */
1025
- async upgradeToPro(args, requestId) {
1026
- return this.billingClient.upgradeToPro(args, requestId);
1027
- }
1028
- /**
1029
- * Creates a Stripe checkout session to start a Pro trial.
1030
- *
1031
- * Requires the `billing:read_write` scope.
1032
- *
1033
- * @param args - Currency, billing cycle, and redirect URLs.
1034
- * @param requestId - Optional custom identifier for the request.
1035
- * @returns A promise that resolves to the checkout session URL.
1036
- */
1037
- async startProTrial(args, requestId) {
1038
- return this.billingClient.startProTrial(args, requestId);
1039
- }
1040
- /**
1041
- * Creates a one-time Stripe billing portal session for the current user's Pro plan.
1042
- *
1043
- * Requires the `billing:read_write` scope.
1044
- *
1045
- * @param args - Return URL and optional flow type / promotion code.
1046
- * @param requestId - Optional custom identifier for the request.
1047
- * @returns A promise that resolves to the billing portal URL.
1048
- */
1049
- async createProBillingPortalSession(args, requestId) {
1050
- return this.billingClient.createProBillingPortalSession(args, requestId);
1051
- }
1052
- /**
1053
- * Retrieves the current user's Pro plan and billing details.
1054
- *
1055
- * Requires the `billing:read` scope.
1056
- *
1057
- * @returns A promise that resolves to the Pro plan details.
1058
- */
1059
- async getProPlanDetails() {
1060
- return this.billingClient.getProPlanDetails();
1061
- }
1062
- /**
1063
- * Creates a Stripe checkout session to upgrade a workspace.
1064
- *
1065
- * Requires the `billing:read_write` scope.
1066
- *
1067
- * @param args - Workspace ID, currency, billing cycle, redirect URLs, and optional promotion details.
1068
- * @param requestId - Optional custom identifier for the request.
1069
- * @returns A promise that resolves to the checkout session URL.
1070
- */
1071
- async upgradeWorkspace(args, requestId) {
1072
- return this.billingClient.upgradeWorkspace(args, requestId);
1073
- }
1074
- /**
1075
- * Creates a Stripe checkout session to start a workspace trial.
1076
- *
1077
- * Requires the `billing:read_write` scope.
1078
- *
1079
- * @param args - Workspace ID, currency, billing cycle, and redirect URLs.
1080
- * @param requestId - Optional custom identifier for the request.
1081
- * @returns A promise that resolves to the checkout session URL.
1082
- */
1083
- async startWorkspaceTrial(args, requestId) {
1084
- return this.billingClient.startWorkspaceTrial(args, requestId);
1085
- }
1086
- /**
1087
- * Creates a one-time Stripe billing portal session for a workspace.
1088
- *
1089
- * Requires the `billing:read_write` scope.
1090
- *
1091
- * @param args - Workspace ID, return URL, and optional flow type.
1092
- * @param requestId - Optional custom identifier for the request.
1093
- * @returns A promise that resolves to the billing portal URL.
1094
- */
1095
- async createWorkspaceBillingPortalSession(args, requestId) {
1096
- return this.billingClient.createWorkspaceBillingPortalSession(args, requestId);
1097
- }
1098
- /**
1099
- * Retrieves available Pro and Teams prices.
1100
- *
1101
- * Requires the `billing:read` scope.
1102
- *
1103
- * @returns A promise that resolves to the available prices.
1104
- */
1105
- async getPrices() {
1106
- return this.billingClient.getPrices();
1107
- }
1108
- /**
1109
- * Retrieves pricing information.
1110
- *
1111
- * Requires the `billing:read` scope.
1112
- *
1113
- * @param args - Optional flag to request formatted pricing.
1114
- * @returns A promise that resolves to current and legacy pricing keyed by version.
1115
- */
1116
- async getPricing(args) {
1117
- return this.billingClient.getPricing(args);
1118
- }
1119
- // ── Backups ──
1120
- /**
1121
- * Retrieves a list of available backups.
1122
- *
1123
- * @param args - Optional parameters including MFA token.
1124
- * @returns A promise that resolves to an array of backups.
1125
- */
1126
- async getBackups(args = {}) {
1127
- return this.backupClient.getBackups(args);
1128
- }
1129
- /**
1130
- * Downloads a backup file as binary data.
1131
- *
1132
- * @param args - Arguments including the backup file URL (from getBackups).
1133
- * @returns A promise that resolves to a response with binary data accessible via arrayBuffer().
1134
- */
1135
- async downloadBackup(args) {
1136
- return this.backupClient.downloadBackup(args);
1137
- }
1138
- // ── Emails ──
1139
- /**
1140
- * Gets or creates an email forwarding address for an object.
1141
- *
1142
- * @param args - Arguments including object type and ID.
1143
- * @param requestId - Optional custom identifier for the request.
1144
- * @returns A promise that resolves to the email address.
1145
- */
1146
- async getOrCreateEmailForwarding(args, requestId) {
1147
- return this.emailClient.getOrCreateEmailForwarding(args, requestId);
1148
- }
1149
- /**
1150
- * Disables email forwarding for an object.
1151
- *
1152
- * @param args - Arguments including object type and ID.
1153
- * @param requestId - Optional custom identifier for the request.
1154
- * @returns A promise that resolves to `true` if successful.
1155
- */
1156
- async disableEmailForwarding(args, requestId) {
1157
- return this.emailClient.disableEmailForwarding(args, requestId);
1158
- }
1159
- // ── ID Mappings ──
1160
- /**
1161
- * Retrieves ID mappings between old and new IDs.
1162
- *
1163
- * @param args - Arguments including object type and IDs to look up.
1164
- * @returns A promise that resolves to an array of ID mappings.
1165
- */
1166
- async getIdMappings(args) {
1167
- return this.idMappingClient.getIdMappings(args);
1168
- }
1169
- /**
1170
- * Retrieves moved IDs for objects that have been migrated.
1171
- *
1172
- * @param args - Arguments including object type and optional old IDs to look up.
1173
- * @returns A promise that resolves to an array of moved ID pairs.
1174
- */
1175
- async getMovedIds(args) {
1176
- return this.idMappingClient.getMovedIds(args);
1177
- }
1178
- // ── Templates ──
1179
- /**
1180
- * Exports a project as a template file (CSV format).
1181
- *
1182
- * @param args - Arguments including project ID and optional date format preference.
1183
- * @returns A promise that resolves to the template file content as a string.
1184
- */
1185
- async exportTemplateAsFile(args) {
1186
- return this.templateClient.exportTemplateAsFile(args);
1187
- }
1188
- /**
1189
- * Exports a project as a template URL.
1190
- *
1191
- * @param args - Arguments including project ID and optional date format preference.
1192
- * @returns A promise that resolves to the file name and URL.
1193
- */
1194
- async exportTemplateAsUrl(args) {
1195
- return this.templateClient.exportTemplateAsUrl(args);
1196
- }
1197
- /**
1198
- * Creates a new project from a template file.
1199
- *
1200
- * @param args - Arguments including project name, template file, and optional workspace ID.
1201
- * @param requestId - Optional custom identifier for the request.
1202
- * @returns A promise that resolves to the created project data.
1203
- */
1204
- async createProjectFromTemplate(args, requestId) {
1205
- return this.templateClient.createProjectFromTemplate(args, requestId);
1206
- }
1207
- /**
1208
- * Imports a template file into an existing project.
1209
- *
1210
- * @param args - Arguments including project ID and template file.
1211
- * @param requestId - Optional custom identifier for the request.
1212
- * @returns A promise that resolves to the import result.
1213
- */
1214
- async importTemplateIntoProject(args, requestId) {
1215
- return this.templateClient.importTemplateIntoProject(args, requestId);
1216
- }
1217
- /**
1218
- * Imports a template by ID into an existing project.
1219
- *
1220
- * @param args - Arguments including project ID, template ID, and optional locale.
1221
- * @param requestId - Optional custom identifier for the request.
1222
- * @returns A promise that resolves to the import result.
1223
- */
1224
- async importTemplateFromId(args, requestId) {
1225
- return this.templateClient.importTemplateFromId(args, requestId);
1226
- }
1227
- /* Workspace methods */
1228
- /**
1229
- * Gets pending invitations for a workspace.
1230
- *
1231
- * @param args - Arguments including workspace ID.
1232
- * @param requestId - Optional request ID for idempotency.
1233
- * @returns Array of email addresses with pending invitations.
1234
- */
1235
- async getWorkspaceInvitations(args, requestId) {
1236
- return this.workspaceClient.getWorkspaceInvitations(args, requestId);
1237
- }
1238
- /**
1239
- * Gets all workspace invitations (admin only).
1240
- *
1241
- * @param requestId - Optional request ID for idempotency.
1242
- * @returns Array of email addresses with pending invitations.
1243
- */
1244
- async getAllWorkspaceInvitations(args = {}, requestId) {
1245
- return this.workspaceClient.getAllWorkspaceInvitations(args, requestId);
1246
- }
1247
- /**
1248
- * Deletes a workspace invitation (admin only).
1249
- *
1250
- * @param args - Arguments including workspace ID and user email.
1251
- * @param requestId - Optional request ID for idempotency.
1252
- * @returns The deleted invitation.
1253
- */
1254
- async deleteWorkspaceInvitation(args, requestId) {
1255
- return this.workspaceClient.deleteWorkspaceInvitation(args, requestId);
1256
- }
1257
- /**
1258
- * Accepts a workspace invitation.
1259
- *
1260
- * @param args - Arguments including invite code.
1261
- * @param requestId - Optional request ID for idempotency.
1262
- * @returns The accepted invitation.
1263
- */
1264
- async acceptWorkspaceInvitation(args, requestId) {
1265
- return this.workspaceClient.acceptWorkspaceInvitation(args, requestId);
1266
- }
1267
- /**
1268
- * Rejects a workspace invitation.
1269
- *
1270
- * @param args - Arguments including invite code.
1271
- * @param requestId - Optional request ID for idempotency.
1272
- * @returns The rejected invitation.
1273
- */
1274
- async rejectWorkspaceInvitation(args, requestId) {
1275
- return this.workspaceClient.rejectWorkspaceInvitation(args, requestId);
1276
- }
1277
- /**
1278
- * Joins a workspace via invitation link or domain auto-join.
1279
- *
1280
- * @param args - Arguments including invite code or workspace ID.
1281
- * @param requestId - Optional request ID for idempotency.
1282
- * @returns Workspace user information.
1283
- */
1284
- async joinWorkspace(args, requestId) {
1285
- return this.workspaceClient.joinWorkspace(args, requestId);
1286
- }
1287
- /**
1288
- * Uploads or updates a workspace logo.
1289
- *
1290
- * @param args - Arguments including workspace ID, file, and options.
1291
- * @param requestId - Optional request ID for idempotency.
1292
- * @returns Logo information or null if deleted.
1293
- */
1294
- async uploadWorkspaceLogo(args, requestId) {
1295
- return this.workspaceClient.uploadWorkspaceLogo(args, requestId);
1296
- }
1297
- /**
1298
- * Gets workspace plan and billing details.
1299
- *
1300
- * @param args - Arguments including workspace ID.
1301
- * @param requestId - Optional request ID for idempotency.
1302
- * @returns Workspace plan details.
1303
- */
1304
- async getWorkspacePlanDetails(args, requestId) {
1305
- return this.workspaceClient.getWorkspacePlanDetails(args, requestId);
1306
- }
1307
- /**
1308
- * Gets workspace users with pagination.
1309
- *
1310
- * @param args - Arguments including optional workspace ID, cursor, and limit.
1311
- * @param requestId - Optional request ID for idempotency.
1312
- * @returns Paginated list of workspace users.
1313
- */
1314
- async getWorkspaceUsers(args = {}, requestId) {
1315
- return this.workspaceClient.getWorkspaceUsers(args, requestId);
1316
- }
1317
- /**
1318
- * Retrieves all workspaces for the authenticated user.
1319
- *
1320
- * @param requestId - Optional custom identifier for the request.
1321
- * @returns A promise that resolves to an array of workspaces.
1322
- *
1323
- * @example
1324
- * ```typescript
1325
- * const workspaces = await api.getWorkspaces()
1326
- * workspaces.forEach(workspace => {
1327
- * console.log(`${workspace.name} (${workspace.plan}) - Role: ${workspace.role}`)
1328
- * })
1329
- * ```
1330
- */
1331
- async getWorkspaces(requestId) {
1332
- return this.workspaceClient.getWorkspaces(requestId);
1333
- }
1334
- /**
1335
- * Retrieves a workspace by its ID.
1336
- *
1337
- * @param id - The unique identifier of the workspace.
1338
- * @param requestId - Optional custom identifier for the request.
1339
- * @returns A promise that resolves to the requested workspace.
1340
- */
1341
- async getWorkspace(id, requestId) {
1342
- return this.workspaceClient.getWorkspace(id, requestId);
1343
- }
1344
- /**
1345
- * Creates a new workspace.
1346
- *
1347
- * @param args - The arguments for creating the workspace.
1348
- * @param requestId - Optional custom identifier for the request.
1349
- * @returns A promise that resolves to the created workspace.
1350
- */
1351
- async addWorkspace(args, requestId) {
1352
- return this.workspaceClient.addWorkspace(args, requestId);
1353
- }
1354
- /**
1355
- * Updates an existing workspace.
1356
- *
1357
- * @param id - The unique identifier of the workspace to update.
1358
- * @param args - The arguments for updating the workspace.
1359
- * @param requestId - Optional custom identifier for the request.
1360
- * @returns A promise that resolves to the updated workspace.
1361
- */
1362
- async updateWorkspace(id, args, requestId) {
1363
- return this.workspaceClient.updateWorkspace(id, args, requestId);
1364
- }
1365
- /**
1366
- * Deletes a workspace by its ID.
1367
- *
1368
- * @param id - The unique identifier of the workspace to delete.
1369
- * @param requestId - Optional custom identifier for the request.
1370
- * @returns A promise that resolves to `true` if successful.
1371
- */
1372
- async deleteWorkspace(id, requestId) {
1373
- return this.workspaceClient.deleteWorkspace(id, requestId);
1374
- }
1375
- /**
1376
- * Retrieves activity information for workspace members.
1377
- *
1378
- * @param args - Arguments including workspace ID and optional user/project filters.
1379
- * @param requestId - Optional custom identifier for the request.
1380
- * @returns A promise that resolves to workspace members activity data.
1381
- */
1382
- async getWorkspaceMembersActivity(args, requestId) {
1383
- return this.workspaceClient.getWorkspaceMembersActivity(args, requestId);
1384
- }
1385
- /**
1386
- * Retrieves tasks assigned to a specific user in a workspace.
1387
- *
1388
- * @param args - Arguments including workspace ID, user ID, and optional project filter.
1389
- * @param requestId - Optional custom identifier for the request.
1390
- * @returns A promise that resolves to workspace user tasks.
1391
- */
1392
- async getWorkspaceUserTasks(args, requestId) {
1393
- return this.workspaceClient.getWorkspaceUserTasks(args, requestId);
1394
- }
1395
- /**
1396
- * Invites users to a workspace by email.
1397
- *
1398
- * @param args - Arguments including workspace ID, email list, and optional role.
1399
- * @param requestId - Optional custom identifier for the request.
1400
- * @returns A promise that resolves to the list of invited emails.
1401
- */
1402
- async inviteWorkspaceUsers(args, requestId) {
1403
- return this.workspaceClient.inviteWorkspaceUsers(args, requestId);
1404
- }
1405
- /**
1406
- * Updates a workspace user's role.
1407
- *
1408
- * @param args - Arguments including workspace ID, user ID, and new role.
1409
- * @param requestId - Optional custom identifier for the request.
1410
- * @returns A promise that resolves to the updated workspace user view.
1411
- */
1412
- async updateWorkspaceUser(args, requestId) {
1413
- return this.workspaceClient.updateWorkspaceUser(args, requestId);
1414
- }
1415
- /**
1416
- * Removes a user from a workspace.
1417
- *
1418
- * @param args - Arguments including workspace ID and user ID.
1419
- * @param requestId - Optional custom identifier for the request.
1420
- * @returns A promise that resolves to `true` if successful.
1421
- */
1422
- async removeWorkspaceUser(args, requestId) {
1423
- return this.workspaceClient.removeWorkspaceUser(args, requestId);
1424
- }
1425
- /**
1426
- * Gets active projects in a workspace with pagination.
1427
- *
1428
- * @param args - Arguments including workspace ID, cursor, and limit.
1429
- * @param requestId - Optional request ID for idempotency.
1430
- * @returns Paginated list of active workspace projects.
1431
- */
1432
- async getWorkspaceActiveProjects(args, requestId) {
1433
- return this.workspaceClient.getWorkspaceActiveProjects(args, requestId);
1434
- }
1435
- /**
1436
- * Gets archived projects in a workspace with pagination.
1437
- *
1438
- * @param args - Arguments including workspace ID, cursor, and limit.
1439
- * @param requestId - Optional request ID for idempotency.
1440
- * @returns Paginated list of archived workspace projects.
1441
- */
1442
- async getWorkspaceArchivedProjects(args, requestId) {
1443
- return this.workspaceClient.getWorkspaceArchivedProjects(args, requestId);
1444
- }
1445
- // ---------------------------------------------------------------------------
1446
- // App management (dev:app_console scope)
1447
- // ---------------------------------------------------------------------------
1448
- /**
1449
- * Lists all developer applications owned by the authenticated user.
1450
- *
1451
- * Requires the `dev:app_console` scope.
1452
- *
1453
- * @param requestId - Optional request ID for idempotency.
1454
- * @returns A promise that resolves to the list of apps.
1455
- */
1456
- async getApps(requestId) {
1457
- return this.appClient.getApps(requestId);
1458
- }
1459
- /**
1460
- * Retrieves a single developer application by ID.
1461
- *
1462
- * Requires the `dev:app_console` scope.
1463
- */
1464
- async getApp(appId, requestId) {
1465
- return this.appClient.getApp(appId, requestId);
1466
- }
1467
- /**
1468
- * Creates a new developer application.
1469
- *
1470
- * Requires the `dev:app_console` scope.
1471
- */
1472
- async addApp(args, requestId) {
1473
- return this.appClient.addApp(args, requestId);
1474
- }
1475
- /**
1476
- * Updates a developer application.
1477
- *
1478
- * Requires the `dev:app_console` scope.
1479
- */
1480
- async updateApp(appId, args, requestId) {
1481
- return this.appClient.updateApp(appId, args, requestId);
1482
- }
1483
- /**
1484
- * Deletes a developer application.
1485
- *
1486
- * Requires the `dev:app_console` scope.
1487
- */
1488
- async deleteApp(appId, requestId) {
1489
- return this.appClient.deleteApp(appId, requestId);
1490
- }
1491
- /**
1492
- * Retrieves the OAuth client credentials (client ID and secret) for an app.
1493
- *
1494
- * Requires the `dev:app_console` scope.
1495
- */
1496
- async getAppSecrets(appId, requestId) {
1497
- return this.appClient.getAppSecrets(appId, requestId);
1498
- }
1499
- /**
1500
- * Rotates the app's OAuth client secret, returning the updated app record.
1501
- *
1502
- * Requires the `dev:app_console` scope.
1503
- */
1504
- async resetAppClientSecret(appId, requestId) {
1505
- return this.appClient.resetAppClientSecret(appId, requestId);
1506
- }
1507
- /**
1508
- * Revokes every access token issued for the given app.
1509
- *
1510
- * Requires the `dev:app_console` scope.
1511
- */
1512
- async revokeAppTokens(appId, requestId) {
1513
- return this.appClient.revokeAppTokens(appId, requestId);
1514
- }
1515
- /**
1516
- * Uploads an icon for a developer application. The `size` argument
1517
- * selects which icon slot to update (defaults to `'medium'`).
1518
- *
1519
- * Requires the `dev:app_console` scope.
1520
- */
1521
- async uploadAppIcon(args, requestId) {
1522
- return this.appClient.uploadAppIcon(args, requestId);
1523
- }
1524
- /**
1525
- * Gets the currently issued developer test token for an app (null if none exists).
1526
- *
1527
- * Requires the `dev:app_console` scope.
1528
- */
1529
- async getAppTestToken(appId, requestId) {
1530
- return this.appClient.getAppTestToken(appId, requestId);
1531
- }
1532
- /**
1533
- * Creates (or rotates) a developer test token for an app.
1534
- *
1535
- * Requires the `dev:app_console` scope.
1536
- */
1537
- async createAppTestToken(appId, requestId) {
1538
- return this.appClient.createAppTestToken(appId, requestId);
1539
- }
1540
- /**
1541
- * Gets the distribution token for an app, which third parties use to install it.
1542
- *
1543
- * Requires the `dev:app_console` scope.
1544
- */
1545
- async getAppDistributionToken(appId, requestId) {
1546
- return this.appClient.getAppDistributionToken(appId, requestId);
1547
- }
1548
- /**
1549
- * Gets the current webhook verification token for an app.
1550
- *
1551
- * Requires the `dev:app_console` scope.
1552
- */
1553
- async getAppVerificationToken(appId, requestId) {
1554
- return this.appClient.getAppVerificationToken(appId, requestId);
1555
- }
1556
- /**
1557
- * Resets the webhook verification token for an app, returning the new value.
1558
- *
1559
- * Requires the `dev:app_console` scope.
1560
- */
1561
- async resetAppVerificationToken(appId, requestId) {
1562
- return this.appClient.resetAppVerificationToken(appId, requestId);
1563
- }
1564
- /**
1565
- * Resolves a public-facing app view from a distribution token. Used during
1566
- * the installation flow to show prospective installers what the app does
1567
- * and which scopes it requests.
1568
- *
1569
- * Requires the `dev:app_console` scope.
1570
- */
1571
- async getAppByDistributionToken(distributionToken, requestId) {
1572
- return this.appClient.getAppByDistributionToken(distributionToken, requestId);
1573
- }
1574
- /**
1575
- * Gets the webhook configuration for an app (null if no webhook is configured).
1576
- *
1577
- * Requires the `dev:app_console` scope.
1578
- */
1579
- async getAppWebhook(appId, requestId) {
1580
- return this.appClient.getAppWebhook(appId, requestId);
1581
- }
1582
- /**
1583
- * Creates or updates an app webhook configuration (upsert).
1584
- *
1585
- * Requires the `dev:app_console` scope.
1586
- */
1587
- async updateAppWebhook(args, requestId) {
1588
- return this.appClient.updateAppWebhook(args, requestId);
1589
- }
1590
- /**
1591
- * Deletes an app webhook configuration.
1592
- *
1593
- * Requires the `dev:app_console` scope.
1594
- */
1595
- async deleteAppWebhook(appId, requestId) {
1596
- return this.appClient.deleteAppWebhook(appId, requestId);
1597
- }
1598
- /**
1599
- * Lists all apps installed on the authenticated user's account.
1600
- *
1601
- * Requires the `dev:app_console` scope.
1602
- */
1603
- async getAppInstallations(requestId) {
1604
- return this.appClient.getAppInstallations(requestId);
1605
- }
1606
- /**
1607
- * Installs an application via its distribution token.
1608
- *
1609
- * Requires the `dev:app_console` scope.
1610
- */
1611
- async installApp(args, requestId) {
1612
- return this.appClient.installApp(args, requestId);
1613
- }
1614
- /**
1615
- * Retrieves a single app installation by ID.
1616
- *
1617
- * Requires the `dev:app_console` scope.
1618
- */
1619
- async getAppInstallation(installationId, requestId) {
1620
- return this.appClient.getAppInstallation(installationId, requestId);
1621
- }
1622
- /**
1623
- * Updates an app installation.
1624
- *
1625
- * Requires the `dev:app_console` scope.
1626
- */
1627
- async updateAppInstallation(installationId, args, requestId) {
1628
- return this.appClient.updateAppInstallation(installationId, args, requestId);
1629
- }
1630
- /**
1631
- * Uninstalls (removes) an app installation.
1632
- *
1633
- * Requires the `dev:app_console` scope.
1634
- */
1635
- async uninstallApp(installationId, requestId) {
1636
- return this.appClient.uninstallApp(installationId, requestId);
1637
- }
1638
- /**
1639
- * Retrieves a single UI extension by ID.
1640
- *
1641
- * Requires the `dev:app_console` scope.
1642
- */
1643
- async getUiExtension(uiExtensionId, requestId) {
1644
- return this.uiExtensionClient.getUiExtension(uiExtensionId, requestId);
1645
- }
1646
- /**
1647
- * Lists UI extensions available (installed) in the web client for the current user.
1648
- *
1649
- * Requires the `dev:app_console` scope.
1650
- */
1651
- async getInstalledUiExtensions(requestId) {
1652
- return this.uiExtensionClient.getInstalledUiExtensions(requestId);
1653
- }
1654
- /**
1655
- * Lists all UI extensions belonging to a given app (integration).
1656
- *
1657
- * Requires the `dev:app_console` scope.
1658
- */
1659
- async getUiExtensionsForApp(appId, requestId) {
1660
- return this.uiExtensionClient.getUiExtensionsForApp(appId, requestId);
1661
- }
1662
- /**
1663
- * Adds a new UI extension to an app.
1664
- *
1665
- * Requires the `dev:app_console` scope.
1666
- */
1667
- async addUiExtension(args, requestId) {
1668
- return this.uiExtensionClient.addUiExtension(args, requestId);
1669
- }
1670
- /**
1671
- * Updates an existing UI extension.
1672
- *
1673
- * Requires the `dev:app_console` scope.
1674
- */
1675
- async updateUiExtension(uiExtensionId, args, requestId) {
1676
- return this.uiExtensionClient.updateUiExtension(uiExtensionId, args, requestId);
1677
- }
1678
- /**
1679
- * Deletes a UI extension.
1680
- *
1681
- * Requires the `dev:app_console` scope.
1682
- */
1683
- async deleteUiExtension(uiExtensionId, requestId) {
1684
- return this.uiExtensionClient.deleteUiExtension(uiExtensionId, requestId);
1685
- }
1686
- /**
1687
- * Uploads an icon for a UI extension.
1688
- *
1689
- * Requires the `dev:app_console` scope.
1690
- */
1691
- async uploadUiExtensionIcon(args, requestId) {
1692
- return this.uiExtensionClient.uploadUiExtensionIcon(args, requestId);
1693
- }
1694
- /**
1695
- * Lists all apps the user has authorized (granted a token to).
1696
- *
1697
- * Requires the `dev:app_console` scope.
1698
- */
1699
- async getUserAuthorizations(requestId) {
1700
- return this.appClient.getUserAuthorizations(requestId);
1701
- }
1702
- /**
1703
- * Revokes a specific user authorization (access token granted to a third-party app).
1704
- *
1705
- * Requires the `dev:app_console` scope.
1706
- */
1707
- async revokeUserAuthorization(args, requestId) {
1708
- return this.appClient.revokeUserAuthorization(args, requestId);
1709
- }
1710
- }
1711
- exports.TodoistApi = TodoistApi;