web

package
v0.0.0-...-6796979 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Credits = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "credits",
			Help:      "How much credits user has",
		},
		[]string{"username"})

	GameStatus = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "game_status",
			Help:      "Indicates if the game is up, running and available",
		},
		[]string{"username"})

	ShipCount = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "shipcount",
			Help:      "Total of ships user has",
		},
		[]string{"username"})

	StructureCount = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "structurecount",
			Help:      "Total of structure user has",
		},
		[]string{"username"})

	ShipLoad = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "shipload",
			Help:      "Unused space in ship cargo",
		},
		[]string{"username", "id", "class", "manufacturer", "type", "maxcargo", "plating", "speed", "weapons"})

	UserRank = promauto.NewGaugeVec(
		prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "userrank",
			Help:      "User rank in leaderboard",
		},
		[]string{"username"})
)

Functions

This section is empty.

Types

type Proxy

type Proxy interface {
	// GetUserDetails collects user details.
	//
	// https://api.spacetraders.io/#api-account-GetAccount
	GetUserDetails() ([]byte, error)

	// GetShipList collects the list of ships the user owns.
	//
	// https://api.spacetraders.io/#api-ships-GetShips
	GetShipList() ([]byte, error)

	// GetLeaderboard collects the leaderboard and the user rank.
	//
	// https://api.spacetraders.io/#api-leaderboard-netWorth
	GetLeaderboard() ([]byte, error)

	// GetGameStatus collects the game status (if it is online and accessible).
	//
	// https://api.spacetraders.io/#api-game-Status
	GetGameStatus() ([]byte, error)
}

Proxy represents the interface the Proxy to the game API needs to provide.

func NewWebProxy

func NewWebProxy(token string) Proxy

NewWebProxy creates a new instance of WebProxy.

token is provided by the game when you claim your username.

type WebProxy

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

WebProxy is an implementation of web.Proxy.

func (*WebProxy) GetGameStatus

func (wp *WebProxy) GetGameStatus() ([]byte, error)

GetGameStatus collects the game status (if it is online and accessible).

https://api.spacetraders.io/#api-game-Status

func (*WebProxy) GetLeaderboard

func (wp *WebProxy) GetLeaderboard() ([]byte, error)

GetLeaderboard collects the leaderboard and the user rank.

https://api.spacetraders.io/#api-leaderboard-netWorth

func (*WebProxy) GetShipList

func (wp *WebProxy) GetShipList() ([]byte, error)

GetShipList collects the list of ships the user owns.

https://api.spacetraders.io/#api-ships-GetShips

func (*WebProxy) GetUserDetails

func (wp *WebProxy) GetUserDetails() ([]byte, error)

GetUserDetails collects user details.

https://api.spacetraders.io/#api-account-GetAccount

Jump to

Keyboard shortcuts

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