nylas 7.2.0 → 7.3.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/lib/cjs/apiClient.js +8 -2
- package/lib/cjs/nylas.js +2 -1
- package/lib/cjs/resources/auth.js +3 -3
- package/lib/cjs/resources/drafts.js +34 -10
- package/lib/cjs/resources/messages.js +17 -5
- package/lib/cjs/utils.js +18 -3
- package/lib/cjs/version.js +1 -1
- package/lib/esm/apiClient.js +8 -2
- package/lib/esm/nylas.js +2 -1
- package/lib/esm/resources/auth.js +3 -3
- package/lib/esm/resources/drafts.js +34 -10
- package/lib/esm/resources/messages.js +17 -5
- package/lib/esm/utils.js +18 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/apiClient.d.ts +5 -1
- package/lib/types/config.d.ts +2 -0
- package/lib/types/models/availability.d.ts +1 -1
- package/lib/types/models/drafts.d.ts +14 -0
- package/lib/types/models/events.d.ts +15 -6
- package/lib/types/resources/events.d.ts +2 -2
- package/lib/types/resources/messages.d.ts +1 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/apiClient.js
CHANGED
|
@@ -9,10 +9,11 @@ const version_js_1 = require("./version.js");
|
|
|
9
9
|
* @ignore Not for public use
|
|
10
10
|
*/
|
|
11
11
|
class APIClient {
|
|
12
|
-
constructor({ apiKey, apiUri, timeout }) {
|
|
12
|
+
constructor({ apiKey, apiUri, timeout, headers }) {
|
|
13
13
|
this.apiKey = apiKey;
|
|
14
14
|
this.serverUrl = apiUri;
|
|
15
15
|
this.timeout = timeout * 1000; // fetch timeout uses milliseconds
|
|
16
|
+
this.headers = headers;
|
|
16
17
|
}
|
|
17
18
|
setRequestUrl({ overrides, path, queryParams, }) {
|
|
18
19
|
const url = new URL(`${overrides?.apiUri || this.serverUrl}${path}`);
|
|
@@ -39,11 +40,16 @@ class APIClient {
|
|
|
39
40
|
return url;
|
|
40
41
|
}
|
|
41
42
|
setRequestHeaders({ headers, overrides, }) {
|
|
43
|
+
const mergedHeaders = {
|
|
44
|
+
...headers,
|
|
45
|
+
...this.headers,
|
|
46
|
+
...overrides?.headers,
|
|
47
|
+
};
|
|
42
48
|
return {
|
|
43
49
|
Accept: 'application/json',
|
|
44
50
|
'User-Agent': `Nylas Node SDK v${version_js_1.SDK_VERSION}`,
|
|
45
51
|
Authorization: `Bearer ${overrides?.apiKey || this.apiKey}`,
|
|
46
|
-
...
|
|
52
|
+
...mergedHeaders,
|
|
47
53
|
};
|
|
48
54
|
}
|
|
49
55
|
async sendRequest(options) {
|
package/lib/cjs/nylas.js
CHANGED
|
@@ -44,7 +44,8 @@ class Nylas {
|
|
|
44
44
|
this.apiClient = new apiClient_js_1.default({
|
|
45
45
|
apiKey: config.apiKey,
|
|
46
46
|
apiUri: config.apiUri || config_js_1.DEFAULT_SERVER_URL,
|
|
47
|
-
timeout: config.timeout ||
|
|
47
|
+
timeout: config.timeout || 90,
|
|
48
|
+
headers: config.headers || {},
|
|
48
49
|
});
|
|
49
50
|
this.applications = new applications_js_1.Applications(this.apiClient);
|
|
50
51
|
this.auth = new auth_js_1.Auth(this.apiClient);
|
|
@@ -149,9 +149,9 @@ class Auth extends resource_js_1.Resource {
|
|
|
149
149
|
}
|
|
150
150
|
if (config.loginHint) {
|
|
151
151
|
url.searchParams.set('login_hint', config.loginHint);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
}
|
|
153
|
+
if (config.includeGrantScopes !== undefined) {
|
|
154
|
+
url.searchParams.set('include_grant_scopes', config.includeGrantScopes.toString());
|
|
155
155
|
}
|
|
156
156
|
if (config.scope) {
|
|
157
157
|
url.searchParams.set('scope', config.scope.join(' '));
|
|
@@ -35,11 +35,23 @@ class Drafts extends resource_js_1.Resource {
|
|
|
35
35
|
* @return The draft
|
|
36
36
|
*/
|
|
37
37
|
create({ identifier, requestBody, overrides, }) {
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
const path = `/v3/grants/${identifier}/drafts`;
|
|
39
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
40
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
41
|
+
return attachment.size || 0;
|
|
42
|
+
}, 0) || 0;
|
|
43
|
+
if (attachmentSize >= messages_js_1.Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
44
|
+
const form = messages_js_1.Messages._buildFormRequest(requestBody);
|
|
45
|
+
return this.apiClient.request({
|
|
46
|
+
method: 'POST',
|
|
47
|
+
path,
|
|
48
|
+
form,
|
|
49
|
+
overrides,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return super._create({
|
|
53
|
+
path,
|
|
54
|
+
requestBody,
|
|
43
55
|
overrides,
|
|
44
56
|
});
|
|
45
57
|
}
|
|
@@ -48,11 +60,23 @@ class Drafts extends resource_js_1.Resource {
|
|
|
48
60
|
* @return The updated draft
|
|
49
61
|
*/
|
|
50
62
|
update({ identifier, draftId, requestBody, overrides, }) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
const path = `/v3/grants/${identifier}/drafts/${draftId}`;
|
|
64
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
65
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
66
|
+
return attachment.size || 0;
|
|
67
|
+
}, 0) || 0;
|
|
68
|
+
if (attachmentSize >= messages_js_1.Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
69
|
+
const form = messages_js_1.Messages._buildFormRequest(requestBody);
|
|
70
|
+
return this.apiClient.request({
|
|
71
|
+
method: 'PUT',
|
|
72
|
+
path,
|
|
73
|
+
form,
|
|
74
|
+
overrides,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return super._update({
|
|
78
|
+
path,
|
|
79
|
+
requestBody,
|
|
56
80
|
overrides,
|
|
57
81
|
});
|
|
58
82
|
}
|
|
@@ -63,13 +63,23 @@ class Messages extends resource_js_1.Resource {
|
|
|
63
63
|
* @return The sent message
|
|
64
64
|
*/
|
|
65
65
|
send({ identifier, requestBody, overrides, }) {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const path = `/v3/grants/${identifier}/messages/send`;
|
|
67
|
+
const requestOptions = {
|
|
68
68
|
method: 'POST',
|
|
69
|
-
path
|
|
70
|
-
form,
|
|
69
|
+
path,
|
|
71
70
|
overrides,
|
|
72
|
-
}
|
|
71
|
+
};
|
|
72
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
73
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
74
|
+
return attachment.size || 0;
|
|
75
|
+
}, 0) || 0;
|
|
76
|
+
if (attachmentSize >= Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
77
|
+
requestOptions.form = Messages._buildFormRequest(requestBody);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
requestOptions.body = requestBody;
|
|
81
|
+
}
|
|
82
|
+
return this.apiClient.request(requestOptions);
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
75
85
|
* Retrieve your scheduled messages
|
|
@@ -127,3 +137,5 @@ class Messages extends resource_js_1.Resource {
|
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
exports.Messages = Messages;
|
|
140
|
+
// The maximum size of an attachment that can be sent using json
|
|
141
|
+
Messages.MAXIMUM_JSON_ATTACHMENT_SIZE = 3 * 1024 * 1024;
|
package/lib/cjs/utils.js
CHANGED
|
@@ -18,6 +18,21 @@ function createFileRequestBuilder(filePath) {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
exports.createFileRequestBuilder = createFileRequestBuilder;
|
|
21
|
+
/**
|
|
22
|
+
* Applies the casing function and ensures numeric parts are preceded by underscores in snake_case.
|
|
23
|
+
* @param casingFunction The original casing function.
|
|
24
|
+
* @param input The string to convert.
|
|
25
|
+
* @returns The converted string.
|
|
26
|
+
*/
|
|
27
|
+
function applyCasing(casingFunction, input) {
|
|
28
|
+
const transformed = casingFunction(input);
|
|
29
|
+
if (casingFunction === change_case_1.snakeCase) {
|
|
30
|
+
return transformed.replace(/(\d+)/g, '_$1');
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return transformed.replace(/_+(\d+)/g, (match, p1) => p1);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
21
36
|
/**
|
|
22
37
|
* A utility function that recursively converts all keys in an object to a given case.
|
|
23
38
|
* @param obj The object to convert
|
|
@@ -33,7 +48,7 @@ function convertCase(obj, casingFunction, excludeKeys) {
|
|
|
33
48
|
newObj[key] = obj[key];
|
|
34
49
|
}
|
|
35
50
|
else if (Array.isArray(obj[key])) {
|
|
36
|
-
newObj[casingFunction
|
|
51
|
+
newObj[applyCasing(casingFunction, key)] = obj[key].map(item => {
|
|
37
52
|
if (typeof item === 'object') {
|
|
38
53
|
return convertCase(item, casingFunction);
|
|
39
54
|
}
|
|
@@ -43,10 +58,10 @@ function convertCase(obj, casingFunction, excludeKeys) {
|
|
|
43
58
|
});
|
|
44
59
|
}
|
|
45
60
|
else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
46
|
-
newObj[casingFunction
|
|
61
|
+
newObj[applyCasing(casingFunction, key)] = convertCase(obj[key], casingFunction);
|
|
47
62
|
}
|
|
48
63
|
else {
|
|
49
|
-
newObj[casingFunction
|
|
64
|
+
newObj[applyCasing(casingFunction, key)] = obj[key];
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
67
|
return newObj;
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/apiClient.js
CHANGED
|
@@ -7,10 +7,11 @@ import { SDK_VERSION } from './version.js';
|
|
|
7
7
|
* @ignore Not for public use
|
|
8
8
|
*/
|
|
9
9
|
export default class APIClient {
|
|
10
|
-
constructor({ apiKey, apiUri, timeout }) {
|
|
10
|
+
constructor({ apiKey, apiUri, timeout, headers }) {
|
|
11
11
|
this.apiKey = apiKey;
|
|
12
12
|
this.serverUrl = apiUri;
|
|
13
13
|
this.timeout = timeout * 1000; // fetch timeout uses milliseconds
|
|
14
|
+
this.headers = headers;
|
|
14
15
|
}
|
|
15
16
|
setRequestUrl({ overrides, path, queryParams, }) {
|
|
16
17
|
const url = new URL(`${overrides?.apiUri || this.serverUrl}${path}`);
|
|
@@ -37,11 +38,16 @@ export default class APIClient {
|
|
|
37
38
|
return url;
|
|
38
39
|
}
|
|
39
40
|
setRequestHeaders({ headers, overrides, }) {
|
|
41
|
+
const mergedHeaders = {
|
|
42
|
+
...headers,
|
|
43
|
+
...this.headers,
|
|
44
|
+
...overrides?.headers,
|
|
45
|
+
};
|
|
40
46
|
return {
|
|
41
47
|
Accept: 'application/json',
|
|
42
48
|
'User-Agent': `Nylas Node SDK v${SDK_VERSION}`,
|
|
43
49
|
Authorization: `Bearer ${overrides?.apiKey || this.apiKey}`,
|
|
44
|
-
...
|
|
50
|
+
...mergedHeaders,
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
53
|
async sendRequest(options) {
|
package/lib/esm/nylas.js
CHANGED
|
@@ -28,7 +28,8 @@ export default class Nylas {
|
|
|
28
28
|
this.apiClient = new APIClient({
|
|
29
29
|
apiKey: config.apiKey,
|
|
30
30
|
apiUri: config.apiUri || DEFAULT_SERVER_URL,
|
|
31
|
-
timeout: config.timeout ||
|
|
31
|
+
timeout: config.timeout || 90,
|
|
32
|
+
headers: config.headers || {},
|
|
32
33
|
});
|
|
33
34
|
this.applications = new Applications(this.apiClient);
|
|
34
35
|
this.auth = new Auth(this.apiClient);
|
|
@@ -146,9 +146,9 @@ export class Auth extends Resource {
|
|
|
146
146
|
}
|
|
147
147
|
if (config.loginHint) {
|
|
148
148
|
url.searchParams.set('login_hint', config.loginHint);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
}
|
|
150
|
+
if (config.includeGrantScopes !== undefined) {
|
|
151
|
+
url.searchParams.set('include_grant_scopes', config.includeGrantScopes.toString());
|
|
152
152
|
}
|
|
153
153
|
if (config.scope) {
|
|
154
154
|
url.searchParams.set('scope', config.scope.join(' '));
|
|
@@ -32,11 +32,23 @@ export class Drafts extends Resource {
|
|
|
32
32
|
* @return The draft
|
|
33
33
|
*/
|
|
34
34
|
create({ identifier, requestBody, overrides, }) {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const path = `/v3/grants/${identifier}/drafts`;
|
|
36
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
37
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
38
|
+
return attachment.size || 0;
|
|
39
|
+
}, 0) || 0;
|
|
40
|
+
if (attachmentSize >= Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
41
|
+
const form = Messages._buildFormRequest(requestBody);
|
|
42
|
+
return this.apiClient.request({
|
|
43
|
+
method: 'POST',
|
|
44
|
+
path,
|
|
45
|
+
form,
|
|
46
|
+
overrides,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return super._create({
|
|
50
|
+
path,
|
|
51
|
+
requestBody,
|
|
40
52
|
overrides,
|
|
41
53
|
});
|
|
42
54
|
}
|
|
@@ -45,11 +57,23 @@ export class Drafts extends Resource {
|
|
|
45
57
|
* @return The updated draft
|
|
46
58
|
*/
|
|
47
59
|
update({ identifier, draftId, requestBody, overrides, }) {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
const path = `/v3/grants/${identifier}/drafts/${draftId}`;
|
|
61
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
62
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
63
|
+
return attachment.size || 0;
|
|
64
|
+
}, 0) || 0;
|
|
65
|
+
if (attachmentSize >= Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
66
|
+
const form = Messages._buildFormRequest(requestBody);
|
|
67
|
+
return this.apiClient.request({
|
|
68
|
+
method: 'PUT',
|
|
69
|
+
path,
|
|
70
|
+
form,
|
|
71
|
+
overrides,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return super._update({
|
|
75
|
+
path,
|
|
76
|
+
requestBody,
|
|
53
77
|
overrides,
|
|
54
78
|
});
|
|
55
79
|
}
|
|
@@ -60,13 +60,23 @@ export class Messages extends Resource {
|
|
|
60
60
|
* @return The sent message
|
|
61
61
|
*/
|
|
62
62
|
send({ identifier, requestBody, overrides, }) {
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const path = `/v3/grants/${identifier}/messages/send`;
|
|
64
|
+
const requestOptions = {
|
|
65
65
|
method: 'POST',
|
|
66
|
-
path
|
|
67
|
-
form,
|
|
66
|
+
path,
|
|
68
67
|
overrides,
|
|
69
|
-
}
|
|
68
|
+
};
|
|
69
|
+
// Use form data only if the attachment size is greater than 3mb
|
|
70
|
+
const attachmentSize = requestBody.attachments?.reduce(function (_, attachment) {
|
|
71
|
+
return attachment.size || 0;
|
|
72
|
+
}, 0) || 0;
|
|
73
|
+
if (attachmentSize >= Messages.MAXIMUM_JSON_ATTACHMENT_SIZE) {
|
|
74
|
+
requestOptions.form = Messages._buildFormRequest(requestBody);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
requestOptions.body = requestBody;
|
|
78
|
+
}
|
|
79
|
+
return this.apiClient.request(requestOptions);
|
|
70
80
|
}
|
|
71
81
|
/**
|
|
72
82
|
* Retrieve your scheduled messages
|
|
@@ -123,3 +133,5 @@ export class Messages extends Resource {
|
|
|
123
133
|
return form;
|
|
124
134
|
}
|
|
125
135
|
}
|
|
136
|
+
// The maximum size of an attachment that can be sent using json
|
|
137
|
+
Messages.MAXIMUM_JSON_ATTACHMENT_SIZE = 3 * 1024 * 1024;
|
package/lib/esm/utils.js
CHANGED
|
@@ -14,6 +14,21 @@ export function createFileRequestBuilder(filePath) {
|
|
|
14
14
|
size: stats.size,
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Applies the casing function and ensures numeric parts are preceded by underscores in snake_case.
|
|
19
|
+
* @param casingFunction The original casing function.
|
|
20
|
+
* @param input The string to convert.
|
|
21
|
+
* @returns The converted string.
|
|
22
|
+
*/
|
|
23
|
+
function applyCasing(casingFunction, input) {
|
|
24
|
+
const transformed = casingFunction(input);
|
|
25
|
+
if (casingFunction === snakeCase) {
|
|
26
|
+
return transformed.replace(/(\d+)/g, '_$1');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return transformed.replace(/_+(\d+)/g, (match, p1) => p1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
17
32
|
/**
|
|
18
33
|
* A utility function that recursively converts all keys in an object to a given case.
|
|
19
34
|
* @param obj The object to convert
|
|
@@ -29,7 +44,7 @@ function convertCase(obj, casingFunction, excludeKeys) {
|
|
|
29
44
|
newObj[key] = obj[key];
|
|
30
45
|
}
|
|
31
46
|
else if (Array.isArray(obj[key])) {
|
|
32
|
-
newObj[casingFunction
|
|
47
|
+
newObj[applyCasing(casingFunction, key)] = obj[key].map(item => {
|
|
33
48
|
if (typeof item === 'object') {
|
|
34
49
|
return convertCase(item, casingFunction);
|
|
35
50
|
}
|
|
@@ -39,10 +54,10 @@ function convertCase(obj, casingFunction, excludeKeys) {
|
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
56
|
else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
42
|
-
newObj[casingFunction
|
|
57
|
+
newObj[applyCasing(casingFunction, key)] = convertCase(obj[key], casingFunction);
|
|
43
58
|
}
|
|
44
59
|
else {
|
|
45
|
-
newObj[casingFunction
|
|
60
|
+
newObj[applyCasing(casingFunction, key)] = obj[key];
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
63
|
return newObj;
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated by scripts/exportVersion.js
|
|
2
|
-
export const SDK_VERSION = '7.
|
|
2
|
+
export const SDK_VERSION = '7.3.0';
|
package/lib/types/apiClient.d.ts
CHANGED
|
@@ -57,7 +57,11 @@ export default class APIClient {
|
|
|
57
57
|
* The timeout for requests to the Nylas API, in seconds
|
|
58
58
|
*/
|
|
59
59
|
timeout: number;
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Additional headers to send with outgoing requests
|
|
62
|
+
*/
|
|
63
|
+
headers: Record<string, string>;
|
|
64
|
+
constructor({ apiKey, apiUri, timeout, headers }: Required<NylasConfig>);
|
|
61
65
|
private setRequestUrl;
|
|
62
66
|
private setQueryStrings;
|
|
63
67
|
private setRequestHeaders;
|
package/lib/types/config.d.ts
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
* @property apiKey The Nylas API key to use for authentication
|
|
4
4
|
* @property apiUri The URL to use for communicating with the Nylas API
|
|
5
5
|
* @property timeout The timeout for requests to the Nylas API, in seconds
|
|
6
|
+
* @property headers Additional headers to send with outgoing requests
|
|
6
7
|
*/
|
|
7
8
|
export type NylasConfig = {
|
|
8
9
|
apiKey: string;
|
|
9
10
|
apiUri?: string;
|
|
10
11
|
timeout?: number;
|
|
12
|
+
headers?: Record<string, string>;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* The options that can override the default Nylas API client configuration.
|
|
@@ -52,7 +52,7 @@ export interface GetAvailabilityRequest {
|
|
|
52
52
|
/**
|
|
53
53
|
* When set to true, the availability time slots will start at 30 minutes past or on the hour.
|
|
54
54
|
* For example, a free slot starting at 16:10 is considered available only from 16:30.
|
|
55
|
-
* @deprecated Use
|
|
55
|
+
* @deprecated Use {@link roundTo} instead.
|
|
56
56
|
*/
|
|
57
57
|
roundTo30Minutes?: boolean;
|
|
58
58
|
}
|
|
@@ -2,6 +2,16 @@ import { BaseMessage } from './messages.js';
|
|
|
2
2
|
import { ListQueryParams } from './listQueryParams.js';
|
|
3
3
|
import { EmailName } from './events.js';
|
|
4
4
|
import { CreateAttachmentRequest } from './attachments.js';
|
|
5
|
+
export interface CustomHeader {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the custom header.
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The value of the custom header.
|
|
12
|
+
*/
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
5
15
|
/**
|
|
6
16
|
* Interface representing a request to create a draft.
|
|
7
17
|
*/
|
|
@@ -55,6 +65,10 @@ export interface CreateDraftRequest {
|
|
|
55
65
|
* Options for tracking opens, links, and thread replies.
|
|
56
66
|
*/
|
|
57
67
|
trackingOptions?: TrackingOptions;
|
|
68
|
+
/**
|
|
69
|
+
* An array of custom headers to add to the message.
|
|
70
|
+
*/
|
|
71
|
+
customHeaders?: CustomHeader[];
|
|
58
72
|
}
|
|
59
73
|
/**
|
|
60
74
|
* Interface representing a request to send a message.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ListQueryParams } from './listQueryParams.js';
|
|
2
2
|
import { Subset } from '../utils.js';
|
|
3
|
+
import { NylasBaseResponse } from './response.js';
|
|
4
|
+
import { NylasApiErrorResponseData } from './error.js';
|
|
3
5
|
/**
|
|
4
6
|
* Interface representing a Nylas Event object.
|
|
5
7
|
*/
|
|
@@ -192,6 +194,13 @@ export type UpdateEventRequest = Subset<CreateEventRequest>;
|
|
|
192
194
|
export type SendRsvpRequest = {
|
|
193
195
|
status: RsvpStatus;
|
|
194
196
|
};
|
|
197
|
+
/**
|
|
198
|
+
* Interface representing the response from sending RSVP to an event.
|
|
199
|
+
* @property sendIcsError If the send-rsvp request succeeded but the ICS email could not be sent, this will contain the error.
|
|
200
|
+
*/
|
|
201
|
+
export interface SendRsvpResponse extends NylasBaseResponse {
|
|
202
|
+
sendIcsError?: NylasApiErrorResponseData;
|
|
203
|
+
}
|
|
195
204
|
/**
|
|
196
205
|
* Interface representing the query parameters for listing events.
|
|
197
206
|
*/
|
|
@@ -329,7 +338,7 @@ type When = Time | Timespan | Date | Datespan;
|
|
|
329
338
|
/**
|
|
330
339
|
* Type representing the different objects representing time and duration when creating events.
|
|
331
340
|
*/
|
|
332
|
-
type CreateWhen = Omit<Time, '
|
|
341
|
+
type CreateWhen = Omit<Time, 'object'> | Omit<Timespan, 'object'> | Omit<Date, 'object'> | Omit<Datespan, 'object'>;
|
|
333
342
|
/**
|
|
334
343
|
* Enum representing the different types of when objects.
|
|
335
344
|
*/
|
|
@@ -409,7 +418,7 @@ export interface Time {
|
|
|
409
418
|
/**
|
|
410
419
|
* The type of 'when' object.
|
|
411
420
|
*/
|
|
412
|
-
|
|
421
|
+
object: WhenType.Time;
|
|
413
422
|
}
|
|
414
423
|
/**
|
|
415
424
|
* Class representation of a time span with start and end times.
|
|
@@ -439,7 +448,7 @@ export interface Timespan {
|
|
|
439
448
|
/**
|
|
440
449
|
* The type of 'when' object.
|
|
441
450
|
*/
|
|
442
|
-
|
|
451
|
+
object: WhenType.Timespan;
|
|
443
452
|
}
|
|
444
453
|
/**
|
|
445
454
|
* Class representation of an entire day spans without specific times.
|
|
@@ -454,7 +463,7 @@ export interface Date {
|
|
|
454
463
|
/**
|
|
455
464
|
* The type of 'when' object.
|
|
456
465
|
*/
|
|
457
|
-
|
|
466
|
+
object: WhenType.Date;
|
|
458
467
|
}
|
|
459
468
|
/**
|
|
460
469
|
* Class representation of a specific dates without clock-based start or end times.
|
|
@@ -474,7 +483,7 @@ export interface Datespan {
|
|
|
474
483
|
/**
|
|
475
484
|
* The type of 'when' object.
|
|
476
485
|
*/
|
|
477
|
-
|
|
486
|
+
object: WhenType.Datespan;
|
|
478
487
|
}
|
|
479
488
|
/**
|
|
480
489
|
* Interface representing an Event participant.
|
|
@@ -523,7 +532,7 @@ export interface ReminderOverride {
|
|
|
523
532
|
* The number of minutes before the event start time when a user wants a reminder for this event.
|
|
524
533
|
* Reminder minutes are in the following format: "[20]".
|
|
525
534
|
*/
|
|
526
|
-
reminderMinutes:
|
|
535
|
+
reminderMinutes: number;
|
|
527
536
|
/**
|
|
528
537
|
* Method to remind the user about the event. (Google only).
|
|
529
538
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Overrides } from '../config.js';
|
|
2
|
-
import { CreateEventQueryParams, CreateEventRequest, DestroyEventQueryParams, Event, FindEventQueryParams, ListEventQueryParams, SendRsvpQueryParams, SendRsvpRequest, UpdateEventQueryParams, UpdateEventRequest } from '../models/events.js';
|
|
2
|
+
import { CreateEventQueryParams, CreateEventRequest, DestroyEventQueryParams, Event, FindEventQueryParams, ListEventQueryParams, SendRsvpQueryParams, SendRsvpRequest, SendRsvpResponse, UpdateEventQueryParams, UpdateEventRequest } from '../models/events.js';
|
|
3
3
|
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
4
|
import { AsyncListResponse, Resource } from './resource.js';
|
|
5
5
|
/**
|
|
@@ -101,6 +101,6 @@ export declare class Events extends Resource {
|
|
|
101
101
|
* You cannot directly update events as an invitee, since you are not the owner/organizer.
|
|
102
102
|
* @return The send-rsvp response
|
|
103
103
|
*/
|
|
104
|
-
sendRsvp({ identifier, eventId, requestBody, queryParams, overrides, }: SendRsvpParams & Overrides): Promise<
|
|
104
|
+
sendRsvp({ identifier, eventId, requestBody, queryParams, overrides, }: SendRsvpParams & Overrides): Promise<SendRsvpResponse>;
|
|
105
105
|
}
|
|
106
106
|
export {};
|
|
@@ -84,6 +84,7 @@ export type StopScheduledMessageParams = FindScheduledMessageParams;
|
|
|
84
84
|
*/
|
|
85
85
|
export declare class Messages extends Resource {
|
|
86
86
|
smartCompose: SmartCompose;
|
|
87
|
+
static MAXIMUM_JSON_ATTACHMENT_SIZE: number;
|
|
87
88
|
constructor(apiClient: APIClient);
|
|
88
89
|
/**
|
|
89
90
|
* Return all Messages
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.
|
|
1
|
+
export declare const SDK_VERSION = "7.3.0";
|