Files
dynamix-golang-sdk/pkg/cloudapi/account/restore.go

33 lines
752 B
Go
Raw Normal View History

2025-09-23 14:34:24 +03:00
package account
import (
"context"
"net/http"
2025-12-08 16:30:08 +03:00
"repository.basistech.ru/BASIS/dynamix-golang-sdk/v13/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"`
}
// Restore restores a deleted account
2025-09-27 01:06:15 +03:00
func (a Account) Restore(ctx context.Context, req RestoreRequest) (string, error) {
2025-09-23 14:34:24 +03:00
err := validators.ValidateRequest(req)
if err != nil {
2025-09-27 01:06:15 +03:00
return "", validators.ValidationErrors(validators.GetErrors(err))
2025-09-23 14:34:24 +03:00
}
url := "/cloudapi/account/restore"
2025-09-27 01:06:15 +03:00
result, err := a.client.DecortApiCall(ctx, http.MethodPost, url, req)
2025-09-23 14:34:24 +03:00
if err != nil {
2025-09-27 01:06:15 +03:00
return "", err
2025-09-23 14:34:24 +03:00
}
2025-09-27 01:06:15 +03:00
return string(result), nil
2025-09-23 14:34:24 +03:00
}