spacetraders_api_fetch
Types
pub type FetchApiError {
ClientError(fetch.FetchError)
JsonDecodeError(json.DecodeError)
ServerError(spacetraders_error.SpacetradersError)
}
Constructors
-
ClientError(fetch.FetchError)
-
JsonDecodeError(json.DecodeError)
-
ServerError(spacetraders_error.SpacetradersError)
pub type FetchApiResponse(data) =
promise.Promise(Result(data, FetchApiError))
Values
pub fn accept_contract(
token: agent_token.AgentToken,
contract_id: contract_id.ContractId,
) -> promise.Promise(
Result(spacetraders_api.ContractAccepted, FetchApiError),
)
pub fn create_chart(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.ChartCreated, FetchApiError),
)
pub fn create_survey(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.SurveyCreated, FetchApiError),
)
pub fn deliver_contract_cargo(
token: agent_token.AgentToken,
contract_id: contract_id.ContractId,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
units: Int,
) -> promise.Promise(
Result(spacetraders_api.ContractCargoDelivered, FetchApiError),
)
pub fn dock_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(Result(ship_nav.ShipNav, FetchApiError))
pub fn extract_resources(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.ResourcesExtracted, FetchApiError),
)
pub fn extract_resources_with_survey(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
survey: survey.Survey,
) -> promise.Promise(
Result(spacetraders_api.ResourcesExtracted, FetchApiError),
)
pub fn fulfill_contract(
token: agent_token.AgentToken,
contract_id: contract_id.ContractId,
) -> promise.Promise(
Result(spacetraders_api.ContractFulfilled, FetchApiError),
)
pub fn get_account(
token: agent_token.AgentToken,
) -> promise.Promise(Result(account.Account, FetchApiError))
pub fn get_agent(
token: agent_token.AgentToken,
) -> promise.Promise(Result(agent.Agent, FetchApiError))
pub fn get_agent_events(
token: agent_token.AgentToken,
) -> promise.Promise(
Result(List(agent_event.AgentEvent), FetchApiError),
)
pub fn get_construction_site(
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(
Result(construction.Construction, FetchApiError),
)
pub fn get_contract(
token: agent_token.AgentToken,
contract_id: contract_id.ContractId,
) -> promise.Promise(Result(contract.Contract, FetchApiError))
pub fn get_faction(
symbol: faction_symbol.FactionSymbol,
) -> promise.Promise(Result(faction.Faction, FetchApiError))
pub fn get_jump_gate(
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(Result(jump_gate.JumpGate, FetchApiError))
pub fn get_market(
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(Result(market.Market, FetchApiError))
pub fn get_my_factions(
token: agent_token.AgentToken,
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(
paged_data.PagedData(List(spacetraders_api.FactionReputation)),
FetchApiError,
),
)
pub fn get_public_agent(
agent_symbol: agent_symbol.AgentSymbol,
) -> promise.Promise(
Result(public_agent.PublicAgent, FetchApiError),
)
pub fn get_repair_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(repair_transaction.RepairTransaction, FetchApiError),
)
pub fn get_scrap_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(scrap_transaction.ScrapTransaction, FetchApiError),
)
pub fn get_server_status(
,
) -> promise.Promise(
Result(spacetraders_api.ServerStatus, FetchApiError),
)
pub fn get_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(Result(ship.Ship, FetchApiError))
pub fn get_ship_cargo(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(Result(ship_cargo.ShipCargo, FetchApiError))
pub fn get_ship_cooldown(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(option.Option(cooldown.Cooldown), FetchApiError),
)
pub fn get_ship_modules(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(List(ship_module.ShipModule), FetchApiError),
)
pub fn get_ship_mounts(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(List(ship_mount.ShipMount), FetchApiError),
)
pub fn get_ship_nav(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(Result(ship_nav.ShipNav, FetchApiError))
pub fn get_shipyard(
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(Result(shipyard.Shipyard, FetchApiError))
pub fn get_supply_chain(
,
) -> promise.Promise(
Result(
dict.Dict(
trade_symbol.TradeSymbol,
List(trade_symbol.TradeSymbol),
),
FetchApiError,
),
)
pub fn get_system(
system_symbol: system_symbol.SystemSymbol,
) -> promise.Promise(Result(system.System, FetchApiError))
pub fn get_waypoint(
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(Result(waypoint.Waypoint, FetchApiError))
pub fn install_ship_module(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
module_symbol: module_symbol.ModuleSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipModuleInstalled, FetchApiError),
)
pub fn install_ship_mount(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
mount_symbol: mount_symbol.MountSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipMountInstalled, FetchApiError),
)
pub fn jettison_cargo(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
units: Int,
) -> promise.Promise(Result(ship_cargo.ShipCargo, FetchApiError))
pub fn jump_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipJumped, FetchApiError),
)
pub fn list_contracts(
token: agent_token.AgentToken,
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(
paged_data.PagedData(List(contract.Contract)),
FetchApiError,
),
)
pub fn list_error_codes(
,
) -> promise.Promise(
Result(List(spacetraders_api.ErrorCode), FetchApiError),
)
pub fn list_factions(
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(
paged_data.PagedData(List(faction.Faction)),
FetchApiError,
),
)
pub fn list_public_agents(
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(
paged_data.PagedData(List(public_agent.PublicAgent)),
FetchApiError,
),
)
pub fn list_ships(
token: agent_token.AgentToken,
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(paged_data.PagedData(List(ship.Ship)), FetchApiError),
)
pub fn list_system_waypoints(
system_symbol: system_symbol.SystemSymbol,
page: option.Option(Int),
limit: option.Option(Int),
type_: option.Option(waypoint_type.WaypointType),
traits: List(waypoint_trait_symbol.WaypointTraitSymbol),
) -> promise.Promise(
Result(
paged_data.PagedData(List(waypoint.Waypoint)),
FetchApiError,
),
)
pub fn list_systems(
page: option.Option(Int),
limit: option.Option(Int),
) -> promise.Promise(
Result(paged_data.PagedData(List(system.System)), FetchApiError),
)
pub fn navigate_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipNavigated, FetchApiError),
)
pub fn negotiate_contract(
token: agent_token.AgentToken,
ship_symbol: String,
) -> promise.Promise(Result(contract.Contract, FetchApiError))
pub fn orbit_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(Result(ship_nav.ShipNav, FetchApiError))
pub fn patch_ship_nav(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
flight_mode: ship_nav_flight_mode.ShipNavFlightMode,
) -> promise.Promise(
Result(spacetraders_api.ShipNavPatched, FetchApiError),
)
pub fn purchase_cargo(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
) -> promise.Promise(
Result(spacetraders_api.CargoPurchased, FetchApiError),
)
pub fn purchase_ship(
token: agent_token.AgentToken,
ship_type: ship_type.ShipType,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipPurchased, FetchApiError),
)
pub fn refine_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
produce: refinement_produce.RefinementProduce,
) -> promise.Promise(
Result(spacetraders_api.ShipRefined, FetchApiError),
)
pub fn refuel_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
units: option.Option(Int),
from_cargo: option.Option(Bool),
) -> promise.Promise(
Result(spacetraders_api.ShipRefueled, FetchApiError),
)
pub fn register_new_agent(
token: account_token.AccountToken,
agent_symbol: agent_symbol.AgentSymbol,
faction_symbol: faction_symbol.FactionSymbol,
) -> promise.Promise(
Result(spacetraders_api.AgentRegistered, FetchApiError),
)
pub fn remove_ship_module(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
module_symbol: module_symbol.ModuleSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipModuleRemoved, FetchApiError),
)
pub fn remove_ship_mount(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
mount_symbol: mount_symbol.MountSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipMountRemoved, FetchApiError),
)
pub fn repair_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipRepaired, FetchApiError),
)
pub fn scan_ships(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(
spacetraders_api.Scan(scanned_ship.ScannedShip),
FetchApiError,
),
)
pub fn scan_systems(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(
spacetraders_api.Scan(scanned_system.ScannedSystem),
FetchApiError,
),
)
pub fn scan_waypoints(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(
spacetraders_api.Scan(scanned_waypoint.ScannedWaypoint),
FetchApiError,
),
)
pub fn scrap_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipScrapped, FetchApiError),
)
pub fn sell_cargo(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
units: Int,
) -> promise.Promise(
Result(spacetraders_api.CargoSold, FetchApiError),
)
pub fn siphon_resources(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.ResourcesSiphoned, FetchApiError),
)
pub fn supply_construction_site(
token: agent_token.AgentToken,
system_symbol: system_symbol.SystemSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
units: Int,
) -> promise.Promise(
Result(spacetraders_api.ConstructionSiteSupplied, FetchApiError),
)
pub fn transfer_cargo(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
trade_symbol: trade_symbol.TradeSymbol,
units: Int,
target_ship_symbol: ship_symbol.ShipSymbol,
) -> promise.Promise(
Result(spacetraders_api.CargoTransferred, FetchApiError),
)
pub fn warp_ship(
token: agent_token.AgentToken,
ship_symbol: ship_symbol.ShipSymbol,
waypoint_symbol: waypoint_symbol.WaypointSymbol,
) -> promise.Promise(
Result(spacetraders_api.ShipWarped, FetchApiError),
)