nylas 7.0.0-beta.0 → 7.0.0-beta.2
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 +27 -19
- package/lib/cjs/apiClient.js +114 -0
- package/lib/cjs/config.js +32 -0
- package/lib/cjs/models/applicationDetails.js +2 -0
- package/lib/cjs/models/auth.js +2 -0
- package/lib/cjs/models/availability.js +11 -0
- package/lib/cjs/models/calendars.js +2 -0
- package/lib/cjs/models/error.js +53 -0
- package/lib/cjs/models/events.js +2 -0
- package/lib/cjs/models/grants.js +2 -0
- package/lib/cjs/models/listQueryParams.js +2 -0
- package/lib/cjs/models/redirectUri.js +2 -0
- package/lib/cjs/models/response.js +2 -0
- package/lib/cjs/models/webhooks.js +18 -0
- package/lib/cjs/nylas.js +34 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/resources/applications.js +30 -0
- package/lib/cjs/resources/auth.js +153 -0
- package/lib/cjs/resources/calendars.js +78 -0
- package/lib/cjs/resources/events.js +69 -0
- package/lib/cjs/resources/grants.js +65 -0
- package/lib/cjs/resources/redirectUris.js +64 -0
- package/lib/cjs/resources/resource.js +111 -0
- package/lib/cjs/resources/webhooks.js +98 -0
- package/lib/cjs/utils.js +58 -0
- package/lib/cjs/version.js +5 -0
- package/lib/esm/apiClient.js +111 -0
- package/lib/esm/config.js +29 -0
- package/lib/esm/models/applicationDetails.js +1 -0
- package/lib/esm/models/auth.js +1 -0
- package/lib/esm/models/availability.js +8 -0
- package/lib/esm/models/calendars.js +1 -0
- package/lib/esm/models/error.js +45 -0
- package/lib/esm/models/events.js +1 -0
- package/lib/esm/models/grants.js +1 -0
- package/lib/esm/models/listQueryParams.js +1 -0
- package/lib/esm/models/redirectUri.js +1 -0
- package/lib/esm/models/response.js +1 -0
- package/lib/esm/models/webhooks.js +15 -0
- package/lib/esm/nylas.js +31 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/resources/applications.js +26 -0
- package/lib/esm/resources/auth.js +149 -0
- package/lib/esm/resources/calendars.js +74 -0
- package/lib/esm/resources/events.js +65 -0
- package/lib/esm/resources/grants.js +61 -0
- package/lib/esm/resources/redirectUris.js +60 -0
- package/lib/esm/resources/resource.js +107 -0
- package/lib/esm/resources/webhooks.js +94 -0
- package/lib/esm/utils.js +53 -0
- package/lib/esm/version.js +2 -0
- package/lib/types/apiClient.d.ts +65 -0
- package/lib/types/config.d.ts +50 -0
- package/lib/types/models/applicationDetails.d.ts +93 -0
- package/lib/types/models/auth.d.ts +196 -0
- package/lib/types/models/availability.d.ts +159 -0
- package/lib/types/models/calendars.d.ts +121 -0
- package/lib/types/models/error.d.ts +104 -0
- package/lib/types/models/events.d.ts +494 -0
- package/lib/types/models/grants.d.ts +134 -0
- package/lib/types/models/listQueryParams.d.ts +4 -0
- package/lib/types/models/redirectUri.d.ts +71 -0
- package/lib/types/models/response.d.ts +40 -0
- package/lib/types/models/webhooks.d.ts +45 -0
- package/lib/types/nylas.d.ts +44 -0
- package/lib/types/resources/applications.d.ts +26 -0
- package/lib/types/resources/auth.d.ts +66 -0
- package/lib/types/resources/calendars.d.ts +97 -0
- package/lib/types/resources/events.d.ts +87 -0
- package/lib/types/resources/grants.d.ts +63 -0
- package/lib/types/resources/redirectUris.d.ts +63 -0
- package/lib/types/resources/resource.d.ts +55 -0
- package/lib/types/resources/webhooks.d.ts +79 -0
- package/lib/types/utils.d.ts +22 -0
- package/lib/types/version.d.ts +1 -0
- package/package.json +33 -42
- package/lib/config.d.ts +0 -70
- package/lib/config.js +0 -68
- package/lib/models/access-token.d.ts +0 -18
- package/lib/models/access-token.js +0 -56
- package/lib/models/account.d.ts +0 -27
- package/lib/models/account.js +0 -73
- package/lib/models/application-details.d.ts +0 -14
- package/lib/models/application-details.js +0 -47
- package/lib/models/attributes.d.ts +0 -151
- package/lib/models/attributes.js +0 -382
- package/lib/models/calendar-availability.d.ts +0 -76
- package/lib/models/calendar-availability.js +0 -121
- package/lib/models/calendar-restful-model-collection.d.ts +0 -17
- package/lib/models/calendar-restful-model-collection.js +0 -181
- package/lib/models/calendar.d.ts +0 -31
- package/lib/models/calendar.js +0 -93
- package/lib/models/component-restful-model-collection.d.ts +0 -9
- package/lib/models/component-restful-model-collection.js +0 -34
- package/lib/models/component.d.ts +0 -37
- package/lib/models/component.js +0 -91
- package/lib/models/connect.d.ts +0 -73
- package/lib/models/connect.js +0 -193
- package/lib/models/contact-restful-model-collection.d.ts +0 -9
- package/lib/models/contact-restful-model-collection.js +0 -60
- package/lib/models/contact.d.ts +0 -129
- package/lib/models/contact.js +0 -289
- package/lib/models/delta-collection.d.ts +0 -17
- package/lib/models/delta-collection.js +0 -139
- package/lib/models/delta-stream.d.ts +0 -32
- package/lib/models/delta-stream.js +0 -250
- package/lib/models/delta.d.ts +0 -28
- package/lib/models/delta.js +0 -88
- package/lib/models/deltas.d.ts +0 -17
- package/lib/models/deltas.js +0 -49
- package/lib/models/draft.d.ts +0 -27
- package/lib/models/draft.js +0 -156
- package/lib/models/email-participant.d.ts +0 -13
- package/lib/models/email-participant.js +0 -46
- package/lib/models/event-conferencing.d.ts +0 -34
- package/lib/models/event-conferencing.js +0 -71
- package/lib/models/event-notification.d.ts +0 -27
- package/lib/models/event-notification.js +0 -62
- package/lib/models/event-participant.d.ts +0 -19
- package/lib/models/event-participant.js +0 -56
- package/lib/models/event.d.ts +0 -96
- package/lib/models/event.js +0 -297
- package/lib/models/file.d.ts +0 -29
- package/lib/models/file.js +0 -136
- package/lib/models/folder.d.ts +0 -21
- package/lib/models/folder.js +0 -69
- package/lib/models/free-busy.d.ts +0 -58
- package/lib/models/free-busy.js +0 -132
- package/lib/models/job-status-restful-model-collection.d.ts +0 -9
- package/lib/models/job-status-restful-model-collection.js +0 -38
- package/lib/models/job-status.d.ts +0 -24
- package/lib/models/job-status.js +0 -68
- package/lib/models/management-account.d.ts +0 -63
- package/lib/models/management-account.js +0 -187
- package/lib/models/management-model-collection.d.ts +0 -10
- package/lib/models/management-model-collection.js +0 -39
- package/lib/models/management-model.d.ts +0 -6
- package/lib/models/management-model.js +0 -29
- package/lib/models/message-restful-model-collection.d.ts +0 -26
- package/lib/models/message-restful-model-collection.js +0 -80
- package/lib/models/message.d.ts +0 -57
- package/lib/models/message.js +0 -173
- package/lib/models/model-collection.d.ts +0 -25
- package/lib/models/model-collection.js +0 -201
- package/lib/models/model.d.ts +0 -12
- package/lib/models/model.js +0 -64
- package/lib/models/neural-categorizer.d.ts +0 -28
- package/lib/models/neural-categorizer.js +0 -139
- package/lib/models/neural-clean-conversation.d.ts +0 -16
- package/lib/models/neural-clean-conversation.js +0 -114
- package/lib/models/neural-ocr.d.ts +0 -14
- package/lib/models/neural-ocr.js +0 -50
- package/lib/models/neural-sentiment-analysis.d.ts +0 -20
- package/lib/models/neural-sentiment-analysis.js +0 -56
- package/lib/models/neural-signature-contact.d.ts +0 -43
- package/lib/models/neural-signature-contact.js +0 -142
- package/lib/models/neural-signature-extraction.d.ts +0 -17
- package/lib/models/neural-signature-extraction.js +0 -54
- package/lib/models/neural.d.ts +0 -36
- package/lib/models/neural.js +0 -163
- package/lib/models/nylas-api-error.d.ts +0 -26
- package/lib/models/nylas-api-error.js +0 -61
- package/lib/models/outbox-job-status.d.ts +0 -20
- package/lib/models/outbox-job-status.js +0 -64
- package/lib/models/outbox-message.d.ts +0 -16
- package/lib/models/outbox-message.js +0 -54
- package/lib/models/outbox.d.ts +0 -35
- package/lib/models/outbox.js +0 -158
- package/lib/models/resource.d.ts +0 -22
- package/lib/models/resource.js +0 -66
- package/lib/models/restful-model-collection.d.ts +0 -15
- package/lib/models/restful-model-collection.js +0 -169
- package/lib/models/restful-model-instance.d.ts +0 -9
- package/lib/models/restful-model-instance.js +0 -37
- package/lib/models/restful-model.d.ts +0 -36
- package/lib/models/restful-model.js +0 -146
- package/lib/models/scheduler-booking-request.d.ts +0 -64
- package/lib/models/scheduler-booking-request.js +0 -148
- package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
- package/lib/models/scheduler-restful-model-collection.js +0 -133
- package/lib/models/scheduler-time-slot.d.ts +0 -20
- package/lib/models/scheduler-time-slot.js +0 -53
- package/lib/models/scheduler.d.ts +0 -226
- package/lib/models/scheduler.js +0 -446
- package/lib/models/thread.d.ts +0 -49
- package/lib/models/thread.js +0 -127
- package/lib/models/webhook-notification.d.ts +0 -108
- package/lib/models/webhook-notification.js +0 -239
- package/lib/models/webhook.d.ts +0 -50
- package/lib/models/webhook.js +0 -101
- package/lib/models/when.d.ts +0 -23
- package/lib/models/when.js +0 -65
- package/lib/nylas-connection.d.ts +0 -71
- package/lib/nylas-connection.js +0 -258
- package/lib/nylas.d.ts +0 -57
- package/lib/nylas.js +0 -210
- package/lib/server-bindings/express-binding.d.ts +0 -18
- package/lib/server-bindings/express-binding.js +0 -163
- package/lib/server-bindings/server-binding.d.ts +0 -65
- package/lib/server-bindings/server-binding.js +0 -87
- package/lib/services/routes.d.ts +0 -26
- package/lib/services/routes.js +0 -95
- package/lib/services/tunnel.d.ts +0 -29
- package/lib/services/tunnel.js +0 -112
package/lib/esm/utils.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { camelCase, snakeCase } from 'change-case';
|
|
2
|
+
/**
|
|
3
|
+
* A utility function that recursively converts all keys in an object to a given case.
|
|
4
|
+
* @param obj The object to convert
|
|
5
|
+
* @param casingFunction The function to use to convert the keys
|
|
6
|
+
* @param excludeKeys An array of keys to exclude from conversion
|
|
7
|
+
* @returns The converted object
|
|
8
|
+
* @ignore Not for public use.
|
|
9
|
+
*/
|
|
10
|
+
function convertCase(obj, casingFunction, excludeKeys) {
|
|
11
|
+
const newObj = {};
|
|
12
|
+
for (const key in obj) {
|
|
13
|
+
if (excludeKeys?.includes(key)) {
|
|
14
|
+
newObj[key] = obj[key];
|
|
15
|
+
}
|
|
16
|
+
else if (Array.isArray(obj[key])) {
|
|
17
|
+
newObj[casingFunction(key)] = obj[key].map(item => {
|
|
18
|
+
if (typeof item === 'object') {
|
|
19
|
+
return convertCase(item, casingFunction);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
return item;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else if (typeof obj[key] === 'object' && obj[key] !== null) {
|
|
27
|
+
newObj[casingFunction(key)] = convertCase(obj[key], casingFunction);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
newObj[casingFunction(key)] = obj[key];
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return newObj;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A utility function that recursively converts all keys in an object to camelCase.
|
|
37
|
+
* @param obj The object to convert
|
|
38
|
+
* @param exclude An array of keys to exclude from conversion
|
|
39
|
+
* @returns The converted object
|
|
40
|
+
* @ignore Not for public use.
|
|
41
|
+
*/
|
|
42
|
+
export function objKeysToCamelCase(obj, exclude) {
|
|
43
|
+
return convertCase(obj, camelCase, exclude);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A utility function that recursively converts all keys in an object to snake_case.
|
|
47
|
+
* @param obj The object to convert
|
|
48
|
+
* @param exclude An array of keys to exclude from conversion
|
|
49
|
+
* @returns The converted object
|
|
50
|
+
*/
|
|
51
|
+
export function objKeysToSnakeCase(obj, exclude) {
|
|
52
|
+
return convertCase(obj, snakeCase, exclude);
|
|
53
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Request, Response } from 'node-fetch';
|
|
2
|
+
import { NylasConfig, OverridableNylasConfig } from './config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for a request to the Nylas API
|
|
5
|
+
* @property path The path to the API endpoint
|
|
6
|
+
* @property method The HTTP method to use
|
|
7
|
+
* @property headers Additional headers to send with the request
|
|
8
|
+
* @property queryParams Query parameters to send with the request
|
|
9
|
+
* @property body The body of the request
|
|
10
|
+
* @property overrides Overrides to the default Nylas API client configuration
|
|
11
|
+
* @ignore Not for public use
|
|
12
|
+
*/
|
|
13
|
+
export interface RequestOptionsParams {
|
|
14
|
+
path: string;
|
|
15
|
+
method: string;
|
|
16
|
+
headers?: Record<string, string>;
|
|
17
|
+
queryParams?: Record<string, any>;
|
|
18
|
+
body?: any;
|
|
19
|
+
overrides?: OverridableNylasConfig;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options for building a request for fetch to understand
|
|
23
|
+
* @property path The path to the API endpoint
|
|
24
|
+
* @property method The HTTP method to use
|
|
25
|
+
* @property headers Additional headers to send with the request
|
|
26
|
+
* @property url The URL of the request
|
|
27
|
+
* @property body The body of the request
|
|
28
|
+
* @property overrides Overrides to the default Nylas API client configuration
|
|
29
|
+
* @ignore Not for public use
|
|
30
|
+
*/
|
|
31
|
+
interface RequestOptions {
|
|
32
|
+
path: string;
|
|
33
|
+
method: string;
|
|
34
|
+
headers: Record<string, string>;
|
|
35
|
+
url: URL;
|
|
36
|
+
body?: string;
|
|
37
|
+
overrides?: Partial<NylasConfig>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The API client for communicating with the Nylas API
|
|
41
|
+
* @ignore Not for public use
|
|
42
|
+
*/
|
|
43
|
+
export default class APIClient {
|
|
44
|
+
/**
|
|
45
|
+
* The API key to use for authentication
|
|
46
|
+
*/
|
|
47
|
+
apiKey: string;
|
|
48
|
+
/**
|
|
49
|
+
* The URL to use for communicating with the Nylas API
|
|
50
|
+
*/
|
|
51
|
+
serverUrl: string;
|
|
52
|
+
/**
|
|
53
|
+
* The timeout for requests to the Nylas API, in seconds
|
|
54
|
+
*/
|
|
55
|
+
timeout: number;
|
|
56
|
+
constructor({ apiKey, apiUri, timeout }: Required<NylasConfig>);
|
|
57
|
+
private setRequestUrl;
|
|
58
|
+
private setQueryStrings;
|
|
59
|
+
private setRequestHeaders;
|
|
60
|
+
requestOptions(optionParams: RequestOptionsParams): RequestOptions;
|
|
61
|
+
newRequest(options: RequestOptionsParams): Request;
|
|
62
|
+
requestWithResponse<T>(response: Response): Promise<T>;
|
|
63
|
+
request<T>(options: RequestOptionsParams): Promise<T>;
|
|
64
|
+
}
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for initializing the Nylas SDK.
|
|
3
|
+
* @property apiKey The Nylas API key to use for authentication
|
|
4
|
+
* @property apiUri The URL to use for communicating with the Nylas API
|
|
5
|
+
* @property timeout The timeout for requests to the Nylas API, in seconds
|
|
6
|
+
*/
|
|
7
|
+
export type NylasConfig = {
|
|
8
|
+
apiKey: string;
|
|
9
|
+
apiUri?: string;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The options that can override the default Nylas API client configuration.
|
|
14
|
+
*/
|
|
15
|
+
export type OverridableNylasConfig = Partial<NylasConfig>;
|
|
16
|
+
/**
|
|
17
|
+
* An object that can be used to override the default Nylas API client configuration on a per-request basis.
|
|
18
|
+
* @property overrides Overrides to the default Nylas API client configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface Overrides {
|
|
21
|
+
overrides?: OverridableNylasConfig;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Enum representing the available Nylas API regions.
|
|
25
|
+
*/
|
|
26
|
+
export declare enum Region {
|
|
27
|
+
Us = "us",
|
|
28
|
+
Eu = "eu"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The default Nylas API region.
|
|
32
|
+
* @default Region.Us
|
|
33
|
+
*/
|
|
34
|
+
export declare const DEFAULT_REGION = Region.Us;
|
|
35
|
+
/**
|
|
36
|
+
* The configuration options for each Nylas API region.
|
|
37
|
+
*/
|
|
38
|
+
type RegionConfig = {
|
|
39
|
+
nylasAPIUrl: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* The available preset configuration values for each Nylas API region.
|
|
43
|
+
*/
|
|
44
|
+
export declare const REGION_CONFIG: Record<Region, RegionConfig>;
|
|
45
|
+
/**
|
|
46
|
+
* The default Nylas API URL.
|
|
47
|
+
* @default https://api.us.nylas.com
|
|
48
|
+
*/
|
|
49
|
+
export declare const DEFAULT_SERVER_URL: string;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { RedirectUri } from './redirectUri.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for a Nylas application details object
|
|
4
|
+
*/
|
|
5
|
+
export interface ApplicationDetails {
|
|
6
|
+
/**
|
|
7
|
+
* Public Application ID
|
|
8
|
+
*/
|
|
9
|
+
applicationId: string;
|
|
10
|
+
/**
|
|
11
|
+
* ID of organization
|
|
12
|
+
*/
|
|
13
|
+
organizationId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Region identifier
|
|
16
|
+
*/
|
|
17
|
+
region: 'us' | 'eu';
|
|
18
|
+
/**
|
|
19
|
+
* Environment identifier
|
|
20
|
+
*/
|
|
21
|
+
environment: 'production' | 'staging';
|
|
22
|
+
/**
|
|
23
|
+
* Branding details for the application
|
|
24
|
+
*/
|
|
25
|
+
branding: Branding;
|
|
26
|
+
/**
|
|
27
|
+
* Hosted authentication branding details
|
|
28
|
+
*/
|
|
29
|
+
hostedAuthentication?: HostedAuthentication;
|
|
30
|
+
/**
|
|
31
|
+
* List of redirect URIs
|
|
32
|
+
*/
|
|
33
|
+
redirectUris?: RedirectUri[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Interface for branding details for the application
|
|
37
|
+
*/
|
|
38
|
+
interface Branding {
|
|
39
|
+
/**
|
|
40
|
+
* Name of the application
|
|
41
|
+
*/
|
|
42
|
+
name: string;
|
|
43
|
+
/**
|
|
44
|
+
* URL points to application icon
|
|
45
|
+
*/
|
|
46
|
+
iconUrl?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Application / publisher website URL
|
|
49
|
+
*/
|
|
50
|
+
websiteUrl?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Description of the appli∏cati∏on
|
|
53
|
+
*/
|
|
54
|
+
description?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Interface for hosted authentication branding details
|
|
58
|
+
*/
|
|
59
|
+
interface HostedAuthentication {
|
|
60
|
+
/**
|
|
61
|
+
* URL of the background image
|
|
62
|
+
*/
|
|
63
|
+
backgroundImageUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Alignment of background image
|
|
66
|
+
*/
|
|
67
|
+
alignment?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Primary color
|
|
70
|
+
*/
|
|
71
|
+
colorPrimary?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Secondary color
|
|
74
|
+
*/
|
|
75
|
+
colorSecondary?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Title
|
|
78
|
+
*/
|
|
79
|
+
title?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Subtitle
|
|
82
|
+
*/
|
|
83
|
+
subtitle?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Background color
|
|
86
|
+
*/
|
|
87
|
+
backgroundColor?: string;
|
|
88
|
+
/**
|
|
89
|
+
* CSS spacing attribute in px
|
|
90
|
+
*/
|
|
91
|
+
spacing?: number;
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type for the access type of the authentication URL.
|
|
3
|
+
*/
|
|
4
|
+
type AccessType = 'online' | 'offline';
|
|
5
|
+
/**
|
|
6
|
+
* Type for the different OAuth providers Nylas supports.
|
|
7
|
+
*/
|
|
8
|
+
export type Provider = 'google' | 'imap' | 'microsoft';
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for generating a URL for OAuth 2.0 authentication.
|
|
11
|
+
*/
|
|
12
|
+
export interface URLForAuthenticationConfig {
|
|
13
|
+
/**
|
|
14
|
+
* The client ID of your application.
|
|
15
|
+
*/
|
|
16
|
+
clientId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Redirect URI of the integration.
|
|
19
|
+
*/
|
|
20
|
+
redirectUri: string;
|
|
21
|
+
/**
|
|
22
|
+
* The integration provider type that you already had set up with Nylas for this application.
|
|
23
|
+
* If not set, the user is directed to the Hosted Login screen and prompted to select a provider.
|
|
24
|
+
*/
|
|
25
|
+
provider?: Provider;
|
|
26
|
+
/**
|
|
27
|
+
* If the exchange token should return a refresh token too. Not suitable for client side or JavaScript apps.
|
|
28
|
+
*/
|
|
29
|
+
accessType?: AccessType;
|
|
30
|
+
/**
|
|
31
|
+
* The prompt parameter is used to force the consent screen to be displayed even if the user has already given consent to your application.
|
|
32
|
+
*/
|
|
33
|
+
prompt?: string;
|
|
34
|
+
/**
|
|
35
|
+
* A space-delimited list of scopes that identify the resources that your application could access on the user's behalf.
|
|
36
|
+
* If no scope is given, all of the default integration's scopes are used.
|
|
37
|
+
*/
|
|
38
|
+
scope?: string[];
|
|
39
|
+
/**
|
|
40
|
+
* If set to true, the scopes granted to the application will be included in the response.
|
|
41
|
+
*/
|
|
42
|
+
includeGrantScopes?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Optional state to be returned after authentication
|
|
45
|
+
*/
|
|
46
|
+
state?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Prefill the login name (usually email) during authorization flow.
|
|
49
|
+
* If a Grant for the provided email already exists, a Grant's re-auth will automatically be initiated.
|
|
50
|
+
*/
|
|
51
|
+
loginHint?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Configuration for generating a URL for admin consent authentication for Microsoft.
|
|
55
|
+
*/
|
|
56
|
+
export interface URLForAdminConsentConfig extends URLForAuthenticationConfig {
|
|
57
|
+
/**
|
|
58
|
+
* The credential ID for the Microsoft account
|
|
59
|
+
*/
|
|
60
|
+
credentialId: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Interface of a Nylas code exchange request
|
|
64
|
+
*/
|
|
65
|
+
export interface CodeExchangeRequest {
|
|
66
|
+
/**
|
|
67
|
+
* Should match the same redirect URI that was used for getting the code during the initial authorization request.
|
|
68
|
+
*/
|
|
69
|
+
redirectUri: string;
|
|
70
|
+
/**
|
|
71
|
+
* OAuth 2.0 code fetched from the previous step.
|
|
72
|
+
*/
|
|
73
|
+
code: string;
|
|
74
|
+
/**
|
|
75
|
+
* Client ID of the application.
|
|
76
|
+
*/
|
|
77
|
+
clientId: string;
|
|
78
|
+
/**
|
|
79
|
+
* Client secret of the application.
|
|
80
|
+
*/
|
|
81
|
+
clientSecret: string;
|
|
82
|
+
/**
|
|
83
|
+
* The original plain text code verifier (code_challenge) used in the initial authorization request (PKCE).
|
|
84
|
+
*/
|
|
85
|
+
codeVerifier?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Interface of a Nylas token exchange request
|
|
89
|
+
*/
|
|
90
|
+
export interface TokenExchangeRequest {
|
|
91
|
+
/**
|
|
92
|
+
* Should match the same redirect URI that was used for getting the code during the initial authorization request.
|
|
93
|
+
*/
|
|
94
|
+
redirectUri: string;
|
|
95
|
+
/**
|
|
96
|
+
* Token to refresh/request your short-lived access token
|
|
97
|
+
*/
|
|
98
|
+
refreshToken: string;
|
|
99
|
+
/**
|
|
100
|
+
* Client ID of the application.
|
|
101
|
+
*/
|
|
102
|
+
clientId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Client secret of the application.
|
|
105
|
+
*/
|
|
106
|
+
clientSecret: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Interface of the object containing the OAuth 2.0 URL as well as the hashed secret.
|
|
110
|
+
*/
|
|
111
|
+
export interface PKCEAuthURL {
|
|
112
|
+
/**
|
|
113
|
+
* The URL for hosted authentication
|
|
114
|
+
*/
|
|
115
|
+
url: string;
|
|
116
|
+
/**
|
|
117
|
+
* Server-side challenge used in the OAuth 2.0 flow
|
|
118
|
+
*/
|
|
119
|
+
secret: string;
|
|
120
|
+
/**
|
|
121
|
+
* SHA-256 hash of the secret
|
|
122
|
+
*/
|
|
123
|
+
secretHash: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Interface of a Nylas code exchange response
|
|
127
|
+
*/
|
|
128
|
+
export interface CodeExchangeResponse {
|
|
129
|
+
/**
|
|
130
|
+
* Supports exchanging the code for tokens, or refreshing an access token using [Auth.refreshAccessToken][com.nylas.resources.Auth.refreshAccessToken].
|
|
131
|
+
*/
|
|
132
|
+
accessToken: string;
|
|
133
|
+
/**
|
|
134
|
+
* Nylas grant ID that is now successfully created.
|
|
135
|
+
*/
|
|
136
|
+
grantId: string;
|
|
137
|
+
/**
|
|
138
|
+
* The remaining lifetime of the access token in seconds.
|
|
139
|
+
*/
|
|
140
|
+
expiresIn: number;
|
|
141
|
+
/**
|
|
142
|
+
* List of scopes associated with this token.
|
|
143
|
+
*/
|
|
144
|
+
scope: string;
|
|
145
|
+
/**
|
|
146
|
+
* Only returned if the code was requested using [AccessType.OFFLINE][com.nylas.models.AccessType.OFFLINE].
|
|
147
|
+
*/
|
|
148
|
+
refreshToken?: string;
|
|
149
|
+
/**
|
|
150
|
+
* A JWT that contains identity information about the user that is digitally signed by Nylas.
|
|
151
|
+
*/
|
|
152
|
+
idToken?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Currently always Bearer.
|
|
155
|
+
*/
|
|
156
|
+
tokenType?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Interface representing the object used to set parameters for detecting a provider.
|
|
160
|
+
*/
|
|
161
|
+
export interface ProviderDetectParams {
|
|
162
|
+
/**
|
|
163
|
+
* Email address to detect the provider for.
|
|
164
|
+
*/
|
|
165
|
+
email: string;
|
|
166
|
+
/**
|
|
167
|
+
* Client ID of the Nylas application.
|
|
168
|
+
*/
|
|
169
|
+
clientId: string;
|
|
170
|
+
/**
|
|
171
|
+
* Search by all providers regardless of created integrations. If unset, defaults to false.
|
|
172
|
+
*/
|
|
173
|
+
allProviderTypes?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Interface representing the Nylas provider detect response.
|
|
177
|
+
*/
|
|
178
|
+
export interface ProviderDetectResponse {
|
|
179
|
+
/**
|
|
180
|
+
* Email provided for autodetection
|
|
181
|
+
*/
|
|
182
|
+
emailAddress: string;
|
|
183
|
+
/**
|
|
184
|
+
* Whether the provider was detected
|
|
185
|
+
*/
|
|
186
|
+
detected: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Detected provider
|
|
189
|
+
*/
|
|
190
|
+
provider?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Provider type (if IMAP provider detected displays the IMAP provider)
|
|
193
|
+
*/
|
|
194
|
+
type?: string;
|
|
195
|
+
}
|
|
196
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for a Nylas get availability response
|
|
3
|
+
*/
|
|
4
|
+
export interface GetAvailabilityResponse {
|
|
5
|
+
/**
|
|
6
|
+
* This property is only populated for round-robin events.
|
|
7
|
+
* It will contain the order in which the accounts would be next in line to attend the proposed meeting.
|
|
8
|
+
*/
|
|
9
|
+
order: string[];
|
|
10
|
+
/**
|
|
11
|
+
* The available time slots where a new meeting can be created for the requested preferences.
|
|
12
|
+
*/
|
|
13
|
+
timeSlots: TimeSlot[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Interface for a Nylas get availability request
|
|
17
|
+
*/
|
|
18
|
+
export interface GetAvailabilityRequest {
|
|
19
|
+
/**
|
|
20
|
+
* Unix timestamp for the start time to check availability for.
|
|
21
|
+
*/
|
|
22
|
+
startTime: number;
|
|
23
|
+
/**
|
|
24
|
+
* Unix timestamp for the end time to check availability for.
|
|
25
|
+
*/
|
|
26
|
+
endTime: number;
|
|
27
|
+
/**
|
|
28
|
+
* Participant details to check availability for.
|
|
29
|
+
*/
|
|
30
|
+
participants: AvailabilityParticipant[];
|
|
31
|
+
/**
|
|
32
|
+
* The total number of minutes the event should last.
|
|
33
|
+
*/
|
|
34
|
+
durationMinutes: number;
|
|
35
|
+
/**
|
|
36
|
+
* Nylas checks from the nearest interval of the passed [startTime].
|
|
37
|
+
* For example, to schedule 30-minute meetings ([durationMinutes]) with 15 minutes between them ([intervalMinutes]).
|
|
38
|
+
* If you have a meeting starting at 9:59, the API returns times starting at 10:00. 10:00-10:30, 10:15-10:45.
|
|
39
|
+
*/
|
|
40
|
+
intervalMinutes?: number;
|
|
41
|
+
/**
|
|
42
|
+
* When set to true, the availability time slots will start at 30 minutes past or on the hour.
|
|
43
|
+
* For example, a free slot starting at 16:10 is considered available only from 16:30.
|
|
44
|
+
*/
|
|
45
|
+
roundTo30Minutes?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The rules to apply when checking availability.
|
|
48
|
+
*/
|
|
49
|
+
availabilityRules?: AvailabilityRules;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Interface for a Nylas availability time slot
|
|
53
|
+
*/
|
|
54
|
+
export interface TimeSlot {
|
|
55
|
+
/**
|
|
56
|
+
* The emails of the participants who are available for the time slot.
|
|
57
|
+
*/
|
|
58
|
+
emails: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Unix timestamp for the start of the slot.
|
|
61
|
+
*/
|
|
62
|
+
startTime: string;
|
|
63
|
+
/**
|
|
64
|
+
* Unix timestamp for the end of the slot.
|
|
65
|
+
*/
|
|
66
|
+
endTime: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Interface for the availability rules for a Nylas calendar.
|
|
70
|
+
*/
|
|
71
|
+
export interface AvailabilityRules {
|
|
72
|
+
/**
|
|
73
|
+
* The method used to determine availability for a meeting.
|
|
74
|
+
*/
|
|
75
|
+
availabilityMethod?: AvailabilityMethod;
|
|
76
|
+
/**
|
|
77
|
+
* The buffer to add to the start and end of a meeting.
|
|
78
|
+
*/
|
|
79
|
+
buffer?: MeetingBuffer;
|
|
80
|
+
/**
|
|
81
|
+
* A default set of open hours to apply to all participants.
|
|
82
|
+
* You can overwrite these open hours for individual participants by specifying [AvailabilityParticipant.openHours]
|
|
83
|
+
* on the participant object.
|
|
84
|
+
*/
|
|
85
|
+
defaultOpenHours?: OpenHours[];
|
|
86
|
+
/**
|
|
87
|
+
* The ID on events that Nylas considers when calculating the order of round-robin participants.
|
|
88
|
+
* This is used for both max-fairness and max-availability methods.
|
|
89
|
+
*/
|
|
90
|
+
roundRobinEventId?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface for the meeting buffer object within an availability request.
|
|
94
|
+
*/
|
|
95
|
+
export interface MeetingBuffer {
|
|
96
|
+
/**
|
|
97
|
+
* The amount of buffer time in increments of 5 minutes to add before existing meetings.
|
|
98
|
+
* Defaults to 0.
|
|
99
|
+
*/
|
|
100
|
+
before: number;
|
|
101
|
+
/**
|
|
102
|
+
* The amount of buffer time in increments of 5 minutes to add after existing meetings.
|
|
103
|
+
* Defaults to 0.
|
|
104
|
+
*/
|
|
105
|
+
after: number;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Interface of a participant's open hours.
|
|
109
|
+
*/
|
|
110
|
+
export interface OpenHours {
|
|
111
|
+
/**
|
|
112
|
+
* The days of the week that the open hour settings will be applied to.
|
|
113
|
+
* Sunday corresponds to 0 and Saturday corresponds to 6.
|
|
114
|
+
*/
|
|
115
|
+
days: number[];
|
|
116
|
+
/**
|
|
117
|
+
* IANA time zone database formatted string (e.g. America/New_York).
|
|
118
|
+
* @see <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">List of tz database time zones</a>
|
|
119
|
+
*/
|
|
120
|
+
timezone: string;
|
|
121
|
+
/**
|
|
122
|
+
* Start time in 24-hour time format. Leading 0's are left off.
|
|
123
|
+
*/
|
|
124
|
+
start: string;
|
|
125
|
+
/**
|
|
126
|
+
* End time in 24-hour time format. Leading 0's are left off.
|
|
127
|
+
*/
|
|
128
|
+
end: string;
|
|
129
|
+
/**
|
|
130
|
+
* A list of dates that will be excluded from the open hours.
|
|
131
|
+
* Dates should be formatted as YYYY-MM-DD.
|
|
132
|
+
*/
|
|
133
|
+
exdates: string[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Interface of participant details to check availability for.
|
|
137
|
+
*/
|
|
138
|
+
export interface AvailabilityParticipant {
|
|
139
|
+
/**
|
|
140
|
+
* The email address of the participant.
|
|
141
|
+
*/
|
|
142
|
+
email: string;
|
|
143
|
+
/**
|
|
144
|
+
* An optional list of the calendar IDs associated with each participant's email address.
|
|
145
|
+
* If not provided, Nylas uses the primary calendar ID.
|
|
146
|
+
*/
|
|
147
|
+
calendarIds?: string[];
|
|
148
|
+
/**
|
|
149
|
+
* Open hours for this participant. The endpoint searches for free time slots during these open hours.
|
|
150
|
+
*/
|
|
151
|
+
openHours?: OpenHours[];
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Enum representing the method used to determine availability for a meeting.
|
|
155
|
+
*/
|
|
156
|
+
export declare enum AvailabilityMethod {
|
|
157
|
+
MaxFairness = "max-fairness",
|
|
158
|
+
MaxAvailability = "max-availability"
|
|
159
|
+
}
|