Skip to content

Commit 6bbb407

Browse files
committed
added support for the select query param to list folders
1 parent fab3773 commit 6bbb407

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Nylas Java SDK Changelog
22

3+
### Unreleased
4+
* Added pagination support for folders
5+
36
### [2.5.2] - Released 2024-12-02
47
* Added support for `skypeForConsumer` as conferencing provider
58

src/main/kotlin/com/nylas/models/ListFoldersQueryParams.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,21 @@ data class ListFoldersQueryParams(
2323
*/
2424
@Json(name = " parent_id")
2525
val parentId: String? = null,
26+
27+
/**
28+
* Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at).
29+
* This allows you to receive only the portion of object data that you're interested in.
30+
* You can use select to optimize response size and reduce latency by limiting queries to only the information that you need
31+
*/
32+
@Json(name = "select")
33+
var select: String? = null,
34+
2635
) : IQueryParams {
2736
class Builder {
2837
private var limit: Int? = null
2938
private var pageToken: String? = null
3039
private var parentId: String? = null
40+
private var select: String? = null
3141

3242
/**
3343
* Sets the maximum number of objects to return.
@@ -52,6 +62,13 @@ data class ListFoldersQueryParams(
5262
*/
5363
fun parentId(parentId: String?) = apply { this.parentId = parentId }
5464

65+
/**
66+
* Sets the fields to return in the response.
67+
* @param select List of field names to return (e.g. "id,updated_at")
68+
* @return The builder.
69+
*/
70+
fun select(select: String?) = apply { this.select = select }
71+
5572
/**
5673
* Builds the [ListFoldersQueryParams] object.
5774
* @return The [ListFoldersQueryParams] object.
@@ -60,6 +77,7 @@ data class ListFoldersQueryParams(
6077
limit = limit,
6178
pageToken = pageToken,
6279
parentId = parentId,
80+
select = select,
6381
)
6482
}
6583
}

src/test/kotlin/com/nylas/resources/FoldersTests.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class FoldersTests {
9696
ListFoldersQueryParams(
9797
limit = 10,
9898
pageToken = "abc-123",
99+
select = "id,updated_at",
99100
)
100101

101102
folders.list(grantId, queryParams)
@@ -113,7 +114,7 @@ class FoldersTests {
113114

114115
assertEquals("v3/grants/$grantId/folders", pathCaptor.firstValue)
115116
assertEquals(Types.newParameterizedType(ListResponse::class.java, Folder::class.java), typeCaptor.firstValue)
116-
assertNull(queryParamCaptor.firstValue)
117+
assertEquals(queryParams, queryParamCaptor.firstValue)
117118
}
118119

119120
@Test

0 commit comments

Comments
 (0)