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 diff --git a/src/models/folders.ts b/src/models/folders.ts index 58784e21..974f65b5 100644 --- a/src/models/folders.ts +++ b/src/models/folders.ts @@ -115,4 +115,22 @@ export interface ListFolderQueryParams extends ListQueryParams { singleLevel?: boolean; } +/** + * Interface representing the query parameters for finding a folder. + */ +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/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..91baacfb 100644 --- a/tests/resources/folders.spec.ts +++ b/tests/resources/folders.spec.ts @@ -183,6 +183,34 @@ describe('Folders', () => { }) ); }); + + it('should call apiClient.request with queryParams in find', async () => { + await folders.find({ + identifier: 'id123', + folderId: 'folder123', + queryParams: { + includeHiddenFolders: true, + select: 'id,name,updated_at', + }, + overrides: { + apiUri: 'https://test.api.nylas.com', + headers: { override: 'bar' }, + }, + }); + + expect(apiClient.request).toHaveBeenCalledWith({ + method: 'GET', + path: '/v3/grants/id123/folders/folder123', + queryParams: { + includeHiddenFolders: true, + select: 'id,name,updated_at', + }, + overrides: { + apiUri: 'https://test.api.nylas.com', + headers: { override: 'bar' }, + }, + }); + }); }); describe('create', () => {