nylas 8.0.5 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -46
- package/lib/cjs/models/agentLists.js +2 -0
- package/lib/cjs/models/index.js +3 -0
- package/lib/cjs/models/policies.js +2 -0
- package/lib/cjs/models/rules.js +2 -0
- package/lib/cjs/nylas.js +6 -0
- package/lib/cjs/resources/agentLists.js +99 -0
- package/lib/cjs/resources/attachments.js +28 -0
- package/lib/cjs/resources/messages.js +1 -1
- package/lib/cjs/resources/policies.js +66 -0
- package/lib/cjs/resources/rules.js +79 -0
- package/lib/cjs/utils.js +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/models/agentLists.js +1 -0
- package/lib/esm/models/index.js +3 -0
- package/lib/esm/models/policies.js +1 -0
- package/lib/esm/models/rules.js +1 -0
- package/lib/esm/nylas.js +6 -0
- package/lib/esm/resources/agentLists.js +95 -0
- package/lib/esm/resources/attachments.js +28 -0
- package/lib/esm/resources/messages.js +1 -1
- package/lib/esm/resources/policies.js +62 -0
- package/lib/esm/resources/rules.js +75 -0
- package/lib/esm/utils.js +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/models/agentLists.d.ts +123 -0
- package/lib/types/models/attachments.d.ts +81 -0
- package/lib/types/models/auth.d.ts +1 -1
- package/lib/types/models/grants.d.ts +37 -2
- package/lib/types/models/index.d.ts +3 -0
- package/lib/types/models/policies.d.ts +167 -0
- package/lib/types/models/rules.d.ts +318 -0
- package/lib/types/nylas.d.ts +15 -0
- package/lib/types/resources/agentLists.d.ts +108 -0
- package/lib/types/resources/attachments.d.ts +31 -1
- package/lib/types/resources/policies.d.ts +69 -0
- package/lib/types/resources/rules.d.ts +82 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { makePathParams } from '../utils.js';
|
|
2
|
+
import { Resource } from './resource.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nylas Agent Account Lists API
|
|
5
|
+
*
|
|
6
|
+
* Lists manage values that rules can reference using the in_list operator.
|
|
7
|
+
*/
|
|
8
|
+
export class AgentLists extends Resource {
|
|
9
|
+
/**
|
|
10
|
+
* Return all lists.
|
|
11
|
+
* @return The list of Agent Account lists.
|
|
12
|
+
*/
|
|
13
|
+
list({ queryParams, overrides, } = {}) {
|
|
14
|
+
return super._list({
|
|
15
|
+
queryParams,
|
|
16
|
+
path: makePathParams('/v3/lists', {}),
|
|
17
|
+
overrides,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Return a list.
|
|
22
|
+
* @return The Agent Account list.
|
|
23
|
+
*/
|
|
24
|
+
find({ listId, overrides, }) {
|
|
25
|
+
return super._find({
|
|
26
|
+
path: makePathParams('/v3/lists/{listId}', { listId }),
|
|
27
|
+
overrides,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a list.
|
|
32
|
+
* @return The created Agent Account list.
|
|
33
|
+
*/
|
|
34
|
+
create({ requestBody, overrides, }) {
|
|
35
|
+
return super._create({
|
|
36
|
+
path: makePathParams('/v3/lists', {}),
|
|
37
|
+
requestBody,
|
|
38
|
+
overrides,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Update a list.
|
|
43
|
+
* @return The updated Agent Account list.
|
|
44
|
+
*/
|
|
45
|
+
update({ listId, requestBody, overrides, }) {
|
|
46
|
+
return super._update({
|
|
47
|
+
path: makePathParams('/v3/lists/{listId}', { listId }),
|
|
48
|
+
requestBody,
|
|
49
|
+
overrides,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Delete a list.
|
|
54
|
+
* @return The deletion response.
|
|
55
|
+
*/
|
|
56
|
+
destroy({ listId, overrides, }) {
|
|
57
|
+
return super._destroy({
|
|
58
|
+
path: makePathParams('/v3/lists/{listId}', { listId }),
|
|
59
|
+
overrides,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Return items in a list.
|
|
64
|
+
* @return The list items.
|
|
65
|
+
*/
|
|
66
|
+
listItems({ listId, queryParams, overrides, }) {
|
|
67
|
+
return super._list({
|
|
68
|
+
queryParams,
|
|
69
|
+
path: makePathParams('/v3/lists/{listId}/items', { listId }),
|
|
70
|
+
overrides,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Add items to a list.
|
|
75
|
+
* @return The updated Agent Account list.
|
|
76
|
+
*/
|
|
77
|
+
addItems({ listId, requestBody, overrides, }) {
|
|
78
|
+
return super._create({
|
|
79
|
+
path: makePathParams('/v3/lists/{listId}/items', { listId }),
|
|
80
|
+
requestBody,
|
|
81
|
+
overrides,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove items from a list.
|
|
86
|
+
* @return The updated Agent Account list.
|
|
87
|
+
*/
|
|
88
|
+
removeItems({ listId, requestBody, overrides, }) {
|
|
89
|
+
return super._destroy({
|
|
90
|
+
path: makePathParams('/v3/lists/{listId}/items', { listId }),
|
|
91
|
+
requestBody,
|
|
92
|
+
overrides,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -51,4 +51,32 @@ export class Attachments extends Resource {
|
|
|
51
51
|
overrides,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a resumable upload session for a large attachment (up to 150 MB).
|
|
56
|
+
* Upload bytes to the returned `url`, then call {@link Attachments.completeUploadSession}.
|
|
57
|
+
*
|
|
58
|
+
* @see https://developer.nylas.com/docs/v3/email/send-large-attachments/
|
|
59
|
+
* @return Session details including `attachmentId` and pre-signed `url`
|
|
60
|
+
*/
|
|
61
|
+
createUploadSession({ identifier, requestBody, overrides, }) {
|
|
62
|
+
return super._create({
|
|
63
|
+
path: makePathParams('/v3/grants/{identifier}/attachment-uploads', {
|
|
64
|
+
identifier,
|
|
65
|
+
}),
|
|
66
|
+
requestBody,
|
|
67
|
+
overrides,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Complete an upload session after the file has been uploaded to the pre-signed URL.
|
|
72
|
+
*
|
|
73
|
+
* @see https://developer.nylas.com/docs/v3/email/send-large-attachments/
|
|
74
|
+
*/
|
|
75
|
+
completeUploadSession({ identifier, attachmentId, overrides, }) {
|
|
76
|
+
return super._create({
|
|
77
|
+
path: makePathParams('/v3/grants/{identifier}/attachment-uploads/{attachmentId}/complete', { identifier, attachmentId }),
|
|
78
|
+
requestBody: {},
|
|
79
|
+
overrides,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
54
82
|
}
|
|
@@ -159,7 +159,7 @@ export class Messages extends Resource {
|
|
|
159
159
|
...requestBody,
|
|
160
160
|
attachments: undefined,
|
|
161
161
|
};
|
|
162
|
-
form.append('message', JSON.stringify(objKeysToSnakeCase(messagePayload)));
|
|
162
|
+
form.append('message', JSON.stringify(objKeysToSnakeCase(messagePayload, ['metadata'])));
|
|
163
163
|
// Add a separate form field for each attachment
|
|
164
164
|
if (requestBody.attachments && requestBody.attachments.length > 0) {
|
|
165
165
|
requestBody.attachments.map((attachment, index) => {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { makePathParams } from '../utils.js';
|
|
2
|
+
import { Resource } from './resource.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nylas Agent Account Policies API
|
|
5
|
+
*
|
|
6
|
+
* Policies define limits, spam settings, options, and linked rules for Agent Accounts.
|
|
7
|
+
*/
|
|
8
|
+
export class Policies extends Resource {
|
|
9
|
+
/**
|
|
10
|
+
* Return all policies.
|
|
11
|
+
* @return The list of policies.
|
|
12
|
+
*/
|
|
13
|
+
list({ queryParams, overrides, } = {}) {
|
|
14
|
+
return super._list({
|
|
15
|
+
queryParams,
|
|
16
|
+
path: makePathParams('/v3/policies', {}),
|
|
17
|
+
overrides,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Return a policy.
|
|
22
|
+
* @return The policy.
|
|
23
|
+
*/
|
|
24
|
+
find({ policyId, overrides, }) {
|
|
25
|
+
return super._find({
|
|
26
|
+
path: makePathParams('/v3/policies/{policyId}', { policyId }),
|
|
27
|
+
overrides,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a policy.
|
|
32
|
+
* @return The created policy.
|
|
33
|
+
*/
|
|
34
|
+
create({ requestBody, overrides, }) {
|
|
35
|
+
return super._create({
|
|
36
|
+
path: makePathParams('/v3/policies', {}),
|
|
37
|
+
requestBody,
|
|
38
|
+
overrides,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Update a policy.
|
|
43
|
+
* @return The updated policy.
|
|
44
|
+
*/
|
|
45
|
+
update({ policyId, requestBody, overrides, }) {
|
|
46
|
+
return super._update({
|
|
47
|
+
path: makePathParams('/v3/policies/{policyId}', { policyId }),
|
|
48
|
+
requestBody,
|
|
49
|
+
overrides,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Delete a policy.
|
|
54
|
+
* @return The deletion response.
|
|
55
|
+
*/
|
|
56
|
+
destroy({ policyId, overrides, }) {
|
|
57
|
+
return super._destroy({
|
|
58
|
+
path: makePathParams('/v3/policies/{policyId}', { policyId }),
|
|
59
|
+
overrides,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { makePathParams } from '../utils.js';
|
|
2
|
+
import { Resource } from './resource.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nylas Agent Account Rules API
|
|
5
|
+
*
|
|
6
|
+
* Rules define inbound and outbound filtering logic for Agent Accounts.
|
|
7
|
+
*/
|
|
8
|
+
export class Rules extends Resource {
|
|
9
|
+
/**
|
|
10
|
+
* Return all rules.
|
|
11
|
+
* @return The list of rules.
|
|
12
|
+
*/
|
|
13
|
+
list({ queryParams, overrides, } = {}) {
|
|
14
|
+
return super._list({
|
|
15
|
+
queryParams,
|
|
16
|
+
path: makePathParams('/v3/rules', {}),
|
|
17
|
+
overrides,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Return a rule.
|
|
22
|
+
* @return The rule.
|
|
23
|
+
*/
|
|
24
|
+
find({ ruleId, overrides, }) {
|
|
25
|
+
return super._find({
|
|
26
|
+
path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
|
|
27
|
+
overrides,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create a rule.
|
|
32
|
+
* @return The created rule.
|
|
33
|
+
*/
|
|
34
|
+
create({ requestBody, overrides, }) {
|
|
35
|
+
return super._create({
|
|
36
|
+
path: makePathParams('/v3/rules', {}),
|
|
37
|
+
requestBody,
|
|
38
|
+
overrides,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Update a rule.
|
|
43
|
+
* @return The updated rule.
|
|
44
|
+
*/
|
|
45
|
+
update({ ruleId, requestBody, overrides, }) {
|
|
46
|
+
return super._update({
|
|
47
|
+
path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
|
|
48
|
+
requestBody,
|
|
49
|
+
overrides,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Delete a rule.
|
|
54
|
+
* @return The deletion response.
|
|
55
|
+
*/
|
|
56
|
+
destroy({ ruleId, overrides, }) {
|
|
57
|
+
return super._destroy({
|
|
58
|
+
path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
|
|
59
|
+
overrides,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Return rule evaluation records for a grant.
|
|
64
|
+
* @return The list of rule evaluation records.
|
|
65
|
+
*/
|
|
66
|
+
listEvaluations({ identifier, queryParams, overrides, }) {
|
|
67
|
+
return super._list({
|
|
68
|
+
queryParams,
|
|
69
|
+
path: makePathParams('/v3/grants/{identifier}/rule-evaluations', {
|
|
70
|
+
identifier,
|
|
71
|
+
}),
|
|
72
|
+
overrides,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
package/lib/esm/utils.js
CHANGED
|
@@ -204,7 +204,7 @@ export function calculateTotalPayloadSize(requestBody) {
|
|
|
204
204
|
...requestBody,
|
|
205
205
|
attachments: undefined,
|
|
206
206
|
};
|
|
207
|
-
const messagePayloadString = JSON.stringify(objKeysToSnakeCase(messagePayloadWithoutAttachments));
|
|
207
|
+
const messagePayloadString = JSON.stringify(objKeysToSnakeCase(messagePayloadWithoutAttachments, ['metadata']));
|
|
208
208
|
totalSize += Buffer.byteLength(messagePayloadString, 'utf8');
|
|
209
209
|
// Add attachment sizes
|
|
210
210
|
const attachmentSize = requestBody.attachments?.reduce((total, attachment) => {
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated by scripts/exportVersion.js
|
|
2
|
-
export const SDK_VERSION = '8.
|
|
2
|
+
export const SDK_VERSION = '8.1.1';
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type for values a Nylas Agent Account list can hold.
|
|
4
|
+
*/
|
|
5
|
+
export type AgentListType = 'domain' | 'tld' | 'address';
|
|
6
|
+
/**
|
|
7
|
+
* Interface representing a Nylas Agent Account list.
|
|
8
|
+
*/
|
|
9
|
+
export interface AgentList {
|
|
10
|
+
/**
|
|
11
|
+
* Globally unique identifier for the list.
|
|
12
|
+
*/
|
|
13
|
+
id: string;
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable name for the list.
|
|
16
|
+
*/
|
|
17
|
+
name: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional description of the list's purpose.
|
|
20
|
+
*/
|
|
21
|
+
description?: string;
|
|
22
|
+
/**
|
|
23
|
+
* The kind of values the list holds.
|
|
24
|
+
*/
|
|
25
|
+
type: AgentListType;
|
|
26
|
+
/**
|
|
27
|
+
* Number of items currently in the list.
|
|
28
|
+
*/
|
|
29
|
+
itemsCount?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The ID of the application that owns the list.
|
|
32
|
+
*/
|
|
33
|
+
applicationId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The ID of the Nylas organization that owns the list.
|
|
36
|
+
*/
|
|
37
|
+
organizationId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Unix timestamp when the list was created.
|
|
40
|
+
*/
|
|
41
|
+
createdAt?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Unix timestamp when the list was last updated.
|
|
44
|
+
*/
|
|
45
|
+
updatedAt?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Interface representing an item in a Nylas Agent Account list.
|
|
49
|
+
*/
|
|
50
|
+
export interface AgentListItem {
|
|
51
|
+
/**
|
|
52
|
+
* Globally unique identifier for the list item.
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
/**
|
|
56
|
+
* The ID of the list that contains the item.
|
|
57
|
+
*/
|
|
58
|
+
listId: string;
|
|
59
|
+
/**
|
|
60
|
+
* The normalized list item value.
|
|
61
|
+
*/
|
|
62
|
+
value: string;
|
|
63
|
+
/**
|
|
64
|
+
* Unix timestamp when the item was added to the list.
|
|
65
|
+
*/
|
|
66
|
+
createdAt?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Interface representing a request to create a Nylas Agent Account list.
|
|
70
|
+
*/
|
|
71
|
+
export interface CreateAgentListRequest {
|
|
72
|
+
/**
|
|
73
|
+
* Human-readable name for the list.
|
|
74
|
+
*/
|
|
75
|
+
name: string;
|
|
76
|
+
/**
|
|
77
|
+
* Optional description of the list's purpose.
|
|
78
|
+
*/
|
|
79
|
+
description?: string;
|
|
80
|
+
/**
|
|
81
|
+
* The kind of values the list holds.
|
|
82
|
+
*/
|
|
83
|
+
type: AgentListType;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Interface representing a request to update a Nylas Agent Account list.
|
|
87
|
+
*/
|
|
88
|
+
export interface UpdateAgentListRequest {
|
|
89
|
+
/**
|
|
90
|
+
* Human-readable name for the list.
|
|
91
|
+
*/
|
|
92
|
+
name?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Optional description of the list's purpose.
|
|
95
|
+
*/
|
|
96
|
+
description?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Interface representing a request to add items to a Nylas Agent Account list.
|
|
100
|
+
*/
|
|
101
|
+
export interface AddAgentListItemsRequest {
|
|
102
|
+
/**
|
|
103
|
+
* Values to add to the list.
|
|
104
|
+
*/
|
|
105
|
+
items: string[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Interface representing a request to remove items from a Nylas Agent Account list.
|
|
109
|
+
*/
|
|
110
|
+
export interface RemoveAgentListItemsRequest {
|
|
111
|
+
/**
|
|
112
|
+
* Values to remove from the list.
|
|
113
|
+
*/
|
|
114
|
+
items: string[];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Interface representing query parameters for listing Agent Account lists.
|
|
118
|
+
*/
|
|
119
|
+
export type ListAgentListsQueryParams = ListQueryParams;
|
|
120
|
+
/**
|
|
121
|
+
* Interface representing query parameters for listing Agent Account list items.
|
|
122
|
+
*/
|
|
123
|
+
export type ListAgentListItemsQueryParams = ListQueryParams;
|
|
@@ -65,4 +65,85 @@ export interface FindAttachmentQueryParams {
|
|
|
65
65
|
* Interface representing of the query parameters for downloading an attachment.
|
|
66
66
|
*/
|
|
67
67
|
export type DownloadAttachmentQueryParams = FindAttachmentQueryParams;
|
|
68
|
+
/**
|
|
69
|
+
* Status of a large-attachment upload session.
|
|
70
|
+
* @see https://developer.nylas.com/docs/v3/email/send-large-attachments/
|
|
71
|
+
*/
|
|
72
|
+
export type AttachmentUploadSessionStatusType = 'uploading' | 'ready' | 'failed' | 'expired';
|
|
73
|
+
/**
|
|
74
|
+
* Request body for creating a large-attachment upload session.
|
|
75
|
+
* Sent to the API as snake_case (`content_type`, etc.).
|
|
76
|
+
*/
|
|
77
|
+
export interface CreateAttachmentUploadSessionRequest {
|
|
78
|
+
/**
|
|
79
|
+
* The name of the file as it will appear in the email.
|
|
80
|
+
*/
|
|
81
|
+
filename: string;
|
|
82
|
+
/**
|
|
83
|
+
* MIME type of the file (for example, `application/pdf`).
|
|
84
|
+
*/
|
|
85
|
+
contentType: string;
|
|
86
|
+
/**
|
|
87
|
+
* Expected file size in bytes. Recommended — Nylas validates the upload matches at completion.
|
|
88
|
+
* Maximum: 157286400 (150 MB).
|
|
89
|
+
*/
|
|
90
|
+
size?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Upload session returned when creating a large-attachment upload session.
|
|
94
|
+
* Corresponds to the `data` object in the create-session API response.
|
|
95
|
+
*/
|
|
96
|
+
export interface AttachmentUploadSession {
|
|
97
|
+
/**
|
|
98
|
+
* Unique identifier for the upload session. Use when completing the session and when referencing the attachment in send or draft.
|
|
99
|
+
*/
|
|
100
|
+
attachmentId: string;
|
|
101
|
+
/**
|
|
102
|
+
* HTTP method to use when uploading to {@link AttachmentUploadSession.url}. Always `PUT`.
|
|
103
|
+
*/
|
|
104
|
+
method: string;
|
|
105
|
+
/**
|
|
106
|
+
* Pre-signed URL to upload file bytes (no Nylas auth header on this request).
|
|
107
|
+
*/
|
|
108
|
+
url: string;
|
|
109
|
+
/**
|
|
110
|
+
* Headers to include when uploading to {@link AttachmentUploadSession.url}.
|
|
111
|
+
*/
|
|
112
|
+
headers: Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* When the upload session expires (RFC 3339).
|
|
115
|
+
*/
|
|
116
|
+
expiresAt: string;
|
|
117
|
+
/**
|
|
118
|
+
* Maximum allowed file size in bytes.
|
|
119
|
+
*/
|
|
120
|
+
maxSize: number;
|
|
121
|
+
/**
|
|
122
|
+
* Expected file size in bytes, echoing the request. `0` if `size` was omitted on creation.
|
|
123
|
+
*/
|
|
124
|
+
size: number;
|
|
125
|
+
/**
|
|
126
|
+
* MIME type of the file.
|
|
127
|
+
*/
|
|
128
|
+
contentType: string;
|
|
129
|
+
/**
|
|
130
|
+
* Name of the file.
|
|
131
|
+
*/
|
|
132
|
+
filename: string;
|
|
133
|
+
/**
|
|
134
|
+
* The grant ID the upload session belongs to.
|
|
135
|
+
*/
|
|
136
|
+
grantId: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Result of completing an upload session (`data` in the complete API response).
|
|
140
|
+
*/
|
|
141
|
+
export interface AttachmentUploadSessionComplete {
|
|
142
|
+
attachmentId: string;
|
|
143
|
+
grantId: string;
|
|
144
|
+
/**
|
|
145
|
+
* After successful completion, typically `ready`.
|
|
146
|
+
*/
|
|
147
|
+
status: AttachmentUploadSessionStatusType;
|
|
148
|
+
}
|
|
68
149
|
export {};
|
|
@@ -5,7 +5,7 @@ type AccessType = 'online' | 'offline';
|
|
|
5
5
|
/**
|
|
6
6
|
* Type for the different OAuth providers Nylas supports.
|
|
7
7
|
*/
|
|
8
|
-
export type Provider = 'google' | 'imap' | 'microsoft' | 'icloud' | 'virtual-calendar' | 'ews' | 'zoom';
|
|
8
|
+
export type Provider = 'google' | 'imap' | 'microsoft' | 'icloud' | 'virtual-calendar' | 'ews' | 'zoom' | 'nylas';
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for generating a URL for OAuth 2.0 authentication.
|
|
11
11
|
*/
|
|
@@ -64,11 +64,11 @@ export interface Grant {
|
|
|
64
64
|
/**
|
|
65
65
|
* Interface representing a request to create a grant.
|
|
66
66
|
*/
|
|
67
|
-
export interface
|
|
67
|
+
export interface CreateCustomAuthenticationGrantRequest {
|
|
68
68
|
/**
|
|
69
69
|
* OAuth provider
|
|
70
70
|
*/
|
|
71
|
-
provider: Provider
|
|
71
|
+
provider: Exclude<Provider, 'nylas'>;
|
|
72
72
|
/**
|
|
73
73
|
* Settings required by provider.
|
|
74
74
|
* Can include 'credentialId' to specify which credential to use for authentication.
|
|
@@ -90,6 +90,41 @@ export interface CreateGrantRequest {
|
|
|
90
90
|
*/
|
|
91
91
|
scope?: string[];
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Interface representing settings to create a Nylas Agent Account grant.
|
|
95
|
+
*/
|
|
96
|
+
export interface CreateAgentAccountSettings {
|
|
97
|
+
/**
|
|
98
|
+
* The Agent Account email address.
|
|
99
|
+
*/
|
|
100
|
+
email: string;
|
|
101
|
+
/**
|
|
102
|
+
* A policy to apply to this grant.
|
|
103
|
+
*/
|
|
104
|
+
policyId?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Password for IMAP and SMTP-submission access.
|
|
107
|
+
*/
|
|
108
|
+
appPassword?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Interface representing a request to create a Nylas Agent Account grant.
|
|
112
|
+
*/
|
|
113
|
+
export interface CreateAgentAccountRequest {
|
|
114
|
+
/**
|
|
115
|
+
* The Nylas provider provisions an Agent Account.
|
|
116
|
+
*/
|
|
117
|
+
provider: 'nylas';
|
|
118
|
+
/**
|
|
119
|
+
* Settings required to provision the Agent Account.
|
|
120
|
+
*/
|
|
121
|
+
settings: CreateAgentAccountSettings;
|
|
122
|
+
/**
|
|
123
|
+
* Optional state value to return to developer's website after authentication flow is completed.
|
|
124
|
+
*/
|
|
125
|
+
state?: string;
|
|
126
|
+
}
|
|
127
|
+
export type CreateGrantRequest = CreateCustomAuthenticationGrantRequest | CreateAgentAccountRequest;
|
|
93
128
|
/**
|
|
94
129
|
* Interface representing a request to update a grant.
|
|
95
130
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './agentLists.js';
|
|
1
2
|
export * from './applicationDetails.js';
|
|
2
3
|
export * from './attachments.js';
|
|
3
4
|
export * from './auth.js';
|
|
@@ -15,8 +16,10 @@ export * from './grants.js';
|
|
|
15
16
|
export * from './listQueryParams.js';
|
|
16
17
|
export * from './messages.js';
|
|
17
18
|
export * from './notetakers.js';
|
|
19
|
+
export * from './policies.js';
|
|
18
20
|
export * from './redirectUri.js';
|
|
19
21
|
export * from './response.js';
|
|
22
|
+
export * from './rules.js';
|
|
20
23
|
export * from './scheduler.js';
|
|
21
24
|
export * from './smartCompose.js';
|
|
22
25
|
export * from './threads.js';
|