backend

package
v0.0.0-...-24140c1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound   = errors.New("not found")
	ErrWrongInput = errors.New("wrong user input")
	ErrBadRouting = errors.New("wrong user input")
)

Functions

func MakeGetGlobalWinrateEndpoint

func MakeGetGlobalWinrateEndpoint(s Service) endpoint.Endpoint

func MakeGetLeaderBoardEndpoint

func MakeGetLeaderBoardEndpoint(s Service) endpoint.Endpoint

func MakeGetPlayerActivityTODEndpoint

func MakeGetPlayerActivityTODEndpoint(s Service) endpoint.Endpoint

func MakeGetPlayerInfoEndpoint

func MakeGetPlayerInfoEndpoint(s Service) endpoint.Endpoint

func MakeGetRatingDistributionEndpoint

func MakeGetRatingDistributionEndpoint(s Service) endpoint.Endpoint

func MakeGetUnitsEndpoint

func MakeGetUnitsEndpoint(s Service) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(s Service) http.Handler

func MakePostCheckReplaysEndpoint

func MakePostCheckReplaysEndpoint(s Service) endpoint.Endpoint

func MakePostPlayerActivityEndpoint

func MakePostPlayerActivityEndpoint(s Service) endpoint.Endpoint

func MakePostPlayerRatingEndpoint

func MakePostPlayerRatingEndpoint(s Service) endpoint.Endpoint

func MakePostPlayerRecordEndpoint

func MakePostPlayerRecordEndpoint(s Service) endpoint.Endpoint

func MakePostPlayerSearchEndpoint

func MakePostPlayerSearchEndpoint(s Service) endpoint.Endpoint

func MakePostPlayerUnitEndpoint

func MakePostPlayerUnitEndpoint(s Service) endpoint.Endpoint

func MakePostReplaysSearchEndpoint

func MakePostReplaysSearchEndpoint(s Service) endpoint.Endpoint

func MakePostReplaysSubmitEndpoint

func MakePostReplaysSubmitEndpoint(s Service) endpoint.Endpoint

Types

type Endpoints

type Endpoints struct {
	PostReplaysSubmitEndpoint endpoint.Endpoint
	PostReplaysSearchEndpoint endpoint.Endpoint

	GetRatingDistributionEndpoint endpoint.Endpoint
	GetLeaderBoardEndpoint        endpoint.Endpoint
	GetGlobalWinrateEndpoint      endpoint.Endpoint
	GetUnitsEndpoint              endpoint.Endpoint

	PostPlayerSearchEndpoint     endpoint.Endpoint
	PostPlayerActivityEndpoint   endpoint.Endpoint
	GetPlayerActivityTODEndpoint endpoint.Endpoint
	GetPlayerInfoEndpoint        endpoint.Endpoint
	PostPlayerRatingEndpoint     endpoint.Endpoint
	PostPlayerRecordEndpoint     endpoint.Endpoint
	PostPlayerUnitEndpoint       endpoint.Endpoint
	PostCheckReplaysEndpoint     endpoint.Endpoint
}

func MakeServerEndpoints

func MakeServerEndpoints(s Service) Endpoints

type Limit

type Limit struct {
	Limit int `json:"limit"`
}

type Service

type Service interface {
	SubmitReplays(ctx context.Context, codes []string) error
	QueryReplays(ctx context.Context, query models.ReplayQuery) ([]models.Replay, error)

	GetPlayerInfo(ctx context.Context, name string) (models.PlayerInfo, error)
	GetLeaderBoard(ctx context.Context, limit int) ([]models.PlayerInfo, error)

	SearchPlayer(ctx context.Context, name string) ([]string, error)

	GetGlobalWinrate(ctx context.Context) (models.WinRate, error)
	GetUnitsWinRate(ctx context.Context, name string) ([]models.KeyedGameRecord, error) // * means all, selector means filter
	GetCheckReplay(ctx context.Context, codes []string) (models.CheckReplay, error)

	GetRatingDistribution(ctx context.Context) (models.RatingDistributionWrapper, error)

	// GetPlayerRating `lower` and `upper` are seconds in Unix time
	GetPlayerRating(ctx context.Context, name string, constrain models.RangeConstrain, datapoints int) (models.PlayerRatingTimeSeries, error)
	GetPlayerActivity(ctx context.Context, name string, constrain models.RangeConstrain) (models.PlayerActivityCalendar, error)
	GetPlayerUnitWinRate(ctx context.Context, playerName string, constrain models.RangeConstrain, limit int) ([]models.KeyedGameRecord, error)
	GetPlayerTimeOfDayActivity(ctx context.Context, name string) (models.TimeOfDayActivity, error)
	GetPlayerRecord(ctx context.Context, name string) (models.PlayerRecord, error)
}

func InitBackend

func InitBackend(backend string, telemetry models.Telemetry) Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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