@doist/todoist-sdk 15.5.0 → 15.7.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 (36) hide show
  1. package/README.md +22 -0
  2. package/dist/esm/clients/activity-client.js +1 -0
  3. package/dist/esm/clients/app-client.js +25 -0
  4. package/dist/esm/clients/backup-client.js +5 -1
  5. package/dist/esm/clients/base-client.js +3 -1
  6. package/dist/esm/clients/billing-client.js +12 -0
  7. package/dist/esm/clients/comment-client.js +5 -0
  8. package/dist/esm/clients/email-client.js +2 -0
  9. package/dist/esm/clients/folder-client.js +5 -0
  10. package/dist/esm/clients/id-mapping-client.js +2 -0
  11. package/dist/esm/clients/insights-client.js +6 -0
  12. package/dist/esm/clients/label-client.js +9 -0
  13. package/dist/esm/clients/productivity-client.js +1 -0
  14. package/dist/esm/clients/project-client.js +16 -0
  15. package/dist/esm/clients/reminder-client.js +10 -0
  16. package/dist/esm/clients/section-client.js +8 -0
  17. package/dist/esm/clients/task-client.js +14 -0
  18. package/dist/esm/clients/template-client.js +5 -0
  19. package/dist/esm/clients/ui-extension-client.js +7 -0
  20. package/dist/esm/clients/upload-client.js +2 -0
  21. package/dist/esm/clients/workspace-client.js +22 -0
  22. package/dist/esm/todoist-api.js +4 -0
  23. package/dist/esm/transport/http-client.js +3 -1
  24. package/dist/esm/transport/sync-request.js +2 -1
  25. package/dist/esm/utils/colors.js +1 -2
  26. package/dist/esm/utils/headers.js +29 -0
  27. package/dist/esm/utils/multipart-upload.js +7 -10
  28. package/dist/types/clients/base-client.d.ts +3 -2
  29. package/dist/types/todoist-api.d.ts +9 -1
  30. package/dist/types/transport/http-client.d.ts +2 -2
  31. package/dist/types/transport/sync-request.d.ts +3 -2
  32. package/dist/types/types/http.d.ts +6 -0
  33. package/dist/types/utils/colors.d.ts +1 -2
  34. package/dist/types/utils/headers.d.ts +13 -0
  35. package/dist/types/utils/multipart-upload.d.ts +3 -1
  36. package/package.json +2 -2
@@ -18,6 +18,7 @@ export class ProjectClient extends BaseClient {
18
18
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id),
19
19
  apiToken: this.authToken,
20
20
  customFetch: this.customFetch,
21
+ customHeaders: this.customHeaders,
21
22
  });
22
23
  return validateProject(response.data);
23
24
  }
@@ -28,6 +29,7 @@ export class ProjectClient extends BaseClient {
28
29
  relativePath: ENDPOINT_REST_PROJECTS,
29
30
  apiToken: this.authToken,
30
31
  customFetch: this.customFetch,
32
+ customHeaders: this.customHeaders,
31
33
  payload: args,
32
34
  });
33
35
  return {
@@ -42,6 +44,7 @@ export class ProjectClient extends BaseClient {
42
44
  relativePath: ENDPOINT_REST_PROJECTS_SEARCH,
43
45
  apiToken: this.authToken,
44
46
  customFetch: this.customFetch,
47
+ customHeaders: this.customHeaders,
45
48
  payload: args,
46
49
  });
47
50
  return {
@@ -56,6 +59,7 @@ export class ProjectClient extends BaseClient {
56
59
  relativePath: ENDPOINT_REST_PROJECTS_ARCHIVED,
57
60
  apiToken: this.authToken,
58
61
  customFetch: this.customFetch,
62
+ customHeaders: this.customHeaders,
59
63
  payload: args,
60
64
  });
61
65
  return {
@@ -70,6 +74,7 @@ export class ProjectClient extends BaseClient {
70
74
  relativePath: ENDPOINT_REST_PROJECTS,
71
75
  apiToken: this.authToken,
72
76
  customFetch: this.customFetch,
77
+ customHeaders: this.customHeaders,
73
78
  payload: args,
74
79
  requestId: requestId,
75
80
  });
@@ -83,6 +88,7 @@ export class ProjectClient extends BaseClient {
83
88
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id),
84
89
  apiToken: this.authToken,
85
90
  customFetch: this.customFetch,
91
+ customHeaders: this.customHeaders,
86
92
  payload: args,
87
93
  requestId: requestId,
88
94
  });
@@ -96,6 +102,7 @@ export class ProjectClient extends BaseClient {
96
102
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id),
97
103
  apiToken: this.authToken,
98
104
  customFetch: this.customFetch,
105
+ customHeaders: this.customHeaders,
99
106
  requestId: requestId,
100
107
  });
101
108
  return isSuccess(response);
@@ -108,6 +115,7 @@ export class ProjectClient extends BaseClient {
108
115
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id, PROJECT_ARCHIVE),
109
116
  apiToken: this.authToken,
110
117
  customFetch: this.customFetch,
118
+ customHeaders: this.customHeaders,
111
119
  requestId: requestId,
112
120
  });
113
121
  return validateProject(response.data);
@@ -120,6 +128,7 @@ export class ProjectClient extends BaseClient {
120
128
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id, PROJECT_UNARCHIVE),
121
129
  apiToken: this.authToken,
122
130
  customFetch: this.customFetch,
131
+ customHeaders: this.customHeaders,
123
132
  requestId: requestId,
124
133
  });
125
134
  return validateProject(response.data);
@@ -131,6 +140,7 @@ export class ProjectClient extends BaseClient {
131
140
  relativePath: ENDPOINT_REST_PROJECTS_MOVE_TO_WORKSPACE,
132
141
  apiToken: this.authToken,
133
142
  customFetch: this.customFetch,
143
+ customHeaders: this.customHeaders,
134
144
  payload: args,
135
145
  requestId: requestId,
136
146
  });
@@ -143,6 +153,7 @@ export class ProjectClient extends BaseClient {
143
153
  relativePath: ENDPOINT_REST_PROJECTS_MOVE_TO_PERSONAL,
144
154
  apiToken: this.authToken,
145
155
  customFetch: this.customFetch,
156
+ customHeaders: this.customHeaders,
146
157
  payload: args,
147
158
  requestId: requestId,
148
159
  });
@@ -155,6 +166,7 @@ export class ProjectClient extends BaseClient {
155
166
  relativePath: ENDPOINT_REST_PROJECTS_ARCHIVED_COUNT,
156
167
  apiToken: this.authToken,
157
168
  customFetch: this.customFetch,
169
+ customHeaders: this.customHeaders,
158
170
  payload: args,
159
171
  });
160
172
  return data;
@@ -166,6 +178,7 @@ export class ProjectClient extends BaseClient {
166
178
  relativePath: ENDPOINT_REST_PROJECTS_PERMISSIONS,
167
179
  apiToken: this.authToken,
168
180
  customFetch: this.customFetch,
181
+ customHeaders: this.customHeaders,
169
182
  });
170
183
  return data;
171
184
  }
@@ -177,6 +190,7 @@ export class ProjectClient extends BaseClient {
177
190
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id, ENDPOINT_REST_PROJECT_FULL),
178
191
  apiToken: this.authToken,
179
192
  customFetch: this.customFetch,
193
+ customHeaders: this.customHeaders,
180
194
  payload: args,
181
195
  });
182
196
  return {
@@ -200,6 +214,7 @@ export class ProjectClient extends BaseClient {
200
214
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, id, ENDPOINT_REST_PROJECT_JOIN),
201
215
  apiToken: this.authToken,
202
216
  customFetch: this.customFetch,
217
+ customHeaders: this.customHeaders,
203
218
  requestId: requestId,
204
219
  });
205
220
  return {
@@ -221,6 +236,7 @@ export class ProjectClient extends BaseClient {
221
236
  relativePath: generatePath(ENDPOINT_REST_PROJECTS, projectId, ENDPOINT_REST_PROJECT_COLLABORATORS),
222
237
  apiToken: this.authToken,
223
238
  customFetch: this.customFetch,
239
+ customHeaders: this.customHeaders,
224
240
  payload: args,
225
241
  });
226
242
  return {
@@ -24,6 +24,7 @@ export class ReminderClient extends BaseClient {
24
24
  relativePath: ENDPOINT_REST_REMINDERS,
25
25
  apiToken: this.authToken,
26
26
  customFetch: this.customFetch,
27
+ customHeaders: this.customHeaders,
27
28
  payload: args,
28
29
  });
29
30
  return {
@@ -38,6 +39,7 @@ export class ReminderClient extends BaseClient {
38
39
  relativePath: ENDPOINT_REST_LOCATION_REMINDERS,
39
40
  apiToken: this.authToken,
40
41
  customFetch: this.customFetch,
42
+ customHeaders: this.customHeaders,
41
43
  payload: args,
42
44
  });
43
45
  return {
@@ -54,6 +56,7 @@ export class ReminderClient extends BaseClient {
54
56
  relativePath: generatePath(ENDPOINT_REST_REMINDERS, id),
55
57
  apiToken: this.authToken,
56
58
  customFetch: this.customFetch,
59
+ customHeaders: this.customHeaders,
57
60
  });
