diff options
| author | s <[email protected]> | 2025-11-16 02:40:58 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-16 02:40:58 -0500 |
| commit | 76d0cff639988ca506b1dc6e848841944c96b263 (patch) | |
| tree | b841dce1980bdb50d9f0c8f96d649a53a1778029 /cmd/admin.go | |
| parent | f4c58dfee401431c37e853643d0188cd020f66d7 (diff) | |
| download | dborg-76d0cff639988ca506b1dc6e848841944c96b263.tar.gz dborg-76d0cff639988ca506b1dc6e848841944c96b263.zip | |
docs: add comprehensive api endpoints documentation and expand cli functionalityv1.0.3
Diffstat (limited to 'cmd/admin.go')
| -rw-r--r-- | cmd/admin.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmd/admin.go b/cmd/admin.go index b0c3e13..5ef98ca 100644 --- a/cmd/admin.go +++ b/cmd/admin.go @@ -57,6 +57,12 @@ var adminDisableCmd = &cobra.Command{ RunE: runAdminDisable, } +var adminStatsCmd = &cobra.Command{ + Use: "stats", + Short: "Get account information and usage statistics", + RunE: runAdminStats, +} + func init() { rootCmd.AddCommand(adminCmd) adminCmd.AddCommand(adminListCmd) @@ -65,6 +71,7 @@ func init() { adminCmd.AddCommand(adminCreditsCmd) adminCmd.AddCommand(adminSetCreditsCmd) adminCmd.AddCommand(adminDisableCmd) + adminCmd.AddCommand(adminStatsCmd) adminCreateCmd.Flags().IntP("credits", "c", 0, "Initial credits") adminCreateCmd.Flags().BoolP("unlimited", "u", false, "Unlimited credits") @@ -241,3 +248,27 @@ func runAdminDisable(cmd *cobra.Command, args []string) error { printOutput(output) return nil } + +func runAdminStats(cmd *cobra.Command, args []string) error { + c, err := getAdminClient(cmd) + if err != nil { + return err + } + + response, err := c.GetAccountStats() + if err != nil { + return err + } + + if err := checkError(response.Error); err != nil { + return err + } + + output, err := formatter.FormatAccountStats(response, IsJSONOutput()) + if err != nil { + return err + } + + printOutput(output) + return nil +} |
