Skip to content

Conversation

@AaronDDM
Copy link
Collaborator

@AaronDDM AaronDDM commented May 30, 2025

What did you do?

The Nylas API only supports filtering by a single folder ID, but the SDK
was incorrectly accepting a List and sending all items to the API.
The API would only use the last item, causing unexpected behavior.

Changes:

  • Modified ListThreadsQueryParams.convertToMap() to use only the first
    folder ID from a list, matching API behavior
  • Added new inFolder(String) method in Builder (recommended approach)
  • Deprecated inFolder(List) method with clear migration guidance
  • Added comprehensive test coverage for all scenarios
  • Updated documentation with API limitations and usage examples
  • Maintained full backward compatibility

The fix ensures proper API behavior while providing a clear migration
path for users. In the next major version, the parameter will be
changed to accept only a String.

Fixes issue where only the last folder ID was used when multiple
folder IDs were provided in the inFolder parameter.

📋 Usage Examples

New recommended approach:

val queryParams = ListThreadsQueryParams.Builder()
    .inFolder("folder-id-123")
    .limit(10)
    .build()

Deprecated but still working:

val queryParams = ListThreadsQueryParams.Builder()
    .inFolder(listOf("folder1", "folder2"))  // Only "folder1" will be used
    .limit(10)
    .build()

License

I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.57%. Comparing base (7406677) to head (c9897db).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #280   +/-   ##
=========================================
  Coverage     80.57%   80.57%           
  Complexity      333      333           
=========================================
  Files            36       36           
  Lines          1014     1014           
  Branches         88       88           
=========================================
  Hits            817      817           
  Misses          138      138           
  Partials         59       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The Nylas API only supports filtering by a single folder ID, but the SDK was incorrectly accepting a List<String> and sending all items to the API. The API would only use the last item, causing unexpected behavior.

Changes:

- Modified ListThreadsQueryParams.convertToMap() to use only the first folder ID from a list, matching API behavior

- Added new inFolder(String) method in Builder (recommended approach)

- Deprecated inFolder(List<String>) method with clear migration guidance

- Added comprehensive test coverage for all scenarios

- Updated documentation with API limitations and usage examples

- Maintained full backward compatibility

The fix ensures proper API behavior while providing a clear migration path for users. In the next major version, the parameter will be changed to accept only a String.

Fixes issue where only the last folder ID was used when multiple folder IDs were provided in the inFolder parameter.
@AaronDDM AaronDDM force-pushed the CUST-3937-v-3-java-kotlin-sdk-when-querying-for-threads-the-list-threads-query-paramss-attribute-in-folder-only-uses-the-last-item-in-the-list branch from 3891404 to c9897db Compare May 30, 2025 13:04
@AaronDDM AaronDDM changed the title fix: resolve folder filtering bug and add inFolderOrLabel parameter fix: ListThreadsQueryParams.inFolder now correctly uses single folder ID May 30, 2025
@AaronDDM AaronDDM requested review from kgsvg and pooja169usp May 30, 2025 13:17
@AaronDDM AaronDDM merged commit 8e0b0ab into main May 30, 2025
3 checks passed
@AaronDDM AaronDDM requested a review from samuelpx May 30, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants