satisfactory-sdk 0.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package satisfactory-sdk --version 0.0.2                
NuGet\Install-Package satisfactory-sdk -Version 0.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="satisfactory-sdk" Version="0.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add satisfactory-sdk --version 0.0.2                
#r "nuget: satisfactory-sdk, 0.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install satisfactory-sdk as a Cake Addin
#addin nuget:?package=satisfactory-sdk&version=0.0.2

// Install satisfactory-sdk as a Cake Tool
#tool nuget:?package=satisfactory-sdk&version=0.0.2                

SatisfactoryClient

Description

A client utilizing the HTTPS API provided by Satisfactory servers. for documentation on the API, see the wiki docs.

Getting a Authentication Token

There are a few ways of getting an authentication token. If the server has already been create and setup, you can run the server.GenerateAPIToken command using the in-game server console to get a token. If the server has not been setup, you can use the ClaimServer function to claim the server and generate an admin token.

Using the in-game console

  1. Click on the Server Manager in the main menu.
  2. Open the server and authenticate if required.
  3. Open the server console and run the server.GenerateAPIToken command.
  4. Copy the given token out of the console.

generating token from in-game consolve

Basic Example

using SatisfactorySdk;

namespace ExampleApplication
{
	public class Program
	{
		public static async void Main(string[] args)
		{
			// Instantiate a new client. 
			// NOTE: This does not perform any commands nor test the connection to the server.
			var client = new SatisfactoryClient(
				"127.0.0.1",
				authToken: "API_KEY"
			);
			
			// Perform a health check function on the server.
			// NOTE: This can throw an exception if a non-standard error occurs (e.g. Timeout, SSL, etc.)
			var healthCheckResponse = await client.HealthCheckAsync();
			
			// Print out the status code returned from the server.
			Console.WriteLine(healthCheckResponse.StatusCode);
			
			// You can check if a standard error was returned by the server (status code will still be 200).
			if (healthCheckResponse.HasError) 
			{
				// ClientResponse.ErrorResponse will contain all the information about the error.
				Console.WriteLine(healthCheckResponse.ErrorResponse.ErrorCode);
			}
			
			// Print out the health returned from the server.
			Console.WriteLine(healthCheckResponse.RequestResponse.Health);
		}
	}
}

Advanced Examples

Setting up a brand new server

var client = new SatisfactoryClient("127.0.0.1");

// Perform the initial login to get a admin token
var loginResponse = await client.PasswordlessLoginAsync(PrivilegeLevelEnum.InitialAdmin);

// Set the client's auth token to what was received before
client.TrySetAuthToken(loginResponse.RequestResponse.Data.AuthenticationToken);

// Claim the server and set the admin password for the server
var claimServerResponse = await client.ClaimServerAsync("Test Server", "Admin1234!");

// Login to the server using the newly set admin password
loginResponse = await client.PasswordLoginAsync("Admin1234!", PrivilegeLevelEnum.Administrator);

// From this point, you can begin the rest of set up (i.e. settings, saves, sessions, etc.)

Utilizing non-standard configurations

var client = new SatisfactoryClient(
	"127.0.0.1",
	authToken: "API_KEY", // Can pass the API bearer token in from instatiation rather than performing a login
	port: 7788, // Can use any port (assuming it is a valid port)
	trustSelfSignedCerts: true, // You can either trust or not trust the self-signed certificates
	usePort: false, // You an decide to not use the port in the connection string (i.e. https://127.0.0.1/api/v1)
	client: new HttpClient(), // You can pass in the HTTP Client to be used by the Satisfactory Client (allows mocked responses for unit testing)
	logger: new Logger() // You can pass in your own logger for the Satisfactory Client to use
);

Requesting new features or reporting bugs

Please submit an issue in Github and mark either as a bug or enhancement.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0 77 10/17/2024
0.1.3 85 10/17/2024
0.1.2 91 10/8/2024
0.1.1 79 10/8/2024
0.1.0 85 10/3/2024
0.0.2 89 10/2/2024
0.0.1 96 10/1/2024