nylas 7.6.2 → 7.7.0

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.
@@ -33,6 +33,7 @@ __exportStar(require("./listQueryParams.js"), exports);
33
33
  __exportStar(require("./messages.js"), exports);
34
34
  __exportStar(require("./redirectUri.js"), exports);
35
35
  __exportStar(require("./response.js"), exports);
36
+ __exportStar(require("./scheduler.js"), exports);
36
37
  __exportStar(require("./smartCompose.js"), exports);
37
38
  __exportStar(require("./threads.js"), exports);
38
39
  __exportStar(require("./webhooks.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/lib/cjs/nylas.js CHANGED
@@ -30,6 +30,7 @@ const folders_js_1 = require("./resources/folders.js");
30
30
  const grants_js_1 = require("./resources/grants.js");
31
31
  const contacts_js_1 = require("./resources/contacts.js");
32
32
  const attachments_js_1 = require("./resources/attachments.js");
33
+ const scheduler_js_1 = require("./resources/scheduler.js");
33
34
  /**
34
35
  * The entry point to the Node SDK
35
36
  *
@@ -60,6 +61,7 @@ class Nylas {
60
61
  this.folders = new folders_js_1.Folders(this.apiClient);
61
62
  this.contacts = new contacts_js_1.Contacts(this.apiClient);
62
63
  this.attachments = new attachments_js_1.Attachments(this.apiClient);
64
+ this.scheduler = new scheduler_js_1.Scheduler(this.apiClient);
63
65
  return this;
64
66
  }
65
67
  }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Bookings = void 0;
4
+ const resource_js_1 = require("./resource.js");
5
+ class Bookings extends resource_js_1.Resource {
6
+ /**
7
+ * Return a Booking
8
+ * @return The booking
9
+ */
10
+ find({ bookingId, queryParams, overrides, }) {
11
+ return super._find({
12
+ path: `/v3/scheduling/bookings/${bookingId}`,
13
+ queryParams,
14
+ overrides,
15
+ });
16
+ }
17
+ /**
18
+ * Create a Booking
19
+ * @return The created booking
20
+ */
21
+ create({ requestBody, queryParams, overrides, }) {
22
+ return super._create({
23
+ path: `/v3/scheduling/bookings`,
24
+ requestBody,
25
+ queryParams,
26
+ overrides,
27
+ });
28
+ }
29
+ /**
30
+ * Confirm a Booking
31
+ * @return The confirmed Booking
32
+ */
33
+ confirm({ bookingId, requestBody, queryParams, overrides, }) {
34
+ return super._update({
35
+ path: `/v3/scheduling/bookings/${bookingId}`,
36
+ requestBody,
37
+ queryParams,
38
+ overrides,
39
+ });
40
+ }
41
+ /**
42
+ * Reschedule a Booking
43
+ * @return The rescheduled Booking
44
+ */
45
+ reschedule({ bookingId, requestBody, queryParams, overrides, }) {
46
+ return super._updatePatch({
47
+ path: `/v3/scheduling/bookings/${bookingId}`,
48
+ requestBody,
49
+ queryParams,
50
+ overrides,
51
+ });
52
+ }
53
+ /**
54
+ * Delete a Booking
55
+ * @return The deleted Booking
56
+ */
57
+ destroy({ bookingId, requestBody, queryParams, overrides, }) {
58
+ return super._destroy({
59
+ path: `/v3/scheduling/bookings/${bookingId}`,
60
+ requestBody,
61
+ queryParams,
62
+ overrides,
63
+ });
64
+ }
65
+ }
66
+ exports.Bookings = Bookings;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Configurations = void 0;
4
+ const resource_js_1 = require("./resource.js");
5
+ class Configurations extends resource_js_1.Resource {
6
+ /**
7
+ * Return all Configurations
8
+ * @return A list of configurations
9
+ */
10
+ list({ identifier, overrides, }) {
11
+ return super._list({
12
+ overrides,
13
+ path: `/v3/grants/${identifier}/scheduling/configurations`,
14
+ });
15
+ }
16
+ /**
17
+ * Return a Configuration
18
+ * @return The configuration
19
+ */
20
+ find({ identifier, configurationId, overrides, }) {
21
+ return super._find({
22
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
23
+ overrides,
24
+ });
25
+ }
26
+ /**
27
+ * Create a Configuration
28
+ * @return The created configuration
29
+ */
30
+ create({ identifier, requestBody, overrides, }) {
31
+ return super._create({
32
+ path: `/v3/grants/${identifier}/scheduling/configurations`,
33
+ requestBody,
34
+ overrides,
35
+ });
36
+ }
37
+ /**
38
+ * Update a Configuration
39
+ * @return The updated Configuration
40
+ */
41
+ update({ configurationId, identifier, requestBody, overrides, }) {
42
+ return super._update({
43
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
44
+ requestBody,
45
+ overrides,
46
+ });
47
+ }
48
+ /**
49
+ * Delete a Configuration
50
+ * @return The deleted Configuration
51
+ */
52
+ destroy({ identifier, configurationId, overrides, }) {
53
+ return super._destroy({
54
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
55
+ overrides,
56
+ });
57
+ }
58
+ }
59
+ exports.Configurations = Configurations;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Messages = void 0;
4
- const resource_js_1 = require("./resource.js");
5
4
  const utils_js_1 = require("../utils.js");
5
+ const resource_js_1 = require("./resource.js");
6
6
  const smartCompose_js_1 = require("./smartCompose.js");
7
7
  /**
8
8
  * Nylas Messages API
@@ -144,7 +144,8 @@ class Messages extends resource_js_1.Resource {
144
144
  form.append('message', JSON.stringify((0, utils_js_1.objKeysToSnakeCase)(messagePayload)));
145
145
  // Add a separate form field for each attachment
146
146
  requestBody.attachments?.forEach((attachment, index) => {
147
- form.append(`file${index}`, attachment.content, {
147
+ const contentId = attachment.contentId || `file${index}`;
148
+ form.append(contentId, attachment.content, {
148
149
  filename: attachment.filename,
149
150
  contentType: attachment.contentType,
150
151
  });
@@ -99,11 +99,12 @@ class Resource {
99
99
  _updatePatch(params) {
100
100
  return this.payloadRequest('PATCH', params);
101
101
  }
102
- _destroy({ path, queryParams, overrides, }) {
102
+ _destroy({ path, queryParams, requestBody, overrides, }) {
103
103
  return this.apiClient.request({
104
104
  method: 'DELETE',
105
105
  path,
106
106
  queryParams,
107
+ body: requestBody,
107
108
  overrides,
108
109
  });
109
110
  }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Scheduler = void 0;
4
+ const configurations_js_1 = require("./configurations.js");
5
+ const sessions_js_1 = require("./sessions.js");
6
+ const bookings_js_1 = require("./bookings.js");
7
+ class Scheduler {
8
+ constructor(apiClient) {
9
+ this.configurations = new configurations_js_1.Configurations(apiClient);
10
+ this.bookings = new bookings_js_1.Bookings(apiClient);
11
+ this.sessions = new sessions_js_1.Sessions(apiClient);
12
+ }
13
+ }
14
+ exports.Scheduler = Scheduler;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sessions = void 0;
4
+ const resource_js_1 = require("./resource.js");
5
+ class Sessions extends resource_js_1.Resource {
6
+ /**
7
+ * Create a Session
8
+ * @return The created session
9
+ */
10
+ create({ requestBody, overrides, }) {
11
+ return super._create({
12
+ path: `/v3/scheduling/sessions`,
13
+ requestBody,
14
+ overrides,
15
+ });
16
+ }
17
+ /**
18
+ * Delete a Session
19
+ * @return The deleted Session
20
+ */
21
+ destroy({ sessionId, overrides, }) {
22
+ return super._destroy({
23
+ path: `/v3/scheduling/sessions/${sessionId}`,
24
+ overrides,
25
+ });
26
+ }
27
+ }
28
+ exports.Sessions = Sessions;
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
4
  // This file is generated by scripts/exportVersion.js
