vimeworld

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Achievement

type Achievement struct {
	ID          int      `json:"id"`
	Title       string   `json:"title"`
	Reward      int      `json:"reward"`
	Description []string `json:"description"`
}

Achievement struct.

type Achievements

type Achievements map[string][]Achievement

Achievements struct.

type AvailableLeaderboard

type AvailableLeaderboard struct {
	Type        string   `json:"type"`
	Description string   `json:"description"`
	MaxSize     int      `json:"max_size"`
	Sort        []string `json:"sort"`
	Season      string   `json:"season"`
}

AvailableLeaderboard struct.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client for VimeWorld API.

func NewClient

func NewClient(opts Options) (*Client, error)

NewClient returns new vimeworld client. Parameters in the options are optional.

func (*Client) BareDo

func (c *Client) BareDo(ctx context.Context, req *http.Request) (*http.Response, error)

BareDo sends an API request and lets you handle the api response.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*http.Response, error)

Do sends an API request and returns the API response.

func (*Client) GetAchievements

func (c *Client) GetAchievements(ctx context.Context) (*Achievements, error)

GetAchievements returns achievements.

func (*Client) GetGames

func (c *Client) GetGames(ctx context.Context) ([]*Game, error)

GetGames returns games.

func (*Client) GetGuildByID

func (c *Client) GetGuildByID(ctx context.Context, id int) (*Guild, error)

GetGuildByID returns guild by ID.

func (*Client) GetGuildByName

func (c *Client) GetGuildByName(ctx context.Context, name string) (*Guild, error)

GetGuildByName returns guild by name.

func (*Client) GetGuildByTag

func (c *Client) GetGuildByTag(ctx context.Context, tag string) (*Guild, error)

GetGuildByTag returns guild by tag.

func (*Client) GetLeaderboard

func (c *Client) GetLeaderboard(ctx context.Context, boardType, sort string, size, offset int) (*Leaderboard, error)

GetLeaderboard returns leaderboard.

func (*Client) GetLeaderboardList

func (c *Client) GetLeaderboardList(ctx context.Context) ([]*AvailableLeaderboard, error)

GetLeaderboardList returns available leaderboards.

func (*Client) GetLocaleByName

func (c *Client) GetLocaleByName(ctx context.Context, name string, parts ...string) (*Locale, error)

GetLocaleByName returns locale by name.

func (*Client) GetMaps

func (c *Client) GetMaps(ctx context.Context) (*Maps, error)

GetMaps returns maps.

func (*Client) GetMatchLatest

func (c *Client) GetMatchLatest(ctx context.Context) ([]*Match, error)

GetMatchLatest returns latest matches.

func (*Client) GetMatchListAfter

func (c *Client) GetMatchListAfter(ctx context.Context, after string, count int) ([]*Match, error)

GetMatchListAfter returns matches after ID.

func (*Client) GetMatchListBefore

func (c *Client) GetMatchListBefore(ctx context.Context, before string, count int) ([]*Match, error)

GetMatchListBefore returns matches before ID.

func (*Client) GetOnline

func (c *Client) GetOnline(ctx context.Context) (*Online, error)

GetOnline return online of a server.

func (*Client) GetOnlineStaff

func (c *Client) GetOnlineStaff(ctx context.Context) ([]*User, error)

GetOnlineStaff returns online staff.

func (*Client) GetOnlineStreams

func (c *Client) GetOnlineStreams(ctx context.Context) ([]*OnlineStream, error)

GetOnlineStreams returns online streams.

func (*Client) GetTokenInfo

func (c *Client) GetTokenInfo(ctx context.Context, token string) (*Token, error)

GetTokenInfo returns token info by token.

func (*Client) GetUserAchievements

func (c *Client) GetUserAchievements(ctx context.Context, id int) (*UserAchievements, error)

GetUserAchievements return user achievements by ID.

func (*Client) GetUserFriends

func (c *Client) GetUserFriends(ctx context.Context, id int) (*Friends, error)

GetUserFriends return Friend list of user by ID.

func (*Client) GetUserLeaderboards

func (c *Client) GetUserLeaderboards(ctx context.Context, id int) (*UserLeaderboards, error)

GetUserLeaderboards returns user leaderboard by ID.

func (*Client) GetUserMatchesAfter

