Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type Logs
- type PlayerList
- type Players
- type Request
- type Server
- func (server *Server) ExecuteCommand(s *Session, command string) (err error)
- func (server *Server) GetLogs(s *Session) (logs string, err error)
- func (server *Server) GetPlayerList(s *Session, types ...string) (playerList *PlayerList, err error)
- func (server *Server) GetRam(s *Session) (ram float64, err error)
- func (server *Server) GetStatus() string
- func (server *Server) Restart(s *Session) (err error)
- func (server *Server) SetRam(s *Session, ram float64) (err error)
- func (server *Server) ShareLogs(s *Session) (shareLogs *ShareLogs, err error)
- func (server *Server) Start(s *Session) (err error)
- func (server *Server) Stop(s *Session) (err error)
- type Session
- type ShareLogs
- type Software
Constants ¶
View Source
const VERSION = "1.0.1"
Exaroton API Wrapper Version
Variables ¶
View Source
var ( EndpointExaroton = "https://api.exaroton.com/" EndpointAPI = EndpointExaroton + "v" + APIVersion + "/" EndpointAccount = EndpointAPI + "account/" EndpointServers = EndpointAPI + "servers/" EndpointServer = func(serverID string) string { return EndpointServers + serverID } EndpointLogs = func(serverID string) string { return EndpointServer(serverID) + "/logs/" } EndpointRam = func(serverID string) string { return EndpointServer(serverID) + "/options" + "/ram/" } EndpointStart = func(serverID string) string { return EndpointServer(serverID) + "/start/" } EndpointStop = func(serverID string) string { return EndpointServer(serverID) + "/stop/" } EndpointRestart = func(serverID string) string { return EndpointServer(serverID) + "/restart/" } EndpointCommand = func(serverID string) string { return EndpointServer(serverID) + "/command/" } EndpointGetPlayerLists = func(serverID string) string { return EndpointServer(serverID) + "/playerlists/" } EndpointPlayerLists = func(serverID string, playerList string) string { return EndpointGetPlayerLists(serverID) + playerList + "/" } )
Exaroton API Endpoints
View Source
var APIVersion = "1"
Exaroton API Version
Functions ¶
This section is empty.
Types ¶
type Logs ¶
type Logs struct {
// The log content
Content string `json:"content"`
}
Logs struct to represent the logs content Gonna remove this (just realize how bad it is)
type PlayerList ¶
type PlayerList struct {
// The server unique ID
ID string
// The playerlist type
// Whitelist/Ops/Banned-Players/Banned-IPs
Type string
// The list of players
List []string
}
PlayerList struct to represent the playerlist
func (*PlayerList) AddEntry ¶
func (playerList *PlayerList) AddEntry(s *Session, entries []string) (err error)
Add a name to the player list
func (*PlayerList) RemoveEntry ¶
func (playerList *PlayerList) RemoveEntry(s *Session, entries []string) (err error)
Remove a name from the player list
type Players ¶
type Players struct {
// The server max player
Max int64 `json:"max"`
// The active player count
Count int64 `json:"count"`
// The active player list
List []interface{} `json:"list"`
}
Players struct to represent player list
type Request ¶
type Request struct {
Success string `json:"success"`
Errors string `json:"error"`
Data string `json:"data"`
}
Request struct for the REST API result
type Server ¶
type Server struct {
// The server unique ID
ID string `json:"id"`
// The server name
Name string `json:"name"`
// The server full address
Address string `json:"address"`
// The server MOTD
MOTD string `json:"motd"`
// The server status is an integer as described in the documentation.
// https://developers.exaroton.com/#header-server-status
Status int64 `json:"status"`
// The server host adress, only available if the server is online
Host interface{} `json:"host"`
// The server port, only available if the server is online
Port interface{} `json:"port"`
// The server player information
Players Players `json:"players"`
// The server software
Software Software `json:"software"`
Shared bool `json:"shared"`
}
Server struct to represent a Exaroton server
func (*Server) ExecuteCommand ¶
Execute a command in the server console
func (*Server) GetPlayerList ¶
func (server *Server) GetPlayerList(s *Session, types ...string) (playerList *PlayerList, err error)
Get the server player list by name
type Session ¶
type Session struct {
// General configurable settings.
// Authentication token for this session
Token string
// The http client used for REST requests
Client *http.Client
// The user agent used for REST APIs
UserAgent string
}
Session struct to represent a connection to the Exaroton API.
Click to show internal directories.
Click to hide internal directories.