5
- exports.SDK_VERSION = '7.6.2';
5
+ exports.SDK_VERSION = '7.7.0';
@@ -17,6 +17,7 @@ export * from './listQueryParams.js';
17
17
  export * from './messages.js';
18
18
  export * from './redirectUri.js';
19
19
  export * from './response.js';
20
+ export * from './scheduler.js';
20
21
  export * from './smartCompose.js';
21
22
  export * from './threads.js';
22
23
  export * from './webhooks.js';
@@ -0,0 +1 @@
1
+ export {};
package/lib/esm/nylas.js CHANGED
@@ -14,6 +14,7 @@ import { Folders } from './resources/folders.js';
14
14
  import { Grants } from './resources/grants.js';
15
15
  import { Contacts } from './resources/contacts.js';
16
16
  import { Attachments } from './resources/attachments.js';
17
+ import { Scheduler } from './resources/scheduler.js';
17
18
  /**
18
19
  * The entry point to the Node SDK
19
20
  *
@@ -44,6 +45,7 @@ export default class Nylas {
44
45
  this.folders = new Folders(this.apiClient);
45
46
  this.contacts = new Contacts(this.apiClient);
46
47
  this.attachments = new Attachments(this.apiClient);
48
+ this.scheduler = new Scheduler(this.apiClient);
47
49
  return this;
48
50
  }
49
51
  }
@@ -0,0 +1,62 @@
1
+ import { Resource } from './resource.js';
2
+ export class Bookings extends Resource {
3
+ /**
4
+ * Return a Booking
5
+ * @return The booking
6
+ */
7
+ find({ bookingId, queryParams, overrides, }) {
8
+ return super._find({
9
+ path: `/v3/scheduling/bookings/${bookingId}`,
10
+ queryParams,
11
+ overrides,
12
+ });
13
+ }
14
+ /**
15
+ * Create a Booking
16
+ * @return The created booking
17
+ */
18
+ create({ requestBody, queryParams, overrides, }) {
19
+ return super._create({
20
+ path: `/v3/scheduling/bookings`,
21
+ requestBody,
22
+ queryParams,
23
+ overrides,
24
+ });
25
+ }
26
+ /**
27
+ * Confirm a Booking
28
+ * @return The confirmed Booking
29
+ */
30
+ confirm({ bookingId, requestBody, queryParams, overrides, }) {
31
+ return super._update({
32
+ path: `/v3/scheduling/bookings/${bookingId}`,
33
+ requestBody,
34
+ queryParams,
35
+ overrides,
36
+ });
37
+ }
38
+ /**
39
+ * Reschedule a Booking
40
+ * @return The rescheduled Booking
41
+ */
42
+ reschedule({ bookingId, requestBody, queryParams, overrides, }) {
43
+ return super._updatePatch({
44
+ path: `/v3/scheduling/bookings/${bookingId}`,
45
+ requestBody,
46
+ queryParams,
47
+ overrides,
48
+ });
49
+ }
50
+ /**
51
+ * Delete a Booking
52
+ * @return The deleted Booking
53
+ */
54
+ destroy({ bookingId, requestBody, queryParams, overrides, }) {
55
+ return super._destroy({
56
+ path: `/v3/scheduling/bookings/${bookingId}`,
57
+ requestBody,
58
+ queryParams,
59
+ overrides,
60
+ });
61
+ }
62
+ }
@@ -0,0 +1,55 @@
1
+ import { Resource } from './resource.js';
2
+ export class Configurations extends Resource {
3
+ /**
4
+ * Return all Configurations
5
+ * @return A list of configurations
6
+ */
7
+ list({ identifier, overrides, }) {
8
+ return super._list({
9
+ overrides,
10
+ path: `/v3/grants/${identifier}/scheduling/configurations`,
11
+ });
12
+ }
13
+ /**
14
+ * Return a Configuration
15
+ * @return The configuration
16
+ */
17
+ find({ identifier, configurationId, overrides, }) {
18
+ return super._find({
19
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
20
+ overrides,
21
+ });
22
+ }
23
+ /**
24
+ * Create a Configuration
25
+ * @return The created configuration
26
+ */
27
+ create({ identifier, requestBody, overrides, }) {
28
+ return super._create({
29
+ path: `/v3/grants/${identifier}/scheduling/configurations`,
30
+ requestBody,
31
+ overrides,
32
+ });
33
+ }
34
+ /**
35
+ * Update a Configuration
36
+ * @return The updated Configuration
37
+ */
38
+ update({ configurationId, identifier, requestBody, overrides, }) {
39
+ return super._update({
40
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
41
+ requestBody,
42
+ overrides,
43
+ });
44
+ }
45
+ /**
46
+ * Delete a Configuration
47
+ * @return The deleted Configuration
48
+ */
49
+ destroy({ identifier, configurationId, overrides, }) {
50
+ return super._destroy({
51
+ path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
52
+ overrides,
53
+ });
54
+ }
55
+ }
@@ -1,5 +1,5 @@
1
- import { Resource } from './resource.js';
2
1
  import { encodeAttachmentStreams, objKeysToSnakeCase } from '../utils.js';
2
+ import { Resource } from './resource.js';
3
3
  import { SmartCompose } from './smartCompose.js';
4
4
  /**
5
5
  * Nylas Messages API
@@ -141,7 +141,8 @@ export class Messages extends Resource {
141
141
  form.append('message', JSON.stringify(objKeysToSnakeCase(messagePayload)));
142
142
  // Add a separate form field for each attachment
143
143
  requestBody.attachments?.forEach((attachment, index) => {
144
- form.append(`file${index}`, attachment.content, {
144
+ const contentId = attachment.contentId || `file${index}`;
145
+ form.append(contentId, attachment.content, {
145
146
  filename: attachment.filename,
146
147
  contentType: attachment.contentType,
147
148
  });
@@ -96,11 +96,12 @@ export class Resource {
96
96
  _updatePatch(params) {
97
97
  return this.payloadRequest('PATCH', params);
98
98
  }
99
- _destroy({ path, queryParams, overrides, }) {
99
+ _destroy({ path, queryParams, requestBody, overrides, }) {
100
100
  return this.apiClient.request({
101
101
  method: 'DELETE',
102
102
  path,
103
103
  queryParams,
104
+ body: requestBody,
104
105
  overrides,
105
106
  });
106
107
  }
@@ -0,0 +1,10 @@
1
+ import { Configurations } from './configurations.js';
2
+ import { Sessions } from './sessions.js';
3
+ import { Bookings } from './bookings.js';
4
+ export class Scheduler {
5
+ constructor(apiClient) {
6
+ this.configurations = new Configurations(apiClient);
7
+ this.bookings = new Bookings(apiClient);
8
+ this.sessions = new Sessions(apiClient);
9
+ }
10
+ }
@@ -0,0 +1,24 @@
1
+ import { Resource } from './resource.js';
2
+ export class Sessions extends Resource {
3
+ /**
4
+ * Create a Session
5
+ * @return The created session
6
+ */
7
+ create({ requestBody, overrides, }) {
8
+ return super._create({
9
+ path: `/v3/scheduling/sessions`,
10
+ requestBody,
11
+ overrides,
12
+ });
13
+ }
14
+ /**
15
+ * Delete a Session
16
+ * @return The deleted Session
17
+ */
18
+ destroy({ sessionId, overrides, }) {
19
+ return super._destroy({
20
+ path: `/v3/scheduling/sessions/${sessionId}`,
21
+ overrides,
22
+ });
23
+ }
24
+ }
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '7.6.2';
2
+ export const SDK_VERSION = '7.7.0';
@@ -348,7 +348,7 @@ type ReminderMethod = 'email' | 'popup' | 'sound' | 'display';
348
348
  /**
349
349
  * Type representing the different conferencing objects.
350
350
  */
351
- type Conferencing = Details | Autocreate;
351
+ export type Conferencing = Details | Autocreate;
352
352
  /**
353
353
  * Type representing the different objects representing time and duration for events.
354
354
  */
@@ -16,6 +16,7 @@ export * from './listQueryParams.js';
16
16
  export * from './messages.js';
17
17
  export * from './redirectUri.js';
18
18
  export * from './response.js';
19
+ export * from './scheduler.js';
19
20
  export * from './smartCompose.js';
20
21
  export * from './threads.js';
21
22
  export * from './webhooks.js';