58
61
  return validateReminder(response.data);
59
62
  }
@@ -73,6 +76,7 @@ export class ReminderClient extends BaseClient {
73
76
  relativePath: generatePath(ENDPOINT_REST_LOCATION_REMINDERS, id),
74
77
  apiToken: this.authToken,
75
78
  customFetch: this.customFetch,
79
+ customHeaders: this.customHeaders,
76
80
  });
77
81
  return validateReminder(response.data);
78
82
  }
@@ -90,6 +94,7 @@ export class ReminderClient extends BaseClient {
90
94
  relativePath: ENDPOINT_REST_REMINDERS,
91
95
  apiToken: this.authToken,
92
96
  customFetch: this.customFetch,
97
+ customHeaders: this.customHeaders,
93
98
  payload: args,
94
99
  requestId: requestId,
95
100
  });
@@ -102,6 +107,7 @@ export class ReminderClient extends BaseClient {
102
107
  relativePath: ENDPOINT_REST_LOCATION_REMINDERS,
103
108
  apiToken: this.authToken,
104
109
  customFetch: this.customFetch,
110
+ customHeaders: this.customHeaders,
105
111
  payload: Object.assign(Object.assign({}, args), { reminderType: ReminderTypeEnum.Location }),
106
112
  requestId: requestId,
107
113
  });
@@ -117,6 +123,7 @@ export class ReminderClient extends BaseClient {
117
123
  relativePath: generatePath(ENDPOINT_REST_REMINDERS, id),
118
124
  apiToken: this.authToken,
119
125
  customFetch: this.customFetch,
126
+ customHeaders: this.customHeaders,
120
127
  payload,
121
128
  requestId: requestId,
122
129
  });
@@ -139,6 +146,7 @@ export class ReminderClient extends BaseClient {
139
146
  relativePath: generatePath(ENDPOINT_REST_LOCATION_REMINDERS, id),
140
147
  apiToken: this.authToken,
141
148
  customFetch: this.customFetch,
149
+ customHeaders: this.customHeaders,
142
150
  payload,
143
151
  requestId: requestId,
144
152
  });
@@ -160,6 +168,7 @@ export class ReminderClient extends BaseClient {
160
168
  relativePath: generatePath(ENDPOINT_REST_REMINDERS, id),
161
169
  apiToken: this.authToken,
162
170
  customFetch: this.customFetch,
171
+ customHeaders: this.customHeaders,
163
172
  requestId: requestId,
164
173
  });
165
174
  return isSuccess(response);
@@ -180,6 +189,7 @@ export class ReminderClient extends BaseClient {
180
189
  relativePath: generatePath(ENDPOINT_REST_LOCATION_REMINDERS, id),
181
190
  apiToken: this.authToken,
182
191
  customFetch: this.customFetch,
192
+ customHeaders: this.customHeaders,
183
193
  requestId: requestId,
184
194
  });
185
195
  return isSuccess(response);
@@ -17,6 +17,7 @@ export class SectionClient extends BaseClient {
17
17
  relativePath: ENDPOINT_REST_SECTIONS,
18
18
  apiToken: this.authToken,
19
19
  customFetch: this.customFetch,
20
+ customHeaders: this.customHeaders,
20
21
  payload: args,
21
22
  });
22
23
  return {
@@ -31,6 +32,7 @@ export class SectionClient extends BaseClient {
31
32
  relativePath: ENDPOINT_REST_SECTIONS_SEARCH,
32
33
  apiToken: this.authToken,
33
34
  customFetch: this.customFetch,
35
+ customHeaders: this.customHeaders,
34
36
  payload: args,
35
37
  });
36
38
  return {
@@ -46,6 +48,7 @@ export class SectionClient extends BaseClient {
46
48
  relativePath: generatePath(ENDPOINT_REST_SECTIONS, id),
47
49
  apiToken: this.authToken,
48
50
  customFetch: this.customFetch,
51
+ customHeaders: this.customHeaders,
49
52
  });
50
53
  return validateSection(response.data);
51
54
  }
@@ -56,6 +59,7 @@ export class SectionClient extends BaseClient {
56
59
  relativePath: ENDPOINT_REST_SECTIONS,
57
60
  apiToken: this.authToken,
58
61
  customFetch: this.customFetch,
62
+ customHeaders: this.customHeaders,
59
63
  payload: args,
60
64
  requestId: requestId,
61
65
  });
