-
Notifications
You must be signed in to change notification settings - Fork 2.2k
refactor: move enterprise apis to insomnia-api #9552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors enterprise-related API functions by moving them from the insomnia package to the insomnia-api package, improving code organization and separation of concerns.
- Extracts four enterprise API endpoints into a dedicated
enterprise.tsmodule in theinsomnia-apipackage - Updates
resource.usage.tsxto import and use the centralized API functions - Removes local API implementations and TypeScript interfaces in favor of the shared module
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/insomnia-api/src/enterprise.ts | New file containing four enterprise API functions (getResourceUsage, getOwnEnterprises, getAccountUsedSeats, getEnterpriseLicenseUsage) with their TypeScript interfaces |
| packages/insomnia-api/src/index.ts | Adds export statement for the new enterprise module |
| packages/insomnia/src/routes/resource.usage.tsx | Removes local API implementations and updates imports to use the centralized insomnia-api functions; updates function calls to use new parameter object syntax |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| interface EnterpriseOwner { | ||
| id: string; | ||
| name: string; | ||
| role: string; | ||
| } |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exporting the TypeScript interfaces to improve API usability and type safety. While the current implementation allows TypeScript to infer return types, explicitly exporting these interfaces (ResourceUsage, EnterpriseOwner, AccountUsedSeats, LicenseUsage) would allow consumers to reference these types directly if needed, similar to how CurrentPlan, UserProfile, and RemoteFile are exported in user.ts. This provides better type documentation and enables consumers to type-check data structures independently of the API functions.
| interface AccountUsedSeats { | ||
| memberCount: number; | ||
| inviteCount: number; | ||
| used: number; | ||
| total: number; | ||
| } |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exporting the TypeScript interfaces to improve API usability and type safety. While the current implementation allows TypeScript to infer return types, explicitly exporting these interfaces (ResourceUsage, EnterpriseOwner, AccountUsedSeats, LicenseUsage) would allow consumers to reference these types directly if needed, similar to how CurrentPlan, UserProfile, and RemoteFile are exported in user.ts. This provides better type documentation and enables consumers to type-check data structures independently of the API functions.
| interface LicenseUsage { | ||
| used: number; | ||
| total: number; | ||
| memberCount: number; | ||
| inviteCount: number; | ||
| free: number; | ||
| } |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exporting the TypeScript interfaces to improve API usability and type safety. While the current implementation allows TypeScript to infer return types, explicitly exporting these interfaces (ResourceUsage, EnterpriseOwner, AccountUsedSeats, LicenseUsage) would allow consumers to reference these types directly if needed, similar to how CurrentPlan, UserProfile, and RemoteFile are exported in user.ts. This provides better type documentation and enables consumers to type-check data structures independently of the API functions.
| interface ResourceUsage { | ||
| mocks: { | ||
| quota: number; | ||
| calls: number; | ||
| autoPurchase: { | ||
| enabled: boolean; | ||
| unit: number; | ||
| }; | ||
| }; | ||
| } |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider exporting the TypeScript interfaces to improve API usability and type safety. While the current implementation allows TypeScript to infer return types, explicitly exporting these interfaces (ResourceUsage, EnterpriseOwner, AccountUsedSeats, LicenseUsage) would allow consumers to reference these types directly if needed, similar to how CurrentPlan, UserProfile, and RemoteFile are exported in user.ts. This provides better type documentation and enables consumers to type-check data structures independently of the API functions.
✅ Circular References ReportGenerated at: 2026-01-09T08:10:19.622Z Summary
Click to view all circular references in PR (167)Click to view all circular references in base branch (167)Analysis✅ No Change: This PR does not introduce or remove any circular references. This report was generated automatically by comparing against the |
Background
INS-1878
Move enterprise related apis to insomnia-api
Changes