Documentation ¶
Overview ¶
Package tatsumakigo provides a wrapper to consume the external Tatsumaki API.
Index ¶
- Variables
- type Action
- type Background
- type Badge
- type BadgeSlot
- type Client
- func (t *Client) AdjustGuildUserPoints(guildID string, userID string, amount int, action Action) (*GuildUserPoints, error)
- func (t *Client) AdjustGuildUserPointsWithContext(ctx context.Context, guildID string, userID string, amount int, action Action) (*GuildUserPoints, error)
- func (t *Client) AdjustGuildUserScore(guildID string, userID string, amount int, action Action) (*GuildUserScore, error)
- func (t *Client) AdjustGuildUserScoreWithContext(ctx context.Context, guildID string, userID string, amount int, action Action) (*GuildUserScore, error)
- func (t *Client) GuildLeaderboard(guildID string, limit int) ([]*GuildRankedUser, error)
- func (t *Client) GuildLeaderboardWithContext(ctx context.Context, guildID string, limit int) ([]*GuildRankedUser, error)
- func (t *Client) GuildUserStats(guildID string, userID string) (*GuildUserStats, error)
- func (t *Client) GuildUserStatsWithContext(ctx context.Context, guildID string, userID string) (*GuildUserStats, error)
- func (t *Client) User(userID string) (*User, error)
- func (t *Client) UserWithContext(ctx context.Context, userID string) (*User, error)
- type GuildRankedUser
- type GuildUserPoints
- type GuildUserScore
- type GuildUserStats
- type LevelProgress
- type Ping
- type User
Constants ¶
This section is empty.
Variables ¶
var ErrAdjustBounds = xerrors.New("tatsumakigo: the amount to adjust must be between 0 and 50,000 (inclusive)")
ErrAdjustBounds is returned by the adjust guild points and score methods if the amount to adjust is invalid.
var ErrAdjustInvalid = xerrors.New("tatsumakigo: the amount to adjust for add and remove actions must be above 0")
ErrAdjustInvalid is returned by the adjust guild points and score methods if the amount to adjust for an action is invalid.
var ErrLeaderboardLimit = xerrors.New("tatsumakigo: guild leaderboard limit cannot be less than -1")
ErrLeaderboardLimit is returned by the guild leaderboard endpoint if the limit is not valid.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action string
Action is the action type for updating a user's guild points or score.
const ( // ActionAdd is the action for adding a user's guild points or score. ActionAdd Action = "add" // ActionRemove is the action for removing a user's guild points or score. ActionRemove Action = "remove" // ActionSet is the action for setting a user's guild points or score. ActionSet Action = "set" )
type Background ¶
Background is the struct for a profile background.
type BadgeSlot ¶
BadgeSlot is the struct for a profile badge slot. If the badge slot does not contain an equipped badge, the badge is nil.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main interface to interact with the API.
func (*Client) AdjustGuildUserPoints ¶
func (t *Client) AdjustGuildUserPoints(guildID string, userID string, amount int, action Action) (*GuildUserPoints, error)
AdjustGuildUserPoints wraps AdjustGuildUserPointsWithContext using the background context.
func (*Client) AdjustGuildUserPointsWithContext ¶
func (t *Client) AdjustGuildUserPointsWithContext(ctx context.Context, guildID string, userID string, amount int, action Action) (*GuildUserPoints, error)
AdjustGuildUserPointsWithContext adjusts a user's points in a guild. The amount must be between 0 and 50,000 (inclusive) and must be above 0 if the action is add or remove.
func (*Client) AdjustGuildUserScore ¶
func (t *Client) AdjustGuildUserScore(guildID string, userID string, amount int, action Action) (*GuildUserScore, error)
AdjustGuildUserScore wraps AdjustGuildUserScoreWithContext using the background context.
func (*Client) AdjustGuildUserScoreWithContext ¶
func (t *Client) AdjustGuildUserScoreWithContext(ctx context.Context, guildID string, userID string, amount int, action Action) (*GuildUserScore, error)
AdjustGuildUserScoreWithContext adjusts a user's score in a guild. The amount must be between 0 and 50,000 (inclusive) and must be above 0 if the action is add or remove.
func (*Client) GuildLeaderboard ¶
func (t *Client) GuildLeaderboard(guildID string, limit int) ([]*GuildRankedUser, error)
GuildLeaderboard wraps GuildLeaderboardWithContext using the background context. To get all guild member rankings for the leaderboard, set limit to -1. If limit is set to 0, the default value will be used as per the API.
func (*Client) GuildLeaderboardWithContext ¶
func (t *Client) GuildLeaderboardWithContext(ctx context.Context, guildID string, limit int) ([]*GuildRankedUser, error)
GuildLeaderboardWithContext gets the leaderboard for a guild. To get all guild member rankings for the leaderboard, set limit to -1. If limit is set to 0, the default value will be used as per the API.
func (*Client) GuildUserStats ¶
func (t *Client) GuildUserStats(guildID string, userID string) (*GuildUserStats, error)
GuildUserStats wraps GuildUserStatsWithContext using the background context.
func (*Client) GuildUserStatsWithContext ¶
func (t *Client) GuildUserStatsWithContext(ctx context.Context, guildID string, userID string) (*GuildUserStats, error)
GuildUserStatsWithContext gets a user's stats for a guild. @me is accepted for the user ID, which will retrieve stats for the owner of the API token.
type GuildRankedUser ¶
type GuildRankedUser struct { Rank int64 `json:"rank"` Score int64 `json:"score,string"` UserID string `json:"user_id"` }
GuildRankedUser is the struct for a ranked user in a guild leaderboard.
type GuildUserPoints ¶
type GuildUserPoints struct {
Points int64 `json:"points,string"`
}
GuildUserPoints is the struct for a user's adjusted points in a guild.
type GuildUserScore ¶
type GuildUserScore struct {
Score int64 `json:"score,string"`
}
GuildUserScore is the struct for a user's adjusted score in a guild.
type GuildUserStats ¶
type GuildUserStats struct { GuildID string `json:"guild_id"` Points int64 `json:"points,string"` Score int64 `json:"score,string"` UserID int64 `json:"user_id,string"` }
GuildUserStats is the struct for a user's stats in a guild.
type LevelProgress ¶
LevelProgress is the struct for a user's current level progress.