Documentation ¶
Index ¶
- type Member
- type MemberList
- type Podium
- func (p *Podium) DeleteLeaderboard(ctx context.Context, leaderboard string) (*Response, error)
- func (p *Podium) GetCount(ctx context.Context, leaderboard string) (int, error)
- func (p *Podium) GetMember(ctx context.Context, leaderboard, memberID string) (*Member, error)
- func (p *Podium) GetMemberInLeaderboards(ctx context.Context, leaderboards []string, memberID string, order ...string) (*ScoreList, error)
- func (p *Podium) GetMembers(ctx context.Context, leaderboard string, memberIDs []string) (*MemberList, error)
- func (p *Podium) GetMembersAroundMember(ctx context.Context, leaderboard, memberID string, pageSize int, ...) (*MemberList, error)
- func (p *Podium) GetTop(ctx context.Context, leaderboard string, page, pageSize int) (*MemberList, error)
- func (p *Podium) GetTopPercent(ctx context.Context, leaderboard string, percentage int) (*MemberList, error)
- func (p *Podium) Healthcheck(ctx context.Context) (string, error)
- func (p *Podium) IncrementScore(ctx context.Context, leaderboard, memberID string, increment, scoreTTL int) (*Member, error)
- func (p *Podium) RemoveMemberFromLeaderboard(ctx context.Context, leaderboard, member string) (*Response, error)
- func (p *Podium) UpdateMembersScore(ctx context.Context, leaderboard string, members []*Member, scoreTTL int) (*MemberList, error)
- func (p *Podium) UpdateScore(ctx context.Context, leaderboard, memberID string, score, scoreTTL int) (*Member, error)
- func (p *Podium) UpdateScores(ctx context.Context, leaderboards []string, memberID string, ...) (*ScoreList, error)
- type PodiumInterface
- type RequestError
- type Response
- type Score
- type ScoreList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemberList ¶
MemberList is a list of member
type Podium ¶
type Podium struct { Config *viper.Viper URL string User string Pass string // contains filtered or unexported fields }
Podium is a struct that represents a podium API application
func (*Podium) DeleteLeaderboard ¶
DeleteLeaderboard deletes the leaderboard from podium
func (*Podium) GetMemberInLeaderboards ¶
func (p *Podium) GetMemberInLeaderboards(ctx context.Context, leaderboards []string, memberID string, order ...string) (*ScoreList, error)
GetMemberInLeaderboards returns the ranking and score of a player in multiple leaderboards
func (*Podium) GetMembers ¶
func (p *Podium) GetMembers(ctx context.Context, leaderboard string, memberIDs []string) (*MemberList, error)
GetMembers returns the members for this leaderboard. Page is 1-index
func (*Podium) GetMembersAroundMember ¶
func (p *Podium) GetMembersAroundMember(ctx context.Context, leaderboard, memberID string, pageSize int, getLastIfNotFound bool, order ...string) (*MemberList, error)
GetMembersAroundMember returns the members around the given memberID
func (*Podium) GetTop ¶
func (p *Podium) GetTop(ctx context.Context, leaderboard string, page, pageSize int) (*MemberList, error)
GetTop returns the top members for this leaderboard. Page is 1-index
func (*Podium) GetTopPercent ¶
func (p *Podium) GetTopPercent(ctx context.Context, leaderboard string, percentage int) (*MemberList, error)
GetTopPercent returns the top x% of members in a leaderboard
func (*Podium) Healthcheck ¶
Healthcheck verifies if podium is still up
func (*Podium) IncrementScore ¶
func (p *Podium) IncrementScore(ctx context.Context, leaderboard, memberID string, increment, scoreTTL int) (*Member, error)
IncrementScore increments the score of a particular member in a leaderboard
func (*Podium) RemoveMemberFromLeaderboard ¶
func (p *Podium) RemoveMemberFromLeaderboard(ctx context.Context, leaderboard, member string) (*Response, error)
RemoveMemberFromLeaderboard removes a member from a leaderboard
func (*Podium) UpdateMembersScore ¶
func (p *Podium) UpdateMembersScore(ctx context.Context, leaderboard string, members []*Member, scoreTTL int) (*MemberList, error)
UpdateMembersScore updates the score of a member in more than one leaderboard
type PodiumInterface ¶
type PodiumInterface interface { DeleteLeaderboard(ctx context.Context, leaderboard string) (*Response, error) GetCount(ctx context.Context, leaderboard string) (int, error) GetMember(ctx context.Context, leaderboard, memberID string) (*Member, error) GetMembers(ctx context.Context, leaderboard string, memberIDs []string) (*MemberList, error) GetMemberInLeaderboards(ctx context.Context, leaderboards []string, memberID string, order ...string) (*ScoreList, error) GetMembersAroundMember(ctx context.Context, leaderboard, memberID string, pageSize int, getLastIfNotFound bool, order ...string) (*MemberList, error) GetTop(ctx context.Context, leaderboard string, page, pageSize int) (*MemberList, error) GetTopPercent(ctx context.Context, leaderboard string, percentage int) (*MemberList, error) Healthcheck(ctx context.Context) (string, error) IncrementScore(ctx context.Context, leaderboard, memberID string, increment, scoreTTL int) (*Member, error) RemoveMemberFromLeaderboard(ctx context.Context, leaderboard, member string) (*Response, error) UpdateScore(ctx context.Context, leaderboard, memberID string, score, scoreTTL int) (*Member, error) UpdateScores(ctx context.Context, leaderboards []string, memberID string, score, scoreTTL int) (*ScoreList, error) UpdateMembersScore(ctx context.Context, leaderboard string, members []*Member, scoreTTL int) (*MemberList, error) }
PodiumInterface defines the interface to be implemented
func NewPodium ¶
func NewPodium(config *viper.Viper) PodiumInterface
NewPodium returns a new podium API application
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
RequestError contains code and body of a request that failed
func NewRequestError ¶
func NewRequestError(statusCode int, body string) *RequestError
NewRequestError returns a request error
func (*RequestError) Error ¶
func (r *RequestError) Error() string
func (*RequestError) Status ¶
func (r *RequestError) Status() int
Status returns the status code of the error