nylas 7.0.0-beta.2 → 7.0.0-beta.3
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 +19 -10
- package/lib/cjs/apiClient.js +7 -0
- package/lib/cjs/models/connectors.js +2 -0
- package/lib/cjs/models/credentials.js +12 -0
- package/lib/cjs/models/drafts.js +2 -0
- package/lib/cjs/models/files.js +2 -0
- package/lib/cjs/models/freeBusy.js +11 -0
- package/lib/cjs/models/messages.js +11 -0
- package/lib/cjs/models/smartCompose.js +2 -0
- package/lib/cjs/models/threads.js +2 -0
- package/lib/cjs/models/webhooks.js +3 -0
- package/lib/cjs/nylas.js +8 -0
- package/lib/cjs/resources/auth.js +8 -6
- package/lib/cjs/resources/calendars.js +12 -0
- package/lib/cjs/resources/connectors.js +68 -0
- package/lib/cjs/resources/credentials.js +60 -0
- package/lib/cjs/resources/drafts.js +81 -0
- package/lib/cjs/resources/grants.js +2 -2
- package/lib/cjs/resources/messages.js +121 -0
- package/lib/cjs/resources/redirectUris.js +1 -1
- package/lib/cjs/resources/smartCompose.js +34 -0
- package/lib/cjs/resources/threads.js +54 -0
- package/lib/cjs/utils.js +17 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/apiClient.js +7 -0
- package/lib/esm/models/connectors.js +1 -0
- package/lib/esm/models/credentials.js +9 -0
- package/lib/esm/models/drafts.js +1 -0
- package/lib/esm/models/files.js +1 -0
- package/lib/esm/models/freeBusy.js +8 -0
- package/lib/esm/models/messages.js +8 -0
- package/lib/esm/models/smartCompose.js +1 -0
- package/lib/esm/models/threads.js +1 -0
- package/lib/esm/models/webhooks.js +3 -0
- package/lib/esm/nylas.js +8 -0
- package/lib/esm/resources/auth.js +8 -6
- package/lib/esm/resources/calendars.js +12 -0
- package/lib/esm/resources/connectors.js +64 -0
- package/lib/esm/resources/credentials.js +56 -0
- package/lib/esm/resources/drafts.js +77 -0
- package/lib/esm/resources/grants.js +2 -2
- package/lib/esm/resources/messages.js +117 -0
- package/lib/esm/resources/redirectUris.js +1 -1
- package/lib/esm/resources/smartCompose.js +30 -0
- package/lib/esm/resources/threads.js +50 -0
- package/lib/esm/utils.js +15 -0
- package/lib/esm/version.js +1 -1
- package/lib/types/apiClient.d.ts +3 -1
- package/lib/types/models/auth.d.ts +1 -1
- package/lib/types/models/calendars.d.ts +1 -1
- package/lib/types/models/connectors.d.ts +127 -0
- package/lib/types/models/credentials.d.ts +151 -0
- package/lib/types/models/drafts.d.ts +92 -0
- package/lib/types/models/files.d.ts +17 -0
- package/lib/types/models/freeBusy.d.ts +79 -0
- package/lib/types/models/messages.d.ts +271 -0
- package/lib/types/models/smartCompose.d.ts +18 -0
- package/lib/types/models/threads.d.ts +153 -0
- package/lib/types/models/webhooks.d.ts +80 -2
- package/lib/types/nylas.d.ts +20 -0
- package/lib/types/resources/calendars.d.ts +16 -1
- package/lib/types/resources/connectors.d.ts +80 -0
- package/lib/types/resources/credentials.d.ts +80 -0
- package/lib/types/resources/drafts.d.ts +87 -0
- package/lib/types/resources/grants.d.ts +1 -1
- package/lib/types/resources/messages.d.ts +129 -0
- package/lib/types/resources/smartCompose.d.ts +41 -0
- package/lib/types/resources/threads.d.ts +70 -0
- package/lib/types/resources/webhooks.d.ts +1 -1
- package/lib/types/utils.d.ts +2 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { EmailName } from './events.js';
|
|
2
|
+
import { CreateFileRequest, File } from './files.js';
|
|
3
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
4
|
+
/**
|
|
5
|
+
* @internal Internal interface for creating a message.
|
|
6
|
+
*/
|
|
7
|
+
export interface BaseCreateMessage {
|
|
8
|
+
/**
|
|
9
|
+
* An array of message recipients.
|
|
10
|
+
*/
|
|
11
|
+
to: EmailName[];
|
|
12
|
+
/**
|
|
13
|
+
* An array of bcc recipients.
|
|
14
|
+
*/
|
|
15
|
+
bcc?: EmailName[];
|
|
16
|
+
/**
|
|
17
|
+
* An array of cc recipients.
|
|
18
|
+
*/
|
|
19
|
+
cc?: EmailName[];
|
|
20
|
+
/**
|
|
21
|
+
* An array of name and email pairs that override the sent reply-to headers.
|
|
22
|
+
*/
|
|
23
|
+
replyTo?: EmailName[];
|
|
24
|
+
/**
|
|
25
|
+
* An array of files to attach to the message.
|
|
26
|
+
*/
|
|
27
|
+
attachments?: CreateFileRequest[];
|
|
28
|
+
/**
|
|
29
|
+
* A short snippet of the message body.
|
|
30
|
+
* This is the first 100 characters of the message body, with any HTML tags removed.
|
|
31
|
+
*/
|
|
32
|
+
snippet?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The message subject.
|
|
35
|
+
*/
|
|
36
|
+
subject?: string;
|
|
37
|
+
/**
|
|
38
|
+
* A reference to the parent thread object.
|
|
39
|
+
* If this is a new draft, the thread will be empty.
|
|
40
|
+
*/
|
|
41
|
+
threadId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The full HTML message body.
|
|
44
|
+
* Messages with only plain-text representations are up-converted to HTML.
|
|
45
|
+
*/
|
|
46
|
+
body?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether or not the message has been starred by the user.
|
|
49
|
+
*/
|
|
50
|
+
starred?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether or not the message has been read by the user.
|
|
53
|
+
*/
|
|
54
|
+
unread?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @internal Internal interface for a message.
|
|
58
|
+
*/
|
|
59
|
+
export interface BaseMessage extends Omit<BaseCreateMessage, 'attachments'> {
|
|
60
|
+
/**
|
|
61
|
+
* The unique identifier for the message.
|
|
62
|
+
*/
|
|
63
|
+
id: string;
|
|
64
|
+
/**
|
|
65
|
+
* Grant ID of the Nylas account.
|
|
66
|
+
*/
|
|
67
|
+
grantId: string;
|
|
68
|
+
/**
|
|
69
|
+
* Unix timestamp of when the message was received by the mail server.
|
|
70
|
+
* This may be different from the unverified Date header in raw message object.
|
|
71
|
+
*/
|
|
72
|
+
date: number;
|
|
73
|
+
/**
|
|
74
|
+
* Unix timestamp of when the message was created.
|
|
75
|
+
*/
|
|
76
|
+
createdAt: number;
|
|
77
|
+
/**
|
|
78
|
+
* The ID of the folder(s) the message appears in.
|
|
79
|
+
*/
|
|
80
|
+
folders: string[];
|
|
81
|
+
/**
|
|
82
|
+
* An array of message senders.
|
|
83
|
+
*/
|
|
84
|
+
from?: EmailName[];
|
|
85
|
+
/**
|
|
86
|
+
* An array of files attached to the message.
|
|
87
|
+
*/
|
|
88
|
+
attachments?: File[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Interface representing a Nylas Message object.
|
|
92
|
+
*/
|
|
93
|
+
export interface Message extends BaseMessage {
|
|
94
|
+
/**
|
|
95
|
+
* The type of object.
|
|
96
|
+
*/
|
|
97
|
+
object: 'message';
|
|
98
|
+
/**
|
|
99
|
+
* The message headers.
|
|
100
|
+
* Only present if the 'fields' query parameter is set to includeHeaders.
|
|
101
|
+
*/
|
|
102
|
+
headers?: MessageHeaders[];
|
|
103
|
+
/**
|
|
104
|
+
* A list of key-value pairs storing additional data.
|
|
105
|
+
*/
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Interface representing a request to update a message.
|
|
110
|
+
*/
|
|
111
|
+
export interface UpdateMessageRequest {
|
|
112
|
+
/**
|
|
113
|
+
* Sets the message as starred or unstarred.
|
|
114
|
+
*/
|
|
115
|
+
starred?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Sets the message as read or unread.
|
|
118
|
+
*/
|
|
119
|
+
unread?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* The IDs of the folders the message should appear in.
|
|
122
|
+
*/
|
|
123
|
+
folders?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* A list of key-value pairs storing additional data.
|
|
126
|
+
*/
|
|
127
|
+
metadata?: Record<string, unknown>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Interface representing a message header.
|
|
131
|
+
*/
|
|
132
|
+
export interface MessageHeaders {
|
|
133
|
+
/**
|
|
134
|
+
* The header name.
|
|
135
|
+
*/
|
|
136
|
+
name: string;
|
|
137
|
+
/**
|
|
138
|
+
* The header value.
|
|
139
|
+
*/
|
|
140
|
+
value: string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Enum representing the message fields that can be included in a response.
|
|
144
|
+
*/
|
|
145
|
+
export declare enum MessageFields {
|
|
146
|
+
STANDARD = "standard",
|
|
147
|
+
INCLUDE_HEADERS = "include_headers"
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Interface representing information about a scheduled message.
|
|
151
|
+
*/
|
|
152
|
+
export interface ScheduledMessage {
|
|
153
|
+
/**
|
|
154
|
+
* The unique identifier for the scheduled message.
|
|
155
|
+
*/
|
|
156
|
+
scheduleId: number;
|
|
157
|
+
/**
|
|
158
|
+
* The status of the scheduled message.
|
|
159
|
+
*/
|
|
160
|
+
status: ScheduledMessageStatus;
|
|
161
|
+
/**
|
|
162
|
+
* The time the message was sent or failed to send, in epoch time.
|
|
163
|
+
*/
|
|
164
|
+
closeTime?: number;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Interface representing a list of scheduled messages.
|
|
168
|
+
*/
|
|
169
|
+
export interface ScheduledMessagesList {
|
|
170
|
+
/**
|
|
171
|
+
* The list of scheduled messages.
|
|
172
|
+
*/
|
|
173
|
+
schedules: ScheduledMessage[];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Interface representing a scheduled message status.
|
|
177
|
+
*/
|
|
178
|
+
export interface ScheduledMessageStatus {
|
|
179
|
+
/**
|
|
180
|
+
* The status code the describes the state of the scheduled message
|
|
181
|
+
*/
|
|
182
|
+
code: string;
|
|
183
|
+
/**
|
|
184
|
+
* A description of the status of the scheduled message
|
|
185
|
+
*/
|
|
186
|
+
description: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Interface representing a response after stopping a scheduled message.
|
|
190
|
+
*/
|
|
191
|
+
export interface StopScheduledMessageResponse {
|
|
192
|
+
/**
|
|
193
|
+
* A message describing the result of the request.
|
|
194
|
+
*/
|
|
195
|
+
message: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Interface representing the query parameters for listing messages.
|
|
199
|
+
*/
|
|
200
|
+
export interface ListMessagesQueryParams extends ListQueryParams {
|
|
201
|
+
/**
|
|
202
|
+
* Return items with a matching literal subject.
|
|
203
|
+
*/
|
|
204
|
+
subject?: string;
|
|
205
|
+
/**
|
|
206
|
+
* Return emails that have been sent or received from this list of email addresses.
|
|
207
|
+
*/
|
|
208
|
+
anyEmail?: string[];
|
|
209
|
+
/**
|
|
210
|
+
* Return items containing messages sent to these email address.
|
|
211
|
+
*/
|
|
212
|
+
to?: string[];
|
|
213
|
+
/**
|
|
214
|
+
* Return items containing messages sent from these email address.
|
|
215
|
+
*/
|
|
216
|
+
from?: string[];
|
|
217
|
+
/**
|
|
218
|
+
* Return items containing messages cc'd on these email address.
|
|
219
|
+
*/
|
|
220
|
+
cc?: string[];
|
|
221
|
+
/**
|
|
222
|
+
* Return items containing messages bcc'd on these email address.
|
|
223
|
+
*/
|
|
224
|
+
bcc?: string[];
|
|
225
|
+
/**
|
|
226
|
+
* Return emails that are in these folder IDs.
|
|
227
|
+
*/
|
|
228
|
+
in?: string[];
|
|
229
|
+
/**
|
|
230
|
+
* Return emails that are unread.
|
|
231
|
+
*/
|
|
232
|
+
unread?: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* Return emails that are starred.
|
|
235
|
+
*/
|
|
236
|
+
starred?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Return emails that belong to this thread.
|
|
239
|
+
*/
|
|
240
|
+
threadId?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Return emails that have been received before this timestamp.
|
|
243
|
+
*/
|
|
244
|
+
receivedBefore?: number;
|
|
245
|
+
/**
|
|
246
|
+
* Return emails that have been received after this timestamp.
|
|
247
|
+
*/
|
|
248
|
+
receivedAfter?: number;
|
|
249
|
+
/**
|
|
250
|
+
* Return emails that contain attachments.
|
|
251
|
+
*/
|
|
252
|
+
hasAttachment?: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Allows you to specify to return messages with headers included.
|
|
255
|
+
*/
|
|
256
|
+
fields?: MessageFields;
|
|
257
|
+
/**
|
|
258
|
+
* The provider-specific query string used to search messages.
|
|
259
|
+
* Available for Google and Microsoft Graph only.
|
|
260
|
+
*/
|
|
261
|
+
searchQueryNative?: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Interface representing the query parameters for finding a message.
|
|
265
|
+
*/
|
|
266
|
+
export interface FindMessageQueryParams {
|
|
267
|
+
/**
|
|
268
|
+
* Allows you to specify to the message with headers included.
|
|
269
|
+
*/
|
|
270
|
+
fields?: MessageFields;
|
|
271
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing a request to compose a message.
|
|
3
|
+
*/
|
|
4
|
+
export interface ComposeMessageRequest {
|
|
5
|
+
/**
|
|
6
|
+
* The prompt that smart compose will use to generate a message suggestion.
|
|
7
|
+
*/
|
|
8
|
+
prompt: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Interface representing a response to a message composition request.
|
|
12
|
+
*/
|
|
13
|
+
export interface ComposeMessageResponse {
|
|
14
|
+
/**
|
|
15
|
+
* The message suggestion generated by smart compose.
|
|
16
|
+
*/
|
|
17
|
+
suggestion: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Message } from './messages.js';
|
|
2
|
+
import { Draft } from './drafts.js';
|
|
3
|
+
import { EmailName } from './events.js';
|
|
4
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
5
|
+
/**
|
|
6
|
+
* Interface representing a Nylas thread object.
|
|
7
|
+
*/
|
|
8
|
+
export interface Thread {
|
|
9
|
+
/**
|
|
10
|
+
* The unique identifier for the thread.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* Grant ID of the Nylas account.
|
|
15
|
+
*/
|
|
16
|
+
grantId: string;
|
|
17
|
+
/**
|
|
18
|
+
* The latest message or draft in the thread.
|
|
19
|
+
*/
|
|
20
|
+
latestDraftOrMessage: Message | Draft;
|
|
21
|
+
/**
|
|
22
|
+
* Whether or not a message in a thread has attachments.
|
|
23
|
+
*/
|
|
24
|
+
hasAttachments: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not a message in a thread has drafts.
|
|
27
|
+
*/
|
|
28
|
+
hasDrafts: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* A boolean indicating whether the thread is starred or not.
|
|
31
|
+
*/
|
|
32
|
+
starred: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A boolean indicating if all messages within the thread are read or not.
|
|
35
|
+
*/
|
|
36
|
+
unread: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Unix timestamp of the earliest or first message in the thread.
|
|
39
|
+
*/
|
|
40
|
+
earliestMessageDate: number;
|
|
41
|
+
/**
|
|
42
|
+
* Unix timestamp of the most recent message received in the thread.
|
|
43
|
+
*/
|
|
44
|
+
latestMessageReceivedDate: number;
|
|
45
|
+
/**
|
|
46
|
+
* Unix timestamp of the most recent message sent in the thread.
|
|
47
|
+
*/
|
|
48
|
+
latestMessageSentDate: number;
|
|
49
|
+
/**
|
|
50
|
+
* An array of participants in the thread.
|
|
51
|
+
*/
|
|
52
|
+
participants: EmailName[];
|
|
53
|
+
/**
|
|
54
|
+
* An array of message IDs in the thread.
|
|
55
|
+
*/
|
|
56
|
+
messageIds: string[];
|
|
57
|
+
/**
|
|
58
|
+
* An array of draft IDs in the thread.
|
|
59
|
+
*/
|
|
60
|
+
draftIds: string[];
|
|
61
|
+
/**
|
|
62
|
+
* An array of folder IDs the thread appears in.
|
|
63
|
+
*/
|
|
64
|
+
folders: string[];
|
|
65
|
+
/**
|
|
66
|
+
* The type of object.
|
|
67
|
+
*/
|
|
68
|
+
object: 'thread';
|
|
69
|
+
/**
|
|
70
|
+
* A short snippet of the last received message/draft body.
|
|
71
|
+
* This is the first 100 characters of the message body, with any HTML tags removed.
|
|
72
|
+
*/
|
|
73
|
+
snippet?: string;
|
|
74
|
+
/**
|
|
75
|
+
* The subject line of the thread.
|
|
76
|
+
*/
|
|
77
|
+
subject?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Interface representing a request to update a thread.
|
|
81
|
+
*/
|
|
82
|
+
export interface UpdateThreadRequest {
|
|
83
|
+
/**
|
|
84
|
+
* Sets all messages in the thread as starred or unstarred.
|
|
85
|
+
*/
|
|
86
|
+
starred?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Sets all messages in the thread as read or unread.
|
|
89
|
+
*/
|
|
90
|
+
unread?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* The IDs of the folders to apply, overwriting all previous folders for all messages in the thread.
|
|
93
|
+
*/
|
|
94
|
+
folders?: string[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Interface representing the query parameters for listing drafts.
|
|
98
|
+
*/
|
|
99
|
+
export interface ListThreadsQueryParams extends ListQueryParams {
|
|
100
|
+
/**
|
|
101
|
+
* Return items with a matching literal subject.
|
|
102
|
+
*/
|
|
103
|
+
subject?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Return threads that contain messages that have been sent or received from this list of email addresses.
|
|
106
|
+
*/
|
|
107
|
+
anyEmail?: string[];
|
|
108
|
+
/**
|
|
109
|
+
* Return threads containing messages sent to these email address.
|
|
110
|
+
*/
|
|
111
|
+
to?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* Return threads containing messages sent from these email address.
|
|
114
|
+
*/
|
|
115
|
+
from?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Return threads containing messages cc'd on these email address.
|
|
118
|
+
*/
|
|
119
|
+
cc?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Return threads containing messages bcc'd on these email address.
|
|
122
|
+
*/
|
|
123
|
+
bcc?: string[];
|
|
124
|
+
/**
|
|
125
|
+
* Return threads with messages that belong to these specified folder IDs.
|
|
126
|
+
*/
|
|
127
|
+
in?: string[];
|
|
128
|
+
/**
|
|
129
|
+
* Return threads with unread messages.
|
|
130
|
+
*/
|
|
131
|
+
unread?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Return threads with starred messages.
|
|
134
|
+
*/
|
|
135
|
+
starred?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Return threads whose most recent message was received before this Unix timestamp.
|
|
138
|
+
*/
|
|
139
|
+
latestMessageBefore?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Return threads whose most recent message was received after this Unix timestamp.
|
|
142
|
+
*/
|
|
143
|
+
latestMessageAfter?: number;
|
|
144
|
+
/**
|
|
145
|
+
* Return threads with messages that contain attachments.
|
|
146
|
+
*/
|
|
147
|
+
hasAttachment?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* The provider-specific query string used to search threads.
|
|
150
|
+
* Available for Google only.
|
|
151
|
+
*/
|
|
152
|
+
searchQueryNative?: string;
|
|
153
|
+
}
|
|
@@ -1,34 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing a Nylas Webhook object.
|
|
3
|
+
*/
|
|
1
4
|
export interface Webhook {
|
|
5
|
+
/**
|
|
6
|
+
* Globally unique object identifier.
|
|
7
|
+
*/
|
|
2
8
|
id: string;
|
|
3
|
-
|
|
9
|
+
/**
|
|
10
|
+
* List of events that triggers the webhook.
|
|
11
|
+
*/
|
|
4
12
|
triggerTypes: WebhookTriggers[];
|
|
13
|
+
/**
|
|
14
|
+
* The url to send webhooks to.
|
|
15
|
+
*/
|
|
5
16
|
callbackUrl: string;
|
|
17
|
+
/**
|
|
18
|
+
* The status of the new destination.
|
|
19
|
+
*/
|
|
6
20
|
status: 'active' | 'failing' | 'failed' | 'pause';
|
|
7
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The time the status field was last updated, represented as a Unix timestamp in seconds.
|
|
23
|
+
*/
|
|
8
24
|
statusUpdatedAt: number;
|
|
25
|
+
/**
|
|
26
|
+
* The time the status field was created, represented as a Unix timestamp in seconds
|
|
27
|
+
*/
|
|
9
28
|
createdAt: number;
|
|
29
|
+
/**
|
|
30
|
+
* The time the status field was last updated, represented as a Unix timestamp in seconds.
|
|
31
|
+
*/
|
|
10
32
|
updatedAt: number;
|
|
33
|
+
/**
|
|
34
|
+
* A human-readable description of the webhook destination.
|
|
35
|
+
*/
|
|
36
|
+
description?: string;
|
|
37
|
+
/**
|
|
38
|
+
* The email addresses that Nylas notifies when a webhook is down for a while.
|
|
39
|
+
*/
|
|
40
|
+
notificationEmailAddress?: string;
|
|
11
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Class representing a Nylas webhook with secret.
|
|
44
|
+
*/
|
|
12
45
|
export interface WebhookWithSecret extends Webhook {
|
|
46
|
+
/**
|
|
47
|
+
* A secret value used to encode the X-Nylas-Signature header on webhook requests.
|
|
48
|
+
*/
|
|
13
49
|
webhookSecret: string;
|
|
14
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Class representing a Nylas webhook delete response.
|
|
53
|
+
*/
|
|
15
54
|
export interface WebhookDeleteResponse {
|
|
55
|
+
/**
|
|
56
|
+
* ID of the request.
|
|
57
|
+
*/
|
|
16
58
|
requestId: string;
|
|
59
|
+
/**
|
|
60
|
+
* Object containing the webhook deletion status.
|
|
61
|
+
*/
|
|
17
62
|
data?: {
|
|
63
|
+
/**
|
|
64
|
+
* The status of the webhook deletion.
|
|
65
|
+
*/
|
|
18
66
|
status: 'success';
|
|
19
67
|
};
|
|
20
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Class representing the response for getting a list of webhook ip addresses.
|
|
71
|
+
*/
|
|
21
72
|
export interface WebhookIpAddressesResponse {
|
|
73
|
+
/**
|
|
74
|
+
* The IP addresses that Nylas send you webhook from.
|
|
75
|
+
*/
|
|
22
76
|
ipAddresses: string[];
|
|
77
|
+
/**
|
|
78
|
+
* UNIX timestamp when Nylas updated the list of IP addresses.
|
|
79
|
+
*/
|
|
23
80
|
updatedAt: number;
|
|
24
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Class representation of a Nylas create webhook request.
|
|
84
|
+
*/
|
|
25
85
|
export interface CreateWebhookRequest {
|
|
86
|
+
/**
|
|
87
|
+
* List of events that triggers the webhook.
|
|
88
|
+
*/
|
|
26
89
|
triggerTypes: WebhookTriggers[];
|
|
90
|
+
/**
|
|
91
|
+
* The url to send webhooks to.
|
|
92
|
+
*/
|
|
27
93
|
callbackUrl: string;
|
|
94
|
+
/**
|
|
95
|
+
* A human-readable description of the webhook destination.
|
|
96
|
+
*/
|
|
28
97
|
description?: string;
|
|
98
|
+
/**
|
|
99
|
+
* The email addresses that Nylas notifies when a webhook is down for a while.
|
|
100
|
+
*/
|
|
29
101
|
notificationEmailAddress?: string;
|
|
30
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Class representation of a Nylas update webhook request.
|
|
105
|
+
*/
|
|
31
106
|
export type UpdateWebhookRequest = Partial<CreateWebhookRequest>;
|
|
107
|
+
/**
|
|
108
|
+
* Enum representing the available webhook triggers.
|
|
109
|
+
*/
|
|
32
110
|
export declare enum WebhookTriggers {
|
|
33
111
|
CalendarCreated = "calendar.created",
|
|
34
112
|
CalendarUpdated = "calendar.updated",
|
package/lib/types/nylas.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { Events } from './resources/events.js';
|
|
|
5
5
|
import { Auth } from './resources/auth.js';
|
|
6
6
|
import { Webhooks } from './resources/webhooks.js';
|
|
7
7
|
import { Applications } from './resources/applications.js';
|
|
8
|
+
import { Messages } from './resources/messages.js';
|
|
9
|
+
import { Drafts } from './resources/drafts.js';
|
|
10
|
+
import { Threads } from './resources/threads.js';
|
|
11
|
+
import { Connectors } from './resources/connectors.js';
|
|
8
12
|
/**
|
|
9
13
|
* The entry point to the Node SDK
|
|
10
14
|
*
|
|
@@ -24,10 +28,26 @@ export default class Nylas {
|
|
|
24
28
|
* Access the Calendars API
|
|
25
29
|
*/
|
|
26
30
|
calendars: Calendars;
|
|
31
|
+
/**
|
|
32
|
+
* Access the Connectors API
|
|
33
|
+
*/
|
|
34
|
+
connectors: Connectors;
|
|
35
|
+
/**
|
|
36
|
+
* Access the Drafts API
|
|
37
|
+
*/
|
|
38
|
+
drafts: Drafts;
|
|
27
39
|
/**
|
|
28
40
|
* Access the Events API
|
|
29
41
|
*/
|
|
30
42
|
events: Events;
|
|
43
|
+
/**
|
|
44
|
+
* Access the Messages API
|
|
45
|
+
*/
|
|
46
|
+
messages: Messages;
|
|
47
|
+
/**
|
|
48
|
+
* Access the Threads API
|
|
49
|
+
*/
|
|
50
|
+
threads: Threads;
|
|
31
51
|
/**
|
|
32
52
|
* Access the Webhooks API
|
|
33
53
|
*/
|
|
@@ -3,6 +3,7 @@ import { Calendar, CreateCalenderRequest, ListCalendersQueryParams, UpdateCalend
|
|
|
3
3
|
import { NylasDeleteResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
4
|
import { Resource, AsyncListResponse } from './resource.js';
|
|
5
5
|
import { GetAvailabilityRequest, GetAvailabilityResponse } from '../models/availability.js';
|
|
6
|
+
import { GetFreeBusyRequest, GetFreeBusyResponse } from '../models/freeBusy.js';
|
|
6
7
|
/**
|
|
7
8
|
* The parameters for the {@link Calendars.find} method
|
|
8
9
|
* @property calendarId The id of the Calendar to retrieve. Use "primary" to refer to the primary calendar associated with grant.
|
|
@@ -56,6 +57,15 @@ interface DestroyCalendarParams {
|
|
|
56
57
|
interface GetAvailabilityParams {
|
|
57
58
|
requestBody: GetAvailabilityRequest;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* The parameters for the {@link Calendars.getFreeBusy} method
|
|
62
|
+
* @property identifier The identifier of the grant to act upon
|
|
63
|
+
* @property requestBody The free busy request
|
|
64
|
+
*/
|
|
65
|
+
interface GetFreeBusyParams {
|
|
66
|
+
identifier: string;
|
|
67
|
+
requestBody: GetFreeBusyRequest;
|
|
68
|
+
}
|
|
59
69
|
/**
|
|
60
70
|
* Nylas Calendar API
|
|
61
71
|
*
|
|
@@ -92,6 +102,11 @@ export declare class Calendars extends Resource {
|
|
|
92
102
|
* Get Availability for a given account / accounts
|
|
93
103
|
* @return The availability response
|
|
94
104
|
*/
|
|
95
|
-
getAvailability({ requestBody, overrides, }: GetAvailabilityParams & Overrides): Promise<GetAvailabilityResponse
|
|
105
|
+
getAvailability({ requestBody, overrides, }: GetAvailabilityParams & Overrides): Promise<NylasResponse<GetAvailabilityResponse>>;
|
|
106
|
+
/**
|
|
107
|
+
* Get the free/busy schedule for a list of email addresses
|
|
108
|
+
* @return The free/busy response
|
|
109
|
+
*/
|
|
110
|
+
getFreeBusy({ identifier, requestBody, overrides, }: GetFreeBusyParams & Overrides): Promise<NylasResponse<GetFreeBusyResponse[]>>;
|
|
96
111
|
}
|
|
97
112
|
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
+
import { Connector, CreateConnectorRequest, ListConnectorsQueryParams, UpdateConnectorRequest } from '../models/connectors.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasDeleteResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
import { Provider } from '../models/auth.js';
|
|
6
|
+
import { Credentials } from './credentials.js';
|
|
7
|
+
import APIClient from '../apiClient.js';
|
|
8
|
+
/**
|
|
9
|
+
* The parameters for the {@link Connectors.find} method
|
|
10
|
+
* @property provider The provider associated to the connector to retrieve.
|
|
11
|
+
*/
|
|
12
|
+
interface FindConnectorParams {
|
|
13
|
+
provider: Provider;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The parameters for the {@link Connectors.list} method
|
|
17
|
+
* @property queryParams The query parameters to include in the request
|
|
18
|
+
*/
|
|
19
|
+
interface ListConnectorsParams {
|
|
20
|
+
queryParams?: ListConnectorsQueryParams;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The parameters for the {@link Connectors.create} method
|
|
24
|
+
* @property requestBody The request body to create a connector
|
|
25
|
+
*/
|
|
26
|
+
interface CreateConnectorParams {
|
|
27
|
+
requestBody: CreateConnectorRequest;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The parameters for the {@link Connectors.update} method
|
|
31
|
+
* @property provider The provider associated to the connector to update.
|
|
32
|
+
* @property requestBody The request body to create a connector
|
|
33
|
+
*/
|
|
34
|
+
interface UpdateConnectorParams {
|
|
35
|
+
provider: Provider;
|
|
36
|
+
requestBody: UpdateConnectorRequest;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The parameters for the {@link Connectors.destroy} method
|
|
40
|
+
* @property provider The provider associated to the connector to update.
|
|
41
|
+
*/
|
|
42
|
+
interface DestroyConnectorParams {
|
|
43
|
+
provider: string;
|
|
44
|
+
}
|
|
45
|
+
export declare class Connectors extends Resource {
|
|
46
|
+
/**
|
|
47
|
+
* Access the Credentials API
|
|
48
|
+
*/
|
|
49
|
+
credentials: Credentials;
|
|
50
|
+
/**
|
|
51
|
+
* @param apiClient client The configured Nylas API client
|
|
52
|
+
*/
|
|
53
|
+
constructor(apiClient: APIClient);
|
|
54
|
+
/**
|
|
55
|
+
* Return all connectors
|
|
56
|
+
* @return A list of connectors
|
|
57
|
+
*/
|
|
58
|
+
list({ queryParams, overrides, }: ListConnectorsParams & ListConnectorsQueryParams & Overrides): AsyncListResponse<NylasListResponse<Connector>>;
|
|
59
|
+
/**
|
|
60
|
+
* Return a connector
|
|
61
|
+
* @return The connector
|
|
62
|
+
*/
|
|
63
|
+
find({ provider, overrides, }: FindConnectorParams & Overrides): Promise<NylasResponse<Connector>>;
|
|
64
|
+
/**
|
|
65
|
+
* Create a connector
|
|
66
|
+
* @return The created connector
|
|
67
|
+
*/
|
|
68
|
+
create({ requestBody, overrides, }: CreateConnectorParams & Overrides): Promise<NylasResponse<Connector>>;
|
|
69
|
+
/**
|
|
70
|
+
* Update a connector
|
|
71
|
+
* @return The updated connector
|
|
72
|
+
*/
|
|
73
|
+
update({ provider, requestBody, overrides, }: UpdateConnectorParams & Overrides): Promise<NylasResponse<Connector>>;
|
|
74
|
+
/**
|
|
75
|
+
* Delete a connector
|
|
76
|
+
* @return The deleted connector
|
|
77
|
+
*/
|
|
78
|
+
destroy({ provider, overrides, }: DestroyConnectorParams & Overrides): Promise<NylasDeleteResponse>;
|
|
79
|
+
}
|
|
80
|
+
export {};
|