Skip to content

Commit

Permalink
CUST-2556 - Adding list folders query params (#565)
Browse files Browse the repository at this point in the history
Adding ListFolderQuery Params to the folders endpoint
  • Loading branch information
kraju3 committed May 17, 2024
1 parent 441cf91 commit 75cf7bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/models/folders.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ListQueryParams } from './listQueryParams.js';

/**
* Interface of a folder object from Nylas.
*/
Expand Down Expand Up @@ -90,5 +92,15 @@ export interface CreateFolderRequest {
*/
backgroundColor?: string;
}
/**
* Interface representing the query parameters for listing folders.
*/

export interface ListFolderQueryParams extends ListQueryParams {
/**
* (Microsoft and EWS only.) Use the ID of a folder to find all child folders it contains.
*/
parentId?: 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 @@ -3,6 +3,7 @@ import {
Folder,
CreateFolderRequest,
UpdateFolderRequest,
ListFolderQueryParams,
} from '../models/folders.js';
import {
NylasBaseResponse,
Expand All @@ -14,9 +15,11 @@ import { Resource, AsyncListResponse } from './resource.js';
/**
* The parameters for the {@link Folders.list} method
* @property identifier The identifier of the grant to act upon
* @property queryParams The query parameters to include in the request
*/
interface ListFoldersParams {
identifier: string;
queryParams?: ListFolderQueryParams;
}

/**
Expand Down Expand Up @@ -81,12 +84,14 @@ export class Folders extends Resource {
*/
public list({
identifier,
queryParams,
overrides,
}: ListFoldersParams & Overrides): AsyncListResponse<
NylasListResponse<Folder>
> {
return super._list<NylasListResponse<Folder>>({
overrides,
queryParams,
path: `/v3/grants/${identifier}/folders`,
});
}
Expand Down

0 comments on commit 75cf7bc

Please sign in to comment.