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
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Provider } from './auth.js';
|
|
2
|
+
/**
|
|
3
|
+
* Interface representing a Nylas Grant object.
|
|
4
|
+
*/
|
|
5
|
+
export interface Grant {
|
|
6
|
+
/**
|
|
7
|
+
* Globally unique object identifier.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* OAuth provider that the user authenticated with.
|
|
12
|
+
*/
|
|
13
|
+
provider: string;
|
|
14
|
+
/**
|
|
15
|
+
* Scopes specified for the grant.
|
|
16
|
+
*/
|
|
17
|
+
scope: string[];
|
|
18
|
+
/**
|
|
19
|
+
* Unix timestamp when the grant was created.
|
|
20
|
+
*/
|
|
21
|
+
createdAt: number;
|
|
22
|
+
/**
|
|
23
|
+
* Status of the grant, if it is still valid or if the user needs to re-authenticate.
|
|
24
|
+
*/
|
|
25
|
+
grantStatus?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Email address associated with the grant.
|
|
28
|
+
*/
|
|
29
|
+
email?: string;
|
|
30
|
+
/**
|
|
31
|
+
* End user's client user agent.
|
|
32
|
+
*/
|
|
33
|
+
userAgent?: string;
|
|
34
|
+
/**
|
|
35
|
+
* End user's client IP address.
|
|
36
|
+
*/
|
|
37
|
+
ip?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Initial state that was sent as part of the OAuth request.
|
|
40
|
+
*/
|
|
41
|
+
state?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Unix timestamp when the grant was updated.
|
|
44
|
+
*/
|
|
45
|
+
updatedAt?: number;
|
|
46
|
+
/**
|
|
47
|
+
* Provider's ID for the user this grant is associated with.
|
|
48
|
+
*/
|
|
49
|
+
providerUserId?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Settings required by the provider that were sent as part of the OAuth request.
|
|
52
|
+
*/
|
|
53
|
+
settings?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Interface representing a request to create a grant.
|
|
57
|
+
*/
|
|
58
|
+
export interface CreateGrantRequest {
|
|
59
|
+
/**
|
|
60
|
+
* OAuth provider
|
|
61
|
+
*/
|
|
62
|
+
provider: Provider;
|
|
63
|
+
/**
|
|
64
|
+
* Settings required by provider.
|
|
65
|
+
*/
|
|
66
|
+
settings: Record<string, unknown>;
|
|
67
|
+
/**
|
|
68
|
+
* Optional state value to return to developer's website after authentication flow is completed.
|
|
69
|
+
*/
|
|
70
|
+
state?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Optional list of scopes to request. If not specified it will use the integration default scopes.
|
|
73
|
+
*/
|
|
74
|
+
scope?: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Interface representing a request to update a grant.
|
|
78
|
+
*/
|
|
79
|
+
export interface UpdateGrantRequest {
|
|
80
|
+
/**
|
|
81
|
+
* Settings required by provider.
|
|
82
|
+
*/
|
|
83
|
+
settings?: Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* List of integration scopes for the grant.
|
|
86
|
+
*/
|
|
87
|
+
scope?: string[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Interface representing the query parameters for listing grants.
|
|
91
|
+
*/
|
|
92
|
+
export interface ListGrantsQueryParams {
|
|
93
|
+
/**
|
|
94
|
+
* The maximum number of objects to return.
|
|
95
|
+
* This field defaults to 10. The maximum allowed value is 200.
|
|
96
|
+
*/
|
|
97
|
+
limit?: number;
|
|
98
|
+
/**
|
|
99
|
+
* Offset grant results by this number.
|
|
100
|
+
*/
|
|
101
|
+
offset?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Sort entries by field name
|
|
104
|
+
*/
|
|
105
|
+
sortBy?: 'createdAt' | 'updatedAt';
|
|
106
|
+
/**
|
|
107
|
+
* Specify ascending or descending order.
|
|
108
|
+
*/
|
|
109
|
+
orderBy?: 'asc' | 'desc';
|
|
110
|
+
/**
|
|
111
|
+
* Scope grants from a specific point in time by Unix timestamp.
|
|
112
|
+
*/
|
|
113
|
+
since?: number;
|
|
114
|
+
/**
|
|
115
|
+
* Scope grants to a specific point in time by Unix timestamp.
|
|
116
|
+
*/
|
|
117
|
+
before?: number;
|
|
118
|
+
/**
|
|
119
|
+
* Filtering your query based on grant email address (if applicable)
|
|
120
|
+
*/
|
|
121
|
+
email?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Filtering your query based on grant email status (if applicable)
|
|
124
|
+
*/
|
|
125
|
+
grantStatus?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Filtering your query based on grant IP address
|
|
128
|
+
*/
|
|
129
|
+
ip?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Filtering your query based on OAuth provider
|
|
132
|
+
*/
|
|
133
|
+
provider?: Provider;
|
|
134
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representation of a Redirect URI object
|
|
3
|
+
*/
|
|
4
|
+
export type RedirectUri = {
|
|
5
|
+
/**
|
|
6
|
+
* Globally unique object identifier
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Redirect URL
|
|
11
|
+
*/
|
|
12
|
+
url: string;
|
|
13
|
+
/**
|
|
14
|
+
* Platform identifier
|
|
15
|
+
*/
|
|
16
|
+
platform: string;
|
|
17
|
+
/**
|
|
18
|
+
* Configuration settings
|
|
19
|
+
*/
|
|
20
|
+
settings?: RedirectUriSettings;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Configuration settings for a Redirect URI object
|
|
24
|
+
*/
|
|
25
|
+
export type RedirectUriSettings = {
|
|
26
|
+
/**
|
|
27
|
+
* Related to JS platform
|
|
28
|
+
*/
|
|
29
|
+
origin?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Related to iOS platform
|
|
32
|
+
*/
|
|
33
|
+
bundleId?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Related to iOS platform
|
|
36
|
+
*/
|
|
37
|
+
appStoreId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Related to iOS platform
|
|
40
|
+
*/
|
|
41
|
+
teamId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Related to Android platform
|
|
44
|
+
*/
|
|
45
|
+
packageName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Related to Android platform
|
|
48
|
+
*/
|
|
49
|
+
sha1CertificateFingerprint?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Class representing a request to create a redirect uri.
|
|
53
|
+
*/
|
|
54
|
+
export type CreateRedirectUriRequest = {
|
|
55
|
+
/**
|
|
56
|
+
* Redirect URL.
|
|
57
|
+
*/
|
|
58
|
+
url: string;
|
|
59
|
+
/**
|
|
60
|
+
* Platform identifier.
|
|
61
|
+
*/
|
|
62
|
+
platform: string;
|
|
63
|
+
/**
|
|
64
|
+
* Optional settings for the redirect uri.
|
|
65
|
+
*/
|
|
66
|
+
settings?: RedirectUriSettings;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Interface representation of a Nylas update redirect uri request
|
|
70
|
+
*/
|
|
71
|
+
export type UpdateRedirectUriRequest = Partial<CreateRedirectUriRequest>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representation of a Nylas response object
|
|
3
|
+
*/
|
|
4
|
+
export interface NylasResponse<T> {
|
|
5
|
+
/**
|
|
6
|
+
* The requested data object
|
|
7
|
+
*/
|
|
8
|
+
data: T;
|
|
9
|
+
/**
|
|
10
|
+
* The request ID
|
|
11
|
+
*/
|
|
12
|
+
requestId: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface representation of a Nylas response object that contains a list of objects.
|
|
16
|
+
*/
|
|
17
|
+
export interface NylasListResponse<T> {
|
|
18
|
+
/**
|
|
19
|
+
* The list of requested data objects.
|
|
20
|
+
*/
|
|
21
|
+
data: T[];
|
|
22
|
+
/**
|
|
23
|
+
* The request ID.
|
|
24
|
+
*/
|
|
25
|
+
requestId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The cursor to use to get the next page of data.
|
|
28
|
+
*/
|
|
29
|
+
nextCursor?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Interface representing a response to a delete request.
|
|
33
|
+
*/
|
|
34
|
+
export interface NylasDeleteResponse {
|
|
35
|
+
requestId: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Helper type for pagination
|
|
39
|
+
*/
|
|
40
|
+
export type ListResponseInnerType<T> = T extends NylasListResponse<infer R> ? R : never;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface Webhook {
|
|
2
|
+
id: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
triggerTypes: WebhookTriggers[];
|
|
5
|
+
callbackUrl: string;
|
|
6
|
+
status: 'active' | 'failing' | 'failed' | 'pause';
|
|
7
|
+
notificationEmailAddress?: string;
|
|
8
|
+
statusUpdatedAt: number;
|
|
9
|
+
createdAt: number;
|
|
10
|
+
updatedAt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface WebhookWithSecret extends Webhook {
|
|
13
|
+
webhookSecret: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WebhookDeleteResponse {
|
|
16
|
+
requestId: string;
|
|
17
|
+
data?: {
|
|
18
|
+
status: 'success';
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface WebhookIpAddressesResponse {
|
|
22
|
+
ipAddresses: string[];
|
|
23
|
+
updatedAt: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CreateWebhookRequest {
|
|
26
|
+
triggerTypes: WebhookTriggers[];
|
|
27
|
+
callbackUrl: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
notificationEmailAddress?: string;
|
|
30
|
+
}
|
|
31
|
+
export type UpdateWebhookRequest = Partial<CreateWebhookRequest>;
|
|
32
|
+
export declare enum WebhookTriggers {
|
|
33
|
+
CalendarCreated = "calendar.created",
|
|
34
|
+
CalendarUpdated = "calendar.updated",
|
|
35
|
+
CalendarDeleted = "calendar.deleted",
|
|
36
|
+
EventCreated = "event.created",
|
|
37
|
+
EventUpdated = "event.updated",
|
|
38
|
+
EventDeleted = "event.deleted",
|
|
39
|
+
GrantCreated = "grant.created",
|
|
40
|
+
GrantUpdated = "grant.updated",
|
|
41
|
+
GrantDeleted = "grant.deleted",
|
|
42
|
+
GrantExpired = "grant.expired",
|
|
43
|
+
MessageSendSuccess = "message.send_success",
|
|
44
|
+
MessageSendFailed = "message.send_failed"
|
|
45
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import APIClient from './apiClient.js';
|
|
2
|
+
import { NylasConfig } from './config.js';
|
|
3
|
+
import { Calendars } from './resources/calendars.js';
|
|
4
|
+
import { Events } from './resources/events.js';
|
|
5
|
+
import { Auth } from './resources/auth.js';
|
|
6
|
+
import { Webhooks } from './resources/webhooks.js';
|
|
7
|
+
import { Applications } from './resources/applications.js';
|
|
8
|
+
/**
|
|
9
|
+
* The entry point to the Node SDK
|
|
10
|
+
*
|
|
11
|
+
* A Nylas instance holds a configured http client pointing to a base URL and is intended to be reused and shared
|
|
12
|
+
* across threads and time.
|
|
13
|
+
*/
|
|
14
|
+
export default class Nylas {
|
|
15
|
+
/**
|
|
16
|
+
* Access the Applications API
|
|
17
|
+
*/
|
|
18
|
+
applications: Applications;
|
|
19
|
+
/**
|
|
20
|
+
* Access the Auth API
|
|
21
|
+
*/
|
|
22
|
+
auth: Auth;
|
|
23
|
+
/**
|
|
24
|
+
* Access the Calendars API
|
|
25
|
+
*/
|
|
26
|
+
calendars: Calendars;
|
|
27
|
+
/**
|
|
28
|
+
* Access the Events API
|
|
29
|
+
*/
|
|
30
|
+
events: Events;
|
|
31
|
+
/**
|
|
32
|
+
* Access the Webhooks API
|
|
33
|
+
*/
|
|
34
|
+
webhooks: Webhooks;
|
|
35
|
+
/**
|
|
36
|
+
* The configured API client
|
|
37
|
+
* @ignore Not for public use
|
|
38
|
+
*/
|
|
39
|
+
apiClient: APIClient;
|
|
40
|
+
/**
|
|
41
|
+
* @param config Configuration options for the Nylas SDK
|
|
42
|
+
*/
|
|
43
|
+
constructor(config: NylasConfig);
|
|
44
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Resource } from './resource.js';
|
|
2
|
+
import { RedirectUris } from './redirectUris.js';
|
|
3
|
+
import APIClient from '../apiClient.js';
|
|
4
|
+
import { ApplicationDetails } from '../models/applicationDetails.js';
|
|
5
|
+
import { NylasResponse } from '../models/response.js';
|
|
6
|
+
import { Overrides } from '../config.js';
|
|
7
|
+
/**
|
|
8
|
+
* Nylas Applications API
|
|
9
|
+
*
|
|
10
|
+
* This endpoint allows for getting application details as well as redirect URI operations.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Applications extends Resource {
|
|
13
|
+
/**
|
|
14
|
+
* Access the collection of redirect URI related API endpoints.
|
|
15
|
+
*/
|
|
16
|
+
redirectUris: RedirectUris;
|
|
17
|
+
/**
|
|
18
|
+
* @param apiClient client The configured Nylas API client
|
|
19
|
+
*/
|
|
20
|
+
constructor(apiClient: APIClient);
|
|
21
|
+
/**
|
|
22
|
+
* Get application details
|
|
23
|
+
* @returns The application details
|
|
24
|
+
*/
|
|
25
|
+
getDetails({ overrides }?: Overrides): Promise<NylasResponse<ApplicationDetails>>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import APIClient from '../apiClient.js';
|
|
2
|
+
import { Resource } from './resource.js';
|
|
3
|
+
import { Grants } from './grants.js';
|
|
4
|
+
import { URLForAdminConsentConfig, URLForAuthenticationConfig, CodeExchangeRequest, PKCEAuthURL, TokenExchangeRequest, CodeExchangeResponse, ProviderDetectParams, ProviderDetectResponse } from '../models/auth.js';
|
|
5
|
+
/**
|
|
6
|
+
* A collection of authentication related API endpoints
|
|
7
|
+
*
|
|
8
|
+
* These endpoints allow for various functionality related to authentication.
|
|
9
|
+
* Also contains the Grants API and collection of provider API endpoints.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Auth extends Resource {
|
|
12
|
+
/**
|
|
13
|
+
* Access the Grants API
|
|
14
|
+
*/
|
|
15
|
+
grants: Grants;
|
|
16
|
+
apiClient: APIClient;
|
|
17
|
+
/**
|
|
18
|
+
* @param apiClient The configured Nylas API client
|
|
19
|
+
*/
|
|
20
|
+
constructor(apiClient: APIClient);
|
|
21
|
+
/**
|
|
22
|
+
* Build the URL for authenticating users to your application with OAuth 2.0
|
|
23
|
+
* @param config The configuration for building the URL
|
|
24
|
+
* @return The URL for hosted authentication
|
|
25
|
+
*/
|
|
26
|
+
urlForOAuth2(config: URLForAuthenticationConfig): string;
|
|
27
|
+
/**
|
|
28
|
+
* Exchange an authorization code for an access token
|
|
29
|
+
* @param request The request parameters for the code exchange
|
|
30
|
+
* @return Information about the Nylas application
|
|
31
|
+
*/
|
|
32
|
+
exchangeCodeForToken(request: CodeExchangeRequest): Promise<CodeExchangeResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Refresh an access token
|
|
35
|
+
* @param request The refresh token request
|
|
36
|
+
* @return The response containing the new access token
|
|
37
|
+
*/
|
|
38
|
+
refreshAccessToken(request: TokenExchangeRequest): Promise<CodeExchangeResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Build the URL for authenticating users to your application with OAuth 2.0 and PKCE
|
|
41
|
+
* IMPORTANT: YOU WILL NEED TO STORE THE 'secret' returned to use it inside the CodeExchange flow
|
|
42
|
+
* @param config The configuration for building the URL
|
|
43
|
+
* @return The URL for hosted authentication
|
|
44
|
+
*/
|
|
45
|
+
urlForOAuth2PKCE(config: URLForAuthenticationConfig): PKCEAuthURL;
|
|
46
|
+
/**
|
|
47
|
+
* Build the URL for admin consent authentication for Microsoft
|
|
48
|
+
* @param config The configuration for building the URL
|
|
49
|
+
* @return The URL for admin consent authentication
|
|
50
|
+
*/
|
|
51
|
+
urlForAdminConsent(config: URLForAdminConsentConfig): string;
|
|
52
|
+
/**
|
|
53
|
+
* Revoke a token (and the grant attached to the token)
|
|
54
|
+
* @param token The token to revoke
|
|
55
|
+
* @return True if the token was revoked successfully
|
|
56
|
+
*/
|
|
57
|
+
revoke(token: string): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Detect provider from email address
|
|
60
|
+
* @param params The parameters to include in the request
|
|
61
|
+
* @return The detected provider, if found
|
|
62
|
+
*/
|
|
63
|
+
detectProvider(params: ProviderDetectParams): Promise<ProviderDetectResponse>;
|
|
64
|
+
private urlAuthBuilder;
|
|
65
|
+
private hashPKCESecret;
|
|
66
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Overrides } from '../config.js';
|
|
2
|
+
import { Calendar, CreateCalenderRequest, ListCalendersQueryParams, UpdateCalenderRequest } from '../models/calendars.js';
|
|
3
|
+
import { NylasDeleteResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
|
+
import { Resource, AsyncListResponse } from './resource.js';
|
|
5
|
+
import { GetAvailabilityRequest, GetAvailabilityResponse } from '../models/availability.js';
|
|
6
|
+
/**
|
|
7
|
+
* The parameters for the {@link Calendars.find} method
|
|
8
|
+
* @property calendarId The id of the Calendar to retrieve. Use "primary" to refer to the primary calendar associated with grant.
|
|
9
|
+
* @property identifier The identifier of the grant to act upon
|
|
10
|
+
*/
|
|
11
|
+
interface FindCalendarParams {
|
|
12
|
+
identifier: string;
|
|
13
|
+
calendarId: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The parameters for the {@link Calendars.list} method
|
|
17
|
+
* @property identifier The identifier of the grant to act upon
|
|
18
|
+
* @property queryParams The query parameters to include in the request
|
|
19
|
+
*/
|
|
20
|
+
interface ListCalendersParams {
|
|
21
|
+
identifier: string;
|
|
22
|
+
queryParams?: ListCalendersQueryParams;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The parameters for the {@link Calendars.create} method
|
|
26
|
+
* @property identifier The identifier of the grant to act upon
|
|
27
|
+
* @property requestBody The request body to create a calendar
|
|
28
|
+
*/
|
|
29
|
+
interface CreateCalendarParams {
|
|
30
|
+
identifier: string;
|
|
31
|
+
requestBody: CreateCalenderRequest;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The parameters for the {@link Calendars.update} method
|
|
35
|
+
* @property identifier The identifier of the grant to act upon
|
|
36
|
+
* @property calendarId The id of the Calendar to retrieve. Use "primary" to refer to the primary calendar associated with grant.
|
|
37
|
+
*/
|
|
38
|
+
interface UpdateCalendarParams {
|
|
39
|
+
identifier: string;
|
|
40
|
+
calendarId: string;
|
|
41
|
+
requestBody: UpdateCalenderRequest;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The parameters for the {@link Calendars.destroy} method
|
|
45
|
+
* @property identifier The identifier of the grant to act upon
|
|
46
|
+
* @property calendarId The id of the Calendar to retrieve. Use "primary" to refer to the primary calendar associated with grant.
|
|
47
|
+
*/
|
|
48
|
+
interface DestroyCalendarParams {
|
|
49
|
+
identifier: string;
|
|
50
|
+
calendarId: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The parameters for the {@link Calendars.getAvailability} method
|
|
54
|
+
* @property requestBody The availability request
|
|
55
|
+
*/
|
|
56
|
+
interface GetAvailabilityParams {
|
|
57
|
+
requestBody: GetAvailabilityRequest;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Nylas Calendar API
|
|
61
|
+
*
|
|
62
|
+
* The Nylas calendar API allows you to create new calendars or manage existing ones.
|
|
63
|
+
* A calendar can be accessed by one, or several people, and can contain events.
|
|
64
|
+
*/
|
|
65
|
+
export declare class Calendars extends Resource {
|
|
66
|
+
/**
|
|
67
|
+
* Return all Calendars
|
|
68
|
+
* @return A list of calendars
|
|
69
|
+
*/
|
|
70
|
+
list({ identifier, queryParams, overrides, }: ListCalendersParams & ListCalendersQueryParams & Overrides): AsyncListResponse<NylasListResponse<Calendar>>;
|
|
71
|
+
/**
|
|
72
|
+
* Return a Calendar
|
|
73
|
+
* @return The calendar
|
|
74
|
+
*/
|
|
75
|
+
find({ identifier, calendarId, overrides, }: FindCalendarParams & Overrides): Promise<NylasResponse<Calendar>>;
|
|
76
|
+
/**
|
|
77
|
+
* Create a Calendar
|
|
78
|
+
* @return The created calendar
|
|
79
|
+
*/
|
|
80
|
+
create({ identifier, requestBody, overrides, }: CreateCalendarParams & Overrides): Promise<NylasResponse<Calendar>>;
|
|
81
|
+
/**
|
|
82
|
+
* Update a Calendar
|
|
83
|
+
* @return The updated Calendar
|
|
84
|
+
*/
|
|
85
|
+
update({ calendarId, identifier, requestBody, overrides, }: UpdateCalendarParams & Overrides): Promise<NylasResponse<Calendar>>;
|
|
86
|
+
/**
|
|
87
|
+
* Delete a Calendar
|
|
88
|
+
* @return The deleted Calendar
|
|
89
|
+
*/
|
|
90
|
+
destroy({ identifier, calendarId, overrides, }: DestroyCalendarParams & Overrides): Promise<NylasDeleteResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Get Availability for a given account / accounts
|
|
93
|
+
* @return The availability response
|
|
94
|
+
*/
|
|
95
|
+
getAvailability({ requestBody, overrides, }: GetAvailabilityParams & Overrides): Promise<GetAvailabilityResponse>;
|
|
96
|
+
}
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Overrides } from '../config.js';
|
|
2
|
+
import { CreateEventQueryParams, CreateEventRequest, DestroyEventQueryParams, Event, FindEventQueryParams, ListEventQueryParams, UpdateEventQueryParams, UpdateEventRequest } from '../models/events.js';
|
|
3
|
+
import { NylasDeleteResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
|
+
import { AsyncListResponse, Resource } from './resource.js';
|
|
5
|
+
/**
|
|
6
|
+
* @property eventId The id of the Event to retrieve.
|
|
7
|
+
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property queryParams The query parameters to include in the request
|
|
9
|
+
*/
|
|
10
|
+
interface FindEventParams {
|
|
11
|
+
identifier: string;
|
|
12
|
+
eventId: string;
|
|
13
|
+
queryParams: FindEventQueryParams;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @property identifier The identifier of the grant to act upon
|
|
17
|
+
* @property queryParams The query parameters to include in the request
|
|
18
|
+
*/
|
|
19
|
+
interface ListEventParams {
|
|
20
|
+
identifier: string;
|
|
21
|
+
queryParams: ListEventQueryParams;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @property identifier The identifier of the grant to act upon
|
|
25
|
+
* @property queryParams The query parameters to include in the request
|
|
26
|
+
* @property requestBody The values to create the Event with
|
|
27
|
+
*/
|
|
28
|
+
interface CreateEventParams {
|
|
29
|
+
identifier: string;
|
|
30
|
+
requestBody: CreateEventRequest;
|
|
31
|
+
queryParams: CreateEventQueryParams;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @property identifier The identifier of the grant to act upon
|
|
35
|
+
* @property eventId The id of the Event to retrieve.
|
|
36
|
+
* @property requestBody The values to update the Event with
|
|
37
|
+
* @property queryParams The query parameters to include in the request
|
|
38
|
+
*/
|
|
39
|
+
interface UpdateEventParams {
|
|
40
|
+
identifier: string;
|
|
41
|
+
eventId: string;
|
|
42
|
+
requestBody: UpdateEventRequest;
|
|
43
|
+
queryParams: UpdateEventQueryParams;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @property identifier The identifier of the grant to act upon
|
|
47
|
+
* @property eventId The id of the Event to retrieve.
|
|
48
|
+
* @property queryParams The query parameters to include in the request
|
|
49
|
+
*/
|
|
50
|
+
interface DestroyEventParams {
|
|
51
|
+
identifier: string;
|
|
52
|
+
eventId: string;
|
|
53
|
+
queryParams: DestroyEventQueryParams;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Nylas Events API
|
|
57
|
+
*
|
|
58
|
+
* The Nylas Events API allows you to create, update, and delete events on user calendars.
|
|
59
|
+
*/
|
|
60
|
+
export declare class Events extends Resource {
|
|
61
|
+
/**
|
|
62
|
+
* Return all Events
|
|
63
|
+
* @return The list of Events
|
|
64
|
+
*/
|
|
65
|
+
list({ identifier, queryParams, overrides, }: ListEventParams & Overrides): AsyncListResponse<NylasListResponse<Event>>;
|
|
66
|
+
/**
|
|
67
|
+
* Return an Event
|
|
68
|
+
* @return The Event
|
|
69
|
+
*/
|
|
70
|
+
find({ identifier, eventId, queryParams, overrides, }: FindEventParams & Overrides): Promise<NylasResponse<Event>>;
|
|
71
|
+
/**
|
|
72
|
+
* Create an Event
|
|
73
|
+
* @return The created Event
|
|
74
|
+
*/
|
|
75
|
+
create({ identifier, requestBody, queryParams, overrides, }: CreateEventParams & Overrides): Promise<NylasResponse<Event>>;
|
|
76
|
+
/**
|
|
77
|
+
* Update an Event
|
|
78
|
+
* @return The updated Event
|
|
79
|
+
*/
|
|
80
|
+
update({ identifier, eventId, requestBody, queryParams, overrides, }: UpdateEventParams & Overrides): Promise<NylasResponse<Event>>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete an Event
|
|
83
|
+
* @return The deletion response
|
|
84
|
+
*/
|
|
85
|
+
destroy({ identifier, eventId, queryParams, overrides, }: DestroyEventParams & Overrides): Promise<NylasDeleteResponse>;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Resource } from './resource.js';
|
|
2
|
+
import { Overrides } from '../config.js';
|
|
3
|
+
import { NylasDeleteResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
|
+
import { CreateGrantRequest, Grant, ListGrantsQueryParams, UpdateGrantRequest } from '../models/grants.js';
|
|
5
|
+
/**
|
|
6
|
+
* @property grantId The id of the Grant to retrieve.
|
|
7
|
+
*/
|
|
8
|
+
interface FindGrantParams {
|
|
9
|
+
grantId: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @property requestBody The values to create the Grant with.
|
|
13
|
+
*/
|
|
14
|
+
interface CreateGrantParams {
|
|
15
|
+
requestBody: CreateGrantRequest;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @property grantId The id of the Grant to update.
|
|
19
|
+
* @property requestBody The values to update the Grant with.
|
|
20
|
+
*/
|
|
21
|
+
interface UpdateGrantParams {
|
|
22
|
+
grantId: string;
|
|
23
|
+
requestBody: UpdateGrantRequest;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @property grantId The id of the Grant to delete.
|
|
27
|
+
*/
|
|
28
|
+
interface DestroyGrantParams {
|
|
29
|
+
grantId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Nylas Grants API
|
|
33
|
+
*
|
|
34
|
+
* The Nylas Grants API allows for the management of grants.
|
|
35
|
+
*/
|
|
36
|
+
export declare class Grants extends Resource {
|
|
37
|
+
/**
|
|
38
|
+
* Return all Grants
|
|
39
|
+
* @return The list of Grants
|
|
40
|
+
*/
|
|
41
|
+
list({ overrides }?: Overrides, queryParams?: ListGrantsQueryParams): Promise<NylasListResponse<Grant>>;
|
|
42
|
+
/**
|
|
43
|
+
* Return a Grant
|
|
44
|
+
* @return The Grant
|
|
45
|
+
*/
|
|
46
|
+
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
|
+
/**
|
|
53
|
+
* Update a Grant
|
|
54
|
+
* @return The updated Grant
|
|
55
|
+
*/
|
|
56
|
+
update({ grantId, requestBody, overrides, }: UpdateGrantParams & Overrides): Promise<NylasResponse<Grant>>;
|
|
57
|
+
/**
|
|
58
|
+
* Delete a Grant
|
|
59
|
+
* @return The deletion response
|
|
60
|
+
*/
|
|
61
|
+
destroy({ grantId, overrides, }: DestroyGrantParams & Overrides): Promise<NylasDeleteResponse>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|