Skip to content

refactor(nango): overhaul crate with connect_session.rs and connection.rs modules#3711

Merged
yujonglee merged 1 commit intomainfrom
devin/1770473516-nango-overhaul
Feb 7, 2026
Merged

refactor(nango): overhaul crate with connect_session.rs and connection.rs modules#3711
yujonglee merged 1 commit intomainfrom
devin/1770473516-nango-overhaul

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Feb 7, 2026

refactor(nango): split into connect_session.rs and connection.rs modules

Summary

Overhauls crates/nango based on the current Nango API reference. The monolithic types.rs and client.rs are split into domain-specific modules, types are renamed for clarity, and all missing API endpoints are implemented.

Structural changes:

  • connect_session.rs — types + impl NangoClient for create, reconnect, get, delete sessions
  • connection.rs — types + impl NangoClient for create, list, get, patch, delete connections + set/update metadata
  • client.rs — slimmed to core builder, shared response helpers (check_response/parse_response), and proxy method
  • types.rs — only shared types (NangoIntegration, webhook types)

Type renames: NangoConnectSessionRequestCreateConnectSessionRequest, NangoConnectSessionRequestUserEndUser, NangoGetConnectionResponseDataConnection, NangoConnectWebhookConnectWebhook, etc.

Error handling: Replaced the response-enum pattern (NangoConnectSessionResponse::Ok / ::Error) with status-code-based check_response helper. Error variant renamed NangoError(String)Api(u16, String).

API path fix: get_connection now hits /connections/{id} (plural, matching docs) instead of the old /connection/{id} (singular), and requires provider_config_key query param.

Review & Testing Checklist for Human

  • Connection.id type changed from String to i64 and credentials changed from typed NangoCredentials enum to serde_json::Value. Verify no downstream code (including any generated TypeScript bindings via specta) depends on the old shapes.
  • get_connection now requires a second provider_config_key parameter 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 / ConnectWebhookEndUser renamed from NangoConnectWebhook / NangoConnectWebhookEndUser. Check webhook handler code isn't broken.

Suggested test plan: Call create_connect_session and list_connections against a real Nango environment to verify the new response parsing works. The existing tests are #[ignore]d and require real credentials.

Notes


Open with Devin

…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>
@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for hyprnote-storybook canceled.

Name Link
🔨 Latest commit 852a1e1
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote-storybook/deploys/69874be6116c340008e0c89f

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for hyprnote canceled.

Name Link
🔨 Latest commit 852a1e1
🔍 Latest deploy log https://app.netlify.com/projects/hyprnote/deploys/69874be62876af00084fabdb

@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

@yujonglee yujonglee merged commit cad0c83 into main Feb 7, 2026
19 checks passed
@yujonglee yujonglee deleted the devin/1770473516-nango-overhaul branch February 7, 2026 14:33
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.

1 participant