Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions src/models/folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CreateFolderRequest>;
5 changes: 5 additions & 0 deletions src/resources/folders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
CreateFolderRequest,
UpdateFolderRequest,
ListFolderQueryParams,
FindFolderQueryParams,
} from '../models/folders.js';
import {
NylasBaseResponse,
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -103,13 +106,15 @@ export class Folders extends Resource {
public find({
identifier,
folderId,
queryParams,
overrides,
}: FindFolderParams & Overrides): Promise<NylasResponse<Folder>> {
return super._find({
path: makePathParams('/v3/grants/{identifier}/folders/{folderId}', {
identifier,
folderId,
}),
queryParams,
overrides,
});
}
Expand Down
28 changes: 28 additions & 0 deletions tests/resources/folders.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down