space_trader

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

README

Cover Image

🚀 Space Trader API 🛠️ [WIP]

Space Traders is an API game where players explore the stars in order to exploit for it's riches.

More info available here.

This project provides a golang wrapper for the api.

🛠️ Work In Progress

Notice this package is in it's alpha stage and is subject to api changes.

🔧 Documentation

View Go Docs here.

💾 Models

Most of the objects have been modelled and can be accessed through the model package.

The methods in this wrapper return the relevant model.

📔 Examples

💻 Contribution

This project is open to contributions.

To contribute follow the standard go style as much as possible and try to achieve an 80% code coverage or higher, with unit tests for the code submitted / changed.

Contributors will be acknowledge in this readme.

❤️ Contributors

HOWZ1T - Project Author & Maintainer

⚖️ License

This project is licensed under GNU General Public License v3.0.

📝 TODO

  • More Examples
    • Quick Start
  • Continuous Integration
  • Unit Tests (Reach at least 80% coverage)
    • Current Coverage: 49.5%
  • Documentation

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

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 New

func New(token string, username string) SpaceTrader

Creates a new SpaceTrader instance.

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

func (st *SpaceTrader) BuyGood(shipID string, good string, quantity int) (models.ShipOrder, error)

Buys the specified good at the specified quantity for the specified ship. Returns models.ShipOrder

func (*SpaceTrader) BuyShip

func (st *SpaceTrader) BuyShip(location string, shipType string) (models.Account, error)

Buys the specified ship. Returns the updated models.Account

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

func (st *SpaceTrader) SearchSystem(system string, type_ string) ([]models.Location, error)

Searches the system for the given type. Returns []models.Location

func (*SpaceTrader) SellGood

func (st *SpaceTrader) SellGood(shipID string, good string, quantity int) (models.ShipOrder, error)

Sells the specified good at the specified quantity for the specified ship. Returns models.ShipOrder

func (*SpaceTrader) TakeLoan

func (st *SpaceTrader) TakeLoan(loanType string) (models.Account, error)

Takes (purchases) a loan. Returns the updated models.Account

Directories

Path Synopsis
Assert provides useful utilities for writing unit tests.
Assert provides useful utilities for writing unit tests.
Provides implementation of errors for this project.
Provides implementation of errors for this project.

Jump to

Keyboard shortcuts

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