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,80 @@
|
|
|
1
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
+
import { Credential, CreateCredentialRequest, ListCredentialsQueryParams, UpdateCredentialRequest } from '../models/credentials.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
import { Provider } from '../models/auth.js';
|
|
6
|
+
/**
|
|
7
|
+
* The parameters for the {@link Credentials.find} method
|
|
8
|
+
* @property provider The provider associated to the credential to retrieve.
|
|
9
|
+
* @property credentialsId The id of the credentials to retrieve.
|
|
10
|
+
*/
|
|
11
|
+
interface FindCredentialParams {
|
|
12
|
+
provider: Provider;
|
|
13
|
+
credentialsId: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The parameters for the {@link Credentials.list} method
|
|
17
|
+
* @property provider The provider associated to the credential to list from.
|
|
18
|
+
* @property queryParams The query parameters to include in the request
|
|
19
|
+
*/
|
|
20
|
+
interface ListCredentialsParams {
|
|
21
|
+
provider: Provider;
|
|
22
|
+
queryParams?: ListCredentialsQueryParams;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The parameters for the {@link Credentials.create} method
|
|
26
|
+
* @property provider The provider associated to the credential being created.
|
|
27
|
+
* @property requestBody The request body to create a credential
|
|
28
|
+
*/
|
|
29
|
+
interface CreateCredentialParams {
|
|
30
|
+
provider: Provider;
|
|
31
|
+
requestBody: CreateCredentialRequest;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The parameters for the {@link Credentials.update} method
|
|
35
|
+
* @property provider The provider associated to the credential to update from.
|
|
36
|
+
* @property requestBody The request body to create a credential
|
|
37
|
+
* @property credentialsId The id of the credentials to update.
|
|
38
|
+
*/
|
|
39
|
+
interface UpdateCredentialParams {
|
|
40
|
+
provider: Provider;
|
|
41
|
+
credentialsId: string;
|
|
42
|
+
requestBody: UpdateCredentialRequest;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The parameters for the {@link Credentials.destroy} method
|
|
46
|
+
* @property provider The provider associated to the credential to delete from.
|
|
47
|
+
* @property credentialsId The id of the credentials to delete.
|
|
48
|
+
*/
|
|
49
|
+
interface DestroyCredentialParams {
|
|
50
|
+
provider: string;
|
|
51
|
+
credentialsId: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class Credentials extends Resource {
|
|
54
|
+
/**
|
|
55
|
+
* Return all credentials
|
|
56
|
+
* @return A list of credentials
|
|
57
|
+
*/
|
|
58
|
+
list({ provider, queryParams, overrides, }: ListCredentialsParams & ListCredentialsQueryParams & Overrides): AsyncListResponse<NylasListResponse<Credential>>;
|
|
59
|
+
/**
|
|
60
|
+
* Return a credential
|
|
61
|
+
* @return The credential
|
|
62
|
+
*/
|
|
63
|
+
find({ provider, credentialsId, overrides, }: FindCredentialParams & Overrides): Promise<NylasResponse<Credential>>;
|
|
64
|
+
/**
|
|
65
|
+
* Create a credential
|
|
66
|
+
* @return The created credential
|
|
67
|
+
*/
|
|
68
|
+
create({ provider, requestBody, overrides, }: CreateCredentialParams & Overrides): Promise<NylasResponse<Credential>>;
|
|
69
|
+
/**
|
|
70
|
+
* Update a credential
|
|
71
|
+
* @return The updated credential
|
|
72
|
+
*/
|
|
73
|
+
update({ provider, credentialsId, requestBody, overrides, }: UpdateCredentialParams & Overrides): Promise<NylasResponse<Credential>>;
|
|
74
|
+
/**
|
|
75
|
+
* Delete a credential
|
|
76
|
+
* @return The deleted credential
|
|
77
|
+
*/
|
|
78
|
+
destroy({ provider, credentialsId, overrides, }: DestroyCredentialParams & Overrides): Promise<NylasBaseResponse>;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
+
import { CreateDraftRequest, Draft, ListDraftsQueryParams, UpdateDraftRequest } from '../models/drafts.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parameters for the {@link Drafts.list} method
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property queryParams The query parameters to include in the request
|
|
9
|
+
*/
|
|
10
|
+
export interface ListDraftsParams {
|
|
11
|
+
identifier: string;
|
|
12
|
+
queryParams?: ListDraftsQueryParams;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The parameters for the {@link Drafts.find} method
|
|
16
|
+
* @property identifier The identifier of the grant to act upon
|
|
17
|
+
* @property draftId The id of the draft to retrieve.
|
|
18
|
+
*/
|
|
19
|
+
export interface FindDraftParams {
|
|
20
|
+
identifier: string;
|
|
21
|
+
draftId: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The parameters for the {@link Drafts.create} method
|
|
25
|
+
* @property identifier The identifier of the grant to act upon
|
|
26
|
+
* @property requestBody The values to create the message with
|
|
27
|
+
*/
|
|
28
|
+
export interface CreateDraftParams {
|
|
29
|
+
identifier: string;
|
|
30
|
+
requestBody: CreateDraftRequest;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The parameters for the {@link Drafts.update} method
|
|
34
|
+
* @property identifier The identifier of the grant to act upon
|
|
35
|
+
* @property draftId The id of the draft to update.
|
|
36
|
+
* @property requestBody The values to update the draft with
|
|
37
|
+
*/
|
|
38
|
+
export interface UpdateDraftParams {
|
|
39
|
+
identifier: string;
|
|
40
|
+
draftId: string;
|
|
41
|
+
requestBody: UpdateDraftRequest;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The parameters for the {@link Drafts.destroy} method
|
|
45
|
+
*/
|
|
46
|
+
export type DestroyDraftParams = FindDraftParams;
|
|
47
|
+
/**
|
|
48
|
+
* The parameters for the {@link Drafts.send} method
|
|
49
|
+
*/
|
|
50
|
+
export type SendDraftParams = FindDraftParams;
|
|
51
|
+
/**
|
|
52
|
+
* Nylas Drafts API
|
|
53
|
+
*
|
|
54
|
+
* The Nylas Drafts API allows you to list, find, update, delete, and send drafts on user accounts.
|
|
55
|
+
*/
|
|
56
|
+
export declare class Drafts extends Resource {
|
|
57
|
+
/**
|
|
58
|
+
* Return all Drafts
|
|
59
|
+
* @return A list of drafts
|
|
60
|
+
*/
|
|
61
|
+
list({ identifier, queryParams, overrides, }: ListDraftsParams & Overrides): AsyncListResponse<NylasListResponse<Draft>>;
|
|
62
|
+
/**
|
|
63
|
+
* Return a Draft
|
|
64
|
+
* @return The draft
|
|
65
|
+
*/
|
|
66
|
+
find({ identifier, draftId, overrides, }: FindDraftParams & Overrides): Promise<NylasResponse<Draft>>;
|
|
67
|
+
/**
|
|
68
|
+
* Return a Draft
|
|
69
|
+
* @return The draft
|
|
70
|
+
*/
|
|
71
|
+
create({ identifier, requestBody, overrides, }: CreateDraftParams & Overrides): Promise<NylasResponse<Draft>>;
|
|
72
|
+
/**
|
|
73
|
+
* Update a Draft
|
|
74
|
+
* @return The updated draft
|
|
75
|
+
*/
|
|
76
|
+
update({ identifier, draftId, requestBody, overrides, }: UpdateDraftParams & Overrides): Promise<NylasResponse<Draft>>;
|
|
77
|
+
/**
|
|
78
|
+
* Delete a Draft
|
|
79
|
+
* @return The deleted draft
|
|
80
|
+
*/
|
|
81
|
+
destroy({ identifier, draftId, overrides, }: DestroyDraftParams & Overrides): Promise<NylasBaseResponse>;
|
|
82
|
+
/**
|
|
83
|
+
* Send a Draft
|
|
84
|
+
* @return The sent draft
|
|
85
|
+
*/
|
|
86
|
+
send({ identifier, draftId, overrides, }: SendDraftParams & Overrides): Promise<NylasResponse<Draft>>;
|
|
87
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Overrides } from '../config.js';
|
|
2
|
-
import { CreateEventQueryParams, CreateEventRequest, DestroyEventQueryParams, Event, FindEventQueryParams, ListEventQueryParams, UpdateEventQueryParams, UpdateEventRequest } from '../models/events.js';
|
|
3
|
-
import {
|
|
2
|
+
import { CreateEventQueryParams, CreateEventRequest, DestroyEventQueryParams, Event, FindEventQueryParams, ListEventQueryParams, SendRsvpQueryParams, SendRsvpRequest, UpdateEventQueryParams, UpdateEventRequest } from '../models/events.js';
|
|
3
|
+
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
4
|
import { AsyncListResponse, Resource } from './resource.js';
|
|
5
5
|
/**
|
|
6
6
|
* @property eventId The id of the Event to retrieve.
|
|
@@ -52,6 +52,18 @@ interface DestroyEventParams {
|
|
|
52
52
|
eventId: string;
|
|
53
53
|
queryParams: DestroyEventQueryParams;
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* @property identifier The identifier of the grant to act upon
|
|
57
|
+
* @property eventId The id of the Event to update.
|
|
58
|
+
* @property queryParams The query parameters to include in the request
|
|
59
|
+
* @property requestBody The values to send the RSVP with
|
|
60
|
+
*/
|
|
61
|
+
interface SendRsvpParams {
|
|
62
|
+
identifier: string;
|
|
63
|
+
eventId: string;
|
|
64
|
+
queryParams: SendRsvpQueryParams;
|
|
65
|
+
requestBody: SendRsvpRequest;
|
|
66
|
+
}
|
|
55
67
|
/**
|
|
56
68
|
* Nylas Events API
|
|
57
69
|
*
|
|
@@ -82,6 +94,13 @@ export declare class Events extends Resource {
|
|
|
82
94
|
* Delete an Event
|
|
83
95
|
* @return The deletion response
|
|
84
96
|
*/
|
|
85
|
-
destroy({ identifier, eventId, queryParams, overrides, }: DestroyEventParams & Overrides): Promise<
|
|
97
|
+
destroy({ identifier, eventId, queryParams, overrides, }: DestroyEventParams & Overrides): Promise<NylasBaseResponse>;
|
|
98
|
+
/**
|
|
99
|
+
* Send RSVP. Allows users to respond to events they have been added to as an attendee.
|
|
100
|
+
* You cannot send RSVP as an event owner/organizer.
|
|
101
|
+
* You cannot directly update events as an invitee, since you are not the owner/organizer.
|
|
102
|
+
* @return The send-rsvp response
|
|
103
|
+
*/
|
|
104
|
+
sendRsvp({ identifier, eventId, requestBody, queryParams, overrides, }: SendRsvpParams & Overrides): Promise<NylasBaseResponse>;
|
|
86
105
|
}
|
|
87
106
|
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Overrides } from '../config.js';
|
|
2
|
+
import { Folder, CreateFolderRequest, UpdateFolderRequest } from '../models/folders.js';
|
|
3
|
+
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
|
+
import { Resource, AsyncListResponse } from './resource.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parameters for the {@link Folders.list} method
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
*/
|
|
9
|
+
interface ListFoldersParams {
|
|
10
|
+
identifier: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The parameters for the {@link Folders.find} method
|
|
14
|
+
* @property identifier The identifier of the grant to act upon
|
|
15
|
+
* @property folderId The id of the Folder to retrieve
|
|
16
|
+
*/
|
|
17
|
+
interface FindFolderParams {
|
|
18
|
+
identifier: string;
|
|
19
|
+
folderId: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The parameters for the {@link Folders.create} method
|
|
23
|
+
* @property identifier The identifier of the grant to act upon
|
|
24
|
+
* @property requestBody The request body to create a folder
|
|
25
|
+
*/
|
|
26
|
+
interface CreateFolderParams {
|
|
27
|
+
identifier: string;
|
|
28
|
+
requestBody: CreateFolderRequest;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The parameters for the {@link Folders.update} method
|
|
32
|
+
* @property identifier The identifier of the grant to act upon
|
|
33
|
+
* @property folderId The id of the Folder to update
|
|
34
|
+
* @property requestBody The request body to update a folder
|
|
35
|
+
*/
|
|
36
|
+
interface UpdateFolderParams {
|
|
37
|
+
identifier: string;
|
|
38
|
+
folderId: string;
|
|
39
|
+
requestBody: UpdateFolderRequest;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The parameters for the {@link Folders.destroy} method
|
|
43
|
+
* @property identifier The identifier of the grant to act upon
|
|
44
|
+
* @property folderId The id of the Folder to delete
|
|
45
|
+
*/
|
|
46
|
+
interface DestroyFolderParams {
|
|
47
|
+
identifier: string;
|
|
48
|
+
folderId: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Nylas Folder API
|
|
52
|
+
*
|
|
53
|
+
* Email providers use folders to store and organize email messages. Examples of common system folders include Inbox, Sent, Drafts, etc.
|
|
54
|
+
*
|
|
55
|
+
* If your team is migrating from Nylas APIv2, there were previously two separate endpoints for interacting with Folders (Microsoft) and Labels (Google).
|
|
56
|
+
* In Nylas API v3, these endpoints are consolidated under Folders.
|
|
57
|
+
*
|
|
58
|
+
* To simplify the developer experience, Nylas uses the same folders commands to manage both folders and labels, using the folder_id key to refer to the folder's ID on the provider.
|
|
59
|
+
* The API also exposes provider-specific fields such as background_color (Google only).
|
|
60
|
+
*
|
|
61
|
+
* Depending on the provider (Google, some IMAP providers, etc.), a message can be contained in more than one folder.
|
|
62
|
+
*/
|
|
63
|
+
export declare class Folders extends Resource {
|
|
64
|
+
/**
|
|
65
|
+
* Return all Folders
|
|
66
|
+
* @return A list of folders
|
|
67
|
+
*/
|
|
68
|
+
list({ identifier, overrides, }: ListFoldersParams & Overrides): AsyncListResponse<NylasListResponse<Folder>>;
|
|
69
|
+
/**
|
|
70
|
+
* Return a Folder
|
|
71
|
+
* @return The folder
|
|
72
|
+
*/
|
|
73
|
+
find({ identifier, folderId, overrides, }: FindFolderParams & Overrides): Promise<NylasResponse<Folder>>;
|
|
74
|
+
/**
|
|
75
|
+
* Create a Folder
|
|
76
|
+
* @return The created folder
|
|
77
|
+
*/
|
|
78
|
+
create({ identifier, requestBody, overrides, }: CreateFolderParams & Overrides): Promise<NylasResponse<Folder>>;
|
|
79
|
+
/**
|
|
80
|
+
* Update a Folder
|
|
81
|
+
* @return The updated Folder
|
|
82
|
+
*/
|
|
83
|
+
update({ identifier, folderId, requestBody, overrides, }: UpdateFolderParams & Overrides): Promise<NylasResponse<Folder>>;
|
|
84
|
+
/**
|
|
85
|
+
* Delete a Folder
|
|
86
|
+
* @return The deleted Folder
|
|
87
|
+
*/
|
|
88
|
+
destroy({ identifier, folderId, overrides, }: DestroyFolderParams & Overrides): Promise<NylasBaseResponse>;
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { Resource } from './resource.js';
|
|
2
2
|
import { Overrides } from '../config.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
|
+
import { Grant, ListGrantsQueryParams, UpdateGrantRequest } from '../models/grants.js';
|
|
5
5
|
/**
|
|
6
6
|
* @property grantId The id of the Grant to retrieve.
|
|
7
7
|
*/
|
|
8
8
|
interface FindGrantParams {
|
|
9
9
|
grantId: string;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* @property requestBody The values to create the Grant with.
|
|
13
|
-
*/
|
|
14
|
-
interface CreateGrantParams {
|
|
15
|
-
requestBody: CreateGrantRequest;
|
|
16
|
-
}
|
|
17
11
|
/**
|
|
18
12
|
* @property grantId The id of the Grant to update.
|
|
19
13
|
* @property requestBody The values to update the Grant with.
|
|
@@ -44,11 +38,6 @@ export declare class Grants extends Resource {
|
|
|
44
38
|
* @return The Grant
|
|
45
39
|
*/
|
|
46
40
|
find({ grantId, overrides, }: FindGrantParams & Overrides): Promise<NylasResponse<Grant>>;
|
|
47
|
-
/**
|
|
48
|
-
* Create a Grant
|
|
49
|
-
* @return The created Grant
|
|
50
|
-
*/
|
|
51
|
-
create({ requestBody, overrides, }: CreateGrantParams & Overrides): Promise<NylasResponse<Grant>>;
|
|
52
41
|
/**
|
|
53
42
|
* Update a Grant
|
|
54
43
|
* @return The updated Grant
|
|
@@ -58,6 +47,6 @@ export declare class Grants extends Resource {
|
|
|
58
47
|
* Delete a Grant
|
|
59
48
|
* @return The deletion response
|
|
60
49
|
*/
|
|
61
|
-
destroy({ grantId, overrides, }: DestroyGrantParams & Overrides): Promise<
|
|
50
|
+
destroy({ grantId, overrides, }: DestroyGrantParams & Overrides): Promise<NylasBaseResponse>;
|
|
62
51
|
}
|
|
63
52
|
export {};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
+
import { BaseCreateMessage, FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
import { SendMessageRequest, UpdateDraftRequest } from '../models/drafts.js';
|
|
6
|
+
import * as FormData from 'form-data';
|
|
7
|
+
import { SmartCompose } from './smartCompose.js';
|
|
8
|
+
import APIClient from '../apiClient.js';
|
|
9
|
+
/**
|
|
10
|
+
* The parameters for the {@link Messages.list} method
|
|
11
|
+
* @property identifier The identifier of the grant to act upon
|
|
12
|
+
* @property queryParams The query parameters to include in the request
|
|
13
|
+
*/
|
|
14
|
+
export interface ListMessagesParams {
|
|
15
|
+
identifier: string;
|
|
16
|
+
queryParams?: ListMessagesQueryParams;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The parameters for the {@link Messages.find} method
|
|
20
|
+
* @property identifier The identifier of the grant to act upon
|
|
21
|
+
* @property messageId The id of the message to retrieve.
|
|
22
|
+
* @property queryParams The query parameters to include in the request
|
|
23
|
+
*/
|
|
24
|
+
export interface FindMessageParams {
|
|
25
|
+
identifier: string;
|
|
26
|
+
messageId: string;
|
|
27
|
+
queryParams?: FindMessageQueryParams;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The parameters for the {@link Messages.update} method
|
|
31
|
+
* @property identifier The identifier of the grant to act upon
|
|
32
|
+
* @property messageId The id of the message to update
|
|
33
|
+
* @property requestBody The values to update the message with
|
|
34
|
+
*/
|
|
35
|
+
export interface UpdateMessageParams {
|
|
36
|
+
identifier: string;
|
|
37
|
+
messageId: string;
|
|
38
|
+
requestBody: UpdateMessageRequest;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The parameters for the {@link Messages.destroy} method
|
|
42
|
+
* @property identifier The identifier of the grant to act upon
|
|
43
|
+
* @property messageId The id of the message to delete
|
|
44
|
+
*/
|
|
45
|
+
export interface DestroyMessageParams {
|
|
46
|
+
identifier: string;
|
|
47
|
+
messageId: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The parameters for the {@link Messages.send} method
|
|
51
|
+
* @property identifier The identifier of the grant to act upon
|
|
52
|
+
* @property requestBody The message to send
|
|
53
|
+
*/
|
|
54
|
+
export interface SendMessageParams {
|
|
55
|
+
identifier: string;
|
|
56
|
+
requestBody: SendMessageRequest;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The parameters for the {@link Messages.listScheduledMessages} method
|
|
60
|
+
* @property identifier The identifier of the grant to act upon
|
|
61
|
+
*/
|
|
62
|
+
export interface ListScheduledMessagesParams {
|
|
63
|
+
identifier: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The parameters for the {@link Messages.findScheduledMessage} method
|
|
67
|
+
* @property identifier The identifier of the grant to act upon
|
|
68
|
+
* @property scheduleId The id of the scheduled message to retrieve.
|
|
69
|
+
*/
|
|
70
|
+
export interface FindScheduledMessageParams {
|
|
71
|
+
identifier: string;
|
|
72
|
+
scheduleId: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The parameters for the {@link Messages.stopScheduledMessage} method
|
|
76
|
+
* @property identifier The identifier of the grant to act upon
|
|
77
|
+
* @property scheduleId The id of the scheduled message to destroy.
|
|
78
|
+
*/
|
|
79
|
+
export type StopScheduledMessageParams = FindScheduledMessageParams;
|
|
80
|
+
/**
|
|
81
|
+
* Nylas Messages API
|
|
82
|
+
*
|
|
83
|
+
* The Nylas Messages API allows you to list, find, update, delete, schedule, and send messages on user accounts.
|
|
84
|
+
*/
|
|
85
|
+
export declare class Messages extends Resource {
|
|
86
|
+
smartCompose: SmartCompose;
|
|
87
|
+
constructor(apiClient: APIClient);
|
|
88
|
+
/**
|
|
89
|
+
* Return all Messages
|
|
90
|
+
* @return A list of messages
|
|
91
|
+
*/
|
|
92
|
+
list({ identifier, queryParams, overrides, }: ListMessagesParams & Overrides): AsyncListResponse<NylasListResponse<Message>>;
|
|
93
|
+
/**
|
|
94
|
+
* Return a Message
|
|
95
|
+
* @return The message
|
|
96
|
+
*/
|
|
97
|
+
find({ identifier, messageId, overrides, }: FindMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
98
|
+
/**
|
|
99
|
+
* Update a Message
|
|
100
|
+
* @return The updated message
|
|
101
|
+
*/
|
|
102
|
+
update({ identifier, messageId, requestBody, overrides, }: UpdateMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
103
|
+
/**
|
|
104
|
+
* Delete a Message
|
|
105
|
+
* @return The deleted message
|
|
106
|
+
*/
|
|
107
|
+
destroy({ identifier, messageId, overrides, }: DestroyMessageParams & Overrides): Promise<NylasBaseResponse>;
|
|
108
|
+
/**
|
|
109
|
+
* Send an email
|
|
110
|
+
* @return The sent message
|
|
111
|
+
*/
|
|
112
|
+
send({ identifier, requestBody, overrides, }: SendMessageParams & Overrides): Promise<NylasResponse<Message>>;
|
|
113
|
+
/**
|
|
114
|
+
* Retrieve your scheduled messages
|
|
115
|
+
* @return A list of scheduled messages
|
|
116
|
+
*/
|
|
117
|
+
listScheduledMessages({ identifier, overrides, }: ListScheduledMessagesParams & Overrides): Promise<NylasResponse<ScheduledMessagesList>>;
|
|
118
|
+
/**
|
|
119
|
+
* Retrieve a scheduled message
|
|
120
|
+
* @return The scheduled message
|
|
121
|
+
*/
|
|
122
|
+
findScheduledMessage({ identifier, scheduleId, overrides, }: FindScheduledMessageParams & Overrides): Promise<NylasResponse<ScheduledMessage>>;
|
|
123
|
+
/**
|
|
124
|
+
* Stop a scheduled message
|
|
125
|
+
* @return The confirmation of the stopped scheduled message
|
|
126
|
+
*/
|
|
127
|
+
stopScheduledMessage({ identifier, scheduleId, overrides, }: StopScheduledMessageParams & Overrides): Promise<NylasResponse<StopScheduledMessageResponse>>;
|
|
128
|
+
static _buildFormRequest(requestBody: BaseCreateMessage | UpdateDraftRequest): FormData;
|
|
129
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncListResponse, Resource } from './resource.js';
|
|
2
|
-
import {
|
|
2
|
+
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
3
3
|
import { CreateRedirectUriRequest, RedirectUri, UpdateRedirectUriRequest } from '../models/redirectUri.js';
|
|
4
4
|
import { Overrides } from '../config.js';
|
|
5
5
|
/**
|
|
@@ -58,6 +58,6 @@ export declare class RedirectUris extends Resource {
|
|
|
58
58
|
* Delete a Redirect URI
|
|
59
59
|
* @return The deleted Redirect URI
|
|
60
60
|
*/
|
|
61
|
-
destroy({ redirectUriId, overrides, }: DestroyRedirectUrisParams & Overrides): Promise<NylasResponse<
|
|
61
|
+
destroy({ redirectUriId, overrides, }: DestroyRedirectUrisParams & Overrides): Promise<NylasResponse<NylasBaseResponse>>;
|
|
62
62
|
}
|
|
63
63
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import APIClient from '../apiClient.js';
|
|
2
4
|
import { OverridableNylasConfig } from '../config.js';
|
|
3
5
|
import { ListQueryParams } from '../models/listQueryParams.js';
|
|
@@ -45,6 +47,8 @@ export declare class Resource {
|
|
|
45
47
|
protected _update<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
|
|
46
48
|
protected _updatePatch<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
|
|
47
49
|
protected _destroy<T>({ path, queryParams, overrides, }: DestroyParams): Promise<T>;
|
|
50
|
+
protected _getRaw({ path, queryParams, overrides, }: FindParams<void>): Promise<Buffer>;
|
|
51
|
+
protected _getStream({ path, queryParams, overrides, }: FindParams<void>): Promise<NodeJS.ReadableStream>;
|
|
48
52
|
}
|
|
49
53
|
type ListYieldReturn<T> = T & {
|
|
50
54
|
next: () => Promise<IteratorResult<T, undefined>>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Resource } from './resource.js';
|
|
2
|
+
import { ComposeMessageRequest, ComposeMessageResponse } from '../models/smartCompose.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasResponse } from '../models/response.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parameters for the {@link SmartCompose.composeMessage} method
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property requestBody The prompt that smart compose will use to generate a message suggestion
|
|
9
|
+
*/
|
|
10
|
+
export interface ComposeMessageParams {
|
|
11
|
+
identifier: string;
|
|
12
|
+
requestBody: ComposeMessageRequest;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The parameters for the {@link SmartCompose.composeMessageReply} method
|
|
16
|
+
* @property identifier The identifier of the grant to act upon
|
|
17
|
+
* @property messageId The id of the message to reply to
|
|
18
|
+
* @property requestBody The prompt that smart compose will use to generate a reply suggestion
|
|
19
|
+
*/
|
|
20
|
+
export interface ComposeMessageReplyParams {
|
|
21
|
+
identifier: string;
|
|
22
|
+
messageId: string;
|
|
23
|
+
requestBody: ComposeMessageRequest;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A collection of Smart Compose related API endpoints.
|
|
27
|
+
*
|
|
28
|
+
* These endpoints allow for the generation of message suggestions.
|
|
29
|
+
*/
|
|
30
|
+
export declare class SmartCompose extends Resource {
|
|
31
|
+
/**
|
|
32
|
+
* Compose a message
|
|
33
|
+
* @return The generated message
|
|
34
|
+
*/
|
|
35
|
+
composeMessage({ identifier, requestBody, overrides, }: ComposeMessageParams & Overrides): Promise<NylasResponse<ComposeMessageResponse>>;
|
|
36
|
+
/**
|
|
37
|
+
* Compose a message reply
|
|
38
|
+
* @return The generated message reply
|
|
39
|
+
*/
|
|
40
|
+
composeMessageReply({ identifier, messageId, requestBody, overrides, }: ComposeMessageReplyParams & Overrides): Promise<NylasResponse<ComposeMessageResponse>>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ListThreadsQueryParams, Thread, UpdateThreadRequest } from '../models/threads.js';
|
|
2
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
3
|
+
import { Overrides } from '../config.js';
|
|
4
|
+
import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
|
|
5
|
+
/**
|
|
6
|
+
* The parameters for the {@link Threads.list} method
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property queryParams The query parameters to include in the request
|
|
9
|
+
*/
|
|
10
|
+
export interface ListThreadsParams {
|
|
11
|
+
identifier: string;
|
|
12
|
+
queryParams?: ListThreadsQueryParams;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The parameters for the {@link Threads.find} method
|
|
16
|
+
* @property identifier The identifier of the grant to act upon
|
|
17
|
+
* @property threadId The id of the thread to retrieve.
|
|
18
|
+
* @property queryParams The query parameters to include in the request
|
|
19
|
+
*/
|
|
20
|
+
export interface FindThreadParams {
|
|
21
|
+
identifier: string;
|
|
22
|
+
threadId: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The parameters for the {@link Threads.update} method
|
|
26
|
+
* @property identifier The identifier of the grant to act upon
|
|
27
|
+
* @property threadId The id of the thread to update
|
|
28
|
+
* @property requestBody The values to update the thread with
|
|
29
|
+
*/
|
|
30
|
+
export interface UpdateThreadParams {
|
|
31
|
+
identifier: string;
|
|
32
|
+
threadId: string;
|
|
33
|
+
requestBody: UpdateThreadRequest;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The parameters for the {@link Threads.destroy} method
|
|
37
|
+
* @property identifier The identifier of the grant to act upon
|
|
38
|
+
* @property threadId The id of the thread to delete
|
|
39
|
+
*/
|
|
40
|
+
export interface DestroyThreadParams {
|
|
41
|
+
identifier: string;
|
|
42
|
+
threadId: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Nylas Threads API
|
|
46
|
+
*
|
|
47
|
+
* The Nylas Threads API allows you to list, find, update, and delete threads on user accounts.
|
|
48
|
+
*/
|
|
49
|
+
export declare class Threads extends Resource {
|
|
50
|
+
/**
|
|
51
|
+
* Return all Threads
|
|
52
|
+
* @return A list of threads
|
|
53
|
+
*/
|
|
54
|
+
list({ identifier, queryParams, overrides, }: ListThreadsParams & Overrides): AsyncListResponse<NylasListResponse<Thread>>;
|
|
55
|
+
/**
|
|
56
|
+
* Return a Thread
|
|
57
|
+
* @return The thread
|
|
58
|
+
*/
|
|
59
|
+
find({ identifier, threadId, overrides, }: FindThreadParams & Overrides): Promise<NylasResponse<Thread>>;
|
|
60
|
+
/**
|
|
61
|
+
* Update a Thread
|
|
62
|
+
* @return The updated thread
|
|
63
|
+
*/
|
|
64
|
+
update({ identifier, threadId, requestBody, overrides, }: UpdateThreadParams & Overrides): Promise<NylasResponse<Thread>>;
|
|
65
|
+
/**
|
|
66
|
+
* Delete a Thread
|
|
67
|
+
* @return The deleted thread
|
|
68
|
+
*/
|
|
69
|
+
destroy({ identifier, threadId, overrides, }: DestroyThreadParams & Overrides): Promise<NylasBaseResponse>;
|
|
70
|
+
}
|
|
@@ -48,7 +48,7 @@ export declare class Webhooks extends Resource {
|
|
|
48
48
|
* Create a webhook destination
|
|
49
49
|
* @returns The created webhook destination
|
|
50
50
|
*/
|
|
51
|
-
create({ requestBody, overrides, }: CreateWebhookParams & Overrides): Promise<NylasResponse<
|
|
51
|
+
create({ requestBody, overrides, }: CreateWebhookParams & Overrides): Promise<NylasResponse<WebhookWithSecret>>;
|
|
52
52
|
/**
|
|
53
53
|
* Update a webhook destination
|
|
54
54
|
* @returns The updated webhook destination
|
package/lib/types/utils.d.ts
CHANGED
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.0.0-beta.
|
|
1
|
+
export declare const SDK_VERSION = "7.0.0-beta.4";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nylas",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.4",
|
|
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",
|
|
@@ -40,15 +40,16 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"change-case": "^4.1.2",
|
|
42
42
|
"eslint-plugin-import": "^2.28.1",
|
|
43
|
+
"form-data": "^4.0.0",
|
|
44
|
+
"mime-types": "^2.1.35",
|
|
43
45
|
"node-fetch": "^2.6.12",
|
|
44
|
-
"sha256": "^0.2.0",
|
|
45
46
|
"uuid": "^8.3.2"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@babel/core": "^7.3.3",
|
|
49
50
|
"@types/jest": "^29.5.2",
|
|
51
|
+
"@types/mime-types": "^2.1.2",
|
|
50
52
|
"@types/node-fetch": "^2.6.4",
|
|
51
|
-
"@types/sha256": "^0.2.0",
|
|
52
53
|
"@types/uuid": "^8.3.4",
|
|
53
54
|
"@typescript-eslint/eslint-plugin": "^2.25.0",
|
|
54
55
|
"@typescript-eslint/parser": "^2.25.0",
|
|
@@ -56,6 +57,7 @@
|
|
|
56
57
|
"eslint-config-prettier": "^4.0.0",
|
|
57
58
|
"eslint-plugin-custom-rules": "^0.0.0",
|
|
58
59
|
"eslint-plugin-prettier": "^3.0.1",
|
|
60
|
+
"eslint-plugin-import": "^2.28.1",
|
|
59
61
|
"jest": "^29.6.1",
|
|
60
62
|
"prettier": "^1.19.1",
|
|
61
63
|
"ts-jest": "^29.1.1",
|