playerdb

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 11 Imported by: 1

README

playerdb

golang client for https://playerdb.co/

Documentation

Index

Constants

View Source
const (
	CodeMinecraftAPIFailure      = "minecraft.api_failure"
	CodeMinecraftInvalidUsername = "minecraft.invalid_username"
	CodePlayerFound              = "player.found"
	CodeXBoxBadResponseCode      = "xbox.bad_response_code"
)

Variables

View Source
var (
	ErrMinecraftAPIFailure      = errors.New(CodeMinecraftAPIFailure)
	ErrMinecraftInvalidUsername = errors.New(CodeMinecraftInvalidUsername)
)

Functions

This section is empty.

Types

type Client

type Client struct {
	HttpClient *http.Client
	Server     string
	UseTLS     bool
}

func NewClient

func NewClient() *Client

func (*Client) Minecraft

func (c *Client) Minecraft(ctx context.Context, id string) (*Player, error)

type Data added in v0.3.0

type Data struct {
	Player *Player `json:"player"`
}

type Meta added in v0.3.0

type Meta struct {
	CachedAt int64 `json:"cached_at"`
}

type Player

type Player struct {
	Avatar      string   `json:"avatar"`
	ID          string   `json:"id"`
	Meta        Meta     `json:"meta"`
	NameHistory []string `json:"name_history"`
	RawID       string   `json:"raw_id"`
	Username    string   `json:"username"`
}

type Response

type Response struct {
	Code    string `json:"code"`
	Data    Data   `json:"data"`
	Error   bool   `json:"error,omitempty"`
	Message string `json:"message"`
	Success bool   `json:"success"`
}

Jump to

Keyboard shortcuts

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