@@ -69,6 +73,7 @@ export class SectionClient extends BaseClient {
69
73
  relativePath: generatePath(ENDPOINT_REST_SECTIONS, id),
70
74
  apiToken: this.authToken,
71
75
  customFetch: this.customFetch,
76
+ customHeaders: this.customHeaders,
72
77
  payload: args,
73
78
  requestId: requestId,
74
79
  });
@@ -82,6 +87,7 @@ export class SectionClient extends BaseClient {
82
87
  relativePath: generatePath(ENDPOINT_REST_SECTIONS, id),
83
88
  apiToken: this.authToken,
84
89
  customFetch: this.customFetch,
90
+ customHeaders: this.customHeaders,
85
91
  requestId: requestId,
86
92
  });
87
93
  return isSuccess(response);
@@ -94,6 +100,7 @@ export class SectionClient extends BaseClient {
94
100
  relativePath: generatePath(ENDPOINT_REST_SECTIONS, id, SECTION_ARCHIVE),
95
101
  apiToken: this.authToken,
96
102
  customFetch: this.customFetch,
103
+ customHeaders: this.customHeaders,
97
104
  requestId: requestId,
98
105
  });
99
106
  return validateSection(response.data);
@@ -106,6 +113,7 @@ export class SectionClient extends BaseClient {
106
113
  relativePath: generatePath(ENDPOINT_REST_SECTIONS, id, SECTION_UNARCHIVE),
107
114
  apiToken: this.authToken,
108
115
  customFetch: this.customFetch,
116
+ customHeaders: this.customHeaders,
109
117
  requestId: requestId,
110
118
  });
111
119
  return validateSection(response.data);
@@ -34,6 +34,7 @@ export class TaskClient extends BaseClient {
34
34
  relativePath: generatePath(ENDPOINT_REST_TASKS, id),
35
35
  apiToken: this.authToken,
36
36
  customFetch: this.customFetch,
37
+ customHeaders: this.customHeaders,
37
38
  });
38
39
  return validateTask(response.data);
39
40
  }
@@ -44,6 +45,7 @@ export class TaskClient extends BaseClient {
44
45
  relativePath: ENDPOINT_REST_TASKS,
45
46
  apiToken: this.authToken,
46
47
  customFetch: this.customFetch,
48
+ customHeaders: this.customHeaders,
47
49
  payload: Object.assign(Object.assign({}, args), spreadIfDefined(args.ids, (ids) => ({ ids: ids.join(',') }))),
48
50
  });
49
51
  return {
@@ -58,6 +60,7 @@ export class TaskClient extends BaseClient {
58
60
  relativePath: ENDPOINT_REST_TASKS_FILTER,
59
61
  apiToken: this.authToken,
60
62
  customFetch: this.customFetch,
63
+ customHeaders: this.customHeaders,
61
64
  payload: args,
62
65
  });
63
66
  return {
@@ -72,6 +75,7 @@ export class TaskClient extends BaseClient {
72
75
  relativePath: ENDPOINT_REST_TASKS_COMPLETED_BY_COMPLETION_DATE,
73
76
  apiToken: this.authToken,
74
77
  customFetch: this.customFetch,
78
+ customHeaders: this.customHeaders,
75
79
  payload: args,
76
80
  });
77
81
  return {
@@ -86,6 +90,7 @@ export class TaskClient extends BaseClient {
86
90
  relativePath: ENDPOINT_REST_TASKS_COMPLETED_BY_DUE_DATE,
87
91
  apiToken: this.authToken,
88
92
  customFetch: this.customFetch,
93
+ customHeaders: this.customHeaders,
89
94
  payload: args,
90
95
  });
91
96
  return {
@@ -100,6 +105,7 @@ export class TaskClient extends BaseClient {
100
105
  relativePath: ENDPOINT_REST_TASKS_COMPLETED_SEARCH,
101
106
  apiToken: this.authToken,
102
107
  customFetch: this.customFetch,
108
+ customHeaders: this.customHeaders,
103
109
  payload: args,
104
110
  });
105
111
  return {
@@ -115,6 +121,7 @@ export class TaskClient extends BaseClient {
115
121
  relativePath: ENDPOINT_REST_TASKS_COMPLETED,
116
122
  apiToken: this.authToken,
117
123
  customFetch: this.customFetch,
124
+ customHeaders: this.customHeaders,
118
125
  payload: Object.assign(Object.assign(Object.assign({}, rest), (since ? { since: since.toISOString() } : {})), (until ? { until: until.toISOString() } : {})),
119
126
  });
120
127
  return {
@@ -132,6 +139,7 @@ export class TaskClient extends BaseClient {
132
139
  relativePath: ENDPOINT_REST_TASKS,
133
140
  apiToken: this.authToken,
134
141
  customFetch: this.customFetch,
142
+ customHeaders: this.customHeaders,
135
143
  payload: processedArgs,
136
144
  requestId: requestId,
137
145
  });
@@ -146,6 +154,7 @@ export class TaskClient extends BaseClient {
146
154
  relativePath: ENDPOINT_SYNC_QUICK_ADD,
147
155
  apiToken: this.authToken,
148
156
  customFetch: this.customFetch,
157
+ customHeaders: this.customHeaders,
149
158
  payload: processedArgs,
150
159
  });
151
160
  return validateTask(response.data);
@@ -166,6 +175,7 @@ export class TaskClient extends BaseClient {
166
175
  relativePath: generatePath(ENDPOINT_REST_TASKS, id),
167
176
  apiToken: this.authToken,
168
177
  customFetch: this.customFetch,
178
+ customHeaders: this.customHeaders,
169
179
  payload: remappedArgs,
170
180
  requestId: requestId,
171
181
  });
@@ -206,6 +216,7 @@ export class TaskClient extends BaseClient {
206
216
  relativePath: generatePath(ENDPOINT_REST_TASKS, id, ENDPOINT_REST_TASK_MOVE),
207
217
  apiToken: this.authToken,
208
218
  customFetch: this.customFetch,
219
+ customHeaders: this.customHeaders,
209
220
  payload: Object.assign(Object.assign(Object.assign({}, spreadIfDefined(args.projectId, (v) => ({ project_id: v }))), spreadIfDefined(args.sectionId, (v) => ({ section_id: v }))), spreadIfDefined(args.parentId, (v) => ({ parent_id: v }))),
210
221
  requestId: requestId,
211
222
  });
@@ -219,6 +230,7 @@ export class TaskClient extends BaseClient {
219
230
  relativePath: generatePath(ENDPOINT_REST_TASKS, id, ENDPOINT_REST_TASK_CLOSE),
220
231
  apiToken: this.authToken,
221
232
  customFetch: this.customFetch,
233
+ customHeaders: this.customHeaders,
222
234
  requestId: requestId,
223
235
  });
224
236
  return isSuccess(response);
@@ -231,6 +243,7 @@ export class TaskClient extends BaseClient {
231
243
  relativePath: generatePath(ENDPOINT_REST_TASKS, id, ENDPOINT_REST_TASK_REOPEN),
232
244
  apiToken: this.authToken,
233
245
  customFetch: this.customFetch,
246
+ customHeaders: this.customHeaders,
234
247
  requestId: requestId,
235
248
  });
236
249
  return isSuccess(response);
@@ -243,6 +256,7 @@ export class TaskClient extends BaseClient {
243
256
  relativePath: generatePath(ENDPOINT_REST_TASKS, id),
244
257
  apiToken: this.authToken,
245
258
  customFetch: this.customFetch,
259
+ customHeaders: this.customHeaders,
246
260
  requestId: requestId,
247
261
  });
248
262
  return isSuccess(response);
@@ -18,6 +18,7 @@ export class TemplateClient extends BaseClient {
18
18
  relativePath: ENDPOINT_REST_TEMPLATES_FILE,
19
19
  apiToken: this.authToken,
20
20
  customFetch: this.customFetch,
21
+ customHeaders: this.customHeaders,
21
22
  payload: args,
22
23
  });
23
24
  return response.data;
@@ -29,6 +30,7 @@ export class TemplateClient extends BaseClient {
29
30
  relativePath: ENDPOINT_REST_TEMPLATES_URL,
30
31
  apiToken: this.authToken,
31
32
  customFetch: this.customFetch,
33
+ customHeaders: this.customHeaders,
32
34
  payload: args,
33
35
  });
34
36
  return data;
@@ -47,6 +49,7 @@ export class TemplateClient extends BaseClient {
47
49
  fileName,
48
50
  additionalFields,
49
51
  customFetch: this.customFetch,
52
+ customHeaders: this.customHeaders,
50
53
  requestId,
51
54
  });
52
55
  return this.validateTemplateResponse(data);
@@ -61,6 +64,7 @@ export class TemplateClient extends BaseClient {
61
64
  fileName,
62
65
  additionalFields: { project_id: projectId },
63
66
  customFetch: this.customFetch,
67
+ customHeaders: this.customHeaders,
64
68
  requestId,
65
69
  });
66
70
  return this.validateTemplateResponse(data);
@@ -72,6 +76,7 @@ export class TemplateClient extends BaseClient {
72
76
  relativePath: ENDPOINT_REST_TEMPLATES_IMPORT_FROM_ID,
73
77
  apiToken: this.authToken,
74
78
  customFetch: this.customFetch,
79
+ customHeaders: this.customHeaders,
75
80
  payload: args,
76
81
  requestId: requestId,
77
82
  });
