Documentation
¶
Overview ¶
Package server provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.3.0 DO NOT EDIT.
Index ¶
- Constants
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r *mux.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler
- func NewNewUserFilter(params ListParams) (user.Filter, error)
- func NewUserFilter(r *http.Request) (user.Filter, error)
- func TranslateUser(u *user.User) rest.User
- func TranslateUserRequest(u rest.UserRequest) (user.Change, error)
- type GorillaServerOptions
- type InvalidParamFormatError
- type ListParams
- type MiddlewareFunc
- type RequiredHeaderError
- type RequiredParamError
- type ServerInterface
- type ServerInterfaceWrapper
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type User
- type UserStorage
- type UsersResponse
- type UsersService
- func (s UsersService) Create(w http.ResponseWriter, r *http.Request)
- func (s UsersService) Get(w http.ResponseWriter, r *http.Request)
- func (s UsersService) List(w http.ResponseWriter, r *http.Request, params ListParams)
- func (UsersService) Name() string
- func (s UsersService) Register(router *mux.Router)
- func (s UsersService) Remove(w http.ResponseWriter, r *http.Request)
- func (UsersService) Shutdown()
- func (s UsersService) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
const (
V1UserRoute string = "/v1/user"
)
Variables ¶
This section is empty.
Functions ¶
func Handler ¶ added in v0.2.2
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶ added in v0.2.2
func HandlerFromMux(si ServerInterface, r *mux.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶ added in v0.2.2
func HandlerWithOptions ¶ added in v0.2.2
func HandlerWithOptions(si ServerInterface, options GorillaServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
func NewNewUserFilter ¶ added in v0.2.2
func NewNewUserFilter(params ListParams) (user.Filter, error)
NewNewUserFilter creates an user users filter from the the given request's query parameters.
func NewUserFilter ¶
NewUserFilter creates an user users filter from the the given request's query parameters.
func TranslateUser ¶
TranslateUser translates an user user to a network user.
func TranslateUserRequest ¶
func TranslateUserRequest(u rest.UserRequest) (user.Change, error)
TranslateUserRequest translates a network user user request to an user user request.
Types ¶
type GorillaServerOptions ¶ added in v0.2.2
type GorillaServerOptions struct {
BaseURL string
BaseRouter *mux.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type InvalidParamFormatError ¶ added in v0.2.2
func (*InvalidParamFormatError) Error ¶ added in v0.2.2
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶ added in v0.2.2
func (e *InvalidParamFormatError) Unwrap() error
type ListParams ¶ added in v0.2.2
type ListParams struct {
// Offset An offset into the total list of users.
Offset *string `form:"offset,omitempty" json:"offset,omitempty"`
// Limit An limit to the number of users returned.
Limit *string `form:"limit,omitempty" json:"limit,omitempty"`
}
ListParams defines parameters for List.
type RequiredHeaderError ¶ added in v0.2.2
func (*RequiredHeaderError) Error ¶ added in v0.2.2
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶ added in v0.2.2
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶ added in v0.2.2
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶ added in v0.2.2
func (e *RequiredParamError) Error() string
type ServerInterface ¶ added in v0.2.2
type ServerInterface interface {
// List returns a list of users.
// (GET /v1/user)
List(w http.ResponseWriter, r *http.Request, params ListParams)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶ added in v0.2.2
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) List ¶ added in v0.2.2
func (siw *ServerInterfaceWrapper) List(w http.ResponseWriter, r *http.Request)
List operation middleware
type TooManyValuesForParamError ¶ added in v0.2.2
func (*TooManyValuesForParamError) Error ¶ added in v0.2.2
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶ added in v0.2.2
func (*UnescapedCookieParamError) Error ¶ added in v0.2.2
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶ added in v0.2.2
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶ added in v0.2.2
func (*UnmarshalingParamError) Error ¶ added in v0.2.2
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶ added in v0.2.2
func (e *UnmarshalingParamError) Unwrap() error
type User ¶ added in v0.2.2
type User struct {
ID string `json:"id"`
Login string `json:"login"`
PublicKey string `json:"publicKey"`
PlayerID string `json:"playerID"`
Created arcade.Timestamp `json:"created"`
Updated arcade.Timestamp `json:"updated"`
}
User holds a user's information, and is sent in a response.
func NewTranslateUser ¶ added in v0.2.2
NewTranslateUser translates an user user to a network user.
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)
Remove(context.Context, user.ID) error
}
UserStorage defines the expected behavior of the user manager in the domain layer.
type UsersResponse ¶ added in v0.2.2
type UsersResponse struct {
Users []User `json:"users"`
}
UsersResponse returns a multiple users.
type UsersService ¶
type UsersService struct {
Storage UserStorage
}
UserService services user related network requests.
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)
Get handles a request to retrieve an user.
func (UsersService) List ¶
func (s UsersService) List(w http.ResponseWriter, r *http.Request, params 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)
Remove handles a request to remove an user.
func (UsersService) Shutdown ¶
func (UsersService) Shutdown()
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)
Update handles a request to update an user.