@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.
- package/README.md +22 -0
- package/dist/esm/clients/activity-client.js +1 -0
- package/dist/esm/clients/app-client.js +25 -0
- package/dist/esm/clients/backup-client.js +5 -1
- package/dist/esm/clients/base-client.js +3 -1
- package/dist/esm/clients/billing-client.js +12 -0
- package/dist/esm/clients/comment-client.js +5 -0
- package/dist/esm/clients/email-client.js +2 -0
- package/dist/esm/clients/folder-client.js +5 -0
- package/dist/esm/clients/id-mapping-client.js +2 -0
- package/dist/esm/clients/insights-client.js +6 -0
- package/dist/esm/clients/label-client.js +9 -0
- package/dist/esm/clients/productivity-client.js +1 -0
- package/dist/esm/clients/project-client.js +16 -0
- package/dist/esm/clients/reminder-client.js +10 -0
- package/dist/esm/clients/section-client.js +8 -0
- package/dist/esm/clients/task-client.js +14 -0
- package/dist/esm/clients/template-client.js +5 -0
- package/dist/esm/clients/ui-extension-client.js +7 -0
- package/dist/esm/clients/upload-client.js +2 -0
- package/dist/esm/clients/workspace-client.js +22 -0
- package/dist/esm/todoist-api.js +4 -0
- package/dist/esm/transport/http-client.js +3 -1
- package/dist/esm/transport/sync-request.js +2 -1
- package/dist/esm/utils/colors.js +1 -2
- package/dist/esm/utils/headers.js +29 -0
- package/dist/esm/utils/multipart-upload.js +7 -10
- package/dist/types/clients/base-client.d.ts +3 -2
- package/dist/types/todoist-api.d.ts +9 -1
- package/dist/types/transport/http-client.d.ts +2 -2
- package/dist/types/transport/sync-request.d.ts +3 -2
- package/dist/types/types/http.d.ts +6 -0
- package/dist/types/utils/colors.d.ts +1 -2
- package/dist/types/utils/headers.d.ts +13 -0
- package/dist/types/utils/multipart-upload.d.ts +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,6 +40,28 @@ Key changes in v1 include:
|
|
|
40
40
|
- Object renames (e.g., items → tasks, notes → comments)
|
|
41
41
|
- URL renames and endpoint signature changes
|
|
42
42
|
|
|
43
|
+
## Custom Headers
|
|
44
|
+
|
|
45
|
+
Pass `headers` to send extra headers with every API request, for example to tell the backend which client is calling:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const api = new TodoistApi('YOURTOKEN', {
|
|
49
|
+
headers: { 'Doist-Platform': 'cli' },
|
|
50
|
+
})
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For values that change between requests, pass a function instead. The SDK calls it once per request, and a retried request reuses its result:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import { randomUUID } from 'node:crypto'
|
|
57
|
+
|
|
58
|
+
const api = new TodoistApi('YOURTOKEN', {
|
|
59
|
+
headers: () => ({ 'Doist-Platform': 'cli', 'Request-Id': randomUUID() }),
|
|
60
|
+
})
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
These headers cannot replace `Authorization`, `X-Request-Id` or the multipart `Content-Type`; the SDK's own values always win. They are not sent on attachment downloads (`viewAttachment`), which redirect to a third-party CDN. The OAuth helpers (`getAuthToken`, `refreshAuthToken`, `revokeToken`, …) take their own options and do not send them.
|
|
64
|
+
|
|
43
65
|
## Custom HTTP Clients
|
|
44
66
|
|
|
45
67
|
The Todoist API client supports custom HTTP implementations to enable usage in environments with specific networking requirements, such as:
|
|
@@ -44,6 +44,7 @@ export class ActivityClient extends BaseClient {
|
|
|
44
44
|
relativePath: ENDPOINT_REST_ACTIVITIES,
|
|
45
45
|
apiToken: this.authToken,
|
|
46
46
|
customFetch: this.customFetch,
|
|
47
|
+
customHeaders: this.customHeaders,
|
|
47
48
|
payload: processedArgs,
|
|
48
49
|
});
|
|
49
50
|
// Convert legacy API object types back to modern SDK types
|
|
@@ -32,6 +32,7 @@ export class AppClient extends BaseClient {
|
|
|
32
32
|
relativePath: ENDPOINT_REST_APPS,
|
|
33
33
|
apiToken: this.authToken,
|
|
34
34
|
customFetch: this.customFetch,
|
|
35
|
+
customHeaders: this.customHeaders,
|
|
35
36
|
requestId: requestId,
|
|
36
37
|
});
|
|
37
38
|
return validateAppArray(response.data);
|
|
@@ -44,6 +45,7 @@ export class AppClient extends BaseClient {
|
|
|
44
45
|
relativePath: getAppEndpoint(appId),
|
|
45
46
|
apiToken: this.authToken,
|
|
46
47
|
customFetch: this.customFetch,
|
|
48
|
+
customHeaders: this.customHeaders,
|
|
47
49
|
requestId: requestId,
|
|
48
50
|
});
|
|
49
51
|
return validateAppWithUserCount(response.data);
|
|
@@ -55,6 +57,7 @@ export class AppClient extends BaseClient {
|
|
|
55
57
|
relativePath: ENDPOINT_REST_APPS,
|
|
56
58
|
apiToken: this.authToken,
|
|
57
59
|
customFetch: this.customFetch,
|
|
60
|
+
customHeaders: this.customHeaders,
|
|
58
61
|
payload: args,
|
|
59
62
|
requestId: requestId,
|
|
60
63
|
});
|
|
@@ -73,6 +76,7 @@ export class AppClient extends BaseClient {
|
|
|
73
76
|
relativePath: getAppEndpoint(appId),
|
|
74
77
|
apiToken: this.authToken,
|
|
75
78
|
customFetch: this.customFetch,
|
|
79
|
+
customHeaders: this.customHeaders,
|
|
76
80
|
payload: payload,
|
|
77
81
|
requestId: requestId,
|
|
78
82
|
});
|
|
@@ -86,6 +90,7 @@ export class AppClient extends BaseClient {
|
|
|
86
90
|
relativePath: getAppEndpoint(appId),
|
|
87
91
|
apiToken: this.authToken,
|
|
88
92
|
customFetch: this.customFetch,
|
|
93
|
+
customHeaders: this.customHeaders,
|
|
89
94
|
requestId: requestId,
|
|
90
95
|
});
|
|
91
96
|
return isSuccess(response);
|
|
@@ -98,6 +103,7 @@ export class AppClient extends BaseClient {
|
|
|
98
103
|
relativePath: getAppSecretsEndpoint(appId),
|
|
99
104
|
apiToken: this.authToken,
|
|
100
105
|
customFetch: this.customFetch,
|
|
106
|
+
customHeaders: this.customHeaders,
|
|
101
107
|
requestId: requestId,
|
|
102
108
|
});
|
|
103
109
|
return validateAppSecrets(response.data);
|
|
@@ -110,6 +116,7 @@ export class AppClient extends BaseClient {
|
|
|
110
116
|
relativePath: getAppClientSecretEndpoint(appId),
|
|
111
117
|
apiToken: this.authToken,
|
|
112
118
|
customFetch: this.customFetch,
|
|
119
|
+
customHeaders: this.customHeaders,
|
|
113
120
|
requestId: requestId,
|
|
114
121
|
});
|
|
115
122
|
return validateAppWithUserCount(response.data);
|
|
@@ -122,6 +129,7 @@ export class AppClient extends BaseClient {
|
|
|
122
129
|
relativePath: getAppTokensEndpoint(appId),
|
|
123
130
|
apiToken: this.authToken,
|
|
124
131
|
customFetch: this.customFetch,
|
|
132
|
+
customHeaders: this.customHeaders,
|
|
125
133
|
requestId: requestId,
|
|
126
134
|
});
|
|
127
135
|
return validateAppWithUserCount(response.data);
|
|
@@ -140,6 +148,7 @@ export class AppClient extends BaseClient {
|
|
|
140
148
|
additionalFields: { file_name: fileName },
|
|
141
149
|
requestId: requestId,
|
|
142
150
|
customFetch: this.customFetch,
|
|
151
|
+
customHeaders: this.customHeaders,
|
|
143
152
|
});
|
|
144
153
|
return validateAppWithUserCount(data);
|
|
145
154
|
}
|
|
@@ -151,6 +160,7 @@ export class AppClient extends BaseClient {
|
|
|
151
160
|
relativePath: getAppTestTokenEndpoint(appId),
|
|
152
161
|
apiToken: this.authToken,
|
|
153
162
|
customFetch: this.customFetch,
|
|
163
|
+
customHeaders: this.customHeaders,
|
|
154
164
|
requestId: requestId,
|
|
155
165
|
});
|
|
156
166
|
return validateAppTestToken(response.data);
|
|
@@ -163,6 +173,7 @@ export class AppClient extends BaseClient {
|
|
|
163
173
|
relativePath: getAppTestTokenEndpoint(appId),
|
|
164
174
|
apiToken: this.authToken,
|
|
165
175
|
customFetch: this.customFetch,
|
|
176
|
+
customHeaders: this.customHeaders,
|
|
166
177
|
requestId: requestId,
|
|
167
178
|
});
|
|
168
179
|
return validateAppTestToken(response.data);
|
|
@@ -175,6 +186,7 @@ export class AppClient extends BaseClient {
|
|
|
175
186
|
relativePath: getAppDistributionTokenEndpoint(appId),
|
|
176
187
|
apiToken: this.authToken,
|
|
177
188
|
customFetch: this.customFetch,
|
|
189
|
+
customHeaders: this.customHeaders,
|
|
178
190
|
requestId: requestId,
|
|
179
191
|
});
|
|
180
192
|
return validateAppDistributionToken(response.data);
|
|
@@ -187,6 +199,7 @@ export class AppClient extends BaseClient {
|
|
|
187
199
|
relativePath: getAppVerificationTokenEndpoint(appId),
|
|
188
200
|
apiToken: this.authToken,
|
|
189
201
|
customFetch: this.customFetch,
|
|
202
|
+
customHeaders: this.customHeaders,
|
|
190
203
|
requestId: requestId,
|
|
191
204
|
});
|
|
192
205
|
return validateAppVerificationToken(response.data);
|
|
@@ -199,6 +212,7 @@ export class AppClient extends BaseClient {
|
|
|
199
212
|
relativePath: getAppVerificationTokenEndpoint(appId),
|
|
200
213
|
apiToken: this.authToken,
|
|
201
214
|
customFetch: this.customFetch,
|
|
215
|
+
customHeaders: this.customHeaders,
|
|
202
216
|
requestId: requestId,
|
|
203
217
|
});
|
|
204
218
|
return validateAppVerificationToken(response.data);
|
|
@@ -211,6 +225,7 @@ export class AppClient extends BaseClient {
|
|
|
211
225
|
relativePath: getAppByDistributionTokenEndpoint(distributionToken),
|
|
212
226
|
apiToken: this.authToken,
|
|
213
227
|
customFetch: this.customFetch,
|
|
228
|
+
customHeaders: this.customHeaders,
|
|
214
229
|
requestId: requestId,
|
|
215
230
|
});
|
|
216
231
|
return validateAppByDistributionToken(response.data);
|
|
@@ -224,6 +239,7 @@ export class AppClient extends BaseClient {
|
|
|
224
239
|
relativePath: getAppWebhookEndpoint(appId),
|
|
225
240
|
apiToken: this.authToken,
|
|
226
241
|
customFetch: this.customFetch,
|
|
242
|
+
customHeaders: this.customHeaders,
|
|
227
243
|
requestId: requestId,
|
|
228
244
|
});
|
|
229
245
|
return response.data ? validateAppWebhook(response.data) : null;
|
|
@@ -236,6 +252,7 @@ export class AppClient extends BaseClient {
|
|
|
236
252
|
relativePath: getAppWebhookEndpoint(appId),
|
|
237
253
|
apiToken: this.authToken,
|
|
238
254
|
customFetch: this.customFetch,
|
|
255
|
+
customHeaders: this.customHeaders,
|
|
239
256
|
payload: Object.assign(Object.assign({}, rest), { events: events.map(webhookEventToWireName) }),
|
|
240
257
|
requestId: requestId,
|
|
241
258
|
});
|
|
@@ -249,6 +266,7 @@ export class AppClient extends BaseClient {
|
|
|
249
266
|
relativePath: getAppWebhookEndpoint(appId),
|
|
250
267
|
apiToken: this.authToken,
|
|
251
268
|
customFetch: this.customFetch,
|
|
269
|
+
customHeaders: this.customHeaders,
|
|
252
270
|
requestId: requestId,
|
|
253
271
|
});
|
|
254
272
|
return isSuccess(response);
|
|
@@ -261,6 +279,7 @@ export class AppClient extends BaseClient {
|
|
|
261
279
|
relativePath: ENDPOINT_REST_APPS_INSTALLATIONS,
|
|
262
280
|
apiToken: this.authToken,
|
|
263
281
|
customFetch: this.customFetch,
|
|
282
|
+
customHeaders: this.customHeaders,
|
|
264
283
|
requestId: requestId,
|
|
265
284
|
});
|
|
266
285
|
return validateAppInstallationArray(response.data);
|
|
@@ -272,6 +291,7 @@ export class AppClient extends BaseClient {
|
|
|
272
291
|
relativePath: ENDPOINT_REST_APPS_INSTALLATIONS,
|
|
273
292
|
apiToken: this.authToken,
|
|
274
293
|
customFetch: this.customFetch,
|
|
294
|
+
customHeaders: this.customHeaders,
|
|
275
295
|
payload: args,
|
|
276
296
|
requestId: requestId,
|
|
277
297
|
});
|
|
@@ -285,6 +305,7 @@ export class AppClient extends BaseClient {
|
|
|
285
305
|
relativePath: getAppInstallationEndpoint(installationId),
|
|
286
306
|
apiToken: this.authToken,
|
|
287
307
|
customFetch: this.customFetch,
|
|
308
|
+
customHeaders: this.customHeaders,
|
|
288
309
|
requestId: requestId,
|
|
289
310
|
});
|
|
290
311
|
return validateAppInstallation(response.data);
|
|
@@ -297,6 +318,7 @@ export class AppClient extends BaseClient {
|
|
|
297
318
|
relativePath: getAppInstallationEndpoint(installationId),
|
|
298
319
|
apiToken: this.authToken,
|
|
299
320
|
customFetch: this.customFetch,
|
|
321
|
+
customHeaders: this.customHeaders,
|
|
300
322
|
payload: args,
|
|
301
323
|
requestId: requestId,
|
|
302
324
|
});
|
|
@@ -310,6 +332,7 @@ export class AppClient extends BaseClient {
|
|
|
310
332
|
relativePath: getAppInstallationEndpoint(installationId),
|
|
311
333
|
apiToken: this.authToken,
|
|
312
334
|
customFetch: this.customFetch,
|
|
335
|
+
customHeaders: this.customHeaders,
|
|
313
336
|
requestId: requestId,
|
|
314
337
|
});
|
|
315
338
|
return isSuccess(response);
|
|
@@ -322,6 +345,7 @@ export class AppClient extends BaseClient {
|
|
|
322
345
|
relativePath: ENDPOINT_REST_USER_AUTHORIZATIONS,
|
|
323
346
|
apiToken: this.authToken,
|
|
324
347
|
customFetch: this.customFetch,
|
|
348
|
+
customHeaders: this.customHeaders,
|
|
325
349
|
requestId: requestId,
|
|
326
350
|
});
|
|
327
351
|
return validateUserAuthorizationArray(response.data);
|
|
@@ -333,6 +357,7 @@ export class AppClient extends BaseClient {
|
|
|
333
357
|
relativePath: ENDPOINT_REST_USER_AUTHORIZATIONS_DELETE,
|
|
334
358
|
apiToken: this.authToken,
|
|
335
359
|
customFetch: this.customFetch,
|
|
360
|
+
customHeaders: this.customHeaders,
|
|
336
361
|
payload: args,
|
|
337
362
|
requestId: requestId,
|
|
338
363
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ENDPOINT_REST_BACKUPS, ENDPOINT_REST_BACKUPS_DOWNLOAD } from '../consts/endpoints.js';
|
|
2
2
|
import { request } from '../transport/http-client.js';
|
|
3
3
|
import { wrapAsFileResponse } from '../utils/file-response.js';
|
|
4
|
+
import { mergeHeaders, resolveCustomHeaders } from '../utils/headers.js';
|
|
4
5
|
import { validateBackupArray } from '../utils/validators.js';
|
|
5
6
|
import { BaseClient } from './base-client.js';
|
|
6
7
|
/**
|
|
@@ -18,6 +19,7 @@ export class BackupClient extends BaseClient {
|
|
|
18
19
|
relativePath: ENDPOINT_REST_BACKUPS,
|
|
19
20
|
apiToken: this.authToken,
|
|
20
21
|
customFetch: this.customFetch,
|
|
22
|
+
customHeaders: this.customHeaders,
|
|
21
23
|
payload: args,
|
|
22
24
|
});
|
|
23
25
|
return validateBackupArray(response.data);
|
|
@@ -25,7 +27,9 @@ export class BackupClient extends BaseClient {
|
|
|
25
27
|
async downloadBackup(args) {
|
|
26
28
|
const url = `${this.syncApiBase}${ENDPOINT_REST_BACKUPS_DOWNLOAD}?file=${encodeURIComponent(args.file)}`;
|
|
27
29
|
const fetchOptions = {
|
|
28
|
-
headers:
|
|
30
|
+
headers: mergeHeaders(resolveCustomHeaders(this.customHeaders), {
|
|
31
|
+
Authorization: `Bearer ${this.authToken}`,
|
|
32
|
+
}),
|
|
29
33
|
};
|
|
30
34
|
if (this.customFetch) {
|
|
31
35
|
const response = await this.customFetch(url, fetchOptions);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal base class for every domain sub-client (tasks, projects, …).
|
|
3
3
|
*
|
|
4
4
|
* Not exported from the package — sub-clients are an implementation detail
|
|
5
|
-
* of `TodoistApi`. Holds the
|
|
5
|
+
* of `TodoistApi`. Holds the pieces of HTTP identity every sub-client
|
|
6
6
|
* needs and exposes a typed accessor to feed the Sync API helper.
|
|
7
7
|
*
|
|
8
8
|
* The constructor takes a {@link SyncRequestContext} — the same record
|
|
@@ -16,12 +16,14 @@ export class BaseClient {
|
|
|
16
16
|
this.syncApiBase = context.syncApiBase;
|
|
17
17
|
this.apiRootBase = new URL('/', context.syncApiBase).toString();
|
|
18
18
|
this.customFetch = context.customFetch;
|
|
19
|
+
this.customHeaders = context.customHeaders;
|
|
19
20
|
}
|
|
20
21
|
get syncContext() {
|
|
21
22
|
return {
|
|
22
23
|
authToken: this.authToken,
|
|
23
24
|
syncApiBase: this.syncApiBase,
|
|
24
25
|
customFetch: this.customFetch,
|
|
26
|
+
customHeaders: this.customHeaders,
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
}
|
|
@@ -16,6 +16,7 @@ export class BillingClient extends BaseClient {
|
|
|
16
16
|
relativePath: ENDPOINT_PAYMENTS_SUBSCRIPTION_INFO,
|
|
17
17
|
apiToken: this.authToken,
|
|
18
18
|
customFetch: this.customFetch,
|
|
19
|
+
customHeaders: this.customHeaders,
|
|
19
20
|
});
|
|
20
21
|
return validateSubscriptionInfo(response.data);
|
|
21
22
|
}
|
|
@@ -26,6 +27,7 @@ export class BillingClient extends BaseClient {
|
|
|
26
27
|
relativePath: ENDPOINT_PAYMENTS_CANCEL_PLAN,
|
|
27
28
|
apiToken: this.authToken,
|
|
28
29
|
customFetch: this.customFetch,
|
|
30
|
+
customHeaders: this.customHeaders,
|
|
29
31
|
payload: args,
|
|
30
32
|
requestId: requestId,
|
|
31
33
|
});
|
|
@@ -38,6 +40,7 @@ export class BillingClient extends BaseClient {
|
|
|
38
40
|
relativePath: ENDPOINT_PAYMENTS_REACTIVATE_PLAN,
|
|
39
41
|
apiToken: this.authToken,
|
|
40
42
|
customFetch: this.customFetch,
|
|
43
|
+
customHeaders: this.customHeaders,
|
|
41
44
|
requestId: requestId,
|
|
42
45
|
});
|
|
43
46
|
return validateSubscriptionInfo(response.data);
|
|
@@ -49,6 +52,7 @@ export class BillingClient extends BaseClient {
|
|
|
49
52
|
relativePath: ENDPOINT_PRO_UPGRADE,
|
|
50
53
|
apiToken: this.authToken,
|
|
51
54
|
customFetch: this.customFetch,
|
|
55
|
+
customHeaders: this.customHeaders,
|
|
52
56
|
payload: args,
|
|
53
57
|
requestId: requestId,
|
|
54
58
|
});
|
|
@@ -61,6 +65,7 @@ export class BillingClient extends BaseClient {
|
|
|
61
65
|
relativePath: ENDPOINT_PRO_TRIAL,
|
|
62
66
|
apiToken: this.authToken,
|
|
63
67
|
customFetch: this.customFetch,
|
|
68
|
+
customHeaders: this.customHeaders,
|
|
64
69
|
payload: args,
|
|
65
70
|
requestId: requestId,
|
|
66
71
|
});
|
|
@@ -73,6 +78,7 @@ export class BillingClient extends BaseClient {
|
|
|
73
78
|
relativePath: ENDPOINT_PRO_BILLING_PORTAL,
|
|
74
79
|
apiToken: this.authToken,
|
|
75
80
|
customFetch: this.customFetch,
|
|
81
|
+
customHeaders: this.customHeaders,
|
|
76
82
|
payload: args,
|
|
77
83
|
requestId: requestId,
|
|
78
84
|
});
|
|
@@ -85,6 +91,7 @@ export class BillingClient extends BaseClient {
|
|
|
85
91
|
relativePath: ENDPOINT_PRO_PLAN_DETAILS,
|
|
86
92
|
apiToken: this.authToken,
|
|
87
93
|
customFetch: this.customFetch,
|
|
94
|
+
customHeaders: this.customHeaders,
|
|
88
95
|
});
|
|
89
96
|
return validateProPlanDetails(response.data);
|
|
90
97
|
}
|
|
@@ -95,6 +102,7 @@ export class BillingClient extends BaseClient {
|
|
|
95
102
|
relativePath: ENDPOINT_WORKSPACE_UPGRADE,
|
|
96
103
|
apiToken: this.authToken,
|
|
97
104
|
customFetch: this.customFetch,
|
|
105
|
+
customHeaders: this.customHeaders,
|
|
98
106
|
payload: args,
|
|
99
107
|
requestId: requestId,
|
|
100
108
|
});
|
|
@@ -107,6 +115,7 @@ export class BillingClient extends BaseClient {
|
|
|
107
115
|
relativePath: ENDPOINT_WORKSPACE_TRIAL,
|
|
108
116
|
apiToken: this.authToken,
|
|
109
117
|
customFetch: this.customFetch,
|
|
118
|
+
customHeaders: this.customHeaders,
|
|
110
119
|
payload: args,
|
|
111
120
|
requestId: requestId,
|
|
112
121
|
});
|
|
@@ -119,6 +128,7 @@ export class BillingClient extends BaseClient {
|
|
|
119
128
|
relativePath: ENDPOINT_WORKSPACE_BILLING_PORTAL,
|
|
120
129
|
apiToken: this.authToken,
|
|
121
130
|
customFetch: this.customFetch,
|
|
131
|
+
customHeaders: this.customHeaders,
|
|
122
132
|
payload: args,
|
|
123
133
|
requestId: requestId,
|
|
124
134
|
});
|
|
@@ -131,6 +141,7 @@ export class BillingClient extends BaseClient {
|
|
|
131
141
|
relativePath: ENDPOINT_PRICES,
|
|
132
142
|
apiToken: this.authToken,
|
|
133
143
|
customFetch: this.customFetch,
|
|
144
|
+
customHeaders: this.customHeaders,
|
|
134
145
|
});
|
|
135
146
|
return validatePrices(response.data);
|
|
136
147
|
}
|
|
@@ -141,6 +152,7 @@ export class BillingClient extends BaseClient {
|
|
|
141
152
|
relativePath: ENDPOINT_PRICING,
|
|
142
153
|
apiToken: this.authToken,
|
|
143
154
|
customFetch: this.customFetch,
|
|
155
|
+
customHeaders: this.customHeaders,
|
|
144
156
|
payload: args,
|
|
145
157
|
});
|
|
146
158
|
return validatePricing(response.data);
|
|
@@ -28,6 +28,7 @@ export class CommentClient extends BaseClient {
|
|
|
28
28
|
relativePath: ENDPOINT_REST_COMMENTS,
|
|
29
29
|
apiToken: this.authToken,
|
|
30
30
|
customFetch: this.customFetch,
|
|
31
|
+
customHeaders: this.customHeaders,
|
|
31
32
|
payload: args,
|
|
32
33
|
});
|
|
33
34
|
return {
|
|
@@ -43,6 +44,7 @@ export class CommentClient extends BaseClient {
|
|
|
43
44
|
relativePath: generatePath(ENDPOINT_REST_COMMENTS, id),
|
|
44
45
|
apiToken: this.authToken,
|
|
45
46
|
customFetch: this.customFetch,
|
|
47
|
+
customHeaders: this.customHeaders,
|
|
46
48
|
});
|
|
47
49
|
return validateComment(response.data);
|
|
48
50
|
}
|
|
@@ -54,6 +56,7 @@ export class CommentClient extends BaseClient {
|
|
|
54
56
|
relativePath: ENDPOINT_REST_COMMENTS,
|
|
55
57
|
apiToken: this.authToken,
|
|
56
58
|
customFetch: this.customFetch,
|
|
59
|
+
customHeaders: this.customHeaders,
|
|
57
60
|
payload: Object.assign(Object.assign({}, rest), ((uidsToNotify === null || uidsToNotify === void 0 ? void 0 : uidsToNotify.length) ? { uidsToNotify } : {})),
|
|
58
61
|
requestId: requestId,
|
|
59
62
|
});
|
|
@@ -67,6 +70,7 @@ export class CommentClient extends BaseClient {
|
|
|
67
70
|
relativePath: generatePath(ENDPOINT_REST_COMMENTS, id),
|
|
68
71
|
apiToken: this.authToken,
|
|
69
72
|
customFetch: this.customFetch,
|
|
73
|
+
customHeaders: this.customHeaders,
|
|
70
74
|
payload: args,
|
|
71
75
|
requestId: requestId,
|
|
72
76
|
});
|
|
@@ -80,6 +84,7 @@ export class CommentClient extends BaseClient {
|
|
|
80
84
|
relativePath: generatePath(ENDPOINT_REST_COMMENTS, id),
|
|
81
85
|
apiToken: this.authToken,
|
|
82
86
|
customFetch: this.customFetch,
|
|
87
|
+
customHeaders: this.customHeaders,
|
|
83
88
|
requestId: requestId,
|
|
84
89
|
});
|
|
85
90
|
return isSuccess(response);
|
|
@@ -16,6 +16,7 @@ export class EmailClient extends BaseClient {
|
|
|
16
16
|
relativePath: ENDPOINT_REST_EMAILS,
|
|
17
17
|
apiToken: this.authToken,
|
|
18
18
|
customFetch: this.customFetch,
|
|
19
|
+
customHeaders: this.customHeaders,
|
|
19
20
|
payload: args,
|
|
20
21
|
requestId: requestId,
|
|
21
22
|
});
|
|
@@ -32,6 +33,7 @@ export class EmailClient extends BaseClient {
|
|
|
32
33
|
relativePath: `${ENDPOINT_REST_EMAILS}?${queryParams.toString()}`,
|
|
33
34
|
apiToken: this.authToken,
|
|
34
35
|
customFetch: this.customFetch,
|
|
36
|
+
customHeaders: this.customHeaders,
|
|
35
37
|
requestId: requestId,
|
|
36
38
|
});
|
|
37
39
|
return isSuccess(response);
|
|
@@ -17,6 +17,7 @@ export class FolderClient extends BaseClient {
|
|
|
17
17
|
relativePath: ENDPOINT_REST_FOLDERS,
|
|
18
18
|
apiToken: this.authToken,
|
|
19
19
|
customFetch: this.customFetch,
|
|
20
|
+
customHeaders: this.customHeaders,
|
|
20
21
|
payload: args,
|
|
21
22
|
});
|
|
22
23
|
return {
|
|
@@ -32,6 +33,7 @@ export class FolderClient extends BaseClient {
|
|
|
32
33
|
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
33
34
|
apiToken: this.authToken,
|
|
34
35
|
customFetch: this.customFetch,
|
|
36
|
+
customHeaders: this.customHeaders,
|
|
35
37
|
});
|
|
36
38
|
return validateFolder(response.data);
|
|
37
39
|
}
|
|
@@ -42,6 +44,7 @@ export class FolderClient extends BaseClient {
|
|
|
42
44
|
relativePath: ENDPOINT_REST_FOLDERS,
|
|
43
45
|
apiToken: this.authToken,
|
|
44
46
|
customFetch: this.customFetch,
|
|
47
|
+
customHeaders: this.customHeaders,
|
|
45
48
|
payload: args,
|
|
46
49
|
requestId: requestId,
|
|
47
50
|
});
|
|
@@ -55,6 +58,7 @@ export class FolderClient extends BaseClient {
|
|
|
55
58
|
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
56
59
|
apiToken: this.authToken,
|
|
57
60
|
customFetch: this.customFetch,
|
|
61
|
+
customHeaders: this.customHeaders,
|
|
58
62
|
payload: args,
|
|
59
63
|
requestId: requestId,
|
|
60
64
|
});
|
|
@@ -68,6 +72,7 @@ export class FolderClient extends BaseClient {
|
|
|
68
72
|
relativePath: generatePath(ENDPOINT_REST_FOLDERS, id),
|
|
69
73
|
apiToken: this.authToken,
|
|
70
74
|
customFetch: this.customFetch,
|
|
75
|
+
customHeaders: this.customHeaders,
|
|
71
76
|
requestId: requestId,
|
|
72
77
|
});
|
|
73
78
|
return isSuccess(response);
|
|
@@ -18,6 +18,7 @@ export class IdMappingClient extends BaseClient {
|
|
|
18
18
|
relativePath: generatePath(ENDPOINT_REST_ID_MAPPINGS, args.objName, args.objIds.join(',')),
|
|
19
19
|
apiToken: this.authToken,
|
|
20
20
|
customFetch: this.customFetch,
|
|
21
|
+
customHeaders: this.customHeaders,
|
|
21
22
|
});
|
|
22
23
|
return validateIdMappingArray(response.data);
|
|
23
24
|
}
|
|
@@ -28,6 +29,7 @@ export class IdMappingClient extends BaseClient {
|
|
|
28
29
|
relativePath: generatePath(ENDPOINT_REST_MOVED_IDS, args.objName),
|
|
29
30
|
apiToken: this.authToken,
|
|
30
31
|
customFetch: this.customFetch,
|
|
32
|
+
customHeaders: this.customHeaders,
|
|
31
33
|
payload: args.oldIds ? { oldIds: args.oldIds.join(',') } : undefined,
|
|
32
34
|
});
|
|
33
35
|
return validateMovedIdArray(response.data);
|
|
@@ -19,6 +19,7 @@ export class InsightsClient extends BaseClient {
|
|
|
19
19
|
relativePath: getProjectInsightsActivityStatsEndpoint(projectId),
|
|
20
20
|
apiToken: this.authToken,
|
|
21
21
|
customFetch: this.customFetch,
|
|
22
|
+
customHeaders: this.customHeaders,
|
|
22
23
|
payload: Object.assign({ objectType: 'ITEM', eventType: 'COMPLETED' }, args),
|
|
23
24
|
});
|
|
24
25
|
return validateProjectActivityStats(response.data);
|
|
@@ -31,6 +32,7 @@ export class InsightsClient extends BaseClient {
|
|
|
31
32
|
relativePath: getProjectInsightsHealthEndpoint(projectId),
|
|
32
33
|
apiToken: this.authToken,
|
|
33
34
|
customFetch: this.customFetch,
|
|
35
|
+
customHeaders: this.customHeaders,
|
|
34
36
|
});
|
|
35
37
|
return validateProjectHealth(response.data);
|
|
36
38
|
}
|
|
@@ -42,6 +44,7 @@ export class InsightsClient extends BaseClient {
|
|
|
42
44
|
relativePath: getProjectInsightsHealthContextEndpoint(projectId),
|
|
43
45
|
apiToken: this.authToken,
|
|
44
46
|
customFetch: this.customFetch,
|
|
47
|
+
customHeaders: this.customHeaders,
|
|
45
48
|
});
|
|
46
49
|
return validateProjectHealthContext(response.data);
|
|
47
50
|
}
|
|
@@ -53,6 +56,7 @@ export class InsightsClient extends BaseClient {
|
|
|
53
56
|
relativePath: getProjectInsightsProgressEndpoint(projectId),
|
|
54
57
|
apiToken: this.authToken,
|
|
55
58
|
customFetch: this.customFetch,
|
|
59
|
+
customHeaders: this.customHeaders,
|
|
56
60
|
});
|
|
57
61
|
return validateProjectProgress(response.data);
|
|
58
62
|
}
|
|
@@ -64,6 +68,7 @@ export class InsightsClient extends BaseClient {
|
|
|
64
68
|
relativePath: getWorkspaceInsightsEndpoint(workspaceId),
|
|
65
69
|
apiToken: this.authToken,
|
|
66
70
|
customFetch: this.customFetch,
|
|
71
|
+
customHeaders: this.customHeaders,
|
|
67
72
|
payload: Object.assign(Object.assign({}, args), (args.projectIds ? { projectIds: args.projectIds.join(',') } : {})),
|
|
68
73
|
});
|
|
69
74
|
return validateWorkspaceInsights(response.data);
|
|
@@ -76,6 +81,7 @@ export class InsightsClient extends BaseClient {
|
|
|
76
81
|
relativePath: getProjectInsightsHealthAnalyzeEndpoint(projectId),
|
|
77
82
|
apiToken: this.authToken,
|
|
78
83
|
customFetch: this.customFetch,
|
|
84
|
+
customHeaders: this.customHeaders,
|
|
79
85
|
requestId: requestId,
|
|
80
86
|
});
|
|
81
87
|
return validateProjectHealth(response.data);
|
|
@@ -18,6 +18,7 @@ export class LabelClient extends BaseClient {
|
|
|
18
18
|
relativePath: generatePath(ENDPOINT_REST_LABELS, id),
|
|
19
19
|
apiToken: this.authToken,
|
|
20
20
|
customFetch: this.customFetch,
|
|
21
|
+
customHeaders: this.customHeaders,
|
|
21
22
|
});
|
|
22
23
|
return validateLabel(response.data);
|
|
23
24
|
}
|
|
@@ -28,6 +29,7 @@ export class LabelClient extends BaseClient {
|
|
|
28
29
|
relativePath: ENDPOINT_REST_LABELS,
|
|
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 LabelClient extends BaseClient {
|
|
|
42
44
|
relativePath: ENDPOINT_REST_LABELS_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 LabelClient extends BaseClient {
|
|
|
56
59
|
relativePath: ENDPOINT_REST_LABELS,
|
|
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 LabelClient extends BaseClient {
|
|
|
69
73
|
relativePath: generatePath(ENDPOINT_REST_LABELS, 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 LabelClient extends BaseClient {
|
|
|
82
87
|
relativePath: generatePath(ENDPOINT_REST_LABELS, 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);
|
|
@@ -93,6 +99,7 @@ export class LabelClient extends BaseClient {
|
|
|
93
99
|
relativePath: ENDPOINT_REST_LABELS_SHARED,
|
|
94
100
|
apiToken: this.authToken,
|
|
95
101
|
customFetch: this.customFetch,
|
|
102
|
+
customHeaders: this.customHeaders,
|
|
96
103
|
payload: args,
|
|
97
104
|
});
|
|
98
105
|
return { results, nextCursor };
|
|
@@ -104,6 +111,7 @@ export class LabelClient extends BaseClient {
|
|
|
104
111
|
relativePath: ENDPOINT_REST_LABELS_SHARED_RENAME,
|
|
105
112
|
apiToken: this.authToken,
|
|
106
113
|
customFetch: this.customFetch,
|
|
114
|
+
customHeaders: this.customHeaders,
|
|
107
115
|
payload: args,
|
|
108
116
|
});
|
|
109
117
|
return isSuccess(response);
|
|
@@ -115,6 +123,7 @@ export class LabelClient extends BaseClient {
|
|
|
115
123
|
relativePath: ENDPOINT_REST_LABELS_SHARED_REMOVE,
|
|
116
124
|
apiToken: this.authToken,
|
|
117
125
|
customFetch: this.customFetch,
|
|
126
|
+
customHeaders: this.customHeaders,
|
|
118
127
|
payload: args,
|
|
119
128
|
});
|
|
120
129
|
return isSuccess(response);
|
|
@@ -17,6 +17,7 @@ export class ProductivityClient extends BaseClient {
|
|
|
17
17
|
relativePath: ENDPOINT_REST_PRODUCTIVITY,
|
|
18
18
|
apiToken: this.authToken,
|
|
19
19
|
customFetch: this.customFetch,
|
|
20
|
+
customHeaders: this.customHeaders,
|
|
20
21
|
});
|
|
21
22
|
return validateProductivityStats(response.data);
|
|
22
23
|
}
|