feat: add subscription plan inference and Management Center theme sync

This commit is contained in:
2026-09-04 14:22:56 +08:00
parent 688a7f395f
commit dc6c2d18b3
6 changed files with 516 additions and 1 deletions
+9
View File
@@ -225,6 +225,7 @@ type UpstreamCreditsResponse struct {
// UpstreamWindowLimits carries fiveHour and weekly window metrics.
type UpstreamWindowLimits struct {
Limited *bool `json:"limited,omitempty"`
FiveHour UpstreamWindowLimit `json:"fiveHour"`
Weekly UpstreamWindowLimit `json:"weekly"`
}
@@ -274,8 +275,15 @@ type UsageWindowLimitsData struct {
Weekly UsageWindowLimitData `json:"weekly"`
}
// PlanInfo represents inferred Command Code subscription plan details.
type PlanInfo struct {
Name string `json:"name"`
Code string `json:"code"`
}
// FormattedUsageData is the complete formatted usage payload.
type FormattedUsageData struct {
Plan PlanInfo `json:"plan"`
Credits UsageCreditsData `json:"credits"`
WindowLimits UsageWindowLimitsData `json:"window_limits"`
UpdatedAt string `json:"updated_at"`
@@ -284,6 +292,7 @@ type FormattedUsageData struct {
// FormattedUsageResponse is returned by GET /plugins/commandcode/usage and POST /plugins/commandcode/usage.
type FormattedUsageResponse struct {
OK bool `json:"ok"`
Plan PlanInfo `json:"plan"`
Data FormattedUsageData `json:"data"`
Credits UsageCreditsData `json:"credits"`
WindowLimits UsageWindowLimitsData `json:"window_limits"`