func (c *Client) GetUserMatchesAfter(ctx context.Context, id int, after string, count int) (*UserMatches, error)

GetUserMatchesAfter return matches after id.

func (*Client) GetUserMatchesBefore

func (c *Client) GetUserMatchesBefore(ctx context.Context, id int, before string, count int) (*UserMatches, error)

GetUserMatchesBefore return matches before id.

func (*Client) GetUserMatchesOffset

func (c *Client) GetUserMatchesOffset(ctx context.Context, id, offset, count int) (*UserMatches, error)

GetUserMatchesOffset return matches by offset.

func (*Client) GetUserSession

func (c *Client) GetUserSession(ctx context.Context, id int) (*Session, error)

GetUserSession return user session by ID.

func (*Client) GetUserStats

func (c *Client) GetUserStats(ctx context.Context, id int, games ...string) (*UserStats, error)

GetUserStats return user stats by ID

func (*Client) GetUsersByIds

func (c *Client) GetUsersByIds(ctx context.Context, ids ...int) ([]*User, error)

GetUsersByIds return users by ids.

func (*Client) GetUsersByNames

func (c *Client) GetUsersByNames(ctx context.Context, names ...string) ([]*User, error)

GetUsersByNames return users by names.

func (*Client) GetUsersSessions

func (c *Client) GetUsersSessions(ctx context.Context, ids ...int) ([]*UserSession, error)

GetUsersSessions return user sessions by ids.

func (*Client) GuildSearch

func (c *Client) GuildSearch(ctx context.Context, query string) ([]*UserGuild, error)

GuildSearch returns guilds by query.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request.

type Error

