Documentation ¶
Index ¶
- type App
- type Config
- type Context
- func (ctx *Context) AuthorizationError() *UserPlayheadError
- func (ctx *Context) CreatePlayhead(playhead *model.UserPlayhead) error
- func (ctx *Context) DeletePlayheadBySeriesUUID(seriesUUID string) error
- func (ctx *Context) DeletePlayheadsForUser(userUUID string) error
- func (ctx *Context) GetPlayhead(seriesUUID string) (*model.UserPlayhead, error)
- func (ctx *Context) GetPlayheadBySeriesId(seriesUUID string) (*model.UserPlayhead, error)
- func (ctx *Context) GetPlayheads() ([]*model.UserPlayhead, error)
- func (ctx *Context) UpdatePlayhead(playhead *model.UserPlayhead) error
- func (ctx *Context) WithLogger(logger logrus.FieldLogger) *Context
- func (ctx *Context) WithRemoteAddress(address string) *Context
- func (ctx *Context) WithUser(user *model.User) *Context
- type CustomClaims
- type UserPlayheadError
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
func (*App) NewContext ¶
type Config ¶
type Config struct { // A secret string used for session cookies, passwords, etc. SecretKey []byte JwtKey []byte }
func InitConfig ¶
type Context ¶
type Context struct { Logger logrus.FieldLogger RemoteAddress string Database *db.Database UserPlayhead *model.UserPlayhead User *model.User }
func (*Context) AuthorizationError ¶
func (ctx *Context) AuthorizationError() *UserPlayheadError
func (*Context) CreatePlayhead ¶
func (ctx *Context) CreatePlayhead(playhead *model.UserPlayhead) error
func (*Context) DeletePlayheadBySeriesUUID ¶
func (*Context) DeletePlayheadsForUser ¶
func (*Context) GetPlayhead ¶
func (ctx *Context) GetPlayhead(seriesUUID string) (*model.UserPlayhead, error)
Get a single playhead
func (*Context) GetPlayheadBySeriesId ¶
func (ctx *Context) GetPlayheadBySeriesId(seriesUUID string) (*model.UserPlayhead, error)
func (*Context) GetPlayheads ¶
func (ctx *Context) GetPlayheads() ([]*model.UserPlayhead, error)
func (*Context) UpdatePlayhead ¶
func (ctx *Context) UpdatePlayhead(playhead *model.UserPlayhead) error
func (*Context) WithLogger ¶
func (ctx *Context) WithLogger(logger logrus.FieldLogger) *Context
func (*Context) WithRemoteAddress ¶
type CustomClaims ¶
type CustomClaims struct { jwt.Claims // contains filtered or unexported fields }
func (ctx *Context) WithBearerToken(token string) (*Context, error) { user, failureReason, err := ctx.App.ValidateBearerToken(token) if err != nil { return nil, err } else if failureReason != "" { ctx.Logger.WithField("reason", failureReason).Info("bearer token validation failure") return nil, nil } return ctx.WithUser(user), nil }
type UserPlayheadError ¶
func (*UserPlayheadError) Error ¶
func (e *UserPlayheadError) Error() string
type ValidationError ¶
type ValidationError struct {
Message string `json:"message"`
}
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.