@@ -19,6 +19,7 @@ export class UiExtensionClient extends BaseClient {
19
19
  relativePath: getUiExtensionEndpoint(uiExtensionId),
20
20
  apiToken: this.authToken,
21
21
  customFetch: this.customFetch,
22
+ customHeaders: this.customHeaders,
22
23
  requestId: requestId,
23
24
  });
24
25
  return validateUiExtension(response.data);
@@ -30,6 +31,7 @@ export class UiExtensionClient extends BaseClient {
30
31
  relativePath: ENDPOINT_REST_APPS_UI_EXTENSIONS_INSTALLED,
31
32
  apiToken: this.authToken,
32
33
  customFetch: this.customFetch,
34
+ customHeaders: this.customHeaders,
33
35
  requestId: requestId,
34
36
  });
35
37
  return validateUiExtensionArray(response.data);
@@ -42,6 +44,7 @@ export class UiExtensionClient extends BaseClient {
42
44
  relativePath: getUiExtensionsByIntegrationEndpoint(appId),
43
45
  apiToken: this.authToken,
44
46
  customFetch: this.customFetch,
47
+ customHeaders: this.customHeaders,
45
48
  requestId: requestId,
46
49
  });
47
50
  return validateUiExtensionArray(response.data);
@@ -53,6 +56,7 @@ export class UiExtensionClient extends BaseClient {
53
56
  relativePath: ENDPOINT_REST_APPS_UI_EXTENSIONS,
54
57
  apiToken: this.authToken,
55
58
  customFetch: this.customFetch,
59
+ customHeaders: this.customHeaders,
56
60
  payload: args,
57
61
  requestId: requestId,
58
62
  });
@@ -66,6 +70,7 @@ export class UiExtensionClient extends BaseClient {
66
70
  relativePath: getUiExtensionEndpoint(uiExtensionId),
67
71
  apiToken: this.authToken,
68
72
  customFetch: this.customFetch,
73
+ customHeaders: this.customHeaders,
69
74
  payload: args,
70
75
  requestId: requestId,
71
76
  });
@@ -79,6 +84,7 @@ export class UiExtensionClient extends BaseClient {
79
84
  relativePath: getUiExtensionEndpoint(uiExtensionId),
80
85
  apiToken: this.authToken,
81
86
  customFetch: this.customFetch,
87
+ customHeaders: this.customHeaders,
82
88
  requestId: requestId,
83
89
  });
84
90
  return isSuccess(response);
@@ -97,6 +103,7 @@ export class UiExtensionClient extends BaseClient {
97
103
  additionalFields: { file_name: (_a = args.fileName) !== null && _a !== void 0 ? _a : '' },
98
104
  requestId: requestId,
99
105
  customFetch: this.customFetch,
106
+ customHeaders: this.customHeaders,
100
107
  });
101
108
  return validateUiExtension(data);
102
109
  }
@@ -91,6 +91,7 @@ export class UploadClient extends BaseClient {
91
91
  additionalFields: additionalFields,
92
92
  requestId: requestId,
93
93
  customFetch: this.customFetch,
94
+ customHeaders: this.customHeaders,
94
95
  });
95
96
  return validateAttachment(data);
96
97
  }
@@ -101,6 +102,7 @@ export class UploadClient extends BaseClient {
101
102
  relativePath: ENDPOINT_REST_UPLOADS,
102
103
  apiToken: this.authToken,
103
104
  customFetch: this.customFetch,
105
+ customHeaders: this.customHeaders,
104
106
  payload: args,
105
107
  requestId: requestId,
106
108
  });
@@ -32,6 +32,7 @@ export class WorkspaceClient extends BaseClient {
32
32
  relativePath: ENDPOINT_WORKSPACE_INVITATIONS,
33
33
  apiToken: this.authToken,
34
34
  customFetch: this.customFetch,
35
+ customHeaders: this.customHeaders,
35
36
  payload: { workspace_id: args.workspaceId },
36
37
  requestId: requestId,
37
38
  });
@@ -48,6 +49,7 @@ export class WorkspaceClient extends BaseClient {
48
49
  relativePath: ENDPOINT_WORKSPACE_INVITATIONS_ALL,
49
50
  apiToken: this.authToken,
50
51
  customFetch: this.customFetch,
52
+ customHeaders: this.customHeaders,
51
53
  payload: queryParams,
52
54
  requestId: requestId,
53
55
  });
