api

package
v3.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VERSION = "3.1.2"

VERSION identifies podium's current version

Functions

func FailWith

func FailWith(status int, message string, c *iris.Context)

FailWith fails with the specified message

func GetAroundMemberHandler

func GetAroundMemberHandler(app *App) func(c *iris.Context)

GetAroundMemberHandler retrieves a list of member score and rank centered in the given member

func GetMemberHandler

func GetMemberHandler(app *App) func(c *iris.Context)

GetMemberHandler is the handler responsible for retrieving a member score and rank

func GetMemberRankHandler

func GetMemberRankHandler(app *App) func(c *iris.Context)

GetMemberRankHandler is the handler responsible for retrieving a member rank

func GetMemberRankInManyLeaderboardsHandler

func GetMemberRankInManyLeaderboardsHandler(app *App) func(c *iris.Context)

GetMemberRankInManyLeaderboardsHandler returns the member rank in several leaderboards at once

func GetMembersHandler

func GetMembersHandler(app *App) func(c *iris.Context)

GetMembersHandler retrieves several members at once

func GetTopMembersHandler

func GetTopMembersHandler(app *App) func(c *iris.Context)

GetTopMembersHandler retrieves onePage of member score and rank

func GetTopPercentageHandler

func GetTopPercentageHandler(app *App) func(c *iris.Context)

GetTopPercentageHandler retrieves top x % members in the leaderboard

func GetTotalMembersHandler

func GetTotalMembersHandler(app *App) func(c *iris.Context)

GetTotalMembersHandler is the handler responsible for returning the total number of members in a leaderboard

func HealthCheckHandler

func HealthCheckHandler(app *App) func(c *iris.Context)

HealthCheckHandler is the handler responsible for validating that the app is still up

func LoadJSONPayload

func LoadJSONPayload(payloadStruct interface{}, c *iris.Context) error

LoadJSONPayload loads the JSON payload to the given struct validating all fields are not null

func NewLoggerMiddleware

func NewLoggerMiddleware(theLogger zap.Logger) iris.HandlerFunc

NewLoggerMiddleware returns the logger middleware

func RemoveLeaderboardHandler

func RemoveLeaderboardHandler(app *App) func(c *iris.Context)

RemoveLeaderboardHandler is the handler responsible for removing a leaderboard

func RemoveMemberHandler

func RemoveMemberHandler(app *App) func(c *iris.Context)

RemoveMemberHandler removes a member from a leaderboard

func RemoveMembersHandler

func RemoveMembersHandler(app *App) func(c *iris.Context)

RemoveMembersHandler removes several members from a leaderboard

func StatusHandler

func StatusHandler(app *App) func(c *iris.Context)

StatusHandler is the handler responsible for reporting podium status

func SucceedWith

func SucceedWith(payload map[string]interface{}, c *iris.Context)

SucceedWith sends payload to member with status 200

func UpsertMemberLeaderboardsScoreHandler

func UpsertMemberLeaderboardsScoreHandler(app *App) func(c *iris.Context)

UpsertMemberLeaderboardsScoreHandler sets the member score for all leaderboards

func UpsertMemberScoreHandler

func UpsertMemberScoreHandler(app *App) func(c *iris.Context)

UpsertMemberScoreHandler is the handler responsible for creating or updating the member score

Types

type App

type App struct {
	Debug       bool
	Port        int
	Host        string
	ConfigPath  string
	Errors      metrics.EWMA
	App         *iris.Framework
	Config      *viper.Viper
	Logger      zap.Logger
	RedisClient *util.RedisClient
}

App is a struct that represents a podium Application

func GetApp

func GetApp(host string, port int, configPath string, debug bool, logger zap.Logger) (*App, error)

GetApp returns a new podium Application

func (*App) AddError

func (app *App) AddError()

AddError rate statistics

func (*App) Configure

func (app *App) Configure() error

Configure instantiates the required dependencies for podium Application

func (*App) OnErrorHandler

func (app *App) OnErrorHandler(err interface{}, stack []byte)

OnErrorHandler handles application panics

func (*App) Start

func (app *App) Start()

Start starts listening for web requests at specified host and port

type JSON

type JSON map[string]interface{}

JSON type

type LoggerMiddleware

type LoggerMiddleware struct {
	Logger zap.Logger
}

LoggerMiddleware is responsible for logging to Zap all requests

func (*LoggerMiddleware) Serve

func (l *LoggerMiddleware) Serve(ctx *iris.Context)

Serve serves the middleware

type RecoveryMiddleware

type RecoveryMiddleware struct {
	OnError func(interface{}, []byte)
}

RecoveryMiddleware recovers from errors in Iris

func (RecoveryMiddleware) Serve

func (r RecoveryMiddleware) Serve(ctx *iris.Context)

Serve executes on error handler when errors happen

type SentryMiddleware

type SentryMiddleware struct {
	App *App
}

SentryMiddleware is responsible for sending all exceptions to sentry

func (*SentryMiddleware) Serve

func (l *SentryMiddleware) Serve(ctx *iris.Context)

Serve serves the middleware

type VersionMiddleware

type VersionMiddleware struct {
	App *App
}

VersionMiddleware automatically adds a version header to response

func (*VersionMiddleware) Serve

func (m *VersionMiddleware) Serve(c *iris.Context)

Serve automatically adds a version header to response

Jump to

Keyboard shortcuts

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