spacetraders_api

Types

pub type AgentRegistered {
  AgentRegistered(
    token: spacetraders_sdk.AgentToken,
    agent: agent.Agent,
    faction: faction.Faction,
    contract: contract.Contract,
    ships: List(ship.Ship),
  )
}

Constructors

pub type Announcement {
  Announcement(title: String, body: String)
}

Constructors

  • Announcement(title: String, body: String)
pub type CargoPurchased {
  CargoPurchased(
    cargo: ship_cargo.ShipCargo,
    transaction: market_transaction.MarketTransaction,
    agent: agent.Agent,
  )
}

Constructors

pub type CargoSold {
  CargoSold(
    cargo: ship_cargo.ShipCargo,
    transaction: market_transaction.MarketTransaction,
    agent: agent.Agent,
  )
}

Constructors

pub type CargoTransferred {
  CargoTransferred(
    cargo: ship_cargo.ShipCargo,
    target_cargo: ship_cargo.ShipCargo,
  )
}

Constructors

pub type ChartCreated {
  ChartCreated(
    chart: chart.Chart,
    waypoint: waypoint.Waypoint,
    transaction: chart_transaction.ChartTransaction,
    agent: agent.Agent,
  )
}

Constructors

pub type ChartLeaderboardEntry {
  ChartLeaderboardEntry(
    agent_symbol: agent_symbol.AgentSymbol,
    chart_count: Int,
  )
}

Constructors

pub type ConstructionSiteSupplied {
  ConstructionSiteSupplied(
    construction: construction.Construction,
    cargo: ship_cargo.ShipCargo,
  )
}

Constructors

pub type ContractAccepted {
  ContractAccepted(
    contract: contract.Contract,
    agent: agent.Agent,
  )
}

Constructors

pub type ContractCargoDelivered {
  ContractCargoDelivered(
    contract: contract.Contract,
    cargo: ship_cargo.ShipCargo,
  )
}

Constructors

pub type ContractFulfilled {
  ContractFulfilled(
    contract: contract.Contract,
    agent: agent.Agent,
  )
}

Constructors

pub type CreditLeaderboardEntry {
  CreditLeaderboardEntry(
    agent_symbol: agent_symbol.AgentSymbol,
    credits: Int,
  )
}

Constructors

pub type ErrorCode {
  ErrorCode(code: Int, name: String)
}

Constructors

  • ErrorCode(code: Int, name: String)
pub type FactionReputation {
  FactionReputation(
    symbol: faction_symbol.FactionSymbol,
    reputation: Int,
  )
}

Constructors

pub type Health {
  Health(last_market_update: option.Option(birl.Time))
}

Constructors

pub type Leaderboards {
  Leaderboards(
    most_credits: List(CreditLeaderboardEntry),
    most_submitted_charts: List(ChartLeaderboardEntry),
  )
}

Constructors

pub type Link {
  Link(name: String, url: uri.Uri)
}

Constructors

pub type ResourcesExtracted {
  ResourcesExtracted(
    extraction: extraction.Extraction,
    cooldown: cooldown.Cooldown,
    cargo: ship_cargo.ShipCargo,
    modifiers: List(waypoint_modifier.WaypointModifier),
    events: List(ship_condition_event.ShipConditionEvent),
  )
}

Constructors

pub type ResourcesSiphoned {
  ResourcesSiphoned(
    siphon: siphon.Siphon,
    cooldown: cooldown.Cooldown,
    cargo: ship_cargo.ShipCargo,
    events: List(ship_condition_event.ShipConditionEvent),
  )
}

Constructors

pub type Scan(data) {
  Scan(cooldown: cooldown.Cooldown, data: List(data))
}

Constructors

pub type ServerResets {
  ServerResets(next: birl.Time, frequency: String)
}

Constructors

  • ServerResets(next: birl.Time, frequency: String)
pub type ServerStatus {
  ServerStatus(
    status: String,
    version: String,
    reset_date: birl.Time,
    description: String,
    stats: Stats,
    health: Health,
    leaderboards: Leaderboards,
    server_resets: ServerResets,
    announcements: List(Announcement),
    links: List(Link),
  )
}

Constructors

pub type ShipJumped {
  ShipJumped(
    nav: ship_nav.ShipNav,
    cooldown: cooldown.Cooldown,
    transaction: market_transaction.MarketTransaction,
    agent: agent.Agent,
  )
}

Constructors

pub type ShipModuleInstalled {
  ShipModuleInstalled(
    agent: agent.Agent,
    modules: List(ship_module.ShipModule),
    cargo: ship_cargo.ShipCargo,
    transaction: ship_modification_transaction.ShipModificationTransaction,
  )
}

Constructors

pub type ShipModuleRemoved {
  ShipModuleRemoved(
    agent: agent.Agent,
    modules: List(ship_module.ShipModule),
    cargo: ship_cargo.ShipCargo,
    transaction: ship_modification_transaction.ShipModificationTransaction,
  )
}

Constructors

