Files
dynamix-golang-sdk/pkg/cloudbroker/account/restore.go
T

36 lines
852 B
Go
Raw Normal View History

2025-09-23 14:34:24 +03:00
package account
import (
"context"
"net/http"
2025-09-26 19:17:30 +03:00
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v11/internal/validators"
2025-09-23 14:34:24 +03:00
)
// RestoreRequest struct to restore a deleted account
type RestoreRequest struct {
// ID an account
// Required: true
AccountID uint64 `url:"accountId" json:"accountId" validate:"required"`
2025-09-26 19:17:30 +03:00
// Reason of disabling
// Required: false
Reason string `url:"reason,omitempty" json:"reason,omitempty"`
2025-09-23 14:34:24 +03:00
}
// Restore restores a deleted account
func (a Account) Restore(ctx context.Context, req RestoreRequest) (bool, error) {
err := validators.ValidateRequest(req)
if err != nil {
return false, validators.ValidationErrors(validators.GetErrors(err))
}
url := "/cloudbroker/account/restore"
_, err = a.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
return true, nil
}