Skip to content

Commit 7b59db5

Browse files
authored
Added query support for folders (#492)
This PR adds the ability to pass query parameters for listing folders. Closes #488.
1 parent 7cac99c commit 7b59db5

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
### Unreleased
4+
* Added query support for folders
45
* Added dependency on `ostruct` gem
56
* Enable SDK to reattach large files to messages on retry
67

lib/nylas/resources/folders.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ class Folders < Resource
1414
# Return all folders.
1515
#
1616
# @param identifier [String] Grant ID or email account to query.
17+
# @param query_params [Hash, nil] Query params to pass to the request.
1718
# @return [Array(Array(Hash), String, String)] The list of folders, API Request ID, and next cursor.
18-
def list(identifier:)
19+
def list(identifier:, query_params: nil)
1920
get_list(
20-
path: "#{api_uri}/v3/grants/#{identifier}/folders"
21+
path: "#{api_uri}/v3/grants/#{identifier}/folders",
22+
query_params: query_params
2123
)
2224
end
2325

spec/nylas/resources/folders_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
identifier = "abc-123-grant-id"
2828
path = "#{api_uri}/v3/grants/#{identifier}/folders"
2929
allow(folders).to receive(:get_list)
30-
.with(path: path)
30+
.with(path: path, query_params: nil)
3131
.and_return(list_response)
3232

3333
folders_response = folders.list(identifier: identifier)

0 commit comments

Comments
 (0)