pub type ShipMountInstalled {
  ShipMountInstalled(
    agent: agent.Agent,
    mounts: List(ship_mount.ShipMount),
    cargo: ship_cargo.ShipCargo,
    transaction: ship_modification_transaction.ShipModificationTransaction,
  )
}

Constructors

pub type ShipMountRemoved {
  ShipMountRemoved(
    agent: agent.Agent,
    mounts: List(ship_mount.ShipMount),
    cargo: ship_cargo.ShipCargo,
    transaction: ship_modification_transaction.ShipModificationTransaction,
  )
}

Constructors

pub type ShipNavPatched {
  ShipNavPatched(
    nav: ship_nav.ShipNav,
    fuel: ship_fuel.ShipFuel,
    events: List(ship_condition_event.ShipConditionEvent),
  )
}

Constructors

pub type ShipNavigated {
  ShipNavigated(
    nav: ship_nav.ShipNav,
    fuel: ship_fuel.ShipFuel,
    events: List(ship_condition_event.ShipConditionEvent),
  )
}

Constructors

pub type ShipPurchased {
  ShipPurchased(
    ship: ship.Ship,
    agent: agent.Agent,
    transaction: shipyard_transaction.ShipyardTransaction,
  )
}

Constructors

pub type ShipRefined {
  ShipRefined(
    cargo: ship_cargo.ShipCargo,
    cooldown: cooldown.Cooldown,
    produced: List(refinement_yield.RefinementYield),
    consumed: List(refinement_yield.RefinementYield),
  )
}

Constructors

pub type ShipRefueled {
  ShipRefueled(
    agent: agent.Agent,
    fuel: ship_fuel.ShipFuel,
    cargo: ship_cargo.ShipCargo,
    transaction: market_transaction.MarketTransaction,
  )
}

Constructors

pub type ShipRepaired {
  ShipRepaired(
    agent: agent.Agent,
    ship: ship.Ship,
    transaction: repair_transaction.RepairTransaction,
  )
}

Constructors

pub type ShipScrapped {
  ShipScrapped(
    agent: agent.Agent,
    transaction: scrap_transaction.ScrapTransaction,
  )
}

Constructors

pub type ShipWarped {
  ShipWarped(
    nav: ship_nav.ShipNav,
    fuel: ship_fuel.ShipFuel,
    events: List(ship_condition_event.ShipConditionEvent),
  )
}

Constructors

pub type Stats {
  Stats(
    accounts: option.Option(Int),
    agents: Int,
    ships: Int,
    systems: Int,
    waypoints: Int,
  )
}

Constructors

  • Stats(
      accounts: option.Option(Int),
      agents: Int,
      ships: Int,
      systems: Int,
      waypoints: Int,
    )
pub type SurveyCreated {
  SurveyCreated(
    cooldown: cooldown.Cooldown,
    surveys: List(survey.Survey),
  )
}

Constructors

Values

pub fn get_server_status(
  ,
) -> Result(ServerStatus, spacetraders_sdk.ApiError)
pub fn list_error_codes(
  ,
) -> Result(List(ErrorCode), spacetraders_sdk.ApiError)
pub fn list_factions(
  page: option.Option(Int),
  limit: option.Option(Int),
) -> Result(
  spacetraders_sdk.PagedData(List(faction.Faction)),
  spacetraders_sdk.ApiError,
)
pub fn list_systems(
  page: option.Option(Int),
  limit: option.Option(Int),
) -> Result(
  spacetraders_sdk.PagedData(List(system.System)),
  spacetraders_sdk.ApiError,
)
pub fn negotiate_contract(
  token: spacetraders_sdk.AgentToken,
  ship_symbol: String,
) -> Result(contract.Contract, spacetraders_sdk.ApiError)
pub fn refuel_ship(
  token: spacetraders_sdk.AgentToken,
  ship_symbol: ship_symbol.ShipSymbol,
  units: option.Option(Int),
  from_cargo: option.Option(Bool),
) -> Result(ShipRefueled, spacetraders_sdk.ApiError)
pub fn sell_cargo(
  token: spacetraders_sdk.AgentToken,
  ship_symbol: ship_symbol.ShipSymbol,
  trade_symbol: trade_symbol.TradeSymbol,
  units: Int,
) -> Result(CargoSold, spacetraders_sdk.ApiError)
pub fn supply_construction_site(
  system_symbol: system_symbol.SystemSymbol,
  waypoint_symbol: waypoint_symbol.WaypointSymbol,
  ship_symbol: ship_symbol.ShipSymbol,
  trade_symbol: trade_symbol.TradeSymbol,
  units: Int,
) -> Result(ConstructionSiteSupplied, spacetraders_sdk.ApiError)
pub fn transfer_cargo(
  token: spacetraders_sdk.AgentToken,
  ship_symbol: ship_symbol.ShipSymbol,
  trade_symbol: trade_symbol.TradeSymbol,
  units: Int,
  target_ship_symbol: ship_symbol.ShipSymbol,
) -> Result(CargoTransferred, spacetraders_sdk.ApiError)
Search Document