AternosAPI 1.0.6

dotnet add package AternosAPI --version 1.0.6                
NuGet\Install-Package AternosAPI -Version 1.0.6                
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="AternosAPI" Version="1.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AternosAPI --version 1.0.6                
#r "nuget: AternosAPI, 1.0.6"                
#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 AternosAPI as a Cake Addin
#addin nuget:?package=AternosAPI&version=1.0.6

// Install AternosAPI as a Cake Tool
#tool nuget:?package=AternosAPI&version=1.0.6                

AternosAPI

NuGet version

Unofficial aternos.org client to control your server(s).

Wiki: https://github.com/dexuby/AternosAPI/wiki

Example usage:

var aternosClient = new AternosClient("<YOUR ATERNOS TOKEN>");
var response = await aternosClient.PrepareAsync();
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to fetch ajax token!");
  return;
}

// Auto select server
response = await aternosClient.UpdateServerIdAsync();
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to update sever id!");
  return;
}

// Start selected server
response = await aternosClient.StartSelectedServerAsync();
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to start the selected server!");
  return;
}

// Stop selected server
response = await aternosClient.StopSelectedServerAsync();
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to stop the selected server!");
  return;
}

// Restart selected server
response = await aternosClient.RestartSelectedServerAsync();
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to restart the selected server!");
  return;
}

// Change a setting (max player count in this example)
response = await aternosClient.ChangeSelectedServerConfigAsync("/server.properties", "max-players", "50");
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to change config!");
  return;
}

// Add a player to a list
response = await aternosClient.AddPlayerToListAsync(AternosList.Whitelist, "test");
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to add player to whitelist!");
  return;
}

// Remove a player from a list
response = await aternosClient.RemovePlayerFromListAsync(AternosList.Whitelist, "test");
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to remove player from whitelist!");
  return;
}

// Install software
response = await aternosClient.InstallSoftwareAsync("<SOFTWARE ID>", false);
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to install software!");
  return;
}

// Install plugin
response = await aternosClient.InstallPluginAsync(AternosPluginProvider.Spigot, "<PLUGIN ID>", "<VERSION ID>");
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to install plugin!");
  return;
}

// Delete file
response = await aternosClient.DeleteFileAsync("/plugins/Example.jar");
if (response.Failed() || !response.GetValue())
{
  Console.WriteLine("Failed to delete file!");
  return;
}

// Get last server status
var statusResponse = await aternosClient.GetLastServerStatusAsync();
if (statusResponse.Succeeded())
{
  var lastStatus = statusResponse.GetValue();
  Console.WriteLine($"Server name: {lastStatus.Name} | Server version: {lastStatus.Version} | Online players: {lastStatus.Players}");
}

// Get AternosLog instance
var logResponse = await aternosClient.GetSelectedServerLogAsync();
if (logResponse.Failed())
{
  Console.WriteLine("Failed to fetch log object!");
  return;
}

If you want to run the unit tests create a text file called "aternos_token.txt" in your application data directory (%appdata%) with your token inside.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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
1.0.6 291 3/27/2023
1.0.5 465 1/14/2022
1.0.4 253 1/13/2022
1.0.3 250 1/7/2022
1.0.2 240 1/7/2022
1.0.1 263 1/7/2022
1.0.0 269 1/4/2022