Skip to content

Commit

Permalink
Adding query param support for Folders
Browse files Browse the repository at this point in the history
  • Loading branch information
kraju3 committed May 30, 2024
1 parent de12763 commit 27ea1fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nylas/models/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from dataclasses_json import dataclass_json
from typing_extensions import TypedDict, NotRequired

from nylas.models.list_query_params import ListQueryParams


@dataclass_json
@dataclass
Expand Down Expand Up @@ -75,3 +77,15 @@ class UpdateFolderRequest(TypedDict):
parent_id: NotRequired[str]
background_color: NotRequired[str]
text_color: NotRequired[str]


class ListFolderQueryParams(ListQueryParams):
"""
Interface representing the query parameters for listing folders.
Attributes:
parent_id: (Microsoft and EWS only.) Use the ID of a folder to find all child folders it contains.
"""

parent_id: NotRequired[str]

4 changes: 4 additions & 0 deletions nylas/resources/folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Folder,
CreateFolderRequest,
UpdateFolderRequest,
ListFolderQueryParams,
)
from nylas.models.response import Response, ListResponse, DeleteResponse

Expand All @@ -30,13 +31,15 @@ class Folders(
def list(
self,
identifier: str,
query_params: ListFolderQueryParams,
overrides: RequestOverrides = None,
) -> ListResponse[Folder]:
"""
Return all Folders.
Args:
identifier: The identifier of the Grant to act upon.
query_params: The query parameters to include in the request.
overrides: The request overrides to use.
Returns:
Expand All @@ -46,6 +49,7 @@ def list(
return super().list(
path=f"/v3/grants/{identifier}/folders",
response_type=Folder,
query_params=query_params,
overrides=overrides,
)

Expand Down

0 comments on commit 27ea1fd

Please sign in to comment.