Conversation
…n.rs modules - Split monolithic types.rs and client.rs into dedicated modules: - connect_session.rs: types + impl for create/reconnect/get/delete sessions - connection.rs: types + impl for create/list/get/patch/delete connections + set/update metadata - client.rs: core NangoClientBuilder, NangoClient, helpers, proxy - types.rs: shared types (NangoIntegration, webhook) - Renamed types to cleaner names (e.g. EndUser, ConnectSession, Connection) - Added proper API error handling via check_response/parse_response helpers - Updated api-integration consumer to match new types Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
✅ Deploy Preview for hyprnote-storybook canceled.
|
✅ Deploy Preview for hyprnote canceled.
|
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor(nango): split into connect_session.rs and connection.rs modules
Summary
Overhauls
crates/nangobased on the current Nango API reference. The monolithictypes.rsandclient.rsare split into domain-specific modules, types are renamed for clarity, and all missing API endpoints are implemented.Structural changes:
connect_session.rs— types +impl NangoClientfor create, reconnect, get, delete sessionsconnection.rs— types +impl NangoClientfor create, list, get, patch, delete connections + set/update metadataclient.rs— slimmed to core builder, shared response helpers (check_response/parse_response), and proxy methodtypes.rs— only shared types (NangoIntegration, webhook types)Type renames:
NangoConnectSessionRequest→CreateConnectSessionRequest,NangoConnectSessionRequestUser→EndUser,NangoGetConnectionResponseData→Connection,NangoConnectWebhook→ConnectWebhook, etc.Error handling: Replaced the response-enum pattern (
NangoConnectSessionResponse::Ok/::Error) with status-code-basedcheck_responsehelper. Error variant renamedNangoError(String)→Api(u16, String).API path fix:
get_connectionnow hits/connections/{id}(plural, matching docs) instead of the old/connection/{id}(singular), and requiresprovider_config_keyquery param.Review & Testing Checklist for Human
Connection.idtype changed fromStringtoi64andcredentialschanged from typedNangoCredentialsenum toserde_json::Value. Verify no downstream code (including any generated TypeScript bindings via specta) depends on the old shapes.get_connectionnow requires a secondprovider_config_keyparameter and the URL path changed from/connection/to/connections/. Confirm this matches your actual Nango environment behavior and that all call sites are updated.get_connect_session()/delete_connect_session()— these hit/connect/session(singular). The Nango docs suggest these endpoints may require the connect session token as bearer auth rather than the API secret key. The client always sends the API key. Verify whether these work correctly or if a token-override mechanism is needed.ConnectWebhook/ConnectWebhookEndUserrenamed fromNangoConnectWebhook/NangoConnectWebhookEndUser. Check webhook handler code isn't broken.Suggested test plan: Call
create_connect_sessionandlist_connectionsagainst a real Nango environment to verify the new response parsing works. The existing tests are#[ignore]d and require real credentials.Notes