@@ -0,0 +1,426 @@
1
+ import { Subset } from '../utils.js';
2
+ import { AvailabilityRules, OpenHours } from './availability.js';
3
+ import { Conferencing } from './events.js';
4
+ export type BookingType = 'booking' | 'organizer-confirmation';
5
+ export type BookingReminderType = 'email' | 'webhook';
6
+ export type BookingRecipientType = 'host' | 'guest' | 'all';
7
+ export interface BookingConfirmedTemplate {
8
+ /**
9
+ * The title to replace the default 'Booking Confirmed' title.
10
+ * This doesn't change the email subject line. Only visible in emails sent to guests.
11
+ */
12
+ title?: string;
13
+ /**
14
+ * The additional body to be appended after the default body.
15
+ * Only visible in emails sent to guests.
16
+ */
17
+ body?: string;
18
+ }
19
+ export interface EmailTemplate {
20
+ /**
21
+ * The URL to a custom logo that appears at the top of the booking email.
22
+ * Replaces the default Nylas logo. The URL must be publicly accessible.
23
+ */
24
+ logo?: string;
25
+ /**
26
+ * Configurable settings specifically for booking confirmed emails.
27
+ */
28
+ bookingConfirmed?: BookingConfirmedTemplate;
29
+ }
30
+ export interface SchedulerSettings {
31
+ /**
32
+ * The definitions for additional fields to be displayed in the Scheduler UI.
33
+ * Guest will see the additional fields on the Scheduling Page when they book an event.
34
+ */
35
+ additionalFields?: Record<string, string>;
36
+ /**
37
+ * The number of days in the future that Scheduler is available for scheduling events.
38
+ */
39
+ availableDaysInFuture?: number;
40
+ /**
41
+ * The minimum number of minutes in the future that a user can make a new booking.
42
+ */
43
+ minBookingNotice?: number;
44
+ /**
45
+ * The minimum number of minutes before a booking can be cancelled.
46
+ */
47
+ minCancellationNotice?: number;
48
+ /**
49
+ * A message about the cancellation policy to display to users when booking an event.
50
+ */
51
+ cancellationPolicy?: string;
52
+ /**
53
+ * The URL used to reschedule bookings. This URL is included in confirmation email messages.
54
+ */
55
+ reschedulingUrl?: string;
56
+ /**
57
+ * The URL used to cancel bookings. This URL is included in confirmation email messages.
58
+ */
59
+ cancellationUrl?: string;
60
+ /**
61
+ * The URL used to confirm or cancel pending bookings. This URL is included in booking request email messages.
62
+ */
63
+ organizerConfirmationUrl?: string;
64
+ /**
65
+ * The custom URL to redirect to once the booking is confirmed.
66
+ */
67
+ confirmationRedirectUrl?: string;
68
+ /**
69
+ * If true, the option to reschedule an event is hidden in booking confirmations and email notifications.
70
+ */
71
+ hideReschedulingOptions?: boolean;
72
+ /**
73
+ * If true, the option to cancel an event is hidden in booking confirmations and email notifications.
74
+ */
75
+ hideCancellationOptions?: boolean;
76
+ /**
77
+ * Whether to hide the Additional guests field on the Scheduling Page. If true, guests cannot invite additional guests to the event.
78
+ */
79
+ hideAdditionalGuests?: boolean;
80
+ /**
81
+ * Configurable settings for booking emails.
82
+ */
83
+ emailTemplate?: EmailTemplate;
84
+ }
85
+ export interface BookingReminder {
86
+ /**
87
+ * The reminder type.
88
+ */
89
+ type: BookingReminderType;
90
+ /**
91
+ * The number of minutes before the event to send the reminder.
92
+ */
93
+ minutesBeforeEvent: number;
94
+ /**
95
+ * The recipient of the reminder.
96
+ */
97
+ recipient?: BookingRecipientType;
98
+ /**
99
+ * The subject of the email reminder.
100
+ */
101
+ emailSubject?: string;
102
+ }
103
+ export interface EventBooking {
104
+ /**
105
+ * The title of the event.
106
+ */
107
+ title: string;
108
+ /**
109
+ * The description of the event.
110
+ */
111
+ description?: string;
112
+ /**
113
+ * The location of the event.
114
+ */
115
+ location?: string;
116
+ /**
117
+ * The timezone for displaying the times in confirmation email messages and reminders.
118
+ */
119
+ timezone?: string;
120
+ /**
121
+ * The type of booking. If set to booking, Scheduler follows the standard booking flow and instantly creates the event.
122
+ * If set to organizer-confirmation, Scheduler creates an event marked "Pending" in the organizer's calendar and sends
123
+ * an confirmation request email to the organizer.
124
+ * The confirmation request email includes a link to a page where the organizer can confirm or cancel the booking.
125
+ */
126
+ bookingType?: BookingType;
127
+ /**
128
+ * An object that allows you to automatically create a conference or enter conferencing details manually.
129
+ */
130
+ conferencing?: Conferencing;
131
+ /**
132
+ * If true, Nylas doesn't send any email messages when an event is booked, cancelled, or rescheduled.
133
+ */
134
+ disableEmails?: boolean;
135
+ /**
136
+ * The list of reminders to send to participants before the event starts.
137
+ */
138
+ reminders?: BookingReminder[];
139
+ }
140
+ export interface Availability {
141
+ /**
142
+ * The total number of minutes the event should last.
143
+ */
144
+ durationMinutes: number;
145
+ /**
146
+ * The interval between meetings in minutes.
147
+ */
148
+ intervalMinutes?: number;
149
+ /**
150
+ * Nylas rounds each time slot to the nearest multiple of this number of minutes.
151
+ * Must be a multiple of 5.
152
+ */
153
+ roundTo?: number;
154
+ /**
155
+ * Availability rules for the scheduling configuration.
156
+ * These rules define how Nylas calculates availability for all participants.
157
+ */
158
+ availabilityRules?: Omit<AvailabilityRules, 'roundRobinEventId'>;
159
+ }
160
+ export interface ParticipantBooking {
161
+ /**
162
+ * The calendar ID that the event is created in.
163
+ */
164
+ calendarId: string;
165
+ }
166
+ export interface ParticipantAvailability {
167
+ /**
168
+ * An optional list of the calendar IDs associated with each participant's email address.
169
+ * If not provided, Nylas uses the primary calendar ID.
170
+ */
171
+ calendarIds: string[];
172
+ /**
173
+ * Open hours for this participant. The endpoint searches for free time slots during these open hours.
174
+ */
175
+ openHours?: OpenHours[];
176
+ }
177
+ /**
178
+ * Interface representing a booking participant.
179
+ */
180
+ export interface ConfigParticipant {
181
+ /**
182
+ * Participant's email address.
183
+ */
184
+ email: string;
185
+ /**
186
+ * The availability data for the participant.
187
+ * If omitted, the participant is considered to be available at all times.
188
+ * At least one participant must have availability data.
189
+ */
190
+ availability: ParticipantAvailability;
191
+ /**
192
+ * The booking data for the participant.
193
+ * If omitted, the participant is not included in the booked event.
194
+ * At least one participant must have booking data.
195
+ */
196
+ booking: ParticipantBooking;
197
+ /**
198
+ * Participant's name.
199
+ */
200
+ name?: string;
201
+ /**
202
+ * Whether the participant is the organizer of the event.
203
+ * For non-round-robin meetings, one of the participants must be specified as an organizer.
204
+ */
205
+ isOrganizer?: boolean;
206
+ /**
207
+ * The participant's timezone.
208
+ * This is used when calculating the participant's open hours and in email notifications.
209
+ */
210
+ timezone?: string;
211
+ }
212
+ export interface Configuration {
213
+ /**
214
+ * The list of participants that is included in the scheduled event.
215
+ * All participants must have a valid Nylas grant.
216
+ */
217
+ participants: ConfigParticipant[];
218
+ /**
219
+ * The rules that determine the available time slots for the event.
220
+ */
221
+ availability: Availability;
222
+ /**
223
+ * The booking data for the event.
224
+ */
225
+ eventBooking: EventBooking;
226
+ /**
227
+ * The slug of the Configuration object. This is an optional, unique identifier for the Configuration object.
228
+ */
229
+ slug?: string;
230
+ /**
231
+ * If true, the scheduling Availability and Bookings endpoints require a valid session ID to authenticate requests when you use this configuration.
232
+ */
233
+ requiresSessionAuth?: boolean;
234
+ /**
235
+ * The settings for the Scheduler UI.
236
+ */
237
+ scheduler?: SchedulerSettings;
238
+ /**
239
+ * The appearance settings for the Scheduler UI.
240
+ */
241
+ appearance?: Record<string, string>;
242
+ }
243
+ export type CreateConfigurationRequest = Configuration;
244
+ export type UpdateConfigurationRequest = Subset<Configuration>;
245
+ export interface CreateSessionRequest {
246
+ /**
247
+ * The ID of the Scheduler Configuration object for the session.
248
+ * If you're using slug, you can omit this field.
249
+ */
250
+ configurationId?: string;
251
+ /**
252
+ * The slug of the Scheduler Configuration object for the session.
253
+ * If you're using configurationId, you can omit this field.
254
+ */
255
+ slug?: string;
256
+ /**
257
+ * The time to live for the session in minutes.
258
+ * The maximum value is 30 minutes.
259
+ */
260
+ timeToLive?: number;
261
+ }
262
+ export interface Session {
263
+ /**
264
+ * The ID of the session
265
+ */
266
+ sessionId: string;
267
+ }
268
+ /**
269
+ * The supported languages for email notifications.
270
+ */
271
+ export type EmailLanguage = 'en' | 'es' | 'fr' | 'de' | 'nl' | 'sv' | 'ja' | 'zh';
272
+ export interface BookingGuest {
273
+ /**
274
+ * The email address of the guest.
275
+ */
276
+ email: string;
277
+ /**
278
+ * The name of the guest.
279
+ */
280
+ name: string;
281
+ }
282
+ export interface BookingParticipant {
283
+ /**
284
+ * The email address of the participant to include in the booking.
285
+ */
286
+ email: string;
287
+ }
288
+ /**
289
+ * Interface representing a create booking request.
290
+ */
291
+ export interface CreateBookingRequest {
292
+ /**
293
+ * The event's start time, in Unix epoch format.
294
+ */
295
+ startTime: number;
296
+ /**
297
+ * The event's end time, in Unix epoch format.
298
+ */
299
+ endTime: number;
300
+ /**
301
+ * Details about the guest that is creating the booking. The guest name and email are required.
302
+ */
303
+ guest: BookingGuest;
304
+ /**
305
+ * An array of objects that include a list of participant email addresses from the Configuration object to include in the booking.
306
+ * If not provided, Nylas includes all participants from the Configuration object.
307
+ */
308
+ participants?: BookingParticipant[];
309
+ /**
310
+ * The guest's timezone that is used in email notifications.
311
+ * If not provided, Nylas uses the timezone from the Configuration object.
312
+ */
313
+ timezone?: string;
314
+ /**
315
+ * The language of the guest email notifications.
316
+ */
317
+ emailLanguage?: EmailLanguage;
318
+ /**
319
+ * An array of objects that include a list of additional guest email addresses to include in the booking.
320
+ */
321
+ additionalGuests?: BookingGuest[];
322
+ /**
323
+ * A dictionary of additional field keys mapped to the values populated by the guest in the booking form.
324
+ */
325
+ additionalFields?: Record<string, string>;
326
+ }
327
+ export interface BookingOrganizer {
328
+ /**
329
+ * The email address of the participant that is designated as the organizer of the event.
330
+ */
331
+ email: string;
332
+ /**
333
+ * The name of the participant that is designated as the organizer of the event.
334
+ */
335
+ name?: string;
336
+ }
337
+ export type BookingStatus = 'pending' | 'booked' | 'cancelled';
338
+ export type ConfirmBookingStatus = 'confirmed' | 'cancelled';
339
+ export interface Booking {
340
+ /**
341
+ * The unique ID of the booking
342
+ */
343
+ bookingId: string;
344
+ /**
345
+ * The unique ID of the event associated with the booking
346
+ */
347
+ eventId: string;
348
+ /**
349
+ * The title of the event
350
+ */
351
+ title: string;
352
+ /**
353
+ * The participant that is designated as the organizer of the event
354
+ */
355
+ organizer: BookingOrganizer;
356
+ /**
357
+ * The current status of the booking
358
+ */
359
+ status: BookingStatus;
360
+ /**
361
+ * The description of the event
362
+ */
363
+ description?: string;
364
+ }
365
+ export interface ConfirmBookingRequest {
366
+ /**
367
+ * The salt extracted from the booking reference embedded in the organizer confirmation link,
368
+ * encoded as a URL-safe base64 string (without padding).
369
+ */
370
+ salt: string;
371
+ /**
372
+ * The action to take on the pending booking
373
+ */
374
+ status: ConfirmBookingStatus;
375
+ /**
376
+ * The reason that the booking is being cancelled
377
+ */
378
+ cancellationReason?: string;
379
+ }
380
+ export interface DeleteBookingRequest {
381
+ /**
382
+ * The reason that the booking is being cancelled
383
+ */
384
+ cancellationReason?: string;
385
+ }
386
+ export interface RescheduleBookingRequest {
387
+ /**
388
+ * The event's start time, in Unix epoch format.
389
+ */
390
+ startTime: number;
391
+ /**
392
+ * The event's end time, in Unix epoch format.
393
+ */
394
+ endTime: number;
395
+ }
396
+ export interface CreateBookingQueryParams {
397
+ /**
398
+ * The ID of the Configuration object whose settings are used for calculating availability.
399
+ * If you're using session authentication (requires_session_auth is set to true), configuration_id is not required.
400
+ */
401
+ configurationId?: string;
402
+ /**
403
+ * The slug of the Configuration object whose settings are used for calculating availability.
404
+ * If you're using session authentication (requires_session_auth is set to true) or using configurationId, slug is not required.
405
+ */
406
+ slug?: string;
407
+ /**
408
+ * The timezone to use for the booking. If not provided, Nylas uses the timezone from the Configuration object.
409
+ */
410
+ timezone?: string;
411
+ }
412
+ export interface FindBookingQueryParams {
413
+ /**
414
+ * The ID of the Configuration object whose settings are used for calculating availability.
415
+ * If you're using session authentication (requires_session_auth is set to true), configuration_id is not required.
416
+ */
417
+ configurationId?: string;
418
+ /**
419
+ * The slug of the Configuration object whose settings are used for calculating availability.
420
+ * If you're using session authentication (requires_session_auth is set to true) or using configurationId, slug is not required.
421
+ */
422
+ slug?: string;
423
+ }
424
+ export type ConfirmBookingQueryParams = FindBookingQueryParams;
425
+ export type RescheduleBookingQueryParams = FindBookingQueryParams;
426
+ export type DestroyBookingQueryParams = FindBookingQueryParams;
@@ -14,6 +14,7 @@ import { Folders } from './resources/folders.js';
14
14
  import { Grants } from './resources/grants.js';
