nylas 7.1.0 → 7.2.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.
- package/lib/cjs/nylas.js +1 -1
- package/lib/cjs/resources/drafts.js +34 -10
- package/lib/cjs/resources/messages.js +19 -6
- package/lib/cjs/utils.js +18 -3
- package/lib/cjs/version.js +1 -1
- package/lib/esm/nylas.js +1 -1
- package/lib/esm/resources/drafts.js +34 -10
- package/lib/esm/resources/messages.js +19 -6
- package/lib/esm/utils.js +18 -3
- package/lib/esm/version.js +1 -1
- package/lib/types/models/auth.d.ts +1 -5
- package/lib/types/models/availability.d.ts +11 -3
- package/lib/types/models/drafts.d.ts +45 -2
- package/lib/types/models/folders.d.ts +7 -0
- package/lib/types/models/messages.d.ts +37 -33
- package/lib/types/resources/messages.d.ts +5 -4
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/nylas.js
CHANGED
|
@@ -44,7 +44,7 @@ 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
48
|
});
|
|
49
49
|
this.applications = new applications_js_1.Applications(this.apiClient);
|
|
50
50
|
this.auth = new auth_js_1.Auth(this.apiClient);
|
|
@@ -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
|
}
|
|
@@ -30,10 +30,11 @@ class Messages extends resource_js_1.Resource {
|
|
|
30
30
|
* Return a Message
|
|
31
31
|
* @return The message
|
|
32
32
|
*/
|
|
33
|
-
find({ identifier, messageId, overrides, }) {
|
|
33
|
+
find({ identifier, messageId, overrides, queryParams, }) {
|
|
34
34
|
return super._find({
|
|
35
35
|
path: `/v3/grants/${identifier}/messages/${messageId}`,
|
|
36
36
|
overrides,
|
|
37
|
+
queryParams,
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
@@ -62,13 +63,23 @@ class Messages extends resource_js_1.Resource {
|
|
|
62
63
|
* @return The sent message
|
|
63
64
|
*/
|
|
64
65
|
send({ identifier, requestBody, overrides, }) {
|
|
65
|
-
const
|
|
66
|
-
|
|
66
|
+
const path = `/v3/grants/${identifier}/messages/send`;
|
|
67
|
+
const requestOptions = {
|
|
67
68
|
method: 'POST',
|
|
68
|
-
path
|
|
69
|
-
form,
|
|
69
|
+
path,
|
|
70
70
|
overrides,
|
|
71
|
-
}
|
|
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);
|
|
72
83
|
}
|
|
73
84
|
/**
|
|
74
85
|
* Retrieve your scheduled messages
|
|
@@ -126,3 +137,5 @@ class Messages extends resource_js_1.Resource {
|
|
|
126
137
|
}
|
|
127
138
|
}
|
|
128
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/nylas.js
CHANGED
|
@@ -28,7 +28,7 @@ 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
32
|
});
|
|
33
33
|
this.applications = new Applications(this.apiClient);
|
|
34
34
|
this.auth = new Auth(this.apiClient);
|
|
@@ -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
|
}
|
|
@@ -27,10 +27,11 @@ export class Messages extends Resource {
|
|
|
27
27
|
* Return a Message
|
|
28
28
|
* @return The message
|
|
29
29
|
*/
|
|
30
|
-
find({ identifier, messageId, overrides, }) {
|
|
30
|
+
find({ identifier, messageId, overrides, queryParams, }) {
|
|
31
31
|
return super._find({
|
|
32
32
|
path: `/v3/grants/${identifier}/messages/${messageId}`,
|
|
33
33
|
overrides,
|
|
34
|
+
queryParams,
|
|
34
35
|
});
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
@@ -59,13 +60,23 @@ export class Messages extends Resource {
|
|
|
59
60
|
* @return The sent message
|
|
60
61
|
*/
|
|
61
62
|
send({ identifier, requestBody, overrides, }) {
|
|
62
|
-
const
|
|
63
|
-
|
|
63
|
+
const path = `/v3/grants/${identifier}/messages/send`;
|
|
64
|
+
const requestOptions = {
|
|
64
65
|
method: 'POST',
|
|
65
|
-
path
|
|
66
|
-
form,
|
|
66
|
+
path,
|
|
67
67
|
overrides,
|
|
68
|
-
}
|
|
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);
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
82
|
* Retrieve your scheduled messages
|
|
@@ -122,3 +133,5 @@ export class Messages extends Resource {
|
|
|
122
133
|
return form;
|
|
123
134
|
}
|
|
124
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.1
|
|
2
|
+
export const SDK_VERSION = '7.2.1';
|
|
@@ -5,7 +5,7 @@ type AccessType = 'online' | 'offline';
|
|
|
5
5
|
/**
|
|
6
6
|
* Type for the different OAuth providers Nylas supports.
|
|
7
7
|
*/
|
|
8
|
-
export type Provider = 'google' | 'imap' | 'microsoft' | 'virtual-calendar';
|
|
8
|
+
export type Provider = 'google' | 'imap' | 'microsoft' | 'icloud' | 'virtual-calendar';
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for generating a URL for OAuth 2.0 authentication.
|
|
11
11
|
*/
|
|
@@ -167,10 +167,6 @@ export interface ProviderDetectParams {
|
|
|
167
167
|
* Email address to detect the provider for.
|
|
168
168
|
*/
|
|
169
169
|
email: string;
|
|
170
|
-
/**
|
|
171
|
-
* Client ID of the Nylas application.
|
|
172
|
-
*/
|
|
173
|
-
clientId: string;
|
|
174
170
|
/**
|
|
175
171
|
* Search by all providers regardless of created integrations. If unset, defaults to false.
|
|
176
172
|
*/
|
|
@@ -39,14 +39,22 @@ export interface GetAvailabilityRequest {
|
|
|
39
39
|
*/
|
|
40
40
|
intervalMinutes?: number;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
42
|
+
* The number of minutes to round the time slots to.
|
|
43
|
+
* This allows for rounding to any multiple of 5 minutes, up to a maximum of 60 minutes.
|
|
44
|
+
* The default value is set to 15 minutes.
|
|
45
|
+
* When this variable is assigned a value, it overrides the behavior of the {@link roundTo30Minutes} flag, if it was set.
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
roundTo?: number;
|
|
46
48
|
/**
|
|
47
49
|
* The rules to apply when checking availability.
|
|
48
50
|
*/
|
|
49
51
|
availabilityRules?: AvailabilityRules;
|
|
52
|
+
/**
|
|
53
|
+
* When set to true, the availability time slots will start at 30 minutes past or on the hour.
|
|
54
|
+
* For example, a free slot starting at 16:10 is considered available only from 16:30.
|
|
55
|
+
* @deprecated Use {@link roundTo} instead.
|
|
56
|
+
*/
|
|
57
|
+
roundTo30Minutes?: boolean;
|
|
50
58
|
}
|
|
51
59
|
/**
|
|
52
60
|
* Interface for a Nylas availability time slot
|
|
@@ -1,9 +1,48 @@
|
|
|
1
|
-
import { BaseMessage
|
|
1
|
+
import { BaseMessage } from './messages.js';
|
|
2
2
|
import { ListQueryParams } from './listQueryParams.js';
|
|
3
|
+
import { EmailName } from './events.js';
|
|
4
|
+
import { CreateAttachmentRequest } from './attachments.js';
|
|
3
5
|
/**
|
|
4
6
|
* Interface representing a request to create a draft.
|
|
5
7
|
*/
|
|
6
|
-
export interface CreateDraftRequest
|
|
8
|
+
export interface CreateDraftRequest {
|
|
9
|
+
/**
|
|
10
|
+
* An array of name/email address pairs that the message was sent from. This is usually one pair only, but can be many.
|
|
11
|
+
*/
|
|
12
|
+
from?: EmailName[];
|
|
13
|
+
/**
|
|
14
|
+
* An array of message recipients.
|
|
15
|
+
*/
|
|
16
|
+
to: EmailName[];
|
|
17
|
+
/**
|
|
18
|
+
* An array of bcc recipients.
|
|
19
|
+
*/
|
|
20
|
+
bcc?: EmailName[];
|
|
21
|
+
/**
|
|
22
|
+
* An array of cc recipients.
|
|
23
|
+
*/
|
|
24
|
+
cc?: EmailName[];
|
|
25
|
+
/**
|
|
26
|
+
* An array of name and email pairs that override the sent reply-to headers.
|
|
27
|
+
*/
|
|
28
|
+
replyTo?: EmailName[];
|
|
29
|
+
/**
|
|
30
|
+
* An array of files to attach to the message.
|
|
31
|
+
*/
|
|
32
|
+
attachments?: CreateAttachmentRequest[];
|
|
33
|
+
/**
|
|
34
|
+
* The message subject.
|
|
35
|
+
*/
|
|
36
|
+
subject?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The full HTML message body.
|
|
39
|
+
* Messages with only plain-text representations are up-converted to HTML.
|
|
40
|
+
*/
|
|
41
|
+
body?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Whether or not the message has been starred by the user.
|
|
44
|
+
*/
|
|
45
|
+
starred?: boolean;
|
|
7
46
|
/**
|
|
8
47
|
* Unix timestamp to send the message at.
|
|
9
48
|
*/
|
|
@@ -21,6 +60,10 @@ export interface CreateDraftRequest extends BaseCreateMessage {
|
|
|
21
60
|
* Interface representing a request to send a message.
|
|
22
61
|
*/
|
|
23
62
|
export interface SendMessageRequest extends CreateDraftRequest {
|
|
63
|
+
/**
|
|
64
|
+
* An array of message senders.
|
|
65
|
+
*/
|
|
66
|
+
from?: EmailName[];
|
|
24
67
|
/**
|
|
25
68
|
* Whether or not to use draft support.
|
|
26
69
|
* This is primarily used when dealing with large attachments.
|
|
@@ -46,6 +46,13 @@ export interface Folder {
|
|
|
46
46
|
* The number of unread items inside of a folder.
|
|
47
47
|
*/
|
|
48
48
|
unreadCount?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Common attribute descriptors shared by system folders across providers.
|
|
51
|
+
* For example, Sent email folders have the `["\\Sent"]` attribute.
|
|
52
|
+
* For IMAP grants, IMAP providers provide the attributes.
|
|
53
|
+
* For Google and Microsoft Graph, Nylas matches system folders to a set of common attributes.
|
|
54
|
+
*/
|
|
55
|
+
attributes?: string[];
|
|
49
56
|
}
|
|
50
57
|
/**
|
|
51
58
|
* Interface for creating a new folder.
|
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { EmailName } from './events.js';
|
|
2
2
|
import { ListQueryParams } from './listQueryParams.js';
|
|
3
|
-
import { Attachment
|
|
3
|
+
import { Attachment } from './attachments.js';
|
|
4
4
|
/**
|
|
5
|
-
* @internal Internal interface for
|
|
5
|
+
* @internal Internal interface for a message.
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface BaseMessage {
|
|
8
|
+
/**
|
|
9
|
+
* The unique identifier for the message.
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Grant ID of the Nylas account.
|
|
14
|
+
*/
|
|
15
|
+
grantId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Unix timestamp of when the message was received by the mail server.
|
|
18
|
+
* This may be different from the unverified Date header in raw message object.
|
|
19
|
+
*/
|
|
20
|
+
date: number;
|
|
21
|
+
/**
|
|
22
|
+
* Unix timestamp of when the message was created.
|
|
23
|
+
*/
|
|
24
|
+
createdAt: number;
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the folder(s) the message appears in.
|
|
27
|
+
*/
|
|
28
|
+
folders: string[];
|
|
8
29
|
/**
|
|
9
30
|
* An array of message recipients.
|
|
10
31
|
*/
|
|
@@ -21,10 +42,6 @@ export interface BaseCreateMessage {
|
|
|
21
42
|
* An array of name and email pairs that override the sent reply-to headers.
|
|
22
43
|
*/
|
|
23
44
|
replyTo?: EmailName[];
|
|
24
|
-
/**
|
|
25
|
-
* An array of files to attach to the message.
|
|
26
|
-
*/
|
|
27
|
-
attachments?: CreateAttachmentRequest[];
|
|
28
45
|
/**
|
|
29
46
|
* The message subject.
|
|
30
47
|
*/
|
|
@@ -38,32 +55,6 @@ export interface BaseCreateMessage {
|
|
|
38
55
|
* Whether or not the message has been starred by the user.
|
|
39
56
|
*/
|
|
40
57
|
starred?: boolean;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* @internal Internal interface for a message.
|
|
44
|
-
*/
|
|
45
|
-
export interface BaseMessage extends Omit<BaseCreateMessage, 'attachments'> {
|
|
46
|
-
/**
|
|
47
|
-
* The unique identifier for the message.
|
|
48
|
-
*/
|
|
49
|
-
id: string;
|
|
50
|
-
/**
|
|
51
|
-
* Grant ID of the Nylas account.
|
|
52
|
-
*/
|
|
53
|
-
grantId: string;
|
|
54
|
-
/**
|
|
55
|
-
* Unix timestamp of when the message was received by the mail server.
|
|
56
|
-
* This may be different from the unverified Date header in raw message object.
|
|
57
|
-
*/
|
|
58
|
-
date: number;
|
|
59
|
-
/**
|
|
60
|
-
* Unix timestamp of when the message was created.
|
|
61
|
-
*/
|
|
62
|
-
createdAt: number;
|
|
63
|
-
/**
|
|
64
|
-
* The ID of the folder(s) the message appears in.
|
|
65
|
-
*/
|
|
66
|
-
folders: string[];
|
|
67
58
|
/**
|
|
68
59
|
* An array of message senders.
|
|
69
60
|
*/
|
|
@@ -104,6 +95,19 @@ export interface Message extends BaseMessage {
|
|
|
104
95
|
* A list of key-value pairs storing additional data.
|
|
105
96
|
*/
|
|
106
97
|
metadata?: Record<string, unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* The unique identifier for the scheduled message.
|
|
100
|
+
*/
|
|
101
|
+
scheduleId?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Unix timestamp to send the message at.
|
|
104
|
+
*/
|
|
105
|
+
sendAt?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Whether or not to use draft support.
|
|
108
|
+
* This is primarily used when dealing with large attachments.
|
|
109
|
+
*/
|
|
110
|
+
useDraft?: boolean;
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* Interface representing a request to update a message.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
-
import {
|
|
2
|
+
import { FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
|
|
3
3
|
import { Overrides } from '../config.js';
|
|
4
4
|
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
-
import { SendMessageRequest, UpdateDraftRequest } from '../models/drafts.js';
|
|
5
|
+
import { CreateDraftRequest, SendMessageRequest, UpdateDraftRequest } from '../models/drafts.js';
|
|
6
6
|
import * as FormData from 'form-data';
|
|
7
7
|
import { SmartCompose } from './smartCompose.js';
|
|
8
8
|
import APIClient from '../apiClient.js';
|
|
@@ -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
|
|
@@ -94,7 +95,7 @@ export declare class Messages extends Resource {
|
|
|
94
95
|
* Return a Message
|
|
95
96
|
* @return The message
|
|
96
97
|
*/
|
|
97
|
-
find({ identifier, messageId, overrides, }: FindMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
98
|
+
find({ identifier, messageId, overrides, queryParams, }: FindMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
98
99
|
/**
|
|
99
100
|
* Update a Message
|
|
100
101
|
* @return The updated message
|
|
@@ -125,5 +126,5 @@ export declare class Messages extends Resource {
|
|
|
125
126
|
* @return The confirmation of the stopped scheduled message
|
|
126
127
|
*/
|
|
127
128
|
stopScheduledMessage({ identifier, scheduleId, overrides, }: StopScheduledMessageParams & Overrides): Promise<NylasResponse<StopScheduledMessageResponse>>;
|
|
128
|
-
static _buildFormRequest(requestBody:
|
|
129
|
+
static _buildFormRequest(requestBody: CreateDraftRequest | UpdateDraftRequest | SendMessageRequest): FormData;
|
|
129
130
|
}
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.1
|
|
1
|
+
export declare const SDK_VERSION = "7.2.1";
|