SpaceMongers (SpaceMongers v0.3.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.

Claim a username and obtain an auth token which can be used to make an authenticated client.

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

Get the user tied to the provided ApiClient

Get list of all docked ships at a particular location

Get all flight plans within a system, including other users. System defaults to OE if not passed.

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"

Gets the list of your loans

Get the ships tied to the provided ApiClient

Scraps a ship for credits

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() :: [{:skip_deserialization, boolean()}]

Specs

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

Link to this section Functions

Link to this function

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

View Source

Specs

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

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

Purchases a loan of a certain type

POST /users/:username/loans

Link to this function

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

View Source

Specs

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

claim_username(username, opts \\ [])

View Source

Specs

claim_username(String.t(), options()) ::
  response(%{token: String.t(), user: SpaceMongers.Models.User.t()})

Claim a username and obtain an auth token which can be used to make an authenticated client.

Make sure you save this token as you cannot reobtain it later!

POST /users/:username/token

Link to this function

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

View Source

Specs

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

Get the user tied to the provided ApiClient

GET /users/:username

Link to this function

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

View Source

Specs

Get list of all docked ships at a particular location

GET /game/locations/:symbol/ships

Link to this function

flight_plans(client, system \\ "OE", opts \\ [])

View Source

Specs

Get all flight plans within a system, including other users. System defaults to OE if not passed.

GET /game/systems/:system/flight-plans

Link to this function

loans(client, opts \\ [])

View Source

Specs

Gets the list of all available loans to purchase

GET /game/loans

Link to this function

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

View Source

Specs

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

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_loans(client, opts \\ [])

View Source

Specs

Gets the list of your loans

GET /users/:username/loans

Link to this function

my_ships(client, opts \\ [])

View Source

Specs

Get the ships tied to the provided ApiClient

GET /users/:username/ships

Link to this function

scrap_ship(client, ship_id, opts \\ [])

View Source

Specs

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

Scraps a ship for credits

DELETE /users/:username/ships/:shipId

Link to this function

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

View Source

Specs

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

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

GET /game/ships

Specs

status(options()) :: response(String.t())

Get the status of the spacetraders.io servers

GET /game/status

Link to this function

systems(client, opts \\ [])

View Source

Specs

Shows all known systems.

GET /game/systems

Link to this function

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

View Source

Specs

Get an existing flight plan via its id

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