nylas 7.0.0-beta.2 → 7.0.0-beta.4
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 +57 -32
- package/lib/cjs/models/attachments.js +2 -0
- package/lib/cjs/models/connectors.js +2 -0
- package/lib/cjs/models/contacts.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/folders.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 +16 -0
- package/lib/cjs/resources/attachments.js +57 -0
- package/lib/cjs/resources/auth.js +21 -16
- package/lib/cjs/resources/calendars.js +12 -0
- package/lib/cjs/resources/connectors.js +68 -0
- package/lib/cjs/resources/contacts.js +76 -0
- package/lib/cjs/resources/credentials.js +60 -0
- package/lib/cjs/resources/drafts.js +81 -0
- package/lib/cjs/resources/events.js +14 -0
- package/lib/cjs/resources/folders.js +72 -0
- package/lib/cjs/resources/grants.js +0 -11
- package/lib/cjs/resources/messages.js +128 -0
- package/lib/cjs/resources/redirectUris.js +1 -1
- package/lib/cjs/resources/resource.js +16 -0
- 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 +57 -32
- package/lib/esm/models/attachments.js +1 -0
- package/lib/esm/models/connectors.js +1 -0
- package/lib/esm/models/contacts.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/folders.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 +16 -0
- package/lib/esm/resources/attachments.js +53 -0
- package/lib/esm/resources/auth.js +21 -16
- package/lib/esm/resources/calendars.js +12 -0
- package/lib/esm/resources/connectors.js +64 -0
- package/lib/esm/resources/contacts.js +72 -0
- package/lib/esm/resources/credentials.js +56 -0
- package/lib/esm/resources/drafts.js +77 -0
- package/lib/esm/resources/events.js +14 -0
- package/lib/esm/resources/folders.js +68 -0
- package/lib/esm/resources/grants.js +0 -11
- package/lib/esm/resources/messages.js +124 -0
- package/lib/esm/resources/redirectUris.js +1 -1
- package/lib/esm/resources/resource.js +16 -0
- 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 +8 -1
- package/lib/types/models/attachments.d.ts +42 -0
- package/lib/types/models/auth.d.ts +5 -1
- package/lib/types/models/calendars.d.ts +1 -1
- package/lib/types/models/connectors.d.ts +123 -0
- package/lib/types/models/contacts.d.ts +148 -0
- package/lib/types/models/credentials.d.ts +151 -0
- package/lib/types/models/drafts.d.ts +92 -0
- package/lib/types/models/events.d.ts +14 -0
- package/lib/types/models/files.d.ts +17 -0
- package/lib/types/models/folders.d.ts +71 -0
- package/lib/types/models/freeBusy.d.ts +79 -0
- package/lib/types/models/messages.d.ts +271 -0
- package/lib/types/models/response.d.ts +6 -6
- 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 +40 -0
- package/lib/types/resources/attachments.d.ts +61 -0
- package/lib/types/resources/auth.d.ts +15 -11
- package/lib/types/resources/calendars.d.ts +18 -3
- package/lib/types/resources/connectors.d.ts +80 -0
- package/lib/types/resources/contacts.d.ts +92 -0
- package/lib/types/resources/credentials.d.ts +80 -0
- package/lib/types/resources/drafts.d.ts +87 -0
- package/lib/types/resources/events.d.ts +22 -3
- package/lib/types/resources/folders.d.ts +90 -0
- package/lib/types/resources/grants.d.ts +3 -14
- package/lib/types/resources/messages.d.ts +129 -0
- package/lib/types/resources/redirectUris.d.ts +2 -2
- package/lib/types/resources/resource.d.ts +4 -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,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,14 @@ 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';
|
|
12
|
+
import { Folders } from './resources/folders.js';
|
|
13
|
+
import { Grants } from './resources/grants.js';
|
|
14
|
+
import { Contacts } from './resources/contacts.js';
|
|
15
|
+
import { Attachments } from './resources/attachments.js';
|
|
8
16
|
/**
|
|
9
17
|
* The entry point to the Node SDK
|
|
10
18
|
*
|
|
@@ -16,6 +24,10 @@ export default class Nylas {
|
|
|
16
24
|
* Access the Applications API
|
|
17
25
|
*/
|
|
18
26
|
applications: Applications;
|
|
27
|
+
/**
|
|
28
|
+
* Access the Attachments API
|
|
29
|
+
*/
|
|
30
|
+
attachments: Attachments;
|
|
19
31
|
/**
|
|
20
32
|
* Access the Auth API
|
|
21
33
|
*/
|
|
@@ -24,14 +36,42 @@ export default class Nylas {
|
|
|
24
36
|
* Access the Calendars API
|
|
25
37
|
*/
|
|
26
38
|
calendars: Calendars;
|
|
39
|
+
/**
|
|
40
|
+
* Access the Connectors API
|
|
41
|
+
*/
|
|
42
|
+
connectors: Connectors;
|
|
43
|
+
/**
|
|
44
|
+
* Access the Contacts API
|
|
45
|
+
*/
|
|
46
|
+
contacts: Contacts;
|
|
47
|
+
/**
|
|
48
|
+
* Access the Drafts API
|
|
49
|
+
*/
|
|
50
|
+
drafts: Drafts;
|
|
27
51
|
/**
|
|
28
52
|
* Access the Events API
|
|
29
53
|
*/
|
|
30
54
|
events: Events;
|
|
55
|
+
/**
|
|
56
|
+
* Access the Grants API
|
|
57
|
+
*/
|
|
58
|
+
grants: Grants;
|
|
59
|
+
/**
|
|
60
|
+
* Access the Messages API
|
|
61
|
+
*/
|
|
62
|
+
messages: Messages;
|
|
63
|
+
/**
|
|
64
|
+
* Access the Threads API
|
|
65
|
+
*/
|
|
66
|
+
threads: Threads;
|
|
31
67
|
/**
|
|
32
68
|
* Access the Webhooks API
|
|
33
69
|
*/
|
|
34
70
|
webhooks: Webhooks;
|
|
71
|
+
/**
|
|
72
|
+
* Access the Folders API
|
|
73
|
+
*/
|
|
74
|
+
folders: Folders;
|
|
35
75
|
/**
|
|
36
76
|
* The configured API client
|
|
37
77
|
* @ignore Not for public use
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { Attachment, FindAttachmentQueryParams, DownloadAttachmentQueryParams } from '../models/attachments.js';
|
|
5
|
+
import { NylasResponse } from '../models/response.js';
|
|
6
|
+
import { Resource } from './resource.js';
|
|
7
|
+
/**
|
|
8
|
+
* @property identifier The ID of the grant to act upon. Use "me" to refer to the grant associated with an access token.
|
|
9
|
+
* @property attachmentId The ID of the attachment to act upon.
|
|
10
|
+
* @property queryParams The query parameters to include in the request
|
|
11
|
+
*/
|
|
12
|
+
interface FindAttachmentParams {
|
|
13
|
+
identifier: string;
|
|
14
|
+
attachmentId: string;
|
|
15
|
+
queryParams: FindAttachmentQueryParams;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @property identifier The ID of the grant to act upon. Use "me" to refer to the grant associated with an access token.
|
|
19
|
+
* @property attachmentId The ID of the attachment to act upon.
|
|
20
|
+
* @property queryParams The query parameters to include in the request
|
|
21
|
+
*/
|
|
22
|
+
interface DownloadAttachmentParams {
|
|
23
|
+
identifier: string;
|
|
24
|
+
attachmentId: string;
|
|
25
|
+
queryParams: DownloadAttachmentQueryParams;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Nylas Attachments API
|
|
29
|
+
*
|
|
30
|
+
* The Nylas Attachments API allows you to retrieve metadata and download attachments.
|
|
31
|
+
*/
|
|
32
|
+
export declare class Attachments extends Resource {
|
|
33
|
+
/**
|
|
34
|
+
* Returns an attachment by ID.
|
|
35
|
+
* @return The Attachment metadata
|
|
36
|
+
*/
|
|
37
|
+
find({ identifier, attachmentId, queryParams, overrides, }: FindAttachmentParams & Overrides): Promise<NylasResponse<Attachment>>;
|
|
38
|
+
/**
|
|
39
|
+
* Download the attachment data
|
|
40
|
+
*
|
|
41
|
+
* This method returns a NodeJS.ReadableStream which can be used to stream the attachment data.
|
|
42
|
+
* This is particularly useful for handling large attachments efficiently, as it avoids loading
|
|
43
|
+
* the entire file into memory. The stream can be piped to a file stream or used in any other way
|
|
44
|
+
* that Node.js streams are typically used.
|
|
45
|
+
*
|
|
46
|
+
* @param identifier Grant ID or email account to query
|
|
47
|
+
* @param attachmentId The id of the attachment to download.
|
|
48
|
+
* @param queryParams The query parameters to include in the request
|
|
49
|
+
* @returns {NodeJS.ReadableStream} The ReadableStream containing the file data.
|
|
50
|
+
*/
|
|
51
|
+
download({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<NodeJS.ReadableStream>;
|
|
52
|
+
/**
|
|
53
|
+
* Download the attachment as a byte array
|
|
54
|
+
* @param identifier Grant ID or email account to query
|
|
55
|
+
* @param attachmentId The id of the attachment to download.
|
|
56
|
+
* @param queryParams The query parameters to include in the request
|
|
57
|
+
* @return The raw file data
|
|
58
|
+
*/
|
|
59
|
+
downloadBytes({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<Buffer>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import APIClient from '../apiClient.js';
|
|
2
1
|
import { Resource } from './resource.js';
|
|
3
|
-
import { Grants } from './grants.js';
|
|
4
2
|
import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse } from '../models/auth.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasResponse } from '../models/response.js';
|
|
5
|
+
import { CreateGrantRequest, Grant } from '../models/grants.js';
|
|
6
|
+
/**
|
|
7
|
+
* @property requestBody The values to create the Grant with.
|
|
8
|
+
*/
|
|
9
|
+
interface CreateGrantParams {
|
|
10
|
+
requestBody: CreateGrantRequest;
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* A collection of authentication related API endpoints
|
|
7
14
|
*
|
|
@@ -9,15 +16,6 @@ import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeReque
|
|
|
9
16
|
* Also contains the Grants API and collection of provider API endpoints.
|
|
10
17
|
*/
|
|
11
18
|
export declare class Auth extends Resource {
|
|
12
|
-
/**
|
|
13
|
-
* Access the Grants API
|
|
14
|
-
*/
|
|
15
|
-
grants: Grants;
|
|
16
|
-
apiClient: APIClient;
|
|
17
|
-
/**
|
|
18
|
-
* @param apiClient The configured Nylas API client
|
|
19
|
-
*/
|
|
20
|
-
constructor(apiClient: APIClient);
|
|
21
19
|
/**
|
|
22
20
|
* Build the URL for authenticating users to your application with OAuth 2.0
|
|
23
21
|
* @param config The configuration for building the URL
|
|
@@ -49,6 +47,11 @@ export declare class Auth extends Resource {
|
|
|
49
47
|
* @return The URL for admin consent authentication
|
|
50
48
|
*/
|
|
51
49
|
urlForAdminConsent(config: URLForAdminConsentConfig): string;
|
|
50
|
+
/**
|
|
51
|
+
* Create a grant via Custom Authentication
|
|
52
|
+
* @return The created grant
|
|
53
|
+
*/
|
|
54
|
+
customAuthentication({ requestBody, overrides, }: CreateGrantParams & Overrides): Promise<NylasResponse<Grant>>;
|
|
52
55
|
/**
|
|
53
56
|
* Revoke a token (and the grant attached to the token)
|
|
54
57
|
* @param token The token to revoke
|
|
@@ -64,3 +67,4 @@ export declare class Auth extends Resource {
|
|
|
64
67
|
private urlAuthBuilder;
|
|
65
68
|
private hashPKCESecret;
|
|
66
69
|
}
|
|
70
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Overrides } from '../config.js';
|
|
2
2
|
import { Calendar, CreateCalenderRequest, ListCalendersQueryParams, UpdateCalenderRequest } from '../models/calendars.js';
|
|
3
|
-
import {
|
|
3
|
+
import { NylasBaseResponse, 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
|
*
|
|
@@ -87,11 +97,16 @@ export declare class Calendars extends Resource {
|
|
|
87
97
|
* Delete a Calendar
|
|
88
98
|
* @return The deleted Calendar
|
|
89
99
|
*/
|
|
90
|
-
destroy({ identifier, calendarId, overrides, }: DestroyCalendarParams & Overrides): Promise<
|
|
100
|
+
destroy({ identifier, calendarId, overrides, }: DestroyCalendarParams & Overrides): Promise<NylasBaseResponse>;
|
|
91
101
|
/**
|
|
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 { NylasBaseResponse, 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<NylasBaseResponse>;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Overrides } from '../config.js';
|
|
2
|
+
import { CreateContactRequest, Contact, ListContactQueryParams, FindContactQueryParams, UpdateContactRequest, ContactGroup } from '../models/contacts.js';
|
|
3
|
+
import { NylasResponse, NylasListResponse, NylasBaseResponse } from '../models/response.js';
|
|
4
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
5
|
+
/**
|
|
6
|
+
* @property contactId The id of the Contact to retrieve.
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property queryParams The query parameters to include in the request
|
|
9
|
+
*/
|
|
10
|
+
interface FindContactParams {
|
|
11
|
+
identifier: string;
|
|
12
|
+
contactId: string;
|
|
13
|
+
queryParams: FindContactQueryParams;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @property identifier The identifier of the grant to act upon
|
|
17
|
+
* @property queryParams The query parameters to include in the request
|
|
18
|
+
*/
|
|
19
|
+
interface ListContactParams {
|
|
20
|
+
identifier: string;
|
|
21
|
+
queryParams: ListContactQueryParams;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @property identifier The identifier of the grant to act upon
|
|
25
|
+
* @property requestBody The values to create the Contact with
|
|
26
|
+
*/
|
|
27
|
+
interface CreateContactParams {
|
|
28
|
+
identifier: string;
|
|
29
|
+
requestBody: CreateContactRequest;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @property identifier The identifier of the grant to act upon
|
|
33
|
+
* @property contactId The id of the Contact to retrieve.
|
|
34
|
+
* @property requestBody The values to update the Contact with
|
|
35
|
+
*/
|
|
36
|
+
interface UpdateContactParams {
|
|
37
|
+
identifier: string;
|
|
38
|
+
contactId: string;
|
|
39
|
+
requestBody: UpdateContactRequest;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @property identifier The identifier of the grant to act upon
|
|
43
|
+
* @property contactId The id of the Contact to retrieve.
|
|
44
|
+
*/
|
|
45
|
+
interface DestroyContactParams {
|
|
46
|
+
identifier: string;
|
|
47
|
+
contactId: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @property identifier The identifier of the grant to act upon
|
|
51
|
+
*/
|
|
52
|
+
interface ListContactGroupParams {
|
|
53
|
+
identifier: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Nylas Contacts API
|
|
57
|
+
*
|
|
58
|
+
* The Nylas Contacts API allows you to create, update, and delete contacts.
|
|
59
|
+
*/
|
|
60
|
+
export declare class Contacts extends Resource {
|
|
61
|
+
/**
|
|
62
|
+
* Return all Contacts
|
|
63
|
+
* @return The list of Contacts
|
|
64
|
+
*/
|
|
65
|
+
list({ identifier, queryParams, overrides, }: ListContactParams & Overrides): AsyncListResponse<NylasListResponse<Contact>>;
|
|
66
|
+
/**
|
|
67
|
+
* Return a Contact
|
|
68
|
+
* @return The Contact
|
|
69
|
+
*/
|
|
70
|
+
find({ identifier, contactId, queryParams, overrides, }: FindContactParams & Overrides): Promise<NylasResponse<Contact>>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a Contact
|
|
73
|
+
* @return The created Contact
|
|
74
|
+
*/
|
|
75
|
+
create({ identifier, requestBody, overrides, }: CreateContactParams & Overrides): Promise<NylasResponse<Contact>>;
|
|
76
|
+
/**
|
|
77
|
+
* Update a Contact
|
|
78
|
+
* @return The updated Contact
|
|
79
|
+
*/
|
|
80
|
+
update({ identifier, contactId, requestBody, overrides, }: UpdateContactParams & Overrides): Promise<NylasResponse<Contact>>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a Contact
|
|
83
|
+
* @return The deletion response
|
|
84
|
+
*/
|
|
85
|
+
destroy({ identifier, contactId, overrides, }: DestroyContactParams & Overrides): Promise<NylasBaseResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Return a Contact Group
|
|
88
|
+
* @return The list of Contact Groups
|
|
89
|
+
*/
|
|
90
|
+
groups({ identifier, overrides, }: ListContactGroupParams & Overrides): Promise<NylasListResponse<ContactGroup>>;
|
|
91
|
+
}
|
|
92
|
+
export {};
|