Skip to content

Ewan-Greer09/space-traders-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for openapi

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: 1.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 openapi "github.com/GIT_USER_ID/GIT_REPO_ID"

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 openapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.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 openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.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 GetAgent Get /agents/{agentSymbol} Get Public Agent
AgentsAPI GetAgents Get /agents List Agents
AgentsAPI GetMyAgent Get /my/agent Get Agent
ContractsAPI AcceptContract Post /my/contracts/{contractId}/accept Accept Contract
ContractsAPI DeliverContract Post /my/contracts/{contractId}/deliver Deliver Cargo to 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 GetStatus Get / Get Status
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 ExtractResourcesWithSurvey Post /my/ships/{shipSymbol}/extract/survey Extract Resources with Survey
FleetAPI GetMounts Get /my/ships/{shipSymbol}/mounts Get Mounts
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 InstallMount Post /my/ships/{shipSymbol}/mounts/install Install Mount
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 NegotiateContract Post /my/ships/{shipSymbol}/negotiate/contract Negotiate Contract
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 RemoveMount Post /my/ships/{shipSymbol}/mounts/remove Remove Mount
FleetAPI SellCargo Post /my/ships/{shipSymbol}/sell Sell Cargo
FleetAPI ShipRefine Post /my/ships/{shipSymbol}/refine Ship Refine
FleetAPI SiphonResources Post /my/ships/{shipSymbol}/siphon Siphon Resources
FleetAPI TransferCargo Post /my/ships/{shipSymbol}/transfer Transfer Cargo
FleetAPI WarpShip Post /my/ships/{shipSymbol}/warp Warp Ship
SystemsAPI GetConstruction Get /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction Get Construction Site
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 in System
SystemsAPI GetSystems Get /systems List Systems
SystemsAPI GetWaypoint Get /systems/{systemSymbol}/waypoints/{waypointSymbol} Get Waypoint
SystemsAPI SupplyConstruction Post /systems/{systemSymbol}/waypoints/{waypointSymbol}/construction/supply Supply Construction Site

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

AgentToken

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), openapi.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

Author

joel@spacetraders.io

space-traders-sdk

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages