Skip to content

Commit 336bc5f

Browse files
feat(folders): Updated Folders.find method to support optional queryParams. (#686)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 2f376fe commit 336bc5f

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Added
11+
- Support for query parameters (`includeHiddenFolders`, `select`) in `folders.find` method ([#685](https://github.com/nylas/nylas-nodejs/issues/685))
12+
813
## [7.13.3] - 2025-10-10
914

1015
### Fixed

src/models/folders.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,22 @@ export interface ListFolderQueryParams extends ListQueryParams {
115115
singleLevel?: boolean;
116116
}
117117

118+
/**
119+
* Interface representing the query parameters for finding a folder.
120+
*/
121+
export interface FindFolderQueryParams {
122+
/**
123+
* (Microsoft only) When true, Nylas includes hidden folders in its response.
124+
* @default false
125+
*/
126+
includeHiddenFolders?: boolean;
127+
128+
/**
129+
* Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at).
130+
* This allows you to receive only the portion of object data that you're interested in.
131+
* You can use select to optimize response size and reduce latency by limiting queries to only the information that you need.
132+
*/
133+
select?: string;
134+
}
135+
118136
export type UpdateFolderRequest = Partial<CreateFolderRequest>;

src/resources/folders.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
CreateFolderRequest,
55
UpdateFolderRequest,
66
ListFolderQueryParams,
7+
FindFolderQueryParams,
78
} from '../models/folders.js';
89
import {
910
NylasBaseResponse,
@@ -26,10 +27,12 @@ interface ListFoldersParams {
2627
* The parameters for the {@link Folders.find} method
2728
* @property identifier The identifier of the grant to act upon
2829
* @property folderId The id of the Folder to retrieve
30+
* @property queryParams The query parameters to include in the request
2931
*/
3032
interface FindFolderParams {
3133
identifier: string;
3234
folderId: string;
35+
queryParams?: FindFolderQueryParams;
3336
}
3437

3538
/**
@@ -103,13 +106,15 @@ export class Folders extends Resource {
103106
public find({
104107
identifier,
105108
folderId,
109+
queryParams,
106110
overrides,
107111
}: FindFolderParams & Overrides): Promise<NylasResponse<Folder>> {
108112
return super._find({
109113
path: makePathParams('/v3/grants/{identifier}/folders/{folderId}', {
110114
identifier,
111115
folderId,
112116
}),
117+
queryParams,
113118
overrides,
114119
});
115120
}

tests/resources/folders.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,34 @@ describe('Folders', () => {
183183
})
184184
);
185185
});
186+
187+
it('should call apiClient.request with queryParams in find', async () => {
188+
await folders.find({
189+
identifier: 'id123',
190+
folderId: 'folder123',
191+
queryParams: {
192+
includeHiddenFolders: true,
193+
select: 'id,name,updated_at',
194+
},
195+
overrides: {
196+
apiUri: 'https://test.api.nylas.com',
197+
headers: { override: 'bar' },
198+
},
199+
});
200+
201+
expect(apiClient.request).toHaveBeenCalledWith({
202+
method: 'GET',
203+
path: '/v3/grants/id123/folders/folder123',
204+
queryParams: {
205+
includeHiddenFolders: true,
206+
select: 'id,name,updated_at',
207+
},
208+
overrides: {
209+
apiUri: 'https://test.api.nylas.com',
210+
headers: { override: 'bar' },
211+
},
212+
});
213+
});
186214
});
187215

188216
describe('create', () => {

0 commit comments

Comments
 (0)