Documentation ¶
Index ¶
- Variables
- func EncodeTextures(textures *TexturesProp) string
- type BadRequestError
- type CapeTexturesResponse
- type EmptyResponse
- type ForbiddenError
- type ProfileInfo
- type Property
- type ResponseError
- type ServerError
- type SignedTexturesResponse
- type SkinTexturesMetadata
- type SkinTexturesResponse
- type TexturesProp
- type TexturesResponse
- type TooManyRequestsError
Constants ¶
This section is empty.
Variables ¶
View Source
var ApiMojangDotComAddr = "https://api.mojang.com"
View Source
var HttpClient = &http.Client{ Timeout: 10 * time.Second, Transport: &http.Transport{ MaxIdleConnsPerHost: 1024, }, }
View Source
var SessionServerMojangComAddr = "https://sessionserver.mojang.com"
Functions ¶
func EncodeTextures ¶
func EncodeTextures(textures *TexturesProp) string
Types ¶
type BadRequestError ¶
type BadRequestError struct { ResponseError ErrorType string Message string }
When passed request params are invalid, Mojang returns 400 Bad Request error
func (*BadRequestError) Error ¶
func (e *BadRequestError) Error() string
func (*BadRequestError) IsMojangError ¶
func (*BadRequestError) IsMojangError() bool
type CapeTexturesResponse ¶
type CapeTexturesResponse struct {
Url string `json:"url"`
}
type EmptyResponse ¶
type EmptyResponse struct { }
Mojang API doesn't return a 404 Not Found error for non-existent data identifiers Instead, they return 204 with an empty body
func (*EmptyResponse) Error ¶
func (*EmptyResponse) Error() string
func (*EmptyResponse) IsMojangError ¶
func (*EmptyResponse) IsMojangError() bool
type ForbiddenError ¶
type ForbiddenError struct {
ResponseError
}
When Mojang decides you're such a bad guy, this error appears (even if the request has no authorization)
func (*ForbiddenError) Error ¶
func (*ForbiddenError) Error() string
type ProfileInfo ¶
type ProfileInfo struct { Id string `json:"id"` Name string `json:"name"` IsLegacy bool `json:"legacy,omitempty"` IsDemo bool `json:"demo,omitempty"` }
func UsernamesToUuids ¶
func UsernamesToUuids(usernames []string) ([]*ProfileInfo, error)
Exchanges usernames array to array of uuids See https://wiki.vg/Mojang_API#Playernames_-.3E_UUIDs
type ResponseError ¶
type ResponseError interface {
IsMojangError() bool
}
type ServerError ¶
type ServerError struct { ResponseError Status int }
ServerError happens when Mojang's API returns any response with 50* status
func (*ServerError) Error ¶
func (e *ServerError) Error() string
func (*ServerError) IsMojangError ¶
func (*ServerError) IsMojangError() bool
type SignedTexturesResponse ¶
type SignedTexturesResponse struct { Id string `json:"id"` Name string `json:"name"` Props []*Property `json:"properties"` // contains filtered or unexported fields }
func UuidToTextures ¶
func UuidToTextures(uuid string, signed bool) (*SignedTexturesResponse, error)
Obtains textures information for provided uuid See https://wiki.vg/Mojang_API#UUID_-.3E_Profile_.2B_Skin.2FCape
func (*SignedTexturesResponse) DecodeTextures ¶
func (t *SignedTexturesResponse) DecodeTextures() (*TexturesProp, error)
type SkinTexturesMetadata ¶
type SkinTexturesMetadata struct {
Model string `json:"model"`
}
type SkinTexturesResponse ¶
type SkinTexturesResponse struct { Url string `json:"url"` Metadata *SkinTexturesMetadata `json:"metadata,omitempty"` }
type TexturesProp ¶
type TexturesProp struct { Timestamp int64 `json:"timestamp"` ProfileID string `json:"profileId"` ProfileName string `json:"profileName"` Textures *TexturesResponse `json:"textures"` }
func DecodeTextures ¶
func DecodeTextures(encodedTextures string) (*TexturesProp, error)
type TexturesResponse ¶
type TexturesResponse struct { Skin *SkinTexturesResponse `json:"SKIN,omitempty"` Cape *CapeTexturesResponse `json:"CAPE,omitempty"` }
type TooManyRequestsError ¶
type TooManyRequestsError struct {
ResponseError
}
When you exceed the set limit of requests, this error will be returned
func (*TooManyRequestsError) Error ¶
func (*TooManyRequestsError) Error() string
func (*TooManyRequestsError) IsMojangError ¶
func (*TooManyRequestsError) IsMojangError() bool
Click to show internal directories.
Click to hide internal directories.