Skip to content

Commit c0939e8

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

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,21 @@ data class ListFoldersQueryParams(
2121
/**
2222
* (Microsoft and EWS only.) Use the ID of a folder to find all child folders it contains.
2323
*/
24-
@Json(name = " parent_id")
24+
@Json(name = "parent_id")
2525
val parentId: String? = null,
26+
/**
27+
* Specify fields that you want Nylas to return, as a comma-separated list (for example, select=id,updated_at).
28+
* This allows you to receive only the portion of object data that you're interested in.
29+
* You can use select to optimize response size and reduce latency by limiting queries to only the information that you need
30+
*/
31+
@Json(name = "select")
32+
var select: String? = null,
2633
) : IQueryParams {
2734
class Builder {
2835
private var limit: Int? = null
2936
private var pageToken: String? = null
3037
private var parentId: String? = null
38+
private var select: String? = null
3139

3240
/**
3341
* Sets the maximum number of objects to return.
@@ -52,6 +60,13 @@ data class ListFoldersQueryParams(
5260
*/
5361
fun parentId(parentId: String?) = apply { this.parentId = parentId }
5462

63+
/**
64+
* Sets the fields to return in the response.
65+
* @param select List of field names to return (e.g. "id,updated_at")
66+
* @return The builder.
67+
*/
68+
fun select(select: String?) = apply { this.select = select }
69+
5570
/**
5671
* Builds the [ListFoldersQueryParams] object.
5772
* @return The [ListFoldersQueryParams] object.
@@ -60,6 +75,7 @@ data class ListFoldersQueryParams(
6075
limit = limit,
6176
pageToken = pageToken,
6277
parentId = parentId,
78+
select = select,
6379
)
6480
}
6581
}

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)