nylas 7.0.0 → 7.2.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/models/index.js +38 -0
- package/lib/cjs/nylas.js +15 -0
- package/lib/cjs/resources/auth.js +23 -0
- package/lib/cjs/resources/messages.js +2 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/models/index.js +22 -0
- package/lib/esm/nylas.js +1 -0
- package/lib/esm/resources/auth.js +23 -0
- package/lib/esm/resources/messages.js +2 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/models/auth.d.ts +30 -5
- package/lib/types/models/availability.d.ts +11 -3
- package/lib/types/models/drafts.d.ts +45 -2
- package/lib/types/models/events.d.ts +8 -8
- package/lib/types/models/folders.d.ts +7 -0
- package/lib/types/models/index.d.ts +21 -0
- package/lib/types/models/messages.d.ts +37 -33
- package/lib/types/models/webhooks.d.ts +9 -5
- package/lib/types/nylas.d.ts +1 -0
- package/lib/types/resources/auth.d.ts +14 -1
- package/lib/types/resources/messages.d.ts +4 -4
- package/lib/types/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// This file is generated by scripts/generateModelIndex.js
|
|
18
|
+
__exportStar(require("./applicationDetails.js"), exports);
|
|
19
|
+
__exportStar(require("./attachments.js"), exports);
|
|
20
|
+
__exportStar(require("./auth.js"), exports);
|
|
21
|
+
__exportStar(require("./availability.js"), exports);
|
|
22
|
+
__exportStar(require("./calendars.js"), exports);
|
|
23
|
+
__exportStar(require("./connectors.js"), exports);
|
|
24
|
+
__exportStar(require("./contacts.js"), exports);
|
|
25
|
+
__exportStar(require("./credentials.js"), exports);
|
|
26
|
+
__exportStar(require("./drafts.js"), exports);
|
|
27
|
+
__exportStar(require("./error.js"), exports);
|
|
28
|
+
__exportStar(require("./events.js"), exports);
|
|
29
|
+
__exportStar(require("./folders.js"), exports);
|
|
30
|
+
__exportStar(require("./freeBusy.js"), exports);
|
|
31
|
+
__exportStar(require("./grants.js"), exports);
|
|
32
|
+
__exportStar(require("./listQueryParams.js"), exports);
|
|
33
|
+
__exportStar(require("./messages.js"), exports);
|
|
34
|
+
__exportStar(require("./redirectUri.js"), exports);
|
|
35
|
+
__exportStar(require("./response.js"), exports);
|
|
36
|
+
__exportStar(require("./smartCompose.js"), exports);
|
|
37
|
+
__exportStar(require("./threads.js"), exports);
|
|
38
|
+
__exportStar(require("./webhooks.js"), exports);
|
package/lib/cjs/nylas.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./models/index.js"), exports);
|
|
3
18
|
const apiClient_js_1 = require("./apiClient.js");
|
|
4
19
|
const config_js_1 = require("./config.js");
|
|
5
20
|
const calendars_js_1 = require("./resources/calendars.js");
|
|
@@ -122,6 +122,22 @@ class Auth extends resource_js_1.Resource {
|
|
|
122
122
|
queryParams: params,
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Get info about an ID token
|
|
127
|
+
* @param idToken The ID token to query.
|
|
128
|
+
* @return The token information
|
|
129
|
+
*/
|
|
130
|
+
idTokenInfo(idToken) {
|
|
131
|
+
return this.getTokenInfo({ id_token: idToken });
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get info about an access token
|
|
135
|
+
* @param accessToken The access token to query.
|
|
136
|
+
* @return The token information
|
|
137
|
+
*/
|
|
138
|
+
accessTokenInfo(accessToken) {
|
|
139
|
+
return this.getTokenInfo({ access_token: accessToken });
|
|
140
|
+
}
|
|
125
141
|
urlAuthBuilder(config) {
|
|
126
142
|
const url = new URL(`${this.apiClient.serverUrl}/v3/connect/auth`);
|
|
127
143
|
url.searchParams.set('client_id', config.clientId);
|
|
@@ -156,5 +172,12 @@ class Auth extends resource_js_1.Resource {
|
|
|
156
172
|
.toString('base64')
|
|
157
173
|
.replace(/=+$/, '');
|
|
158
174
|
}
|
|
175
|
+
getTokenInfo(params) {
|
|
176
|
+
return this.apiClient.request({
|
|
177
|
+
method: 'GET',
|
|
178
|
+
path: `/v3/connect/tokeninfo`,
|
|
179
|
+
queryParams: params,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
159
182
|
}
|
|
160
183
|
exports.Auth = Auth;
|
|
@@ -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
|
/**
|
package/lib/cjs/version.js
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// This file is generated by scripts/generateModelIndex.js
|
|
2
|
+
export * from './applicationDetails.js';
|
|
3
|
+
export * from './attachments.js';
|
|
4
|
+
export * from './auth.js';
|
|
5
|
+
export * from './availability.js';
|
|
6
|
+
export * from './calendars.js';
|
|
7
|
+
export * from './connectors.js';
|
|
8
|
+
export * from './contacts.js';
|
|
9
|
+
export * from './credentials.js';
|
|
10
|
+
export * from './drafts.js';
|
|
11
|
+
export * from './error.js';
|
|
12
|
+
export * from './events.js';
|
|
13
|
+
export * from './folders.js';
|
|
14
|
+
export * from './freeBusy.js';
|
|
15
|
+
export * from './grants.js';
|
|
16
|
+
export * from './listQueryParams.js';
|
|
17
|
+
export * from './messages.js';
|
|
18
|
+
export * from './redirectUri.js';
|
|
19
|
+
export * from './response.js';
|
|
20
|
+
export * from './smartCompose.js';
|
|
21
|
+
export * from './threads.js';
|
|
22
|
+
export * from './webhooks.js';
|
package/lib/esm/nylas.js
CHANGED
|
@@ -119,6 +119,22 @@ export class Auth extends Resource {
|
|
|
119
119
|
queryParams: params,
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Get info about an ID token
|
|
124
|
+
* @param idToken The ID token to query.
|
|
125
|
+
* @return The token information
|
|
126
|
+
*/
|
|
127
|
+
idTokenInfo(idToken) {
|
|
128
|
+
return this.getTokenInfo({ id_token: idToken });
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get info about an access token
|
|
132
|
+
* @param accessToken The access token to query.
|
|
133
|
+
* @return The token information
|
|
134
|
+
*/
|
|
135
|
+
accessTokenInfo(accessToken) {
|
|
136
|
+
return this.getTokenInfo({ access_token: accessToken });
|
|
137
|
+
}
|
|
122
138
|
urlAuthBuilder(config) {
|
|
123
139
|
const url = new URL(`${this.apiClient.serverUrl}/v3/connect/auth`);
|
|
124
140
|
url.searchParams.set('client_id', config.clientId);
|
|
@@ -153,4 +169,11 @@ export class Auth extends Resource {
|
|
|
153
169
|
.toString('base64')
|
|
154
170
|
.replace(/=+$/, '');
|
|
155
171
|
}
|
|
172
|
+
getTokenInfo(params) {
|
|
173
|
+
return this.apiClient.request({
|
|
174
|
+
method: 'GET',
|
|
175
|
+
path: `/v3/connect/tokeninfo`,
|
|
176
|
+
queryParams: params,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
156
179
|
}
|
|
@@ -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
|
/**
|
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.2.0';
|
|
@@ -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
|
*/
|
|
@@ -197,4 +193,33 @@ export interface ProviderDetectResponse {
|
|
|
197
193
|
*/
|
|
198
194
|
type?: string;
|
|
199
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Interface representing a Nylas token information response.
|
|
198
|
+
*/
|
|
199
|
+
export interface TokenInfoResponse {
|
|
200
|
+
/**
|
|
201
|
+
* The issuer of the token.
|
|
202
|
+
*/
|
|
203
|
+
iss: string;
|
|
204
|
+
/**
|
|
205
|
+
* The token's audience.
|
|
206
|
+
*/
|
|
207
|
+
aud: string;
|
|
208
|
+
/**
|
|
209
|
+
* The time that the token was issued.
|
|
210
|
+
*/
|
|
211
|
+
iat: number;
|
|
212
|
+
/**
|
|
213
|
+
* The time that the token expires.
|
|
214
|
+
*/
|
|
215
|
+
exp: number;
|
|
216
|
+
/**
|
|
217
|
+
* The token's subject.
|
|
218
|
+
*/
|
|
219
|
+
sub?: string;
|
|
220
|
+
/**
|
|
221
|
+
* The email address of the Grant belonging to the user's token.
|
|
222
|
+
*/
|
|
223
|
+
email?: string;
|
|
224
|
+
}
|
|
200
225
|
export {};
|
|
@@ -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 [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.
|
|
@@ -28,14 +28,6 @@ export interface Event {
|
|
|
28
28
|
* If the event participants are able to edit the event.
|
|
29
29
|
*/
|
|
30
30
|
readOnly: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Unix timestamp when the event was created.
|
|
33
|
-
*/
|
|
34
|
-
createdAt: number;
|
|
35
|
-
/**
|
|
36
|
-
* Unix timestamp when the event was last updated.
|
|
37
|
-
*/
|
|
38
|
-
updatedAt: number;
|
|
39
31
|
/**
|
|
40
32
|
* List of participants invited to the event. Participants may also be rooms or resources.
|
|
41
33
|
*/
|
|
@@ -109,6 +101,14 @@ export interface Event {
|
|
|
109
101
|
* Status of the event.
|
|
110
102
|
*/
|
|
111
103
|
status?: Status;
|
|
104
|
+
/**
|
|
105
|
+
* Unix timestamp when the event was created.
|
|
106
|
+
*/
|
|
107
|
+
createdAt?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Unix timestamp when the event was last updated.
|
|
110
|
+
*/
|
|
111
|
+
updatedAt?: number;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Interface representing a request to create an event.
|
|
@@ -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.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './applicationDetails.js';
|
|
2
|
+
export * from './attachments.js';
|
|
3
|
+
export * from './auth.js';
|
|
4
|
+
export * from './availability.js';
|
|
5
|
+
export * from './calendars.js';
|
|
6
|
+
export * from './connectors.js';
|
|
7
|
+
export * from './contacts.js';
|
|
8
|
+
export * from './credentials.js';
|
|
9
|
+
export * from './drafts.js';
|
|
10
|
+
export * from './error.js';
|
|
11
|
+
export * from './events.js';
|
|
12
|
+
export * from './folders.js';
|
|
13
|
+
export * from './freeBusy.js';
|
|
14
|
+
export * from './grants.js';
|
|
15
|
+
export * from './listQueryParams.js';
|
|
16
|
+
export * from './messages.js';
|
|
17
|
+
export * from './redirectUri.js';
|
|
18
|
+
export * from './response.js';
|
|
19
|
+
export * from './smartCompose.js';
|
|
20
|
+
export * from './threads.js';
|
|
21
|
+
export * from './webhooks.js';
|
|
@@ -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.
|
|
@@ -13,11 +13,11 @@ export interface Webhook {
|
|
|
13
13
|
/**
|
|
14
14
|
* The url to send webhooks to.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
webhookUrl: string;
|
|
17
17
|
/**
|
|
18
18
|
* The status of the new destination.
|
|
19
19
|
*/
|
|
20
|
-
status:
|
|
20
|
+
status: WebhookStatus;
|
|
21
21
|
/**
|
|
22
22
|
* The time the status field was last updated, represented as a Unix timestamp in seconds.
|
|
23
23
|
*/
|
|
@@ -37,7 +37,7 @@ export interface Webhook {
|
|
|
37
37
|
/**
|
|
38
38
|
* The email addresses that Nylas notifies when a webhook is down for a while.
|
|
39
39
|
*/
|
|
40
|
-
|
|
40
|
+
notificationEmailAddresses?: string[];
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Class representing a Nylas webhook with secret.
|
|
@@ -90,7 +90,7 @@ export interface CreateWebhookRequest {
|
|
|
90
90
|
/**
|
|
91
91
|
* The url to send webhooks to.
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
webhookUrl: string;
|
|
94
94
|
/**
|
|
95
95
|
* A human-readable description of the webhook destination.
|
|
96
96
|
*/
|
|
@@ -98,7 +98,7 @@ export interface CreateWebhookRequest {
|
|
|
98
98
|
/**
|
|
99
99
|
* The email addresses that Nylas notifies when a webhook is down for a while.
|
|
100
100
|
*/
|
|
101
|
-
|
|
101
|
+
notificationEmailAddresses?: string[];
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Class representation of a Nylas update webhook request.
|
|
@@ -121,3 +121,7 @@ export declare enum WebhookTriggers {
|
|
|
121
121
|
MessageSendSuccess = "message.send_success",
|
|
122
122
|
MessageSendFailed = "message.send_failed"
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Enum representing the available webhook statuses.
|
|
126
|
+
*/
|
|
127
|
+
export type WebhookStatus = 'active' | 'failing' | 'failed' | 'pause';
|
package/lib/types/nylas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Resource } from './resource.js';
|
|
2
|
-
import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse } from '../models/auth.js';
|
|
2
|
+
import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse, TokenInfoResponse } from '../models/auth.js';
|
|
3
3
|
import { Overrides } from '../config.js';
|
|
4
4
|
import { NylasResponse } from '../models/response.js';
|
|
5
5
|
import { CreateGrantRequest, Grant } from '../models/grants.js';
|
|
@@ -64,7 +64,20 @@ export declare class Auth extends Resource {
|
|
|
64
64
|
* @return The detected provider, if found
|
|
65
65
|
*/
|
|
66
66
|
detectProvider(params: ProviderDetectParams): Promise<NylasResponse<ProviderDetectResponse>>;
|
|
67
|
+
/**
|
|
68
|
+
* Get info about an ID token
|
|
69
|
+
* @param idToken The ID token to query.
|
|
70
|
+
* @return The token information
|
|
71
|
+
*/
|
|
72
|
+
idTokenInfo(idToken: string): Promise<NylasResponse<TokenInfoResponse>>;
|
|
73
|
+
/**
|
|
74
|
+
* Get info about an access token
|
|
75
|
+
* @param accessToken The access token to query.
|
|
76
|
+
* @return The token information
|
|
77
|
+
*/
|
|
78
|
+
accessTokenInfo(accessToken: string): Promise<NylasResponse<TokenInfoResponse>>;
|
|
67
79
|
private urlAuthBuilder;
|
|
68
80
|
private hashPKCESecret;
|
|
81
|
+
private getTokenInfo;
|
|
69
82
|
}
|
|
70
83
|
export {};
|
|
@@ -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';
|
|
@@ -94,7 +94,7 @@ export declare class Messages extends Resource {
|
|
|
94
94
|
* Return a Message
|
|
95
95
|
* @return The message
|
|
96
96
|
*/
|
|
97
|
-
find({ identifier, messageId, overrides, }: FindMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
97
|
+
find({ identifier, messageId, overrides, queryParams, }: FindMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
98
98
|
/**
|
|
99
99
|
* Update a Message
|
|
100
100
|
* @return The updated message
|
|
@@ -125,5 +125,5 @@ export declare class Messages extends Resource {
|
|
|
125
125
|
* @return The confirmation of the stopped scheduled message
|
|
126
126
|
*/
|
|
127
127
|
stopScheduledMessage({ identifier, scheduleId, overrides, }: StopScheduledMessageParams & Overrides): Promise<NylasResponse<StopScheduledMessageResponse>>;
|
|
128
|
-
static _buildFormRequest(requestBody:
|
|
128
|
+
static _buildFormRequest(requestBody: CreateDraftRequest | UpdateDraftRequest | SendMessageRequest): FormData;
|
|
129
129
|
}
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.
|
|
1
|
+
export declare const SDK_VERSION = "7.2.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nylas",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.0",
|
|
4
4
|
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
|
|
5
5
|
"main": "lib/cjs/nylas.js",
|
|
6
6
|
"types": "lib/types/nylas.d.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"lint:prettier:check": "prettier --check '**/*.{ts,js}'",
|
|
22
22
|
"export-version": "node scripts/exportVersion.js",
|
|
23
23
|
"generate-lib-package-json": "node scripts/generateLibPackageJson.js",
|
|
24
|
-
"
|
|
24
|
+
"generate-model-index": "node scripts/generateModelIndex.js",
|
|
25
|
+
"prebuild": "npm run export-version && npm run generate-model-index",
|
|
25
26
|
"build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-json",
|
|
26
27
|
"build-esm": "tsc -p tsconfig.esm.json",
|
|
27
28
|
"build-cjs": "tsc -p tsconfig.cjs.json",
|