mcbouncer

package module
v0.0.0-...-0369700 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2015 License: MIT Imports: 11 Imported by: 0

README

mcbouncer

GoDoc

mcbouncer library

Documentation

Index

Constants

View Source
const (
	AddBan        = "addBan"
	RemoveBan     = "removeBan"
	GetBans       = "getBans"
	GetBanCount   = "getBanCount"
	GetBanReason  = "getBanReason"
	GetBanDetails = "getBanDetails"
	AddIPBan      = "addIPBan"
	RemoveIPBan   = "removeIPBan"
	GetIPBans     = "getIPBans"
	GetIPBanCount = "getIPBanCount"
	AddNote       = "addNote"
	RemoveNote    = "removeNote"
	GetNotes      = "getNotes"
	GetNoteCount  = "getNoteCount"
	UpdateUser    = "updateUser"
)

actions

View Source
const APIURLf = "http://www.mcbouncer.com/api/%s/%s/%s"

APIURLf is the format string for the api url /api/{action}/{apikey}/{params} params are in the format `param0/param1/param2`

View Source
const TimeFormat = `"2006-01-02T15:04:05.999"`

TimeFormat is the time format

Variables

This section is empty.

Functions

This section is empty.

Types

type BanDetail

type BanDetail struct {
	Username string `json:"username"`
	IP       string `json:"ip"`
	Reason   string `json:"reason"`
	Server   string `json:"server"`
	Time     *Time  `json:"time"`
	Issuer   string `json:"issuer"`
	Banned   bool   `json:"is_banned"`
}

BanDetail holds information on a specific ban

type BanResult

type BanResult struct {
	User    string `json:"user"`
	Success bool   `json:"success"`
	Error   string `json:"error"`
}

BanResult is returned from AddBan

type Bans

type Bans struct {
	Count   int          `json:"totalcount"`
	Page    int          `json:"page"`
	Success bool         `json:"success"`
	Bans    []*BanDetail `json:"data"`
}

Bans holds information on bans

type Client

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

Client implements mcbouncer api

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a new client

func (*Client) AddBan

func (c *Client) AddBan(issuer, player, reason string) (result *BanResult, err error)

AddBan submits a ban to the api

func (*Client) AddIPBan

func (c *Client) AddIPBan(issuer, ip, reason string) (result *IPBan, err error)

AddIPBan adds IP ban

func (*Client) AddNote

func (c *Client) AddNote(issuer, player, note string) (result *NoteResult, err error)

AddNote adds a note to player

func (*Client) GetBan

func (c *Client) GetBan(player string, page, bansPerPage int) (result *Bans, err error)

GetBan retrieves bans for a player

func (*Client) GetBanCount

func (c *Client) GetBanCount(player string) (bans int, err error)

GetBanCount returns ban count for player

func (*Client) GetBanDetails

func (c *Client) GetBanDetails(player string) (result *BanDetail, err error)

GetBanDetails retrieves details on ban for specified player's ban on your server

func (*Client) GetBanReason

func (c *Client) GetBanReason(player string) (result *BanDetail, err error)

GetBanReason retrieves reason for specified player's ban on your server

func (*Client) GetIPBan

func (c *Client) GetIPBan(ip string, page, bansPerPage int) (result *Bans, err error)

GetIPBan retrieves bans for provided IP address

func (*Client) GetIPBanCount

func (c *Client) GetIPBanCount(ip string) (count int, err error)

GetIPBanCount returns ban count for provided IP address

func (*Client) GetNoteCount

func (c *Client) GetNoteCount(player string) (notes int, err error)

GetNoteCount retrieves count of notes for player

func (*Client) GetNotes

func (c *Client) GetNotes(player string, page, notesPerPage int) (result *Notes, err error)

GetNotes retrieves notes on a player

func (*Client) RemoveBan

func (c *Client) RemoveBan(player string) (result *BanResult, err error)

RemoveBan removes player ban

func (*Client) RemoveIPBan

func (c *Client) RemoveIPBan(ip string) (result *IPBan, err error)

RemoveIPBan removes ban for provided IP address

func (*Client) RemoveNote

func (c *Client) RemoveNote(id int) (result *NoteResult, err error)

RemoveNote removes a note

type IPBan

type IPBan struct {
	IPAddress string `json:"ipaddress"`
	Success   bool   `json:"success"`
	Error     string `json:"error"`
}

IPBan holds details about an IP ban

type NoteDetail

type NoteDetail struct {
	Username string `json:"username"`
	Note     string `json:"string"`
	Time     *Time  `json:"time"`
	Issuer   string `json:"issuer"`
	ID       int    `json:"noteid"`
	Server   string `json:"server"`
}

NoteDetail holds information on note

type NoteResult

type NoteResult struct {
	User    string `json:"user"`
	Success bool   `json:"success"`
	Error   string `json:"error"`
	ID      string `json:"noteid"`
}

NoteResult is returned when performing actions on a note

type Notes

type Notes struct {
	Count   int           `json:"totalcount"`
	Notes   []*NoteDetail `json:"data"`
	Page    int           `json:"page"`
	Success bool          `json:"success"`
}

Notes holds notes

type Time

type Time struct {
	time.Time
}

Time holds time type

func (*Time) MarshalJSON

func (bt *Time) MarshalJSON() ([]byte, error)

MarshalJSON implements MarshalJSON for custom ban timestamp

func (*Time) UnmarshalJSON

func (bt *Time) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements UnmarshalJSON for custom ban timestamp

Jump to

Keyboard shortcuts

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