type Error struct {
	ErrorCode int    `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
	Comment   string `json:"comment"`
}

Error is a api error.

func (Error) Error

func (e Error) Error() string

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

ErrorResponse struct.

type Friends

type Friends struct {
	User    User   `json:"user"`
	Friends []User `json:"friends"`
}

Friends struct.

type Game

type Game struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	GlobalStats []string `json:"global_stats"`
	SeasonStats struct {
		Monthly []string `json:"monthly"`
		Manual  []string `json:"manual"`
	} `json:"season_stats"`
}

Game struct.

type GameLocale

type GameLocale struct {
	Name string `json:"name"`
}

GameLocale struct.

type Guild

type Guild struct {
	ID              int                  `json:"id"`
	Name            string               `json:"name"`
	Tag             string               `json:"tag"`
	Color           string               `json:"color"`
	Level           int                  `json:"level"`
	LevelPercentage float64              `json:"levelPercentage"`
	AvatarURL       string               `json:"avatar_url"`
	TotalExp        int                  `json:"totalExp"`
	TotalCoins      int                  `json:"totalCoins"`
	Created         int                  `json:"created"`
	WebInfo         string               `json:"web_info"`
	Perks           map[string]GuildPerk `json:"perks"`
	Members         []GuildMember        `json:"members"`
}

Guild struct.

type GuildMember

type GuildMember struct {
	User       User   `json:"user"`
	Status     string `json:"status"`
	Joined     int    `json:"joined"`
	GuildCoins int    `json:"guildCoins"`
	GuildExp   int    `json:"guildExp"`
}

GuildMember struct.

type GuildPerk

type GuildPerk struct {
	Name  string `json:"name"`
	Level int    `json:"level"`
}

GuildPerk struct.

type Leaderboard

type Leaderboard struct {
	Meta    LeaderboardResponseMeta `json:"leaderboard"`
	Records []interface{}           `json:"records"`
}

Leaderboard struct.

type LeaderboardResponseMeta

type LeaderboardResponseMeta struct {
	Type    string `json:"type"`
	Sort    string `json:"sort"`
	Offset  int    `json:"offset"`
	Size    int    `json:"size"`
	MaxSize int    `json:"max_size"`
}

LeaderboardResponseMeta struct.

type Locale

type Locale struct {
	Games     map[string]GameLocale             `json:"games"`
	GameStats map[string]map[string]interface{} `json:"game_stats"`
	Ranks     map[string]RankLocale             `json:"ranks"`
}

Locale struct.

type Map

type Map struct {
	Name          string `json:"name"`
	Teams         int    `json:"teams"`
	PlayersInTeam int    `json:"playersInTeam"`
}

Map struct.

type Maps

type Maps map[string]map[string]Map

Maps struct.

type Match

type Match struct {
	ID       string   `json:"id"`
	Game     string   `json:"game"`
	Map      MatchMap `json:"map"`
	Date     int64    `json:"date"`
	Duration int      `json:"duration"`
	Players  int      `json:"players"`
}

Match struct.

type MatchMap

type MatchMap struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Teams         int    `json:"teams"`
	PlayersInTeam int    `json:"playersInTeam"`
}

MatchMap struct.

type Online

type Online struct {
	Total     int            `json:"total"`
	Separated map[string]int `json:"separated"`
}

Online struct.

type OnlineSession

type OnlineSession struct {
	Value   bool   `json:"value"`
	Message string `json:"message"`
	Game    string `json:"game"`
}

OnlineSession struct.

type OnlineStream

type OnlineStream struct {
	Title    string `json:"title"`
	Owner    string `json:"owner"`
	Viewers  int    `json:"viewers"`
	URL      string `json:"url"`
	Duration int    `json:"duration"`
	Platform string `json:"platform"`
	User     User   `json:"user"`
}

OnlineStream struct.

type Options

type Options struct {
	Client  *http.Client
	BaseURL string
	Tokens  []string
}

Options for Client.

type RankLocale

type RankLocale struct {
	Name   string `json:"name"`
	Prefix string `json:"prefix"`
}

RankLocale struct.

type Session

type Session struct {
	User   User          `json:"user"`
	Online OnlineSession `json:"online"`
}

Session struct.

type Token

type Token struct {
	Token string `json:"token"`
	Valid bool   `json:"valid"`
	Type  string `json:"type"`
	Limit int    `json:"limit"`
	Owner *User  `json:"owner"`
}

Token struct.

type User

type User struct {
	ID              int        `json:"id"`
	Username        string     `json:"username"`
	Level           int        `json:"level"`
	LevelPercentage float64    `json:"levelPercentage"`
	Rank            string     `json:"rank"`
	PlayedSeconds   int64      `json:"playedSeconds"`
	LastSeen        int64      `json:"lastSeen"`
	Guild           *UserGuild `json:"guild"`
}

User struct.

type UserAchievement

type UserAchievement struct {
	ID   int   `json:"ID"`
	Time int64 `json:"time"`
}

UserAchievement struct.

type UserAchievements

type UserAchievements struct {
	User         User              `json:"user"`
	Achievements []UserAchievement `json:"achievements"`
}

UserAchievements struct.

type UserGuild

type UserGuild struct {
	ID              int     `json:"id"`
	Name            string  `json:"name"`
	Tag             string  `json:"tag"`
	Color           string  `json:"color"`
	Level           int     `json:"level"`
	LevelPercentage float64 `json:"levelPercentage"`
	AvatarURL       string  `json:"avatar_url"`
}

UserGuild struct.

type UserLeaderboard

type UserLeaderboard struct {
	Type  string `json:"type"`
	Sort  string `json:"sort"`
	Place int    `json:"place"`
}

UserLeaderboard struct.

type UserLeaderboards

type UserLeaderboards struct {
	User         User              `json:"user"`
	Leaderboards []UserLeaderboard `json:"leaderboards"`
}

UserLeaderboards struct.

type UserMatch

type UserMatch struct {
	ID       string   `json:"id"`
	Game     string   `json:"game"`
	Map      MatchMap `json:"map"`
	Date     int      `json:"date"`
	Duration int      `json:"duration"`
	Players  int      `json:"players"`
	Win      bool     `json:"win"`
	State    int      `json:"state"`
}

UserMatch struct.

type UserMatches

type UserMatches struct {
	User    User `json:"user"`
	Request struct {
		Count  int `json:"count"`
		Offset int `json:"offset"`
		Size   int `json:"size"`
	} `json:"request"`
	Matches []UserMatch `json:"matches"`
}

UserMatches struct.

type UserSession

type UserSession struct {
	User
	Online OnlineSession `json:"online"`
}

UserSession struct.

type UserStats

type UserStats struct {
	User  User                   `json:"user"`
	Stats map[string]interface{} `json:"stats"`
}

UserStats struct.

Jump to

Keyboard shortcuts

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