@@ -60,6 +62,7 @@ export class WorkspaceClient extends BaseClient {
60
62
  relativePath: ENDPOINT_WORKSPACE_INVITATIONS_DELETE,
61
63
  apiToken: this.authToken,
62
64
  customFetch: this.customFetch,
65
+ customHeaders: this.customHeaders,
63
66
  payload: {
64
67
  workspace_id: args.workspaceId,
65
68
  user_email: args.userEmail,
@@ -75,6 +78,7 @@ export class WorkspaceClient extends BaseClient {
75
78
  relativePath: getWorkspaceInvitationAcceptEndpoint(args.inviteCode),
76
79
  apiToken: this.authToken,
77
80
  customFetch: this.customFetch,
81
+ customHeaders: this.customHeaders,
78
82
  requestId: requestId,
79
83
  });
80
84
  return validateWorkspaceInvitation(response.data);
@@ -86,6 +90,7 @@ export class WorkspaceClient extends BaseClient {
86
90
  relativePath: getWorkspaceInvitationRejectEndpoint(args.inviteCode),
87
91
  apiToken: this.authToken,
88
92
  customFetch: this.customFetch,
93
+ customHeaders: this.customHeaders,
89
94
  requestId: requestId,
90
95
  });
91
96
  return validateWorkspaceInvitation(response.data);
@@ -97,6 +102,7 @@ export class WorkspaceClient extends BaseClient {
97
102
  relativePath: ENDPOINT_WORKSPACE_JOIN,
98
103
  apiToken: this.authToken,
99
104
  customFetch: this.customFetch,
105
+ customHeaders: this.customHeaders,
100
106
  payload: {
101
107
  invite_code: args.inviteCode,
102
108
  workspace_id: args.workspaceId,
@@ -120,6 +126,7 @@ export class WorkspaceClient extends BaseClient {
120
126
  },
121
127
  requestId: requestId,
122
128
  customFetch: this.customFetch,
129
+ customHeaders: this.customHeaders,
123
130
  });
124
131
  return data;
125
132
  }
@@ -142,6 +149,7 @@ export class WorkspaceClient extends BaseClient {
142
149
  additionalFields: additionalFields,
143
150
  requestId: requestId,
144
151
  customFetch: this.customFetch,
152
+ customHeaders: this.customHeaders,
145
153
  });
146
154
  return data;
147
155
  }
@@ -152,6 +160,7 @@ export class WorkspaceClient extends BaseClient {
152
160
  relativePath: ENDPOINT_WORKSPACE_PLAN_DETAILS,
153
161
  apiToken: this.authToken,
154
162
  customFetch: this.customFetch,
163
+ customHeaders: this.customHeaders,
155
164
  payload: { workspace_id: args.workspaceId },
156
165
  requestId: requestId,
157
166
  });
@@ -174,6 +183,7 @@ export class WorkspaceClient extends BaseClient {
174
183
  relativePath: ENDPOINT_WORKSPACE_USERS,
175
184
  apiToken: this.authToken,
176
185
  customFetch: this.customFetch,
186
+ customHeaders: this.customHeaders,
177
187
  payload: queryParams,
178
188
  requestId: requestId,
179
189
  });
@@ -190,6 +200,7 @@ export class WorkspaceClient extends BaseClient {
190
200
  relativePath: ENDPOINT_REST_WORKSPACES,
191
201
  apiToken: this.authToken,
192
202
  customFetch: this.customFetch,
203
+ customHeaders: this.customHeaders,
193
204
  requestId: requestId,
194
205
  });
195
206
  return validateWorkspaceArray(response.data);
@@ -202,6 +213,7 @@ export class WorkspaceClient extends BaseClient {
202
213
  relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
203
214
  apiToken: this.authToken,
204
215
  customFetch: this.customFetch,
216
+ customHeaders: this.customHeaders,
205
217
  requestId: requestId,
206
218
  });
207
219
  return validateWorkspace(response.data);
@@ -213,6 +225,7 @@ export class WorkspaceClient extends BaseClient {
213
225
  relativePath: ENDPOINT_REST_WORKSPACES,
214
226
  apiToken: this.authToken,
215
227
  customFetch: this.customFetch,
228
+ customHeaders: this.customHeaders,
216
229
  payload: args,
217
230
  requestId: requestId,
218
231
  });
@@ -226,6 +239,7 @@ export class WorkspaceClient extends BaseClient {
226
239
  relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
227
240
  apiToken: this.authToken,
228
241
  customFetch: this.customFetch,
242
+ customHeaders: this.customHeaders,
229
243
  payload: args,
230
244
  requestId: requestId,
231
245
  });
