v1.0.0
This commit is contained in:
@@ -6,21 +6,27 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Request struct for delete account
|
||||
type DeleteRequest struct {
|
||||
AccountID uint64 `url:"accountId"`
|
||||
Permanently bool `url:"permanently,omitempty"`
|
||||
// ID of account to delete
|
||||
// Required: true
|
||||
AccountID uint64 `url:"accountId"`
|
||||
|
||||
// Whether to completely delete the account
|
||||
// Required: false
|
||||
Permanently bool `url:"permanently,omitempty"`
|
||||
}
|
||||
|
||||
func (arq DeleteRequest) Validate() error {
|
||||
|
||||
func (arq DeleteRequest) validate() error {
|
||||
if arq.AccountID == 0 {
|
||||
return errors.New("validation-error: field AccountID must be set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete completes delete an account from the system Returns true if account is deleted or was already deleted or never existed
|
||||
func (a Account) Delete(ctx context.Context, req DeleteRequest) (bool, error) {
|
||||
err := req.Validate()
|
||||
err := req.validate()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user