-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cursor/limit functionality not available through the SDK? #613
Comments
Hi! I've investigated this issue and found that this appears to be a documentation/naming mismatch rather than missing functionality:
The functionality works exactly as described in the V3 upgrade documentation, just with a slightly different parameter name in the SDK. Here's how to use it: When making paginated requests:
The functionality is fully implemented and working, it's just that the parameter name in the SDK ( You can find the implementation in:
|
For what it's worth, I just got through being tripped up by this. I could not find anything in the docs mentioning anything accepting a This is my current implementation: export const fetchNylasEvents = async (
grantId: string,
calendarId: string,
startTime: string,
endTime: string,
): Promise<NylasEvent[]> => {
const events: NylasEvent[] = [];
let pageToken: string | undefined;
let pageCount = 0;
try {
do {
const response = await nylasClient.events.list({
identifier: grantId,
queryParams: {
start: startTime,
end: endTime,
calendarId,
select: 'title,description,location,status,when',
...(pageToken && { pageToken }),
},
});
events.push(...response.data);
pageToken = response.nextCursor;
pageCount++;
console.debug(
`Fetched page ${pageCount} of events (${response.data.length} events)`,
);
} while (pageToken);
console.debug(
`Total events fetched: ${events.length} in ${pageCount} pages`,
);
return events;
} catch (error) {
console.error('Error fetching Nylas events:', error);
throw new Error(
`Failed to fetch Nylas events: ${error instanceof Error ? error.message : String(error)}`,
);
}
}; But it would've been good to see the docs mentioning such a common usecase. EDIT: What's more, the API fails with a generic response if I pass |
The docs reference a "limit" field that doesn't seem to exist in queryParams anymore.
This reference the new cursor ability but I don't think the SDK has a field for it either
https://developer.nylas.com/docs/v2/upgrade-to-v3/features-and-changes/
The text was updated successfully, but these errors were encountered: