feat(scheduler): add GET /v3/scheduling/availability endpoint support#714
feat(scheduler): add GET /v3/scheduling/availability endpoint support#714yun-jay wants to merge 3 commits intonylas:mainfrom
Conversation
| */ | ||
| export interface GetAvailabilityParams { | ||
| queryParams: GetAvailabilityQueryParams; | ||
| } |
There was a problem hiding this comment.
Duplicate GetAvailabilityParams name across resource files
Low Severity
The new GetAvailabilityParams interface in src/resources/availability.ts has the same name as the existing GetAvailabilityParams in src/resources/calendars.ts, but with a different structure (queryParams vs requestBody). This creates ambiguity for IDE auto-imports and requires aliasing if both are needed in the same file. A more specific name like GetSchedulerAvailabilityParams or ListAvailabilityParams would avoid confusion.
|
Closing in favor of #716. |
|
Hey @radenkovic why does #716 solve this? I would like to be able to call the endpoint I'm currently doing: nylas.apiClient.request({
method: 'GET',
path: '/v3/scheduling/availability',
queryParams,
});but type safety would be really appreciated :) |
|
@yun-jay thanks for pointing out, you are right! addressing this today. |
|
@radenkovic Awesome, thank you very much! |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| export interface AvailabilityTimeSlot { | ||
| emails: string[]; | ||
| startTime: number; | ||
| endTime: number; |
There was a problem hiding this comment.
Availability time slot timestamps likely wrong type
Medium Severity
AvailabilityTimeSlot.startTime and endTime are typed as number, but the analogous TimeSlot interface in models/availability.ts (used for calendar availability — a very similar endpoint) types these same fields as string. The Nylas SDK reference documentation also confirms that availability time slot timestamps are strings. If the scheduling availability endpoint follows the same convention, consumers relying on number arithmetic will get unexpected results at runtime since the actual values would be strings.


Summary
Adds support for the
GET /v3/scheduling/availabilityendpoint, which returns available time slots for a given scheduling configuration within a time range. This was missing from the scheduling API support that already included sessions, bookings, and configurations.Changes
AvailabilityTimeSlot,AvailabilityResponse, andGetAvailabilityQueryParamstypes tosrc/models/scheduler.tssrc/resources/availability.tswithSchedulerAvailabilityresource class andlistmethodavailabilitysub-resource insrc/resources/scheduler.tstests/resources/availability.spec.tsUsage
License
I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.
Note
Low Risk
Low risk: additive API surface (new resource/types) with no changes to existing scheduling flows beyond wiring a new sub-resource.
Overview
Adds a new
scheduler.availability.listresource that callsGET /v3/scheduling/availabilitywith time-range/config query params and returns typed availability time slots.Updates scheduler models with
AvailabilityTimeSlot/AvailabilityResponse/GetAvailabilityQueryParams, wires the new sub-resource intoScheduler, and adds a unit test asserting the request shape and overrides handling.Written by Cursor Bugbot for commit c86729a. This will update automatically on new commits. Configure here.