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 ¶
- type Client
- func (c *Client) CreateRequest(method string, params map[string]string) (*http.Request, error)
- func (c *Client) FindGuildByName(name string) (string, error)
- func (c *Client) FindGuildByPlayer(player string) (string, error)
- func (c *Client) FindGuildByUUID(uuid string) (string, error)
- func (c *Client) FriendsByName(name string) ([]map[string]interface{}, error)
- func (c *Client) FriendsByUUID(uuid string) ([]map[string]interface{}, error)
- func (c *Client) Guild(id string) (map[string]interface{}, error)
- func (c *Client) KeyInfo() (map[string]interface{}, error)
- func (c *Client) PlayerByName(name string) (map[string]interface{}, error)
- func (c *Client) PlayerByUUID(uuid string) (map[string]interface{}, error)
- func (c *Client) Query(method string, parameters map[string]string, result interface{}) error
- func (c *Client) SessionByName(name string) (map[string]interface{}, error)
- func (c *Client) SessionByUUID(uuid string) (map[string]interface{}, error)
- type FriendsResponse
- type GuildIDResponse
- type GuildResponse
- type KeyInfoResponse
- type PlayerResponse
- type SessionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) 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) FindGuildByPlayer ¶
FindGuildByPlayer finds a guild id by an name of a guilds member. 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) FriendsByName ¶
FriendsByName queries friends of the player name.
func (*Client) FriendsByUUID ¶
FriendsByUUID queries friends of the player uuid.
func (*Client) Guild ¶
Guild queries a guilds information by its id. Returns nil if no guild with this id is known.
func (*Client) KeyInfo ¶
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) PlayerByName ¶
PlayerByName queries a player by its name.
func (*Client) PlayerByUUID ¶
PlayerByUUID queries a player by its uuid.
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) SessionByName ¶
SessionByName queries a players session by its name.
type FriendsResponse ¶
type FriendsResponse struct { Records []map[string]interface{} `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 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 map[string]interface{} `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 map[string]interface{} `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 PlayerResponse ¶
type PlayerResponse struct { Player map[string]interface{} `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 SessionResponse ¶
type SessionResponse struct { Session map[string]interface{} `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.