15
15
  import { Contacts } from './resources/contacts.js';
16
16
  import { Attachments } from './resources/attachments.js';
17
+ import { Scheduler } from './resources/scheduler.js';
17
18
  /**
18
19
  * The entry point to the Node SDK
19
20
  *
@@ -73,6 +74,10 @@ export default class Nylas {
73
74
  * Access the Folders API
74
75
  */
75
76
  folders: Folders;
77
+ /**
78
+ * Access the scheduler API
79
+ */
80
+ scheduler: Scheduler;
76
81
  /**
77
82
  * The configured API client
78
83
  * @ignore Not for public use
@@ -0,0 +1,86 @@
1
+ import { Overrides } from '../config.js';
2
+ import { NylasBaseResponse, NylasResponse } from '../models/response.js';
3
+ import { Booking, ConfirmBookingQueryParams, ConfirmBookingRequest, CreateBookingQueryParams, CreateBookingRequest, DeleteBookingRequest, DestroyBookingQueryParams, FindBookingQueryParams, RescheduleBookingQueryParams, RescheduleBookingRequest } from '../models/scheduler.js';
4
+ import { Resource } from './resource.js';
5
+ /**
6
+ * The parameters for the {@link Bookings.find} method
7
+ * @property bookingId The id of the Booking to retrieve. Use "primary" to refer to the primary booking associated with grant.
8
+ * @property identifier The identifier of the grant to act upon
9
+ * @property queryParams The query parameters to include in the request
10
+ */
11
+ export interface FindBookingParams {
12
+ bookingId: string;
13
+ queryParams?: FindBookingQueryParams;
14
+ }
15
+ /**
16
+ * The parameters for the {@link Bookings.create} method
17
+ * @property identifier The identifier of the grant to act upon
18
+ * @property requestBody The request body to create a booking
19
+ * @property queryParams The query parameters to include in the request
20
+ */
21
+ export interface CreateBookingParams {
22
+ requestBody: CreateBookingRequest;
23
+ queryParams?: CreateBookingQueryParams;
24
+ }
25
+ /**
26
+ * The parameters for the {@link Bookings.confirm} method
27
+ * @property identifier The identifier of the grant to act upon
28
+ * @property bookingId The id of the Booking to retrieve. Use "primary" to refer to the primary booking associated with grant.
29
+ * @property requestBody The values to confirm the Booking with
30
+ * @property queryParams The query parameters to include in the request
31
+ */
32
+ export interface ConfirmBookingParams {
33
+ bookingId: string;
34
+ requestBody: ConfirmBookingRequest;
35
+ queryParams?: ConfirmBookingQueryParams;
36
+ }
37
+ /**
38
+ * The parameters for the {@link Bookings.reschedule} method
39
+ * @property identifier The identifier of the grant to act upon
40
+ * @property bookingId The id of the Booking to retrieve. Use "primary" to refer to the primary booking associated with grant.
41
+ * @property requestBody The values to reschedule the Booking with
42
+ * @property queryParams The query parameters to include in the request
43
+ */
44
+ export interface RescheduleBookingParams {
45
+ bookingId: string;
46
+ requestBody: RescheduleBookingRequest;
47
+ queryParams?: RescheduleBookingQueryParams;
48
+ }
49
+ /**
50
+ * The parameters for the {@link Bookings.destroy} method
51
+ * @property identifier The identifier of the grant to act upon
52
+ * @property bookingId The id of the Booking to retrieve. Use "primary" to refer to the primary booking associated with grant.
53
+ * @property queryParams The query parameters to include in the request
54
+ */
55
+ export interface DestroyBookingParams {
56
+ bookingId: string;
57
+ requestBody?: DeleteBookingRequest;
58
+ queryParams?: DestroyBookingQueryParams;
59
+ }
60
+ export declare class Bookings extends Resource {
61
+ /**
62
+ * Return a Booking
63
+ * @return The booking
64
+ */
65
+ find({ bookingId, queryParams, overrides, }: FindBookingParams & Overrides): Promise<NylasResponse<Booking>>;
66
+ /**
67
+ * Create a Booking
68
+ * @return The created booking
69
+ */
70
+ create({ requestBody, queryParams, overrides, }: CreateBookingParams & Overrides): Promise<NylasResponse<Booking>>;
71
+ /**
72
+ * Confirm a Booking
73
+ * @return The confirmed Booking
74
+ */
75
+ confirm({ bookingId, requestBody, queryParams, overrides, }: ConfirmBookingParams & Overrides): Promise<NylasResponse<Booking>>;
76
+ /**
77
+ * Reschedule a Booking
78
+ * @return The rescheduled Booking
79
+ */
80
+ reschedule({ bookingId, requestBody, queryParams, overrides, }: RescheduleBookingParams & Overrides): Promise<NylasResponse<Booking>>;
81
+ /**
82
+ * Delete a Booking
83
+ * @return The deleted Booking
84
+ */
85
+ destroy({ bookingId, requestBody, queryParams, overrides, }: DestroyBookingParams & Overrides): Promise<NylasBaseResponse>;
86
+ }
@@ -0,0 +1,76 @@
1
+ import { AsyncListResponse, Resource } from './resource.js';
2
+ import { CreateConfigurationRequest, UpdateConfigurationRequest, Configuration } from '../models/scheduler.js';
3
+ import { Overrides } from '../config.js';
4
+ import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
5
+ /**
6
+ * The parameters for the {@link Configurations.find} method
7
+ * @property configurationId The id of the Configuration to retrieve. Use "primary" to refer to the primary configuration associated with grant.
8
+ * @property identifier The identifier of the grant to act upon
9
+ */
10
+ export interface FindConfigurationParams {
11
+ identifier: string;
12
+ configurationId: string;
13
+ }
14
+ /**
15
+ * The parameters for the {@link Configurations.list} method
16
+ * @property identifier The identifier of the grant to act upon
17
+ * @property queryParams The query parameters to include in the request
18
+ */
19
+ export interface ListConfigurationsParams {
20
+ identifier: string;
21
+ }
22
+ /**
23
+ * The parameters for the {@link Configurations.create} method
24
+ * @property identifier The identifier of the grant to act upon
25
+ * @property requestBody The request body to create a configuration
26
+ */
27
+ export interface CreateConfigurationParams {
28
+ identifier: string;
29
+ requestBody: CreateConfigurationRequest;
30
+ }
31
+ /**
32
+ * The parameters for the {@link Configurations.update} method
33
+ * @property identifier The identifier of the grant to act upon
34
+ * @property configurationId The id of the Configuration to retrieve. Use "primary" to refer to the primary configuration associated with grant.
35
+ */
36
+ export interface UpdateConfigurationParams {
37
+ identifier: string;
38
+ configurationId: string;
39
+ requestBody: UpdateConfigurationRequest;
40
+ }
41
+ /**
42
+ * The parameters for the {@link Configurations.destroy} method
43
+ * @property identifier The identifier of the grant to act upon
44
+ * @property configurationId The id of the Configuration to retrieve. Use "primary" to refer to the primary configuration associated with grant.
45
+ */
46
+ export interface DestroyConfigurationParams {
47
+ identifier: string;
48
+ configurationId: string;
49
+ }
50
+ export declare class Configurations extends Resource {
51
+ /**
52
+ * Return all Configurations
53
+ * @return A list of configurations
54
+ */
55
+ list({ identifier, overrides, }: ListConfigurationsParams & Overrides): AsyncListResponse<NylasListResponse<Configuration>>;
56
+ /**
57
+ * Return a Configuration
58
+ * @return The configuration
59
+ */
60
+ find({ identifier, configurationId, overrides, }: FindConfigurationParams & Overrides): Promise<NylasResponse<Configuration>>;
61
+ /**
62
+ * Create a Configuration
63
+ * @return The created configuration
64
+ */
65
+ create({ identifier, requestBody, overrides, }: CreateConfigurationParams & Overrides): Promise<NylasResponse<Configuration>>;
66
+ /**
67
+ * Update a Configuration
68
+ * @return The updated Configuration
69
+ */
70
+ update({ configurationId, identifier, requestBody, overrides, }: UpdateConfigurationParams & Overrides): Promise<NylasResponse<Configuration>>;
71
+ /**
72
+ * Delete a Configuration
73
+ * @return The deleted Configuration
74
+ */
75
+ destroy({ identifier, configurationId, overrides, }: DestroyConfigurationParams & Overrides): Promise<NylasBaseResponse>;
76
+ }
@@ -1,11 +1,11 @@
1
- import { AsyncListResponse, Resource } from './resource.js';
2
- import { CleanMessagesRequest, CleanMessagesResponse, FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
1
+ import FormData from 'form-data';
2
+ import APIClient from '../apiClient.js';
3
3
  import { Overrides } from '../config.js';
4
- import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
5
4
  import { CreateDraftRequest, SendMessageRequest, UpdateDraftRequest } from '../models/drafts.js';
6
- import FormData from 'form-data';
5
+ import { CleanMessagesRequest, CleanMessagesResponse, FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
6
+ import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
7
+ import { AsyncListResponse, Resource } from './resource.js';
7
8
  import { SmartCompose } from './smartCompose.js';
8
- import APIClient from '../apiClient.js';
9
9
  /**
10
10
  * The parameters for the {@link Messages.list} method
11
11
  * @property identifier The identifier of the grant to act upon
@@ -24,6 +24,7 @@ interface PayloadParams<T> {
24
24
  interface DestroyParams {
25
25
  path: string;
26
26
  queryParams?: Record<string, any>;
27
+ requestBody?: Record<string, any>;
27
28
  overrides?: OverridableNylasConfig;
28
29
  }
29
30
  type List<T> = NylasListResponse<ListResponseInnerType<T>>;
@@ -46,7 +47,7 @@ export declare class Resource {
46
47
  protected _create<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
47
48
  protected _update<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
48
49
  protected _updatePatch<T>(params: PayloadParams<T>): Promise<NylasResponse<T>>;
49
- protected _destroy<T>({ path, queryParams, overrides, }: DestroyParams): Promise<T>;
50
+ protected _destroy<T>({ path, queryParams, requestBody, overrides, }: DestroyParams): Promise<T>;
50
51
  protected _getRaw({ path, queryParams, overrides, }: FindParams<void>): Promise<Buffer>;
51
52
  protected _getStream({ path, queryParams, overrides, }: FindParams<void>): Promise<NodeJS.ReadableStream>;
52
53
  }
@@ -0,0 +1,10 @@
1
+ import { Configurations } from './configurations.js';
2
+ import { Sessions } from './sessions.js';
3
+ import { Bookings } from './bookings.js';
4
+ import APIClient from '../apiClient.js';
5
+ export declare class Scheduler {
6
+ configurations: Configurations;
7
+ bookings: Bookings;
8
+ sessions: Sessions;
9
+ constructor(apiClient: APIClient);
10
+ }
@@ -0,0 +1,32 @@
1
+ import { Overrides } from '../config.js';
2
+ import { NylasBaseResponse, NylasResponse } from '../models/response.js';
3
+ import { CreateSessionRequest, Session } from '../models/scheduler.js';
4
+ import { Resource } from './resource.js';
5
+ /**
6
+ * The parameters for the {@link Sessions.create} method
7
+ * @property identifier The identifier of the grant to act upon
8
+ * @property requestBody The request body to create a session
9
+ */
10
+ export interface CreateSessionParams {
11
+ requestBody: CreateSessionRequest;
12
+ }
13
+ /**
14
+ * The parameters for the {@link Sessions.destroy} method
15
+ * @property identifier The identifier of the grant to act upon
16
+ * @property sessionId The id of the Session to retrieve. Use "primary" to refer to the primary session associated with grant.
17
+ */
18
+ export interface DestroySessionParams {
19
+ sessionId: string;
20
+ }
21
+ export declare class Sessions extends Resource {
22
+ /**
23
+ * Create a Session
24
+ * @return The created session
25
+ */
26
+ create({ requestBody, overrides, }: CreateSessionParams & Overrides): Promise<NylasResponse<Session>>;
27
+ /**
28
+ * Delete a Session
29
+ * @return The deleted Session
30
+ */
31
+ destroy({ sessionId, overrides, }: DestroySessionParams & Overrides): Promise<NylasBaseResponse>;
32
+ }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "7.6.2";
1
+ export declare const SDK_VERSION = "7.7.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "7.6.2",
3
+ "version": "7.7.0",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
5
  "main": "lib/cjs/nylas.js",
6
6
  "types": "lib/types/nylas.d.ts",