working commit

This commit is contained in:
2026-02-12 17:16:28 +02:00
parent 9b29364d6b
commit fbbb09a3cb
2 changed files with 41 additions and 25 deletions
+32 -2
View File
@@ -151,7 +151,38 @@ func (cli *Client) UpdateAccount(ctx context.Context, hosturi, id, username, new
return err
}
func (cli *Client) DeleteAccount(ctx context.Context, hosturi, id, username string) error {
func (cli *Client) DeleteAccountByName(ctx context.Context, hosturi, username string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/account/delete")
if err != nil {
return err
}
operParams := operator.DeleteAccountParams{
Username: username,
}
paramsJson, err := json.Marshal(operParams)
if err != nil {
return err
}
respBytes, err := doHTTPCall(ctx, apipath, paramsJson)
if err != nil {
return err
}
operRes := handler.NewResponse[operator.DeleteAccountResult]()
err = json.Unmarshal(respBytes, operRes)
if err != nil {
return err
}
if operRes.Error {
err = fmt.Errorf("%s", operRes.Message)
return err
}
return err
}
func (cli *Client) DeleteAccountByID(ctx context.Context, hosturi, id string) error {
var err error
apipath, err := setApiPath(hosturi, "/v3/api/account/delete")
@@ -159,7 +190,6 @@ func (cli *Client) DeleteAccount(ctx context.Context, hosturi, id, username stri
return err
}
operParams := operator.DeleteAccountParams{
Username: username,
AccountID: id,
}
paramsJson, err := json.Marshal(operParams)