Documentation
¶
Overview ¶
Package hypixel provides a client for using the Hypixel API.
Construct a new Hypixel client to access the various aspects of their public api. For example, to show an api keys statistics:
client := hypixel.NewClient("your-api-key", nil) response, err := client.KeyInfo()
Index ¶
- func UUIDToUsername(uuid string) (string, error)
- type BoostersResponse
- type Client
- func (c *Client) Boosters() (*json.RawMessage, *json.RawMessage, error)
- func (c *Client) CreateRequest(method string, params map[string]string) (*http.Request, error)
- func (c *Client) FindGuildByName(name string) (string, error)
- func (c *Client) FindGuildByUUID(uuid string) (string, error)
- func (c *Client) FriendsByUUID(uuid string) (*json.RawMessage, error)
- func (c *Client) GameCounts() (*json.RawMessage, *json.RawMessage, error)
- func (c *Client) GuildByID(id string) (*json.RawMessage, error)
- func (c *Client) GuildByName(name string) (*json.RawMessage, error)
- func (c *Client) GuildByUUID(uuid string) (*json.RawMessage, error)
- func (c *Client) KeyInfo() (*json.RawMessage, error)
- func (c *Client) Leaderboards() (*json.RawMessage, error)
- func (c *Client) PlayerByUUID(uuid string) (*json.RawMessage, error)
- func (c *Client) PlayerCount() (*json.RawMessage, error)
- func (c *Client) Query(method string, parameters map[string]string, result interface{}) error
- func (c *Client) RecentGamesByUUID(uuid string) (*json.RawMessage, error)
- func (c *Client) SessionByUUID(uuid string) (*json.RawMessage, error)
- func (c *Client) WatchDogStats() (*json.RawMessage, *json.RawMessage, *json.RawMessage, *json.RawMessage, ...)
- type FriendsResponse
- type GameCountsResponse
- type GuildIDResponse
- type GuildResponse
- type KeyInfoResponse
- type LeaderboardsResponse
- type MojangResponse
- type PlayerCountResponse
- type PlayerResponse
- type RecentGamesResponse
- type SessionResponse
- type WatchDogStatsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UUIDToUsername ¶
Types ¶
type BoostersResponse ¶
type BoostersResponse struct { Boosters *json.RawMessage `json:"boosters"` BoosterState *json.RawMessage `json:"boosterState"` Cause string `json:"cause"` Success bool `json:"success"` }
BoostersResponse is the bare response of the API containing maybe the boosters, maybe the boosters state, maybe a cause and a bool determine if the request was successful.
type Client ¶
type Client struct { // The base url of the API requests. Default to the Hypixel API. BaseURL string // The api key. APIKey string // The user agent. Default to "go-hypixel/0.1 (see https://github.com/maxikg/go-hypixel)". UserAgent string // contains filtered or unexported fields }
A Client manages communication with the Hypixel API.
func NewClient ¶
NewClient returns a new Hypixel API client. If a nil httpClient is provided, http.DefaultClient will be used.
func (*Client) Boosters ¶
func (c *Client) Boosters() (*json.RawMessage, *json.RawMessage, error)
Boosters calls the API at /boosters. It will returns an error or a *json.RawMessage of the boosters and a *json.RawMessage of the booster state.
func (*Client) CreateRequest ¶
CreateRequest creates an http.Request for querying the API. method specify which method should be called. Optional a map can be provided for additional parameters.
func (*Client) FindGuildByName ¶
FindGuildByName finds a guild id by the guilds name. Returns an empty string as the id if no guild data is available.
func (*Client) FindGuildByUUID ¶
FindGuildByUUID finds a guild id by an uuid of a guilds member. Returns an empty string as the id if no guild data is available.
func (*Client) FriendsByUUID ¶
func (c *Client) FriendsByUUID(uuid string) (*json.RawMessage, error)
FriendsByUUID queries friends of the player uuid.
func (*Client) GameCounts ¶
func (c *Client) GameCounts() (*json.RawMessage, *json.RawMessage, error)
GameCounts calls the API at /gameCounts. It will returns an error or a *json.RawMessage of the games and a *json.RawMessage of the player count.
func (*Client) GuildByID ¶
func (c *Client) GuildByID(id string) (*json.RawMessage, error)
GuildByID finds a guild by a the guild's ID. Returns nil if no guild data is available.
func (*Client) GuildByName ¶
func (c *Client) GuildByName(name string) (*json.RawMessage, error)
GuildByName finds a guild by the guilds name. Returns nil if no guild data is available.
func (*Client) GuildByUUID ¶
func (c *Client) GuildByUUID(uuid string) (*json.RawMessage, error)
GuildByUUID finds a guild by a member player's UUID. Returns nil if no guild data is available.
func (*Client) KeyInfo ¶
func (c *Client) KeyInfo() (*json.RawMessage, error)
KeyInfo calls the API at /key. It will returns an error or a KeyInfo which contains statistics about the usage of the currently used key.
func (*Client) Leaderboards ¶
func (c *Client) Leaderboards() (*json.RawMessage, error)
Leaderboards calls the API at /leaderboards. It will returns an error or a *json.RawMessage of the leaderboards.
func (*Client) PlayerByUUID ¶
func (c *Client) PlayerByUUID(uuid string) (*json.RawMessage, error)
PlayerByUUID queries a players by their uuid.
func (*Client) PlayerCount ¶
func (c *Client) PlayerCount() (*json.RawMessage, error)
PlayerCount calls the API at /playerCount. It will returns an error or a *json.RawMessage of the player count.
func (*Client) Query ¶
Query queries the remote API for a specified method, an optional map of parameters and an instance of a struct in which the response will be deserialized.
func (*Client) RecentGamesByUUID ¶
func (c *Client) RecentGamesByUUID(uuid string) (*json.RawMessage, error)
RecentGamesByUUID queries a players recent games by their uuid.
func (*Client) SessionByUUID ¶
func (c *Client) SessionByUUID(uuid string) (*json.RawMessage, error)
SessionByUUID queries a players session by its uuid.
func (*Client) WatchDogStats ¶
func (c *Client) WatchDogStats() (*json.RawMessage, *json.RawMessage, *json.RawMessage, *json.RawMessage, *json.RawMessage, error)
WatchDogStats calls the API at /watchdogstats. It will returns an error or five *json.RawMessage consisting of the various Watchdog stats.
type FriendsResponse ¶
type FriendsResponse struct { Records *json.RawMessage `json:"records"` Cause string `json:"cause"` Success bool `json:"success"` }
FriendsResponse is the bare response of the API containing maybe an array of friends, maybe a cause and a bool determine if the request was successful.
type GameCountsResponse ¶
type GameCountsResponse struct { Games *json.RawMessage `json:"games"` PlayerCount *json.RawMessage `json:"playerCount"` Cause string `json:"cause"` Success bool `json:"success"` }
GameCountsResponse is the bare response of the API containing maybe the game counts, maybe the player count, maybe a cause and a bool determine if the request was successful.
type GuildIDResponse ¶
type GuildIDResponse struct { Guild string `json:"guild"` Cause string `json:"cause"` Success bool `json:"success"` }
GuildIDResponse is the bare response of the API containing maybe a guild id, maybe a cause and a bool determine if the request was successful.
type GuildResponse ¶
type GuildResponse struct { Guild *json.RawMessage `json:"guild"` Cause string `json:"cause"` Success bool `json:"success"` }
GuildResponse is the bare response of the API containing maybe a guild, maybe a cause and a bool determine if the request was successful.
type KeyInfoResponse ¶
type KeyInfoResponse struct { Record *json.RawMessage `json:"record"` Cause string `json:"cause"` Success bool `json:"success"` }
KeyInfoResponse is the bare response of the API containing maybe the record, maybe a cause and a bool determine if the request was successful.
type LeaderboardsResponse ¶
type LeaderboardsResponse struct { Leaderboards *json.RawMessage `json:"leaderboards"` Cause string `json:"cause"` Success bool `json:"success"` }
LeaderboardsResponse is the bare response of the API containing maybe the leaderboards, maybe a cause and a bool determine if the request was successful.
type MojangResponse ¶
MojangResponse is the bare response of the Mojang API containing the UUID and the Username.
func Mojang ¶
func Mojang(username string) (*MojangResponse, error)
Mojang calls the Mojang API at /users/profiles/minecraft
type PlayerCountResponse ¶
type PlayerCountResponse struct { PlayerCount *json.RawMessage `json:"playerCount"` Cause string `json:"cause"` Success bool `json:"success"` }
PlayerCountResponse is the bare response of the API containing maybe the player count, maybe a cause and a bool determine if the request was successful.
type PlayerResponse ¶
type PlayerResponse struct { Player *json.RawMessage `json:"player"` Cause string `json:"cause"` Success bool `json:"success"` }
PlayerResponse is the bare response of the API containing maybe the player, maybe a cause and a bool determine if the request was successful.
type RecentGamesResponse ¶
type RecentGamesResponse struct { Games *json.RawMessage `json:"games"` Cause string `json:"cause"` Success bool `json:"success"` }
RecentGamesResponse is the bare response of the API containing maybe the recent games of a player, maybe a cause and a bool determine if the request was successful.
type SessionResponse ¶
type SessionResponse struct { Session *json.RawMessage `json:"session"` Cause string `json:"cause"` Success bool `json:"success"` }
SessionResponse is the bare response of the API containing maybe the session, maybe a cause and a bool determine if the request was successful.
type WatchDogStatsResponse ¶
type WatchDogStatsResponse struct { WatchdogLastMinute *json.RawMessage `json:"watchdog_lastMinute"` WatchdogRollingDaily *json.RawMessage `json:"watchdog_rollingDaily"` WatchdogTotal *json.RawMessage `json:"watchdog_total"` StaffRollingDaily *json.RawMessage `json:"staff_rollingDaily"` StaffTotal *json.RawMessage `json:"staff_total"` Cause string `json:"cause"` Success bool `json:"success"` }
WatchDogStatsResponse is the bare response of the API containing maybe a set of stats, maybe the player count, maybe a cause and a bool determine if the request was successful.