service

package
v0.0.0-...-9360ad4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAlreadyExists will be returned in Create()
	ErrAlreadyExists = errors.New("already exists")
	// ErrNotFound will be returned in GetResetPasswordRequestWithToken()
	ErrNotFound = errors.New("not found")
	// ErrWrongPassword will be returned in GetWithIDAndPassword()
	ErrWrongPassword = errors.New("wrong password")
)

Functions

func New

func New(validator Validator,
	accountRepo AccountRepository) umapi.Service

New creates instance

Types

type Account

type Account interface {
	ID() string
	ToJSON() map[string]interface{}
}

Account is app Account

type AccountRepository

type AccountRepository interface {
	// Create new account
	Create(identifier, password string, params map[string]interface{}) (Account, error)

	// GetWithIDAndPassword gets account with id and password
	GetWithIDAndPassword(id, password string) (Account, error)

	// GetWithID gets account with identifier
	GetWithIdentifier(identifier string) (Account, error)

	UpdatePassword(id, newPassword string) error

	CreateResetPasswordRequest(account Account) error

	GetResetPasswordRequestWithToken(token string) (ResetPasswordRequest, error)

	DeleteResetPasswordRequest(token string) error
}

AccountRepository provides account related API

type ResetPasswordRequest

type ResetPasswordRequest interface {
	AccountID() string
	ToJSON() map[string]interface{}
}

ResetPasswordRequest is request

type Validator

type Validator interface {
	ValidateIdentifier(identifier string) error

	ValidatePassword(password string) error
}

Validator validates input parameter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL