api

package
v0.0.0-...-7360598 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRankNonNumeric = errors.New("must be a number")
	ErrRankInvalid    = errors.New("must be a positive number")
)

Functions

func AucBotContext

func AucBotContext(r *http.Request) *model.AucBotContext

func NewBotHTTPRouter

func NewBotHTTPRouter(apiConfig model.APIConfig, patch model.RecipeVersion, accessors *Accessors, abh *handlers.AucBot) http.Handler

NewBotHTTPRouter creates an instrumented router for serving http requests

func NewChiRouter

func NewChiRouter(apiConfig model.APIConfig, patch model.RecipeVersion, accessors *Accessors, abh *handlers.AucBot) *chi.Mux

Types

type Accessors

type Accessors struct {
	DbAccessor   *db.Accessor
	BnetAccessor *bnet.Accessor

	EnableValuationFunctions bool
}

Accessors holds data sources shared by all API routes

type AucbotMiddleware

type AucbotMiddleware struct {
	R *render.Render
}

func (*AucbotMiddleware) AucBotContext

func (m *AucbotMiddleware) AucBotContext(generateCID bool, patch model.RecipeVersion) func(next http.Handler) http.Handler

AucBotContext adds the context object and requestID

func (*AucbotMiddleware) BasicAuth

func (m *AucbotMiddleware) BasicAuth(tokens model.HTTPAuth) func(next http.Handler) http.Handler

BasicAuth is middleware authenticating with basic auth

func (*AucbotMiddleware) Realm

func (m *AucbotMiddleware) Realm(bnet *bnet.Accessor) func(next http.Handler) http.Handler

Realm extracts the realm from the path parameter

func (*AucbotMiddleware) RequiredQueryParams

func (m *AucbotMiddleware) RequiredQueryParams(requiredParams ...string) func(next http.Handler) http.Handler

RequiredQueryParams denies requests that do not include the given query params

func (*AucbotMiddleware) Session

func (m *AucbotMiddleware) Session() func(next http.Handler) http.Handler

Session constructs a session from other context values

type Session

type Session struct {
	AucBotContext *model.AucBotContext
	RequestID     string
	RealmSlug     string
	Region        string
}

Session is an API layer implementation of Session

func (Session) AccessTypeTag

func (a Session) AccessTypeTag() model.AccessTypeTag

func (Session) ChannelID

func (a Session) ChannelID() string

func (Session) ChannelSessionID

func (a Session) ChannelSessionID() string

func (Session) Context

func (a Session) Context() *model.AucBotContext

func (Session) MessageID

func (a Session) MessageID() string

func (Session) SetToken

func (a Session) SetToken(token string)

func (Session) Token

func (a Session) Token() string

func (Session) UserSessionID

func (a Session) UserSessionID() string

func (Session) Username

func (a Session) Username() string

Jump to

Keyboard shortcuts

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