Documentation
¶
Overview ¶
Space Traders is an API game where players explore the stars in order to exploit for it's riches.
More info available here: https://spacetraders.io/
This project provides a golang wrapper for the api.
Index ¶
- type SpaceTrader
- func (st *SpaceTrader) Account() (models.Account, error)
- func (st *SpaceTrader) ApiStatus() (string, error)
- func (st *SpaceTrader) AvailableLoans() ([]models.Loan, error)
- func (st *SpaceTrader) AvailableShips(class string) ([]models.Ship, error)
- func (st *SpaceTrader) BuyGood(shipID string, good string, quantity int) (models.ShipOrder, error)
- func (st *SpaceTrader) BuyShip(location string, shipType string) (models.Account, error)
- func (st *SpaceTrader) CreateFlightPlan(shipID string, destination string) (models.FlightPlan, error)
- func (st *SpaceTrader) GetFlightPlan(flightPlanID string) (models.FlightPlan, error)
- func (st *SpaceTrader) PayLoan(loanID string) (models.Account, error)
- func (st *SpaceTrader) RegisterUser(username string) (string, error)
- func (st *SpaceTrader) SearchSystem(system string, type_ string) ([]models.Location, error)
- func (st *SpaceTrader) SellGood(shipID string, good string, quantity int) (models.ShipOrder, error)
- func (st *SpaceTrader) TakeLoan(loanType string) (models.Account, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SpaceTrader ¶
type SpaceTrader struct {
// contains filtered or unexported fields
}
SpaceTrader is a struct representing the API wrapper and provides functionality for consuming the API.
func (*SpaceTrader) Account ¶
func (st *SpaceTrader) Account() (models.Account, error)
Gets the user's account info as models.Account
func (*SpaceTrader) ApiStatus ¶
func (st *SpaceTrader) ApiStatus() (string, error)
Gets the status of the api as a string.
func (*SpaceTrader) AvailableLoans ¶
func (st *SpaceTrader) AvailableLoans() ([]models.Loan, error)
Gets the available loans as []models.Loan
func (*SpaceTrader) AvailableShips ¶
func (st *SpaceTrader) AvailableShips(class string) ([]models.Ship, error)
Gets the available ships as []models.Ship Can filter ships by specifying class. If class is specified as "" then no filter is applied.
func (*SpaceTrader) BuyGood ¶
Buys the specified good at the specified quantity for the specified ship. Returns models.ShipOrder
func (*SpaceTrader) CreateFlightPlan ¶
func (st *SpaceTrader) CreateFlightPlan(shipID string, destination string) (models.FlightPlan, error)
Creates a flight plan for the ship to the destination. Remember to calculate your estimated fuel usage!
Returns models.FlightPlan
func (*SpaceTrader) GetFlightPlan ¶
func (st *SpaceTrader) GetFlightPlan(flightPlanID string) (models.FlightPlan, error)
Retrieves a models.FlightPlan by the given ID.
func (*SpaceTrader) PayLoan ¶
func (st *SpaceTrader) PayLoan(loanID string) (models.Account, error)
Pays the specified loan. Returns the updated models.Account
func (*SpaceTrader) RegisterUser ¶
func (st *SpaceTrader) RegisterUser(username string) (string, error)
Registers a new user.
func (*SpaceTrader) SearchSystem ¶
Searches the system for the given type. Returns []models.Location
