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,30 @@
|
|
|
1
|
+
import { Resource } from './resource.js';
|
|
2
|
+
/**
|
|
3
|
+
* A collection of Smart Compose related API endpoints.
|
|
4
|
+
*
|
|
5
|
+
* These endpoints allow for the generation of message suggestions.
|
|
6
|
+
*/
|
|
7
|
+
export class SmartCompose extends Resource {
|
|
8
|
+
/**
|
|
9
|
+
* Compose a message
|
|
10
|
+
* @return The generated message
|
|
11
|
+
*/
|
|
12
|
+
composeMessage({ identifier, requestBody, overrides, }) {
|
|
13
|
+
return super._create({
|
|
14
|
+
path: `/v3/grants/${identifier}/messages/smart-compose`,
|
|
15
|
+
requestBody,
|
|
16
|
+
overrides,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compose a message reply
|
|
21
|
+
* @return The generated message reply
|
|
22
|
+
*/
|
|
23
|
+
composeMessageReply({ identifier, messageId, requestBody, overrides, }) {
|
|
24
|
+
return super._create({
|
|
25
|
+
path: `/v3/grants/${identifier}/messages/${messageId}/smart-compose`,
|
|
26
|
+
requestBody,
|
|
27
|
+
overrides,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Resource } from './resource.js';
|
|
2
|
+
/**
|
|
3
|
+
* Nylas Threads API
|
|
4
|
+
*
|
|
5
|
+
* The Nylas Threads API allows you to list, find, update, and delete threads on user accounts.
|
|
6
|
+
*/
|
|
7
|
+
export class Threads extends Resource {
|
|
8
|
+
/**
|
|
9
|
+
* Return all Threads
|
|
10
|
+
* @return A list of threads
|
|
11
|
+
*/
|
|
12
|
+
list({ identifier, queryParams, overrides, }) {
|
|
13
|
+
return super._list({
|
|
14
|
+
queryParams,
|
|
15
|
+
overrides,
|
|
16
|
+
path: `/v3/grants/${identifier}/threads`,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Return a Thread
|
|
21
|
+
* @return The thread
|
|
22
|
+
*/
|
|
23
|
+
find({ identifier, threadId, overrides, }) {
|
|
24
|
+
return super._find({
|
|
25
|
+
path: `/v3/grants/${identifier}/threads/${threadId}`,
|
|
26
|
+
overrides,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Update a Thread
|
|
31
|
+
* @return The updated thread
|
|
32
|
+
*/
|
|
33
|
+
update({ identifier, threadId, requestBody, overrides, }) {
|
|
34
|
+
return super._update({
|
|
35
|
+
path: `/v3/grants/${identifier}/threads/${threadId}`,
|
|
36
|
+
requestBody,
|
|
37
|
+
overrides,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Delete a Thread
|
|
42
|
+
* @return The deleted thread
|
|
43
|
+
*/
|
|
44
|
+
destroy({ identifier, threadId, overrides, }) {
|
|
45
|
+
return super._destroy({
|
|
46
|
+
path: `/v3/grants/${identifier}/threads/${threadId}`,
|
|
47
|
+
overrides,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
package/lib/esm/utils.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { camelCase, snakeCase } from 'change-case';
|
|
2
|
+
import * as fs from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import * as mime from 'mime-types';
|
|
5
|
+
export function createFileRequestBuilder(filePath) {
|
|
6
|
+
const stats = fs.statSync(filePath);
|
|
7
|
+
const filename = path.basename(filePath);
|
|
8
|
+
const contentType = mime.lookup(filePath) || 'application/octet-stream';
|
|
9
|
+
const content = fs.createReadStream(filePath);
|
|
10
|
+
return {
|
|
11
|
+
filename,
|
|
12
|
+
contentType,
|
|
13
|
+
content,
|
|
14
|
+
size: stats.size,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
2
17
|
/**
|
|
3
18
|
* A utility function that recursively converts all keys in an object to a given case.
|
|
4
19
|
* @param obj The object to convert
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated by scripts/exportVersion.js
|
|
2
|
-
export const SDK_VERSION = '7.0.0-beta.
|
|
2
|
+
export const SDK_VERSION = '7.0.0-beta.4';
|
package/lib/types/apiClient.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
1
3
|
import { Request, Response } from 'node-fetch';
|
|
2
4
|
import { NylasConfig, OverridableNylasConfig } from './config.js';
|
|
5
|
+
import * as FormData from 'form-data';
|
|
3
6
|
/**
|
|
4
7
|
* Options for a request to the Nylas API
|
|
5
8
|
* @property path The path to the API endpoint
|
|
@@ -16,6 +19,7 @@ export interface RequestOptionsParams {
|
|
|
16
19
|
headers?: Record<string, string>;
|
|
17
20
|
queryParams?: Record<string, any>;
|
|
18
21
|
body?: any;
|
|
22
|
+
form?: FormData;
|
|
19
23
|
overrides?: OverridableNylasConfig;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
@@ -33,7 +37,7 @@ interface RequestOptions {
|
|
|
33
37
|
method: string;
|
|
34
38
|
headers: Record<string, string>;
|
|
35
39
|
url: URL;
|
|
36
|
-
body?:
|
|
40
|
+
body?: any;
|
|
37
41
|
overrides?: Partial<NylasConfig>;
|
|
38
42
|
}
|
|
39
43
|
/**
|
|
@@ -57,9 +61,12 @@ export default class APIClient {
|
|
|
57
61
|
private setRequestUrl;
|
|
58
62
|
private setQueryStrings;
|
|
59
63
|
private setRequestHeaders;
|
|
64
|
+
private sendRequest;
|
|
60
65
|
requestOptions(optionParams: RequestOptionsParams): RequestOptions;
|
|
61
66
|
newRequest(options: RequestOptionsParams): Request;
|
|
62
67
|
requestWithResponse<T>(response: Response): Promise<T>;
|
|
63
68
|
request<T>(options: RequestOptionsParams): Promise<T>;
|
|
69
|
+
requestRaw(options: RequestOptionsParams): Promise<Buffer>;
|
|
70
|
+
requestStream(options: RequestOptionsParams): Promise<NodeJS.ReadableStream>;
|
|
64
71
|
}
|
|
65
72
|
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface of an attachment object from Nylas.
|
|
3
|
+
*/
|
|
4
|
+
export interface Attachment {
|
|
5
|
+
/**
|
|
6
|
+
* A globally unique object identifier.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Attachment's name.
|
|
11
|
+
*/
|
|
12
|
+
filename: string;
|
|
13
|
+
/**
|
|
14
|
+
* Attachment's content type.
|
|
15
|
+
*/
|
|
16
|
+
contentType: string;
|
|
17
|
+
/**
|
|
18
|
+
* Grant ID of the Nylas account.
|
|
19
|
+
*/
|
|
20
|
+
grantId: string;
|
|
21
|
+
/**
|
|
22
|
+
* If it's an inline attachment.
|
|
23
|
+
*/
|
|
24
|
+
isInline: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Attachment's size in bytes.
|
|
27
|
+
*/
|
|
28
|
+
size: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface representing of the query parameters for finding an attachment's metadata.
|
|
32
|
+
*/
|
|
33
|
+
export interface FindAttachmentQueryParams {
|
|
34
|
+
/**
|
|
35
|
+
* ID of the message the attachment belongs to.
|
|
36
|
+
*/
|
|
37
|
+
messageId: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interface representing of the query parameters for downloading an attachment.
|
|
41
|
+
*/
|
|
42
|
+
export type DownloadAttachmentQueryParams = FindAttachmentQueryParams;
|
|
@@ -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';
|
|
8
|
+
export type Provider = 'google' | 'imap' | 'microsoft' | 'virtual-calendar';
|
|
9
9
|
/**
|
|
10
10
|
* Configuration for generating a URL for OAuth 2.0 authentication.
|
|
11
11
|
*/
|
|
@@ -134,6 +134,10 @@ export interface CodeExchangeResponse {
|
|
|
134
134
|
* Nylas grant ID that is now successfully created.
|
|
135
135
|
*/
|
|
136
136
|
grantId: string;
|
|
137
|
+
/**
|
|
138
|
+
* Email address of the grant that is created.
|
|
139
|
+
*/
|
|
140
|
+
email: string;
|
|
137
141
|
/**
|
|
138
142
|
* The remaining lifetime of the access token in seconds.
|
|
139
143
|
*/
|
|
@@ -47,7 +47,7 @@ export interface CreateCalenderRequest {
|
|
|
47
47
|
/**
|
|
48
48
|
* Interface of a Nylas update calendar request
|
|
49
49
|
*/
|
|
50
|
-
export interface UpdateCalenderRequest extends CreateCalenderRequest {
|
|
50
|
+
export interface UpdateCalenderRequest extends Partial<CreateCalenderRequest> {
|
|
51
51
|
/**
|
|
52
52
|
* The background color of the calendar in the hexadecimal format (e.g. #0099EE).
|
|
53
53
|
* Empty indicates default color.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Provider } from './auth.js';
|
|
2
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
3
|
+
/**
|
|
4
|
+
* Interface representing the Nylas connector response.
|
|
5
|
+
*/
|
|
6
|
+
export interface Connector {
|
|
7
|
+
/**
|
|
8
|
+
* The provider type
|
|
9
|
+
*/
|
|
10
|
+
provider: Provider;
|
|
11
|
+
/**
|
|
12
|
+
* Optional settings from provider
|
|
13
|
+
*/
|
|
14
|
+
settings?: Record<string, unknown>;
|
|
15
|
+
/**
|
|
16
|
+
* Default scopes for the connector
|
|
17
|
+
*/
|
|
18
|
+
scope?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Interface representing a Google connector creation request.
|
|
22
|
+
*/
|
|
23
|
+
export interface GoogleCreateConnectorSettings {
|
|
24
|
+
/**
|
|
25
|
+
* The Google Client ID
|
|
26
|
+
*/
|
|
27
|
+
clientId: string;
|
|
28
|
+
/**
|
|
29
|
+
* The Google Client Secret
|
|
30
|
+
*/
|
|
31
|
+
clientSecret: string;
|
|
32
|
+
/**
|
|
33
|
+
* The Google Pub/Sub topic name
|
|
34
|
+
*/
|
|
35
|
+
topicName?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Interface representing a Microsoft connector creation request.
|
|
39
|
+
*/
|
|
40
|
+
export interface MicrosoftCreateConnectorSettings {
|
|
41
|
+
/**
|
|
42
|
+
* The Microsoft Client ID
|
|
43
|
+
*/
|
|
44
|
+
clientId: string;
|
|
45
|
+
/**
|
|
46
|
+
* The Microsoft Client Secret
|
|
47
|
+
*/
|
|
48
|
+
clientSecret: string;
|
|
49
|
+
/**
|
|
50
|
+
* The Microsoft tenant ID
|
|
51
|
+
*/
|
|
52
|
+
tenant?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Interface representing the base Nylas connector creation request.
|
|
56
|
+
*/
|
|
57
|
+
interface BaseCreateConnectionRequest {
|
|
58
|
+
/**
|
|
59
|
+
* Custom name of the connector
|
|
60
|
+
*/
|
|
61
|
+
name: string;
|
|
62
|
+
/**
|
|
63
|
+
* The provider type
|
|
64
|
+
*/
|
|
65
|
+
provider: Provider;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Interface representing the base Nylas connector creation request.
|
|
69
|
+
*/
|
|
70
|
+
export interface GoogleCreateConnectorRequest extends BaseCreateConnectionRequest {
|
|
71
|
+
/**
|
|
72
|
+
* The Google OAuth provider credentials and settings
|
|
73
|
+
*/
|
|
74
|
+
settings: GoogleCreateConnectorSettings;
|
|
75
|
+
/**
|
|
76
|
+
* The Google OAuth scopes
|
|
77
|
+
*/
|
|
78
|
+
scope?: string[];
|
|
79
|
+
}
|
|
80
|
+
export interface MicrosoftCreateConnectorRequest extends BaseCreateConnectionRequest {
|
|
81
|
+
/**
|
|
82
|
+
* The Microsoft OAuth provider credentials and settings
|
|
83
|
+
*/
|
|
84
|
+
settings: MicrosoftCreateConnectorSettings;
|
|
85
|
+
/**
|
|
86
|
+
* The Microsoft OAuth scopes
|
|
87
|
+
*/
|
|
88
|
+
scope?: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Interface representing the base Nylas connector creation request.
|
|
92
|
+
*/
|
|
93
|
+
export type ImapCreateConnectorRequest = BaseCreateConnectionRequest;
|
|
94
|
+
/**
|
|
95
|
+
* Interface representing the base Nylas connector creation request.
|
|
96
|
+
*/
|
|
97
|
+
export type VirtualCalendarsCreateConnectorRequest = BaseCreateConnectionRequest;
|
|
98
|
+
/**
|
|
99
|
+
* The type of the Nylas connector creation request.
|
|
100
|
+
*/
|
|
101
|
+
export type CreateConnectorRequest = GoogleCreateConnectorRequest | MicrosoftCreateConnectorRequest | ImapCreateConnectorRequest | VirtualCalendarsCreateConnectorRequest;
|
|
102
|
+
/**
|
|
103
|
+
* Interface representing the base Nylas connector creation request.
|
|
104
|
+
*/
|
|
105
|
+
export interface UpdateConnectorRequest {
|
|
106
|
+
/**
|
|
107
|
+
* Custom name of the connector
|
|
108
|
+
*/
|
|
109
|
+
name?: string;
|
|
110
|
+
/**
|
|
111
|
+
* The OAuth provider credentials and settings
|
|
112
|
+
*/
|
|
113
|
+
settings?: Record<string, unknown>;
|
|
114
|
+
/**
|
|
115
|
+
* The OAuth scopes
|
|
116
|
+
*/
|
|
117
|
+
scope?: string[];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Interface of the query parameters for listing connectors.
|
|
121
|
+
*/
|
|
122
|
+
export type ListConnectorsQueryParams = ListQueryParams;
|
|
123
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing a Nylas Contact object.
|
|
4
|
+
*/
|
|
5
|
+
export interface Contact {
|
|
6
|
+
id: string;
|
|
7
|
+
grantId: string;
|
|
8
|
+
object: 'contact';
|
|
9
|
+
birthday?: string;
|
|
10
|
+
companyName?: string;
|
|
11
|
+
displayName: string;
|
|
12
|
+
emails: Email[];
|
|
13
|
+
imAddresses: InstantMessagingAddress[];
|
|
14
|
+
givenName?: string;
|
|
15
|
+
jobTitle?: string;
|
|
16
|
+
managerName?: string;
|
|
17
|
+
middleName?: string;
|
|
18
|
+
nickname?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
officeLocation?: string;
|
|
21
|
+
pictureUrl?: string;
|
|
22
|
+
picture?: string;
|
|
23
|
+
suffix?: string;
|
|
24
|
+
surname?: string;
|
|
25
|
+
source?: SourceType;
|
|
26
|
+
phoneNumbers: PhoneNumber[];
|
|
27
|
+
physicalAddresses: PhysicalAddress[];
|
|
28
|
+
webPages: WebPage[];
|
|
29
|
+
groups: ContactGroup[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Custom Types.
|
|
33
|
+
*/
|
|
34
|
+
export type ContactType = 'work' | 'home' | 'other';
|
|
35
|
+
export type SourceType = 'address_book' | 'inbox' | 'domain';
|
|
36
|
+
export type GroupType = 'user' | 'system' | 'other';
|
|
37
|
+
/**
|
|
38
|
+
* Interface for email addresses in a contact.
|
|
39
|
+
*/
|
|
40
|
+
export interface Email {
|
|
41
|
+
email?: string;
|
|
42
|
+
type?: ContactType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Interface for IM addresses in a contact.
|
|
46
|
+
*/
|
|
47
|
+
export interface InstantMessagingAddress {
|
|
48
|
+
type?: string;
|
|
49
|
+
imAddress?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Interface for phone numbers in a contact.
|
|
53
|
+
*/
|
|
54
|
+
export interface PhoneNumber {
|
|
55
|
+
number?: string;
|
|
56
|
+
type?: ContactType;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Interface for physical addresses in a contact.
|
|
60
|
+
*/
|
|
61
|
+
export interface PhysicalAddress {
|
|
62
|
+
format?: string;
|
|
63
|
+
streetAddress?: string;
|
|
64
|
+
city?: string;
|
|
65
|
+
postalCode?: string;
|
|
66
|
+
state?: string;
|
|
67
|
+
country?: string;
|
|
68
|
+
type?: ContactType;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Interface for web pages in a contact.
|
|
72
|
+
*/
|
|
73
|
+
export interface WebPage {
|
|
74
|
+
url?: string;
|
|
75
|
+
type?: ContactType;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Interface representing a contact group.
|
|
79
|
+
*/
|
|
80
|
+
export interface ContactGroup {
|
|
81
|
+
id: string;
|
|
82
|
+
object: 'contact_group';
|
|
83
|
+
grantId?: string;
|
|
84
|
+
groupType?: GroupType;
|
|
85
|
+
name?: string;
|
|
86
|
+
path?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Interface representing the query parameters for listing contacts.
|
|
90
|
+
*/
|
|
91
|
+
export interface ListContactQueryParams extends ListQueryParams {
|
|
92
|
+
/**
|
|
93
|
+
* Returns the contacts matching the exact contact's email.
|
|
94
|
+
*/
|
|
95
|
+
email?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Returns the contacts matching the contact's exact phone number
|
|
98
|
+
*/
|
|
99
|
+
phoneNumber?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Returns the contacts matching from the address book or auto-generated contacts from emails.
|
|
102
|
+
* For example of contacts only from the address book: /contacts?source=address_bookor for only autogenerated contacts:/contacts?source=inbox`
|
|
103
|
+
*/
|
|
104
|
+
source?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the contacts belonging to the Contact Group matching this ID
|
|
107
|
+
*/
|
|
108
|
+
group?: string;
|
|
109
|
+
/**
|
|
110
|
+
* When set to true, returns the contacts also within the specified Contact Group subgroups, if the group parameter is set.
|
|
111
|
+
*/
|
|
112
|
+
recurse?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Interface representing the query parameters for retrieving a single contact.
|
|
116
|
+
*/
|
|
117
|
+
export interface FindContactQueryParams {
|
|
118
|
+
profilePicture?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Interface for creating a contact.
|
|
122
|
+
*/
|
|
123
|
+
export type CreateContactRequest = {
|
|
124
|
+
displayName?: string;
|
|
125
|
+
birthday?: string;
|
|
126
|
+
companyName?: string;
|
|
127
|
+
emails?: Email[];
|
|
128
|
+
givenName?: string;
|
|
129
|
+
imAddresses?: InstantMessagingAddress[];
|
|
130
|
+
jobTitle?: string;
|
|
131
|
+
managerName?: string;
|
|
132
|
+
middleName?: string;
|
|
133
|
+
nickname?: string;
|
|
134
|
+
notes?: string;
|
|
135
|
+
officeLocation?: string;
|
|
136
|
+
phoneNumbers?: PhoneNumber[];
|
|
137
|
+
physicalAddresses?: PhysicalAddress[];
|
|
138
|
+
suffix?: string;
|
|
139
|
+
surname?: string;
|
|
140
|
+
webPages?: WebPage[];
|
|
141
|
+
picture?: string;
|
|
142
|
+
source?: SourceType;
|
|
143
|
+
groups?: ContactGroup[];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Interface for updating a contact.
|
|
147
|
+
*/
|
|
148
|
+
export type UpdateContactRequest = CreateContactRequest;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing a Nylas Credential object.
|
|
3
|
+
*/
|
|
4
|
+
export interface Credential {
|
|
5
|
+
/**
|
|
6
|
+
* Globally unique object identifier
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the credential
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* The type of credential
|
|
15
|
+
*/
|
|
16
|
+
credentialType?: CredentialType;
|
|
17
|
+
/**
|
|
18
|
+
* Hashed value of the credential that you created
|
|
19
|
+
*/
|
|
20
|
+
hashedData?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Timestamp of when the credential was created
|
|
23
|
+
*/
|
|
24
|
+
createdAt?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp of when the credential was updated
|
|
27
|
+
*/
|
|
28
|
+
updatedAt?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface representing additional data needed to create a credential for Microsoft Admin Consent
|
|
32
|
+
*/
|
|
33
|
+
export interface MicrosoftAdminConsentSettings {
|
|
34
|
+
clientId: string;
|
|
35
|
+
clientSecret: string;
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Interface representing additional data needed to create a credential for Google Service Account
|
|
40
|
+
*/
|
|
41
|
+
export interface GoogleServiceAccountCredential {
|
|
42
|
+
privateKeyId: string;
|
|
43
|
+
privateKey: string;
|
|
44
|
+
clientEmail: string;
|
|
45
|
+
[key: string]: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Interface representing additional data needed to create a credential for a Connector Override
|
|
49
|
+
*/
|
|
50
|
+
export type ConnectorOverrideCredential = Record<string, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Type representing the data needed to create a credential
|
|
53
|
+
*/
|
|
54
|
+
export type CredentialData = MicrosoftAdminConsentSettings | GoogleServiceAccountCredential | ConnectorOverrideCredential;
|
|
55
|
+
/**
|
|
56
|
+
* Interface representing a request to create a Microsoft Admin Consent credential
|
|
57
|
+
*/
|
|
58
|
+
export interface CreateMicrosoftCredentialRequest {
|
|
59
|
+
/**
|
|
60
|
+
* Unique name of this credential
|
|
61
|
+
*/
|
|
62
|
+
name: string;
|
|
63
|
+
/**
|
|
64
|
+
* Type of credential for the admin consent flow
|
|
65
|
+
*/
|
|
66
|
+
credentialType: CredentialType.ADMINCONSENT;
|
|
67
|
+
/**
|
|
68
|
+
* Data that specifies some special data required for this credential
|
|
69
|
+
*/
|
|
70
|
+
credentialData: MicrosoftAdminConsentSettings;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Interface representing a request to create a Google Service Account credential
|
|
74
|
+
*/
|
|
75
|
+
export interface CreateGoogleCredentialRequest {
|
|
76
|
+
/**
|
|
77
|
+
* Unique name of this credential
|
|
78
|
+
*/
|
|
79
|
+
name: string;
|
|
80
|
+
/**
|
|
81
|
+
* Type of credential for the app permission flow
|
|
82
|
+
*/
|
|
83
|
+
credentialType: CredentialType.SERVICEACCOUNT;
|
|
84
|
+
/**
|
|
85
|
+
* Data that specifies some special data required for this credential
|
|
86
|
+
*/
|
|
87
|
+
credentialData: GoogleServiceAccountCredential;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Interface representing a request to create a Connector Override credential
|
|
91
|
+
*/
|
|
92
|
+
export interface CreateOverrideCredentialRequest {
|
|
93
|
+
/**
|
|
94
|
+
* Unique name of this credential
|
|
95
|
+
*/
|
|
96
|
+
name: string;
|
|
97
|
+
/**
|
|
98
|
+
* Type of credential to force the override of a connector's client values
|
|
99
|
+
*/
|
|
100
|
+
credentialType: CredentialType.CONNECTOR;
|
|
101
|
+
/**
|
|
102
|
+
* Data that specifies some special data required for this credential
|
|
103
|
+
*/
|
|
104
|
+
credentialData: ConnectorOverrideCredential;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Interface representing a request to create a credential
|
|
108
|
+
*/
|
|
109
|
+
export type CreateCredentialRequest = CreateMicrosoftCredentialRequest | CreateGoogleCredentialRequest | CreateOverrideCredentialRequest;
|
|
110
|
+
/**
|
|
111
|
+
* Interface representing a request to update a credential
|
|
112
|
+
*/
|
|
113
|
+
export interface UpdateCredentialRequest {
|
|
114
|
+
/**
|
|
115
|
+
* Unique name of this credential
|
|
116
|
+
*/
|
|
117
|
+
name?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Data that specifies some special data required for this credential
|
|
120
|
+
*/
|
|
121
|
+
credentialData?: CredentialData;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Enum representing the type of credential
|
|
125
|
+
*/
|
|
126
|
+
export declare enum CredentialType {
|
|
127
|
+
ADMINCONSENT = "adminconsent",
|
|
128
|
+
SERVICEACCOUNT = "serviceaccount",
|
|
129
|
+
CONNECTOR = "connector"
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Interface representing the query parameters for listing credentials.
|
|
133
|
+
*/
|
|
134
|
+
export interface ListCredentialsQueryParams {
|
|
135
|
+
/**
|
|
136
|
+
* Limit the number of results
|
|
137
|
+
*/
|
|
138
|
+
limit?: number;
|
|
139
|
+
/**
|
|
140
|
+
* Offset the results by this number
|
|
141
|
+
*/
|
|
142
|
+
offset?: number;
|
|
143
|
+
/**
|
|
144
|
+
* Sort the results by field name
|
|
145
|
+
*/
|
|
146
|
+
sortBy?: 'createdAt' | 'updatedAt';
|
|
147
|
+
/**
|
|
148
|
+
* Order the results by ascending or descending
|
|
149
|
+
*/
|
|
150
|
+
orderBy?: 'desc' | 'asc';
|
|
151
|
+
}
|