Skip to content

Commit 76f14db

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

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ 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
2634
) : IQueryParams {
2735
class Builder {
2836
private var limit: Int? = null
2937
private var pageToken: String? = null
3038
private var parentId: String? = null
39+
private var select: String? = null
3140

3241
/**
3342
* Sets the maximum number of objects to return.
@@ -52,6 +61,13 @@ data class ListFoldersQueryParams(
5261
*/
5362
fun parentId(parentId: String?) = apply { this.parentId = parentId }
5463

64+
/**
65+
* Sets the fields to return in the response.
66+
* @param select List of field names to return (e.g. "id,updated_at")
67+
* @return The builder.
68+
*/
69+
fun select(select: String?) = apply { this.select = select }
70+
5571
/**
5672
* Builds the [ListFoldersQueryParams] object.
5773
* @return The [ListFoldersQueryParams] object.
@@ -60,6 +76,7 @@ data class ListFoldersQueryParams(
6076
limit = limit,
6177
pageToken = pageToken,
6278
parentId = parentId,
79+
select = select
6380
)
6481
}
6582
}

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)