Documentation
¶
Index ¶
- Constants
- func AssocPlayer(r oapi.AssociatePlayerRequest) (user.AssociatePlayer, error)
- func CreateChange(r oapi.UserCreateRequest) (user.Change, error)
- func TranslateUser(u *user.User) oapi.User
- func UpdateChange(r oapi.UserUpdateRequest) (user.Change, error)
- func UserFilter(params oapi.ListParams) (user.Filter, error)
- type UserStorage
- type UsersService
- func (s UsersService) AssociatePlayer(w http.ResponseWriter, r *http.Request, id string)
- func (s UsersService) Create(w http.ResponseWriter, r *http.Request)
- func (s UsersService) Get(w http.ResponseWriter, r *http.Request, id string)
- func (s UsersService) List(w http.ResponseWriter, r *http.Request, params oapi.ListParams)
- func (UsersService) Name() string
- func (s UsersService) Register(router *mux.Router)
- func (s UsersService) Remove(w http.ResponseWriter, r *http.Request, id string)
- func (UsersService) Shutdown(context.Context)
- func (s UsersService) Update(w http.ResponseWriter, r *http.Request, id string)
Constants ¶
const (
V1UserRoute string = "/v1/user"
)
Variables ¶
This section is empty.
Functions ¶
func AssocPlayer ¶ added in v0.2.7
func AssocPlayer(r oapi.AssociatePlayerRequest) (user.AssociatePlayer, error)
AssocPlayer translates a user player update request to an user change.
func CreateChange ¶ added in v0.2.7
func CreateChange(r oapi.UserCreateRequest) (user.Change, error)
CreateChange translates a user create request to an user change.
func TranslateUser ¶
TranslateUser translates an user user to a network user.
func UpdateChange ¶ added in v0.2.7
func UpdateChange(r oapi.UserUpdateRequest) (user.Change, error)
UpdateChange translates a user create request to an user change.
func UserFilter ¶ added in v0.2.7
func UserFilter(params oapi.ListParams) (user.Filter, error)
UserFilter creates an user users filter from the the given request's query parameters.
Types ¶
type UserStorage ¶
type UserStorage interface {
List(context.Context, user.Filter) ([]*user.User, error)
Get(context.Context, user.ID) (*user.User, error)
Create(context.Context, user.Create) (*user.User, error)
Update(context.Context, user.ID, user.Update) (*user.User, error)
AssociatePlayer(context.Context, user.ID, user.AssociatePlayer) (*user.User, error)
Remove(context.Context, user.ID) error
}
UserStorage defines the expected behavior of the user manager in the data layer.
type UsersService ¶
type UsersService struct {
Storage UserStorage
}
UserService services user related network requests.
func (UsersService) AssociatePlayer ¶ added in v0.2.7
func (s UsersService) AssociatePlayer(w http.ResponseWriter, r *http.Request, id string)
AssociatePlayer associates a player with the given user.
func (UsersService) Create ¶
func (s UsersService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create an user.
func (UsersService) Get ¶
func (s UsersService) Get(w http.ResponseWriter, r *http.Request, id string)
Get handles a request to retrieve an user.
func (UsersService) List ¶
func (s UsersService) List(w http.ResponseWriter, r *http.Request, params oapi.ListParams)
List handles a request to retrieve multiple users.
func (UsersService) Register ¶
func (s UsersService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (UsersService) Remove ¶
func (s UsersService) Remove(w http.ResponseWriter, r *http.Request, id string)
Remove handles a request to remove an user.
func (UsersService) Shutdown ¶
func (UsersService) Shutdown(context.Context)
Shutdown is a no-op since there no long running processes for this service.
func (UsersService) Update ¶
func (s UsersService) Update(w http.ResponseWriter, r *http.Request, id string)
Update handles a request to update an user.