Documentation
¶
Index ¶
- Constants
- type BanDetail
- type BanResult
- type Bans
- type Client
- func (c *Client) AddBan(issuer, player, reason string) (result *BanResult, err error)
- func (c *Client) AddIPBan(issuer, ip, reason string) (result *IPBan, err error)
- func (c *Client) AddNote(issuer, player, note string) (result *NoteResult, err error)
- func (c *Client) GetBan(player string, page, bansPerPage int) (result *Bans, err error)
- func (c *Client) GetBanCount(player string) (bans int, err error)
- func (c *Client) GetBanDetails(player string) (result *BanDetail, err error)
- func (c *Client) GetBanReason(player string) (result *BanDetail, err error)
- func (c *Client) GetIPBan(ip string, page, bansPerPage int) (result *Bans, err error)
- func (c *Client) GetIPBanCount(ip string) (count int, err error)
- func (c *Client) GetNoteCount(player string) (notes int, err error)
- func (c *Client) GetNotes(player string, page, notesPerPage int) (result *Notes, err error)
- func (c *Client) RemoveBan(player string) (result *BanResult, err error)
- func (c *Client) RemoveIPBan(ip string) (result *IPBan, err error)
- func (c *Client) RemoveNote(id int) (result *NoteResult, err error)
- type IPBan
- type NoteDetail
- type NoteResult
- type Notes
- type Time
Constants ¶
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
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`
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 (*Client) AddNote ¶
func (c *Client) AddNote(issuer, player, note string) (result *NoteResult, err error)
AddNote adds a note to player
func (*Client) GetBanCount ¶
GetBanCount returns ban count for player
func (*Client) GetBanDetails ¶
GetBanDetails retrieves details on ban for specified player's ban on your server
func (*Client) GetBanReason ¶
GetBanReason retrieves reason for specified player's ban on your server
func (*Client) GetIPBanCount ¶
GetIPBanCount returns ban count for provided IP address
func (*Client) GetNoteCount ¶
GetNoteCount retrieves count of notes for player
func (*Client) RemoveIPBan ¶
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 ¶
Time holds time type
func (*Time) MarshalJSON ¶
MarshalJSON implements MarshalJSON for custom ban timestamp
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements UnmarshalJSON for custom ban timestamp