Skip to content

Commit 6c38580

Browse files
jfrench9claude
andauthored
Refactor API structure: consolidate billing/analytics endpoints (#30)
## Summary This PR implements a comprehensive refactoring of the robosystems client API structure, consolidating fragmented billing, analytics, and subscription endpoints into a more cohesive and maintainable architecture. ## Key Accomplishments ### API Structure Reorganization - **Consolidated credits management**: Moved all credit-related operations from `graph_credits` to unified `credits_` module - **Streamlined subscriptions**: Merged billing and user subscription functionality into a single `subscriptions` module - **Unified analytics**: Consolidated graph analytics and usage tracking into dedicated `usage` module - **Simplified user operations**: Moved user limits functionality directly into the `user` module ### Endpoint Modernization - Removed 15+ deprecated billing and analytics endpoints that were redundant or obsolete - Added new streamlined endpoints: - `create_repository_subscription.py` - `get_graph_subscription.py` - `get_graph_usage_analytics.py` - Updated subscription management with more intuitive `cancel_subscription` and `upgrade_subscription` operations ### Data Model Improvements - Eliminated 20+ redundant response models and consolidated similar functionality - Added new models: `GraphSubscriptionResponse`, `PerformanceInsights`, `StorageSummary` - Simplified credit summary structure and operation breakdowns - Enhanced graph usage response with better recent events tracking ## Breaking Changes ⚠️ **This is a breaking change** that affects client code using the deprecated endpoints: ### Removed Modules - `graph_analytics/*` (except metrics, moved to `usage/`) - `graph_billing/*` (consolidated into `subscriptions/`) - `user_analytics/*` - `user_limits/*` (core functionality moved to `user/`) - `user_subscriptions/*` (moved to `subscriptions/`) ### Removed Models - All legacy billing response models (`get_current_graph_bill_response_*`, etc.) - Deprecated user analytics models (`user_analytics_response_*`) - Obsolete subscription models (`subscription_info`, `repository_plan`, etc.) ### Migration Path - Update imports from `graph_credits.*` → `credits_.*` - Replace `graph_billing.*` calls with `subscriptions.*` equivalents - Switch `user_limits.get_user_limits` → `user.get_user_limits` - Use new consolidated analytics via `usage.get_graph_usage_analytics` ## Testing Notes - Verify all new consolidated endpoints return expected data structures - Test subscription management workflows (create, upgrade, cancel) - Validate credit balance and transaction tracking functionality - Confirm usage analytics provide comprehensive metrics and performance insights ## Infrastructure Considerations - This refactoring reduces API surface area by ~25% while maintaining full functionality - Improved response times expected due to consolidated data models - Client applications will need updates to import paths and model references - Consider implementing backward compatibility warnings in deployment tooling --- 🤖 Generated with [Claude Code](https://claude.ai/code) **Branch Info:** - Source: `refactor/graph-billing-improvements` - Target: `main` - Type: feature Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 7548973 + ee6a3ba commit 6c38580

70 files changed

Lines changed: 1589 additions & 5239 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

robosystems_client/api/graph_credits/check_credit_balance.py renamed to robosystems_client/api/credits_/check_credit_balance.py

File renamed without changes.

robosystems_client/api/graph_credits/check_storage_limits.py renamed to robosystems_client/api/credits_/check_storage_limits.py

File renamed without changes.

robosystems_client/api/graph_credits/get_credit_summary.py renamed to robosystems_client/api/credits_/get_credit_summary.py

File renamed without changes.

robosystems_client/api/graph_credits/get_storage_usage.py renamed to robosystems_client/api/credits_/get_storage_usage.py

File renamed without changes.

robosystems_client/api/graph_credits/list_credit_transactions.py renamed to robosystems_client/api/credits_/list_credit_transactions.py

File renamed without changes.

‎robosystems_client/api/graph_analytics/get_graph_usage_stats.py‎

Lines changed: 0 additions & 289 deletions
This file was deleted.

0 commit comments

Comments
 (0)