Skip to content

Conversation

AaronDDM
Copy link
Collaborator

@AaronDDM AaronDDM commented Sep 25, 2025

Description

This PR fixes issue #669 by updating the ListGrantsQueryParams interface to use snake_case parameter values that align with the Nylas API documentation.

  • Updated ListGrantsQueryParams interface in src/models/grants.ts to use snake_case parameter names:

    • sortBy → with values 'created_at' | 'updated_at'
    • orderBy → with values 'asc' | 'desc'
  • The SDK's internal conversion mechanism continues to work, maintaining backward compatibility

Copy link

cursor bot commented Sep 25, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.42%. Comparing base (e4ed8bd) to head (00d04c2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #672      +/-   ##
==========================================
+ Coverage   93.34%   96.42%   +3.07%     
==========================================
  Files          37       37              
  Lines         812      812              
  Branches       72       72              
==========================================
+ Hits          758      783      +25     
+ Misses         47       26      -21     
+ Partials        7        3       -4     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AaronDDM AaronDDM changed the title Fix Nylas Node.js SDK issue 669 Fix: Update ListGrantsQueryParams to use snake_case parameter names (Fixes #669) Sep 25, 2025
Copy link

playerzero-ai bot commented Sep 25, 2025

Pull Request Summary

  • What changed

    • Type change: ListGrantsQueryParams.sortBy was changed from camelCase ('createdAt' | 'updatedAt') to snake_case ('created_at' | 'updated_at') in src/models/grants.ts.
    • Test added: new unit test tests/resources/grants.spec.ts (Grants.list suite) verifies that grants.list builds/forwards query parameters correctly for pagination, sorting, ordering and grant-status filtering (checks the API client receives the expected API values).
  • Intent

    • Align the TypeScript types with the API/query-string parameter names (snake_case) so typed values match what the backend expects and reduce runtime mismatches.
    • Add test coverage to prevent regressions in how query params are composed and forwarded to the API client.
  • Impact

    • Developer/compile-time: Breaking change for callers — code passing 'createdAt'/'updatedAt' for sortBy will fail TypeScript checks and must be updated to 'created_at'/'updated_at'.
    • Runtime/behavior: No new runtime behavior in this diff itself; the change reduces the chance of incorrect sorting/filtering at runtime once callers are updated.
    • User/UX: No direct end-user UI changes; potential improvements in sorting/filtering correctness if callers migrate.
  • Action items / notes

    • Update any callers of grants.list to use 'created_at' / 'updated_at' for sortBy.
    • Add a migration/changelog note for the breaking type change.

Files Changed

File Name Summary
tests/resources/grants.spec.ts - Added a unit test under Grants.list: "should properly handle camelCase query parameters with correct API values".
- Calls grants.list with camelCase query params (limit, offset, sortBy, orderBy, grantStatus) and asserts the API client is invoked with the expected query-string/API values (e.g., 'created_at', 'desc', 'valid').
- Purpose: prevent regressions in query-param handling.
src/models/grants.ts - Changed ListGrantsQueryParams.sortBy type from camelCase ('createdAt' | 'updatedAt') to snake_case ('created_at' | 'updated_at').
- Impact: compile-time breaking for callers using 'createdAt'/'updatedAt' — update to 'created_at'/'updated_at'.
- Action: update callers and add a migration/changelog note.

View more in PlayerZero
updated: Sep 25 @ 10:27 PM UTC

@AaronDDM AaronDDM changed the title Fix: Update ListGrantsQueryParams to use snake_case parameter names (Fixes #669) Fix: Update ListGrantsQueryParams to use snake_case parameter values (Fixes #669) Sep 25, 2025
Copy link

@johnjiang johnjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not just the values, but the keys too. Can we do an audit of all other apis to ensure this is correct?

@AaronDDM
Copy link
Collaborator Author

Not just the values, but the keys too. Can we do an audit of all other apis to ensure this is correct?

All of our models use camel case which is translated to snake case to match the expected API schemas.

We are working on having our models automatically generated from our OpenAPI spec files, which will resolve such inconsistencies.

cursoragent and others added 3 commits September 26, 2025 10:18
Co-authored-by: demello.aaron <demello.aaron@gmail.com>
- Keep camelCase property names (sortBy, orderBy, grantStatus)
- Update values to match API: 'created_at' | 'updated_at' for sortBy
- Add test coverage for correct API value usage
- Maintains backward compatibility with existing code

Fixes #669
- Add unreleased section with fix for ListGrantsQueryParams.sortBy values
- Follows conventional commits format
Copy link

playerzero-ai bot commented Sep 26, 2025

nylas + PlayerZero

View more in PlayerZero
updated: Sep 26 @ 02:50 PM UTC

@AaronDDM AaronDDM merged commit 2bd4fc7 into main Sep 26, 2025
7 checks passed
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