shoopea ca2ef83299 | ||
---|---|---|
.openapi-generator | ||
api | ||
docs | ||
test | ||
.gitignore | ||
.openapi-generator-ignore | ||
.travis.yml | ||
LICENSE | ||
README.md | ||
api_agents.go | ||
api_contracts.go | ||
api_default.go | ||
api_factions.go | ||
api_fleet.go | ||
api_systems.go | ||
client.go | ||
configuration.go | ||
git_push.sh | ||
go.mod | ||
go.sum | ||
model_accept_contract_200_response.go | ||
model_accept_contract_200_response_data.go | ||
model_agent.go | ||
model_chart.go | ||
model_connected_system.go | ||
model_contract.go | ||
model_contract_deliver_good.go | ||
model_contract_payment.go | ||
model_contract_terms.go | ||
model_cooldown.go | ||
model_create_chart_201_response.go | ||
model_create_chart_201_response_data.go | ||
model_create_ship_ship_scan_201_response.go | ||
model_create_ship_ship_scan_201_response_data.go | ||
model_create_ship_system_scan_201_response.go | ||
model_create_ship_system_scan_201_response_data.go | ||
model_create_ship_waypoint_scan_201_response.go | ||
model_create_ship_waypoint_scan_201_response_data.go | ||
model_create_survey_201_response.go | ||
model_create_survey_201_response_data.go | ||
model_deliver_contract_200_response.go | ||
model_deliver_contract_200_response_data.go | ||
model_deliver_contract_request.go | ||
model_dock_ship_200_response.go | ||
model_extract_resources_201_response.go | ||
model_extract_resources_201_response_data.go | ||
model_extract_resources_request.go | ||
model_extraction.go | ||
model_extraction_yield.go | ||
model_faction.go | ||
model_faction_trait.go | ||
model_fulfill_contract_200_response.go | ||
model_get_contract_200_response.go | ||
model_get_contracts_200_response.go | ||
model_get_faction_200_response.go | ||
model_get_factions_200_response.go | ||
model_get_jump_gate_200_response.go | ||
model_get_market_200_response.go | ||
model_get_my_agent_200_response.go | ||
model_get_my_ship_200_response.go | ||
model_get_my_ship_cargo_200_response.go | ||
model_get_my_ships_200_response.go | ||
model_get_ship_cooldown_200_response.go | ||
model_get_ship_nav_200_response.go | ||
model_get_shipyard_200_response.go | ||
model_get_system_200_response.go | ||
model_get_system_waypoints_200_response.go | ||
model_get_systems_200_response.go | ||
model_get_waypoint_200_response.go | ||
model_jettison_200_response.go | ||
model_jettison_200_response_data.go | ||
model_jettison_request.go | ||
model_jump_gate.go | ||
model_jump_ship_200_response.go | ||
model_jump_ship_200_response_data.go | ||
model_jump_ship_request.go | ||
model_market.go | ||
model_market_trade_good.go | ||
model_market_transaction.go | ||
model_meta.go | ||
model_navigate_ship_200_response.go | ||
model_navigate_ship_200_response_data.go | ||
model_navigate_ship_request.go | ||
model_orbit_ship_200_response.go | ||
model_orbit_ship_200_response_data.go | ||
model_patch_ship_nav_request.go | ||
model_purchase_cargo_201_response.go | ||
model_purchase_cargo_request.go | ||
model_purchase_ship_201_response.go | ||
model_purchase_ship_201_response_data.go | ||
model_purchase_ship_request.go | ||
model_refuel_ship_200_response.go | ||
model_refuel_ship_200_response_data.go | ||
model_register_201_response.go | ||
model_register_201_response_data.go | ||
model_register_request.go | ||
model_scanned_ship.go | ||
model_scanned_ship_engine.go | ||
model_scanned_ship_frame.go | ||
model_scanned_ship_mounts_inner.go | ||
model_scanned_ship_reactor.go | ||
model_scanned_system.go | ||
model_scanned_waypoint.go | ||
model_sell_cargo_201_response.go | ||
model_sell_cargo_201_response_data.go | ||
model_sell_cargo_request.go | ||
model_ship.go | ||
model_ship_cargo.go | ||
model_ship_cargo_item.go | ||
model_ship_crew.go | ||
model_ship_engine.go | ||
model_ship_frame.go | ||
model_ship_fuel.go | ||
model_ship_fuel_consumed.go | ||
model_ship_module.go | ||
model_ship_mount.go | ||
model_ship_nav.go | ||
model_ship_nav_flight_mode.go | ||
model_ship_nav_route.go | ||
model_ship_nav_route_waypoint.go | ||
model_ship_nav_status.go | ||
model_ship_reactor.go | ||
model_ship_refine_200_response.go | ||
model_ship_refine_200_response_data.go | ||
model_ship_refine_200_response_data_produced_inner.go | ||
model_ship_refine_request.go | ||
model_ship_registration.go | ||
model_ship_requirements.go | ||
model_ship_role.go | ||
model_ship_type.go | ||
model_shipyard.go | ||
model_shipyard_ship.go | ||
model_shipyard_ship_types_inner.go | ||
model_shipyard_transaction.go | ||
model_survey.go | ||
model_survey_deposit.go | ||
model_system.go | ||
model_system_faction.go | ||
model_system_type.go | ||
model_system_waypoint.go | ||
model_trade_good.go | ||
model_trade_symbol.go | ||
model_transfer_cargo_200_response.go | ||
model_transfer_cargo_request.go | ||
model_waypoint.go | ||
model_waypoint_faction.go | ||
model_waypoint_orbital.go | ||
model_waypoint_trait.go | ||
model_waypoint_type.go | ||
response.go | ||
utils.go |
README.md
Go API client for spacetraders
SpaceTraders is an open-universe game and learning platform that offers a set of HTTP endpoints to control a fleet of ships and explore a multiplayer universe.
The API is documented using OpenAPI. You can send your first request right here in your browser to check the status of the game server.
{
\"method\": \"GET\",
\"url\": \"https://api.spacetraders.io/v2\",
}
Unlike a traditional game, SpaceTraders does not have a first-party client or app to play the game. Instead, you can use the API to build your own client, write a script to automate your ships, or try an app built by the community.
We have a Discord channel where you can share your projects, ask questions, and get help from other players.
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 2.0.0
- Package version: 2.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import spacetraders "git.siteop.biz/spacetraders/spacetraders"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value sw.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), spacetraders.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), spacetraders.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices
and sw.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), spacetraders.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), spacetraders.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to https://api.spacetraders.io/v2
Class | Method | HTTP request | Description |
---|---|---|---|
AgentsApi | GetMyAgent | Get /my/agent | My Agent Details |
ContractsApi | AcceptContract | Post /my/contracts/{contractId}/accept | Accept Contract |
ContractsApi | DeliverContract | Post /my/contracts/{contractId}/deliver | Deliver Contract |
ContractsApi | FulfillContract | Post /my/contracts/{contractId}/fulfill | Fulfill Contract |
ContractsApi | GetContract | Get /my/contracts/{contractId} | Get Contract |
ContractsApi | GetContracts | Get /my/contracts | List Contracts |
DefaultApi | Register | Post /register | Register New Agent |
FactionsApi | GetFaction | Get /factions/{factionSymbol} | Get Faction |
FactionsApi | GetFactions | Get /factions | List Factions |
FleetApi | CreateChart | Post /my/ships/{shipSymbol}/chart | Create Chart |
FleetApi | CreateShipShipScan | Post /my/ships/{shipSymbol}/scan/ships | Scan Ships |
FleetApi | CreateShipSystemScan | Post /my/ships/{shipSymbol}/scan/systems | Scan Systems |
FleetApi | CreateShipWaypointScan | Post /my/ships/{shipSymbol}/scan/waypoints | Scan Waypoints |
FleetApi | CreateSurvey | Post /my/ships/{shipSymbol}/survey | Create Survey |
FleetApi | DockShip | Post /my/ships/{shipSymbol}/dock | Dock Ship |
FleetApi | ExtractResources | Post /my/ships/{shipSymbol}/extract | Extract Resources |
FleetApi | GetMyShip | Get /my/ships/{shipSymbol} | Get Ship |
FleetApi | GetMyShipCargo | Get /my/ships/{shipSymbol}/cargo | Get Ship Cargo |
FleetApi | GetMyShips | Get /my/ships | List Ships |
FleetApi | GetShipCooldown | Get /my/ships/{shipSymbol}/cooldown | Get Ship Cooldown |
FleetApi | GetShipNav | Get /my/ships/{shipSymbol}/nav | Get Ship Nav |
FleetApi | Jettison | Post /my/ships/{shipSymbol}/jettison | Jettison Cargo |
FleetApi | JumpShip | Post /my/ships/{shipSymbol}/jump | Jump Ship |
FleetApi | NavigateShip | Post /my/ships/{shipSymbol}/navigate | Navigate Ship |
FleetApi | OrbitShip | Post /my/ships/{shipSymbol}/orbit | Orbit Ship |
FleetApi | PatchShipNav | Patch /my/ships/{shipSymbol}/nav | Patch Ship Nav |
FleetApi | PurchaseCargo | Post /my/ships/{shipSymbol}/purchase | Purchase Cargo |
FleetApi | PurchaseShip | Post /my/ships | Purchase Ship |
FleetApi | RefuelShip | Post /my/ships/{shipSymbol}/refuel | Refuel Ship |
FleetApi | SellCargo | Post /my/ships/{shipSymbol}/sell | Sell Cargo |
FleetApi | ShipRefine | Post /my/ships/{shipSymbol}/refine | Ship Refine |
FleetApi | TransferCargo | Post /my/ships/{shipSymbol}/transfer | Transfer Cargo |
FleetApi | WarpShip | Post /my/ships/{shipSymbol}/warp | Warp Ship |
SystemsApi | GetJumpGate | Get /systems/{systemSymbol}/waypoints/{waypointSymbol}/jump-gate | Get Jump Gate |
SystemsApi | GetMarket | Get /systems/{systemSymbol}/waypoints/{waypointSymbol}/market | Get Market |
SystemsApi | GetShipyard | Get /systems/{systemSymbol}/waypoints/{waypointSymbol}/shipyard | Get Shipyard |
SystemsApi | GetSystem | Get /systems/{systemSymbol} | Get System |
SystemsApi | GetSystemWaypoints | Get /systems/{systemSymbol}/waypoints | List Waypoints |
SystemsApi | GetSystems | Get /systems | List Systems |
SystemsApi | GetWaypoint | Get /systems/{systemSymbol}/waypoints/{waypointSymbol} | Get Waypoint |
Documentation For Models
- AcceptContract200Response
- AcceptContract200ResponseData
- Agent
- Chart
- ConnectedSystem
- Contract
- ContractDeliverGood
- ContractPayment
- ContractTerms
- Cooldown
- CreateChart201Response
- CreateChart201ResponseData
- CreateShipShipScan201Response
- CreateShipShipScan201ResponseData
- CreateShipSystemScan201Response
- CreateShipSystemScan201ResponseData
- CreateShipWaypointScan201Response
- CreateShipWaypointScan201ResponseData
- CreateSurvey201Response
- CreateSurvey201ResponseData
- DeliverContract200Response
- DeliverContract200ResponseData
- DeliverContractRequest
- DockShip200Response
- ExtractResources201Response
- ExtractResources201ResponseData
- ExtractResourcesRequest
- Extraction
- ExtractionYield
- Faction
- FactionTrait
- FulfillContract200Response
- GetContract200Response
- GetContracts200Response
- GetFaction200Response
- GetFactions200Response
- GetJumpGate200Response
- GetMarket200Response
- GetMyAgent200Response
- GetMyShip200Response
- GetMyShipCargo200Response
- GetMyShips200Response
- GetShipCooldown200Response
- GetShipNav200Response
- GetShipyard200Response
- GetSystem200Response
- GetSystemWaypoints200Response
- GetSystems200Response
- GetWaypoint200Response
- Jettison200Response
- Jettison200ResponseData
- JettisonRequest
- JumpGate
- JumpShip200Response
- JumpShip200ResponseData
- JumpShipRequest
- Market
- MarketTradeGood
- MarketTransaction
- Meta
- NavigateShip200Response
- NavigateShip200ResponseData
- NavigateShipRequest
- OrbitShip200Response
- OrbitShip200ResponseData
- PatchShipNavRequest
- PurchaseCargo201Response
- PurchaseCargoRequest
- PurchaseShip201Response
- PurchaseShip201ResponseData
- PurchaseShipRequest
- RefuelShip200Response
- RefuelShip200ResponseData
- Register201Response
- Register201ResponseData
- RegisterRequest
- ScannedShip
- ScannedShipEngine
- ScannedShipFrame
- ScannedShipMountsInner
- ScannedShipReactor
- ScannedSystem
- ScannedWaypoint
- SellCargo201Response
- SellCargo201ResponseData
- SellCargoRequest
- Ship
- ShipCargo
- ShipCargoItem
- ShipCrew
- ShipEngine
- ShipFrame
- ShipFuel
- ShipFuelConsumed
- ShipModule
- ShipMount
- ShipNav
- ShipNavFlightMode
- ShipNavRoute
- ShipNavRouteWaypoint
- ShipNavStatus
- ShipReactor
- ShipRefine200Response
- ShipRefine200ResponseData
- ShipRefine200ResponseDataProducedInner
- ShipRefineRequest
- ShipRegistration
- ShipRequirements
- ShipRole
- ShipType
- Shipyard
- ShipyardShip
- ShipyardShipTypesInner
- ShipyardTransaction
- Survey
- SurveyDeposit
- System
- SystemFaction
- SystemType
- SystemWaypoint
- TradeGood
- TradeSymbol
- TransferCargo200Response
- TransferCargoRequest
- Waypoint
- WaypointFaction
- WaypointOrbital
- WaypointTrait
- WaypointType
Documentation For Authorization
AgentToken
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime