summaryrefslogtreecommitdiffstats
path: root/internal/client
diff options
context:
space:
mode:
authorsinner <[email protected]>2026-04-08 13:47:51 -0400
committersinner <[email protected]>2026-04-08 13:47:51 -0400
commit6c8beb133073ebb3b6d8bb16e852b29dbc23f133 (patch)
tree1410c127c20ae9ec304221af9ad685fe35935fee /internal/client
parent850cc065469d2efaefc7947dcb7a6b79e9da1858 (diff)
downloaddborg-6c8beb133073ebb3b6d8bb16e852b29dbc23f133.tar.gz
dborg-6c8beb133073ebb3b6d8bb16e852b29dbc23f133.zip
feat: add admin edit command for updating account properties
Diffstat (limited to 'internal/client')
-rw-r--r--internal/client/admin.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/client/admin.go b/internal/client/admin.go
index bf8c5ce..c776b7c 100644
--- a/internal/client/admin.go
+++ b/internal/client/admin.go
@@ -123,6 +123,29 @@ func (c *Client) ToggleAccount(apiKey string, enable bool) (*models.AdminRespons
return &response, nil
}
+func (c *Client) UpdateAccount(apiKey string, req *models.AccountUpdateRequest) (*models.AdminResponse, error) {
+ path := fmt.Sprintf("/admin/accounts/%s", url.PathEscape(apiKey))
+ data, err := c.Patch(path, req)
+ if err != nil {
+ return nil, err
+ }
+
+ var account models.Account
+ if err := json.Unmarshal(data, &account); err == nil && account.APIKey != "" {
+ return &models.AdminResponse{
+ Success: true,
+ Account: &account,
+ }, nil
+ }
+
+ var response models.AdminResponse
+ if err := json.Unmarshal(data, &response); err != nil {
+ return nil, fmt.Errorf("failed to parse admin response: %w", err)
+ }
+
+ return &response, nil
+}
+
func (c *Client) GetAccountStats() (*models.AccountStatsResponse, error) {
data, err := c.Get("/me", nil)
if err != nil {