Skip to content

Commit 78d91a1

Browse files
authored
Add tentative_as_busy parameter (#631)
1 parent ed0a9b0 commit 78d91a1

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Unreleased
22
* Add support for Notetaker API endpoints
33
* Update calendar and event models with notetaker settings
4+
* Add support for `tentativeAsBusy` parameter in availability and event listing
45

56
# Changelog
67

src/models/availability.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ export interface AvailabilityRules {
100100
* This is used for both max-fairness and max-availability methods.
101101
*/
102102
roundRobinEventId?: string;
103+
/**
104+
* tentative_as_busy: Controls whether tentative calendar events should be treated as busy time.
105+
* When set to false, tentative events will be considered as free in availability calculations.
106+
* Defaults to true. Only applicable for Microsoft and EWS calendar providers.
107+
*/
108+
tentativeAsBusy?: boolean;
103109
}
104110

105111
/**

src/models/events.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@ export interface ListEventQueryParams extends ListQueryParams {
316316
* Master event id if recurring events.
317317
*/
318318
masterEventId?: string;
319+
/**
320+
* When set to false, treats tentative calendar events as busy:false.
321+
* Only applicable for Microsoft and EWS calendar providers. Defaults to true.
322+
*/
323+
tentativeAsBusy?: boolean;
319324
}
320325

321326
/**
@@ -330,6 +335,11 @@ export interface CreateEventQueryParams {
330335
* Email notifications containing the calendar event is sent to all event participants.
331336
*/
332337
notifyParticipants?: boolean;
338+
/**
339+
* When set to false, treats tentative calendar events as busy:false.
340+
* Only applicable for Microsoft and EWS calendar providers. Defaults to true.
341+
*/
342+
tentativeAsBusy?: boolean;
333343
}
334344

335345
/**
@@ -340,6 +350,11 @@ export interface FindEventQueryParams {
340350
* Calendar ID to find the event in. "primary" is a supported value indicating the user's primary calendar.
341351
*/
342352
calendarId: string;
353+
/**
354+
* When set to false, treats tentative calendar events as busy:false.
355+
* Only applicable for Microsoft and EWS calendar providers. Defaults to true.
356+
*/
357+
tentativeAsBusy?: boolean;
343358
}
344359

345360
/**

tests/resources/calendars.spec.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,74 @@ describe('Calendars', () => {
318318
},
319319
});
320320
});
321+
322+
it('should call apiClient.request with tentativeAsBusy parameter', async () => {
323+
await calendars.getAvailability({
324+
requestBody: {
325+
startTime: 123,
326+
endTime: 456,
327+
participants: [],
328+
durationMinutes: 30,
329+
intervalMinutes: 15,
330+
availabilityRules: {
331+
availabilityMethod: AvailabilityMethod.MaxAvailability,
332+
buffer: {
333+
before: 15,
334+
after: 15,
335+
},
336+
defaultOpenHours: [
337+
{
338+
days: [0],
339+
timezone: 'America/Toronto',
340+
start: '09:00',
341+
end: '17:00',
342+
exdates: ['2020-01-01'],
343+
},
344+
],
345+
roundRobinEventId: 'event123',
346+
tentativeAsBusy: false, // Don't treat tentative events as busy
347+
},
348+
},
349+
overrides: {
350+
apiUri: 'https://test.api.nylas.com',
351+
headers: { override: 'bar' },
352+
},
353+
});
354+
355+
expect(apiClient.request).toHaveBeenCalledWith({
356+
method: 'POST',
357+
path: '/v3/calendars/availability',
358+
body: {
359+
startTime: 123,
360+
endTime: 456,
361+
participants: [],
362+
durationMinutes: 30,
363+
intervalMinutes: 15,
364+
availabilityRules: {
365+
availabilityMethod: AvailabilityMethod.MaxAvailability,
366+
buffer: {
367+
before: 15,
368+
after: 15,
369+
},
370+
defaultOpenHours: [
371+
{
372+
days: [0],
373+
timezone: 'America/Toronto',
374+
start: '09:00',
375+
end: '17:00',
376+
exdates: ['2020-01-01'],
377+
},
378+
],
379+
roundRobinEventId: 'event123',
380+
tentativeAsBusy: false, // Don't treat tentative events as busy
381+
},
382+
},
383+
overrides: {
384+
apiUri: 'https://test.api.nylas.com',
385+
headers: { override: 'bar' },
386+
},
387+
});
388+
});
321389
});
322390

323391
describe('getCollectiveAvailability', () => {

tests/resources/events.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,33 @@ describe('Events', () => {
4444
});
4545
});
4646

47+
it('should call apiClient.request with tentativeAsBusy parameter', async () => {
48+
await events.list({
49+
identifier: 'id123',
50+
queryParams: {
51+
calendarId: 'calendar123',
52+
tentativeAsBusy: false, // Don't treat tentative events as busy
53+
},
54+
overrides: {
55+
apiUri: 'https://test.api.nylas.com',
56+
headers: { override: 'bar' },
57+
},
58+
});
59+
60+
expect(apiClient.request).toHaveBeenCalledWith({
61+
method: 'GET',
62+
path: '/v3/grants/id123/events',
63+
queryParams: {
64+
calendarId: 'calendar123',
65+
tentativeAsBusy: false, // Don't treat tentative events as busy
66+
},
67+
overrides: {
68+
apiUri: 'https://test.api.nylas.com',
69+
headers: { override: 'bar' },
70+
},
71+
});
72+
});
73+
4774
it('should paginate correctly if a nextCursor is present', async () => {
4875
apiClient.request.mockResolvedValueOnce({
4976
requestId: 'request123',

0 commit comments

Comments
 (0)