working commit
This commit is contained in:
+32
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user