Documentation ¶
Overview ¶
Package yggdrasil provides methods to utilize Mojang's Yggdrasil API.
Index ¶
- type Agent
- type AuthenticationRequest
- type AuthenticationResponse
- type Client
- func (client *Client) Authenticate(username, password, gameName string, gameVersion int) (*AuthenticationResponse, *Error)
- func (client *Client) Invalidate() *Error
- func (client *Client) Refresh() (*RefreshResponse, *Error)
- func (client *Client) Signout(username, password string) (bool, *Error)
- func (client *Client) Validate() (bool, *Error)
- type Error
- type InvalidateRequest
- type Profile
- type Property
- type RefreshRequest
- type RefreshResponse
- type SignoutRequest
- type User
- type ValidateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationRequest ¶
type AuthenticationRequest struct { Agent Agent `json:"agent"` Username string `json:"username"` Password string `json:"password"` ClientToken string `json:"clientToken"` RequestUser bool `json:"requestUser"` }
AuthenticationRequest holds data used to make an authentication request.
type AuthenticationResponse ¶
type AuthenticationResponse struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` AvailableProfiles []Profile `json:"availableProfiles"` SelectedProfile Profile `json:"selectedProfile"` User User `json:"user"` }
AuthenticationResponse holds data returned from a successful authentication request.
type Client ¶
Client holds an access token and a client token. After a successful authentication, it will also hold the currently selected profile and the current user.
func (*Client) Authenticate ¶
func (client *Client) Authenticate(username, password, gameName string, gameVersion int) (*AuthenticationResponse, *Error)
Authenticate attempts to authenticate with Yggdrasil.
func (*Client) Invalidate ¶
Invalidate attempts to invalidate an existing access/client token pair.
func (*Client) Refresh ¶
func (client *Client) Refresh() (*RefreshResponse, *Error)
Refresh attempts to refresh an existing access/client token pair to get a new valid access token.
type Error ¶
type Error struct { Error string `json:"error"` ErrorMessage string `json:"errorMessage"` Cause string `json:"cause"` StatusCode int FuncError error }
Error holds data about a Yggdrasil or internal error.
type InvalidateRequest ¶
type InvalidateRequest struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` }
InvalidateRequest holds data used to make an invalidate request.
type RefreshRequest ¶
type RefreshRequest struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` SelectedProfile Profile `json:"selectedProfile"` RequestUser bool `json:"requestUser"` }
RefreshRequest holds data used to make a refresh request.
type RefreshResponse ¶
type RefreshResponse struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` SelectedProfile Profile `json:"selectedProfile"` User User `json:"user"` }
RefreshResponse holds data returned from a successful refresh request.
type SignoutRequest ¶
SignoutRequest holds data used to make a signout request.
type ValidateRequest ¶
type ValidateRequest struct { AccessToken string `json:"accessToken"` ClientToken string `json:"clientToken"` }
ValidateRequest holds data used to make a validate request.