playerdb

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

README

playerdb

golang client for https://playerdb.co/

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrDataMissingPlayer = errors.New("data missing player field")
)

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 FieldMissingError

type FieldMissingError struct {
	// contains filtered or unexported fields
}

FieldMissingError is returned when a field from an object is missing

func (*FieldMissingError) Error

func (f *FieldMissingError) Error() string

type FieldTypeError

type FieldTypeError struct {
	// contains filtered or unexported fields
}

FieldTypeError is returned when a field from an object is the wrong type

func (*FieldTypeError) Error

func (f *FieldTypeError) Error() string

type HTTPStatusError

type HTTPStatusError struct {
	// contains filtered or unexported fields
}

HTTPStatusError is returned when an unexpected

func (*HTTPStatusError) Error

func (f *HTTPStatusError) Error() string

type Player

type Player struct {
	Avatar      string                 `json:"avatar"`
	ID          string                 `json:"id"`
	Meta        map[string]interface{} `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    map[string]interface{} `json:"data"`
	Error   bool                   `json:"error,omitempty"`
	Message string                 `json:"message"`
	Success bool                   `json:"success"`
}

func (*Response) Player

func (r *Response) Player() (*Player, error)

Jump to

Keyboard shortcuts

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