Skip to content

SpaceTradersAPI/se-unity-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

openapi

🏗 Welcome to your new SDK! 🏗

It has been generated successfully based on your OpenAPI spec. However, it is not yet ready for production use. Here are some next steps:

SDK Installation

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.

SDK Example Usage

Example

using Openapi;
using Openapi.Models.Components;

var sdk = new SeUnitySDK();

using(var res = await sdk.GetStatusAsync())
{
    // handle response
}

Available Resources and Operations

Server Selection

Server Selection

Select Server by Index

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

Override Server URL Per-Client

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:

Authentication

Per-Client Security Schemes

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
}

Per-Operation Security Schemes

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
}

Development

Maturity

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.

Contributions

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!

SDK Created by Speakeasy

About

A SpaceTraders SDK for Unity generated by Speakeasy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages