SpaceMongers (SpaceMongers v0.1.0) View Source

Simple API wrapper for spacetraders.io

Most functions in this module require a SpaceMongers.ApiClient instance. More detailed information on which endpoints are available is at https://api.spacetraders.io/

All function calls here are automatically rate-limited to avoid overloading the servers and getting your user banned. Right now the rate limiting is quite agressive so expect SpaceMongers to become more efficient in the future.

Link to this section Summary

Functions

Lists available trades for a particular location

Purchases a particular good at the location where your ship is located

Purchases a loan of a certain type

Purchase a ship. Takes a location, and the type of ship.

Start a flight plan for a particular ship. Takes a ship_id and a destination

Get the user tied to the provided ApiClient

Gets the list of all available loans to purchase

Gets information about a particular location.

Gets the locations within a particular system. If system is not passed, it is assumed to be "OE". Takes an optional parameter for type such as "PLANET" or "ASTEROID"

Get the ships tied to the provided ApiClient

Sells a particular good at the location of your ship

Shows all available ships for purchase. Takes an optional class parameter.

Get the status of the spacetraders.io servers

Shows all known systems.

Get an existing flight plan via its id

Link to this section Types

Specs

client() :: SpaceMongers.ApiClient.t()

Specs

options() :: [{:include_full_response, boolean()}]

Specs

response() ::
  {:ok | :error, any()} | {:ok | :error, any(), SpaceMongers.FullResponse.t()}

Link to this section Functions

Link to this function

available_trades(client, location, opts \\ [])

View Source

Specs

available_trades(client(), String.t(), options()) :: response()

Lists available trades for a particular location

GET /game/locations/:location/marketplace

Link to this function

buy_goods(client, ship_id, good, quantity, opts \\ [])

View Source

Specs

buy_goods(client(), String.t(), String.t(), number(), options()) :: response()

Purchases a particular good at the location where your ship is located

POST /users/:username/purchase-orders

Link to this function

buy_loan(client, type, opts \\ [])

View Source

Specs

buy_loan(client(), String.t(), options()) :: response()

Purchases a loan of a certain type

POST /users/:username/loans

Link to this function

buy_ship(client, location, type, opts \\ [])

View Source

Specs

buy_ship(client(), String.t(), String.t(), options()) :: response()

Purchase a ship. Takes a location, and the type of ship.

Note that type is different than class. type is like ZA-MK-II while class is like MK-II

POST /users/:username/ships

Link to this function

create_flight_plan(client, ship_id, destination, opts \\ [])

View Source

Specs

create_flight_plan(client(), String.t(), String.t(), options()) :: response()

Start a flight plan for a particular ship. Takes a ship_id and a destination

POST /users/:username/flight-plans

Link to this function

current_user(client, opts \\ [])

View Source

Specs

current_user(client(), options()) :: response()

Get the user tied to the provided ApiClient

GET /users/:username

Link to this function

loans(client, opts \\ [])

View Source

Specs

loans(client(), options()) :: response()

Gets the list of all available loans to purchase

GET /game/loans

Link to this function

location_info(client, symbol, opts \\ [])

View Source

Specs

location_info(client(), String.t(), options()) :: response()

Gets information about a particular location.

GET /game/locations/:symbol

Link to this function

locations(client, location_type \\ nil, system \\ "OE", opts \\ [])

View Source

Specs

locations(client(), String.t() | nil, String.t(), options()) :: response()

Gets the locations within a particular system. If system is not passed, it is assumed to be "OE". Takes an optional parameter for type such as "PLANET" or "ASTEROID"

GET /game/systems/:system/locations

Link to this function

my_ships(client, opts \\ [])

View Source

Specs

my_ships(client(), options()) :: response()

Get the ships tied to the provided ApiClient

GET /users/:username/ships

Link to this function

sell_goods(client, ship_id, good, quantity, opts \\ [])

View Source

Specs

sell_goods(client(), String.t(), String.t(), number(), options()) :: response()

Sells a particular good at the location of your ship

POST /users/:username/sell-orders

Link to this function

ships(client, class \\ nil, opts \\ [])

View Source

Specs

ships(client(), String.t() | nil, options()) :: response()

Shows all available ships for purchase. Takes an optional class parameter.

GET /game/ships

Link to this function

status(client, opts \\ [])

View Source

Specs

status(client(), options()) :: response()

Get the status of the spacetraders.io servers

GET /game/status

Link to this function

systems(client, opts \\ [])

View Source

Specs

systems(client(), options()) :: response()

Shows all known systems.

GET /game/systems

Link to this function

view_flight_plan(client, flight_plan_id, opts \\ [])

View Source

Specs

view_flight_plan(client(), String.t(), options()) :: response()

Get an existing flight plan via its id

GET /users/:username/flight-plans/:id