From e904c6d751daadc140928d2c2f083ca50d88fd92 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 3 Dec 2025 02:21:38 +0000 Subject: [PATCH 1/4] feat: Add queryParams to folders.find Co-authored-by: aaron.d --- src/models/folders.ts | 8 ++++++++ src/resources/folders.ts | 5 +++++ tests/resources/folders.spec.ts | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/src/models/folders.ts b/src/models/folders.ts index 58784e21..132a64bd 100644 --- a/src/models/folders.ts +++ b/src/models/folders.ts @@ -115,4 +115,12 @@ export interface ListFolderQueryParams extends ListQueryParams { singleLevel?: boolean; } +/** + * Interface representing the query parameters for finding a folder. + */ +export interface FindFolderQueryParams { + // Currently no specific query parameters for finding a folder + // This interface can be extended in the future if the API adds query parameters +} + export type UpdateFolderRequest = Partial; diff --git a/src/resources/folders.ts b/src/resources/folders.ts index 8a0fddcd..5534548a 100644 --- a/src/resources/folders.ts +++ b/src/resources/folders.ts @@ -4,6 +4,7 @@ import { CreateFolderRequest, UpdateFolderRequest, ListFolderQueryParams, + FindFolderQueryParams, } from '../models/folders.js'; import { NylasBaseResponse, @@ -26,10 +27,12 @@ interface ListFoldersParams { * The parameters for the {@link Folders.find} method * @property identifier The identifier of the grant to act upon * @property folderId The id of the Folder to retrieve + * @property queryParams The query parameters to include in the request */ interface FindFolderParams { identifier: string; folderId: string; + queryParams?: FindFolderQueryParams; } /** @@ -103,6 +106,7 @@ export class Folders extends Resource { public find({ identifier, folderId, + queryParams, overrides, }: FindFolderParams & Overrides): Promise> { return super._find({ @@ -110,6 +114,7 @@ export class Folders extends Resource { identifier, folderId, }), + queryParams, overrides, }); } diff --git a/tests/resources/folders.spec.ts b/tests/resources/folders.spec.ts index d9be0728..c36f5d44 100644 --- a/tests/resources/folders.spec.ts +++ b/tests/resources/folders.spec.ts @@ -183,6 +183,28 @@ describe('Folders', () => { }) ); }); + + it('should call apiClient.request with queryParams in find', async () => { + await folders.find({ + identifier: 'id123', + folderId: 'folder123', + queryParams: {}, + overrides: { + apiUri: 'https://test.api.nylas.com', + headers: { override: 'bar' }, + }, + }); + + expect(apiClient.request).toHaveBeenCalledWith({ + method: 'GET', + path: '/v3/grants/id123/folders/folder123', + queryParams: {}, + overrides: { + apiUri: 'https://test.api.nylas.com', + headers: { override: 'bar' }, + }, + }); + }); }); describe('create', () => { From 438a80e4d7a68c791bbda690ad3bad2b94503e43 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 3 Dec 2025 02:27:34 +0000 Subject: [PATCH 2/4] Refactor FindFolderQueryParams to use Record Co-authored-by: aaron.d --- src/models/folders.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/models/folders.ts b/src/models/folders.ts index 132a64bd..81ab44b8 100644 --- a/src/models/folders.ts +++ b/src/models/folders.ts @@ -117,10 +117,8 @@ export interface ListFolderQueryParams extends ListQueryParams { /** * Interface representing the query parameters for finding a folder. + * Currently no specific query parameters are supported, but this type can be extended in the future. */ -export interface FindFolderQueryParams { - // Currently no specific query parameters for finding a folder - // This interface can be extended in the future if the API adds query parameters -} +export type FindFolderQueryParams = Record; export type UpdateFolderRequest = Partial; From 9f6fd25a7fcd6e7a2726b87eee28c90ff5b5efec Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 3 Dec 2025 02:29:33 +0000 Subject: [PATCH 3/4] feat: Add query params to find folder Co-authored-by: aaron.d --- src/models/folders.ts | 16 ++++++++++++++-- tests/resources/folders.spec.ts | 10 ++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/models/folders.ts b/src/models/folders.ts index 81ab44b8..974f65b5 100644 --- a/src/models/folders.ts +++ b/src/models/folders.ts @@ -117,8 +117,20 @@ export interface ListFolderQueryParams extends ListQueryParams { /** * Interface representing the query parameters for finding a folder. - * Currently no specific query parameters are supported, but this type can be extended in the future. */ -export type FindFolderQueryParams = Record; +export interface FindFolderQueryParams { + /** + * (Microsoft only) When true, Nylas includes hidden folders in its response. + * @default false + */ + includeHiddenFolders?: boolean; + + /** + * Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at). + * This allows you to receive only the portion of object data that you're interested in. + * You can use select to optimize response size and reduce latency by limiting queries to only the information that you need. + */ + select?: string; +} export type UpdateFolderRequest = Partial; diff --git a/tests/resources/folders.spec.ts b/tests/resources/folders.spec.ts index c36f5d44..91baacfb 100644 --- a/tests/resources/folders.spec.ts +++ b/tests/resources/folders.spec.ts @@ -188,7 +188,10 @@ describe('Folders', () => { await folders.find({ identifier: 'id123', folderId: 'folder123', - queryParams: {}, + queryParams: { + includeHiddenFolders: true, + select: 'id,name,updated_at', + }, overrides: { apiUri: 'https://test.api.nylas.com', headers: { override: 'bar' }, @@ -198,7 +201,10 @@ describe('Folders', () => { expect(apiClient.request).toHaveBeenCalledWith({ method: 'GET', path: '/v3/grants/id123/folders/folder123', - queryParams: {}, + queryParams: { + includeHiddenFolders: true, + select: 'id,name,updated_at', + }, overrides: { apiUri: 'https://test.api.nylas.com', headers: { override: 'bar' }, From d0feb9d8ad5730a45bff2045a433481a9767b7f9 Mon Sep 17 00:00:00 2001 From: Aaron de Mello Date: Tue, 9 Dec 2025 12:53:24 -0500 Subject: [PATCH 4/4] chore: Update CHANGELOG for added support of query parameters in folders.find method --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca37c2df..7878bf08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Added +- Support for query parameters (`includeHiddenFolders`, `select`) in `folders.find` method ([#685](https://github.com/nylas/nylas-nodejs/issues/685)) + ## [7.13.3] - 2025-10-10 ### Fixed