summaryrefslogtreecommitdiffstats
path: root/internal/client/admin.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client/admin.go')
-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 {