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.
Files changed (204) hide show
  1. package/README.md +27 -19
  2. package/lib/cjs/apiClient.js +114 -0
  3. package/lib/cjs/config.js +32 -0
  4. package/lib/cjs/models/applicationDetails.js +2 -0
  5. package/lib/cjs/models/auth.js +2 -0
  6. package/lib/cjs/models/availability.js +11 -0
  7. package/lib/cjs/models/calendars.js +2 -0
  8. package/lib/cjs/models/error.js +53 -0
  9. package/lib/cjs/models/events.js +2 -0
  10. package/lib/cjs/models/grants.js +2 -0
  11. package/lib/cjs/models/listQueryParams.js +2 -0
  12. package/lib/cjs/models/redirectUri.js +2 -0
  13. package/lib/cjs/models/response.js +2 -0
  14. package/lib/cjs/models/webhooks.js +18 -0
  15. package/lib/cjs/nylas.js +34 -0
  16. package/lib/cjs/package.json +3 -0
  17. package/lib/cjs/resources/applications.js +30 -0
  18. package/lib/cjs/resources/auth.js +153 -0
  19. package/lib/cjs/resources/calendars.js +78 -0
  20. package/lib/cjs/resources/events.js +69 -0
  21. package/lib/cjs/resources/grants.js +65 -0
  22. package/lib/cjs/resources/redirectUris.js +64 -0
  23. package/lib/cjs/resources/resource.js +111 -0
  24. package/lib/cjs/resources/webhooks.js +98 -0
  25. package/lib/cjs/utils.js +58 -0
  26. package/lib/cjs/version.js +5 -0
  27. package/lib/esm/apiClient.js +111 -0
  28. package/lib/esm/config.js +29 -0
  29. package/lib/esm/models/applicationDetails.js +1 -0
  30. package/lib/esm/models/auth.js +1 -0
  31. package/lib/esm/models/availability.js +8 -0
  32. package/lib/esm/models/calendars.js +1 -0
  33. package/lib/esm/models/error.js +45 -0
  34. package/lib/esm/models/events.js +1 -0
  35. package/lib/esm/models/grants.js +1 -0
  36. package/lib/esm/models/listQueryParams.js +1 -0
  37. package/lib/esm/models/redirectUri.js +1 -0
  38. package/lib/esm/models/response.js +1 -0
  39. package/lib/esm/models/webhooks.js +15 -0
  40. package/lib/esm/nylas.js +31 -0
  41. package/lib/esm/package.json +3 -0
  42. package/lib/esm/resources/applications.js +26 -0
  43. package/lib/esm/resources/auth.js +149 -0
  44. package/lib/esm/resources/calendars.js +74 -0
  45. package/lib/esm/resources/events.js +65 -0
  46. package/lib/esm/resources/grants.js +61 -0
  47. package/lib/esm/resources/redirectUris.js +60 -0
  48. package/lib/esm/resources/resource.js +107 -0
  49. package/lib/esm/resources/webhooks.js +94 -0
  50. package/lib/esm/utils.js +53 -0
  51. package/lib/esm/version.js +2 -0
  52. package/lib/types/apiClient.d.ts +65 -0
  53. package/lib/types/config.d.ts +50 -0
  54. package/lib/types/models/applicationDetails.d.ts +93 -0
  55. package/lib/types/models/auth.d.ts +196 -0
  56. package/lib/types/models/availability.d.ts +159 -0
  57. package/lib/types/models/calendars.d.ts +121 -0
  58. package/lib/types/models/error.d.ts +104 -0
  59. package/lib/types/models/events.d.ts +494 -0
  60. package/lib/types/models/grants.d.ts +134 -0
  61. package/lib/types/models/listQueryParams.d.ts +4 -0
  62. package/lib/types/models/redirectUri.d.ts +71 -0
  63. package/lib/types/models/response.d.ts +40 -0
  64. package/lib/types/models/webhooks.d.ts +45 -0
  65. package/lib/types/nylas.d.ts +44 -0
  66. package/lib/types/resources/applications.d.ts +26 -0
  67. package/lib/types/resources/auth.d.ts +66 -0
  68. package/lib/types/resources/calendars.d.ts +97 -0
  69. package/lib/types/resources/events.d.ts +87 -0
  70. package/lib/types/resources/grants.d.ts +63 -0
  71. package/lib/types/resources/redirectUris.d.ts +63 -0
  72. package/lib/types/resources/resource.d.ts +55 -0
  73. package/lib/types/resources/webhooks.d.ts +79 -0
  74. package/lib/types/utils.d.ts +22 -0
  75. package/lib/types/version.d.ts +1 -0
  76. package/package.json +33 -42
  77. package/lib/config.d.ts +0 -70
  78. package/lib/config.js +0 -68
  79. package/lib/models/access-token.d.ts +0 -18
  80. package/lib/models/access-token.js +0 -56
  81. package/lib/models/account.d.ts +0 -27
  82. package/lib/models/account.js +0 -73
  83. package/lib/models/application-details.d.ts +0 -14
  84. package/lib/models/application-details.js +0 -47
  85. package/lib/models/attributes.d.ts +0 -151
  86. package/lib/models/attributes.js +0 -382
  87. package/lib/models/calendar-availability.d.ts +0 -76
  88. package/lib/models/calendar-availability.js +0 -121
  89. package/lib/models/calendar-restful-model-collection.d.ts +0 -17
  90. package/lib/models/calendar-restful-model-collection.js +0 -181
  91. package/lib/models/calendar.d.ts +0 -31
  92. package/lib/models/calendar.js +0 -93
  93. package/lib/models/component-restful-model-collection.d.ts +0 -9
  94. package/lib/models/component-restful-model-collection.js +0 -34
  95. package/lib/models/component.d.ts +0 -37
  96. package/lib/models/component.js +0 -91
  97. package/lib/models/connect.d.ts +0 -73
  98. package/lib/models/connect.js +0 -193
  99. package/lib/models/contact-restful-model-collection.d.ts +0 -9
  100. package/lib/models/contact-restful-model-collection.js +0 -60
  101. package/lib/models/contact.d.ts +0 -129
  102. package/lib/models/contact.js +0 -289
  103. package/lib/models/delta-collection.d.ts +0 -17
  104. package/lib/models/delta-collection.js +0 -139
  105. package/lib/models/delta-stream.d.ts +0 -32
  106. package/lib/models/delta-stream.js +0 -250
  107. package/lib/models/delta.d.ts +0 -28
  108. package/lib/models/delta.js +0 -88
  109. package/lib/models/deltas.d.ts +0 -17
  110. package/lib/models/deltas.js +0 -49
  111. package/lib/models/draft.d.ts +0 -27
  112. package/lib/models/draft.js +0 -156
  113. package/lib/models/email-participant.d.ts +0 -13
  114. package/lib/models/email-participant.js +0 -46
  115. package/lib/models/event-conferencing.d.ts +0 -34
  116. package/lib/models/event-conferencing.js +0 -71
  117. package/lib/models/event-notification.d.ts +0 -27
  118. package/lib/models/event-notification.js +0 -62
  119. package/lib/models/event-participant.d.ts +0 -19
  120. package/lib/models/event-participant.js +0 -56
  121. package/lib/models/event.d.ts +0 -96
  122. package/lib/models/event.js +0 -297
  123. package/lib/models/file.d.ts +0 -29
  124. package/lib/models/file.js +0 -136
  125. package/lib/models/folder.d.ts +0 -21
  126. package/lib/models/folder.js +0 -69
  127. package/lib/models/free-busy.d.ts +0 -58
  128. package/lib/models/free-busy.js +0 -132
  129. package/lib/models/job-status-restful-model-collection.d.ts +0 -9
  130. package/lib/models/job-status-restful-model-collection.js +0 -38
  131. package/lib/models/job-status.d.ts +0 -24
  132. package/lib/models/job-status.js +0 -68
  133. package/lib/models/management-account.d.ts +0 -63
  134. package/lib/models/management-account.js +0 -187
  135. package/lib/models/management-model-collection.d.ts +0 -10
  136. package/lib/models/management-model-collection.js +0 -39
  137. package/lib/models/management-model.d.ts +0 -6
  138. package/lib/models/management-model.js +0 -29
  139. package/lib/models/message-restful-model-collection.d.ts +0 -26
  140. package/lib/models/message-restful-model-collection.js +0 -80
  141. package/lib/models/message.d.ts +0 -57
  142. package/lib/models/message.js +0 -173
  143. package/lib/models/model-collection.d.ts +0 -25
  144. package/lib/models/model-collection.js +0 -201
  145. package/lib/models/model.d.ts +0 -12
  146. package/lib/models/model.js +0 -64
  147. package/lib/models/neural-categorizer.d.ts +0 -28
  148. package/lib/models/neural-categorizer.js +0 -139
  149. package/lib/models/neural-clean-conversation.d.ts +0 -16
  150. package/lib/models/neural-clean-conversation.js +0 -114
  151. package/lib/models/neural-ocr.d.ts +0 -14
  152. package/lib/models/neural-ocr.js +0 -50
  153. package/lib/models/neural-sentiment-analysis.d.ts +0 -20
  154. package/lib/models/neural-sentiment-analysis.js +0 -56
  155. package/lib/models/neural-signature-contact.d.ts +0 -43
  156. package/lib/models/neural-signature-contact.js +0 -142
  157. package/lib/models/neural-signature-extraction.d.ts +0 -17
  158. package/lib/models/neural-signature-extraction.js +0 -54
  159. package/lib/models/neural.d.ts +0 -36
  160. package/lib/models/neural.js +0 -163
  161. package/lib/models/nylas-api-error.d.ts +0 -26
  162. package/lib/models/nylas-api-error.js +0 -61
  163. package/lib/models/outbox-job-status.d.ts +0 -20
  164. package/lib/models/outbox-job-status.js +0 -64
  165. package/lib/models/outbox-message.d.ts +0 -16
  166. package/lib/models/outbox-message.js +0 -54
  167. package/lib/models/outbox.d.ts +0 -35
  168. package/lib/models/outbox.js +0 -158
  169. package/lib/models/resource.d.ts +0 -22
  170. package/lib/models/resource.js +0 -66
  171. package/lib/models/restful-model-collection.d.ts +0 -15
  172. package/lib/models/restful-model-collection.js +0 -169
  173. package/lib/models/restful-model-instance.d.ts +0 -9
  174. package/lib/models/restful-model-instance.js +0 -37
  175. package/lib/models/restful-model.d.ts +0 -36
  176. package/lib/models/restful-model.js +0 -146
  177. package/lib/models/scheduler-booking-request.d.ts +0 -64
  178. package/lib/models/scheduler-booking-request.js +0 -148
  179. package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
  180. package/lib/models/scheduler-restful-model-collection.js +0 -133
  181. package/lib/models/scheduler-time-slot.d.ts +0 -20
  182. package/lib/models/scheduler-time-slot.js +0 -53
  183. package/lib/models/scheduler.d.ts +0 -226
  184. package/lib/models/scheduler.js +0 -446
  185. package/lib/models/thread.d.ts +0 -49
  186. package/lib/models/thread.js +0 -127
  187. package/lib/models/webhook-notification.d.ts +0 -108
  188. package/lib/models/webhook-notification.js +0 -239
  189. package/lib/models/webhook.d.ts +0 -50
  190. package/lib/models/webhook.js +0 -101
  191. package/lib/models/when.d.ts +0 -23
  192. package/lib/models/when.js +0 -65
  193. package/lib/nylas-connection.d.ts +0 -71
  194. package/lib/nylas-connection.js +0 -258
  195. package/lib/nylas.d.ts +0 -57
  196. package/lib/nylas.js +0 -210
  197. package/lib/server-bindings/express-binding.d.ts +0 -18
  198. package/lib/server-bindings/express-binding.js +0 -163
  199. package/lib/server-bindings/server-binding.d.ts +0 -65
  200. package/lib/server-bindings/server-binding.js +0 -87
  201. package/lib/services/routes.d.ts +0 -26
  202. package/lib/services/routes.js +0 -95
  203. package/lib/services/tunnel.d.ts +0 -29
  204. 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,4 @@
1
+ export interface ListQueryParams {
2
+ limit?: number;
3
+ pageToken?: string;
4
+ }
@@ -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 {};