@@ -239,6 +253,7 @@ export class WorkspaceClient extends BaseClient {
239
253
  relativePath: generatePath(ENDPOINT_REST_WORKSPACES, id),
240
254
  apiToken: this.authToken,
241
255
  customFetch: this.customFetch,
256
+ customHeaders: this.customHeaders,
242
257
  requestId: requestId,
243
258
  });
244
259
  return isSuccess(response);
@@ -251,6 +266,7 @@ export class WorkspaceClient extends BaseClient {
251
266
  relativePath: ENDPOINT_WORKSPACE_MEMBERS,
252
267
  apiToken: this.authToken,
253
268
  customFetch: this.customFetch,
269
+ customHeaders: this.customHeaders,
254
270
  payload: Object.assign({ workspaceId }, queryParams),
255
271
  requestId: requestId,
256
272
  });
@@ -266,6 +282,7 @@ export class WorkspaceClient extends BaseClient {
266
282
  relativePath: getWorkspaceUserTasksEndpoint(workspaceId, userId),
267
283
  apiToken: this.authToken,
268
284
  customFetch: this.customFetch,
285
+ customHeaders: this.customHeaders,
269
286
  payload: queryParams,
270
287
  requestId: requestId,
271
288
  });
@@ -281,6 +298,7 @@ export class WorkspaceClient extends BaseClient {
281
298
  relativePath: getWorkspaceInviteUsersEndpoint(workspaceId),
282
299
  apiToken: this.authToken,
283
300
  customFetch: this.customFetch,
301
+ customHeaders: this.customHeaders,
284
302
  payload: payload,
285
303
  requestId: requestId,
286
304
  });
@@ -294,6 +312,7 @@ export class WorkspaceClient extends BaseClient {
294
312
  relativePath: getWorkspaceUserEndpoint(workspaceId, userId),
295
313
  apiToken: this.authToken,
296
314
  customFetch: this.customFetch,
315
+ customHeaders: this.customHeaders,
297
316
  payload: payload,
298
317
  requestId: requestId,
299
318
  });
@@ -307,6 +326,7 @@ export class WorkspaceClient extends BaseClient {
307
326
  relativePath: getWorkspaceUserEndpoint(workspaceId, userId),
308
327
  apiToken: this.authToken,
309
328
  customFetch: this.customFetch,
329
+ customHeaders: this.customHeaders,
310
330
  requestId: requestId,
311
331
  });
312
332
  return isSuccess(response);
@@ -326,6 +346,7 @@ export class WorkspaceClient extends BaseClient {
326
346
  relativePath: getWorkspaceActiveProjectsEndpoint(args.workspaceId),
327
347
  apiToken: this.authToken,
328
348
  customFetch: this.customFetch,
349
+ customHeaders: this.customHeaders,
329
350
  payload: queryParams,
330
351
  requestId: requestId,
331
352
  });
@@ -350,6 +371,7 @@ export class WorkspaceClient extends BaseClient {
350
371
  relativePath: getWorkspaceArchivedProjectsEndpoint(args.workspaceId),
351
372
  apiToken: this.authToken,
352
373
  customFetch: this.customFetch,
374
+ customHeaders: this.customHeaders,
353
375
  payload: queryParams,
354
376
  requestId: requestId,
355
377
  });
@@ -39,10 +39,12 @@ export class TodoistApi {
39
39
  const opts = options || {};
40
40
  this.syncApiBase = getSyncBaseUri(opts.baseUrl);
41
41
  this.customFetch = opts.customFetch;
42
+ this.customHeaders = opts.headers;
42
43
  const clientDeps = {
43
44
  authToken: this.authToken,
44
45
  syncApiBase: this.syncApiBase,
45
46
  customFetch: this.customFetch,
47
+ customHeaders: this.customHeaders,
46
48
  };
47
49
  this.taskClient = new TaskClient(clientDeps);
48
50
  this.projectClient = new ProjectClient(clientDeps);
@@ -95,6 +97,7 @@ export class TodoistApi {
95
97
  authToken: this.authToken,
96
98
  syncApiBase: this.syncApiBase,
97
99
  customFetch: this.customFetch,
100
+ customHeaders: this.customHeaders,
98
101
  }, syncRequest, { requestId, hasSyncCommands: Boolean((_a = syncRequest.commands) === null || _a === void 0 ? void 0 : _a.length) });
99
102
  }
100
103
  /**
@@ -137,6 +140,7 @@ export class TodoistApi {
137
140
  relativePath: ENDPOINT_REST_USER,
138
141
  apiToken: this.authToken,
139
142
  customFetch: this.customFetch,
143
+ customHeaders: this.customHeaders,
140
144
  });
141
145
  return validateCurrentUser(response.data);
142
146
  }