It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:
- 🛠 Make your SDK feel handcrafted by customizing it
- ♻️ Refine your SDK quickly by iterating locally with the Speakeasy CLI
- 🎁 Publish your SDK to package managers by configuring automatic publishing
- ✨ When ready to productionize, delete this section from the README
The SDK can either be compiled using dotnet build
and the resultant .dll
file can be copied into your Unity project's Assets
folder, or you can copy the source code directly into your project.
The SDK relies on Newtonsoft's JSON.NET Package which can be installed via the Unity Package Manager.
To do so open the Package Manager via Window > Package Manager
and click the +
button then Add package from git URL...
and enter com.unity.nuget.newtonsoft-json
and click Add
.
using Openapi;
using Openapi.Models.Components;
var sdk = new SeUnitySDK();
using(var res = await sdk.GetStatusAsync())
{
// handle response
}
- GetSystems - List Systems
- GetSystem - Get System
- GetSystemWaypoints - List Waypoints in System
- GetWaypoint - Get Waypoint
- GetMarket - Get Market
- GetShipyard - Get Shipyard
- GetJumpGate - Get Jump Gate
- GetConstruction - Get Construction Site
- SupplyConstruction - Supply Construction Site
- GetFactions - List Factions
- GetFaction - Get Faction
- GetMyAgent - Get Agent
- GetAgents - List Agents
- GetAgent - Get Public Agent
- GetContracts - List Contracts
- GetContract - Get Contract
- AcceptContract - Accept Contract
- DeliverContract - Deliver Cargo to Contract
- FulfillContract - Fulfill Contract
- GetMyShips - List Ships
- PurchaseShip - Purchase Ship
- GetMyShip - Get Ship
- GetMyShipCargo - Get Ship Cargo
- OrbitShip - Orbit Ship
- ShipRefine - Ship Refine
- CreateChart - Create Chart
- GetShipCooldown - Get Ship Cooldown
- DockShip - Dock Ship
- CreateSurvey - Create Survey
- ExtractResources - Extract Resources
- SiphonResources - Siphon Resources
- ExtractResourcesWithSurvey - Extract Resources with Survey
- Jettison - Jettison Cargo
- JumpShip - Jump Ship
- NavigateShip - Navigate Ship
- PatchShipNav - Patch Ship Nav
- GetShipNav - Get Ship Nav
- WarpShip - Warp Ship
- SellCargo - Sell Cargo
- CreateShipSystemScan - Scan Systems
- CreateShipWaypointScan - Scan Waypoints
- CreateShipShipScan - Scan Ships
- RefuelShip - Refuel Ship
- PurchaseCargo - Purchase Cargo
- TransferCargo - Transfer Cargo
- NegotiateContract - Negotiate Contract
- GetMounts - Get Mounts
- InstallMount - Install Mount
- RemoveMount - Remove Mount
- GetScrapShip - Get Scrap Ship
- ScrapShip - Scrap Ship
- GetRepairShip - Get Repair Ship
- RepairShip - Repair Ship
You can override the default server globally by passing a server index to the serverIndex: number
optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
# | Server | Variables |
---|---|---|
0 | https://api.spacetraders.io/v2 |
None |
The default server can also be overridden globally by passing a URL to the serverUrl: str
optional parameter when initializing the SDK client instance. For example:
This SDK supports the following security scheme globally:
Name | Type | Scheme |
---|---|---|
AgentToken |
http | HTTP Bearer |
To authenticate with the API the AgentToken
parameter must be set when initializing the SDK client instance. For example:
using Openapi;
using Openapi.Models.Components;
var sdk = new SeUnitySDK(AgentToken: "<YOUR_BEARER_TOKEN_HERE>");
using(var res = await sdk.GetStatusAsync())
{
// handle response
}
Some operations in this SDK require the security scheme to be specified at the request level. For example:
using Openapi;
using Openapi.Models.Requests;
var sdk = new SeUnitySDK();
using(var res = await sdk.Systems.SupplyConstructionAsync(
"<YOUR_BEARER_TOKEN_HERE>",
systemSymbol: "<value>",
waypointSymbol: "<value>",
requestBody: new SupplyConstructionRequestBody() {
ShipSymbol = "<value>",
TradeSymbol = "<value>",
Units = 110828,
}))
{
// handle response
}
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!