Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

.net library to connect to Rust api server

License

Notifications You must be signed in to change notification settings

NickRimmer/RustApi.ClientNet

Repository files navigation

Validation build NuGet package

RustApi.ClientNet

This is library for RustApiClient to Rust game server with RustApi extension.

It is quite simple one (=

How to use

// define RustApiClient options
var options = new RustApiClientOptions("http://localhost:28017", "admin", "secret1");

// create RustApiClient instance
IRustApiClient rustApiClient = new RustApiClient(options);

Then you can use this rustApiClient to call hooks:

// name of hook
var name = "TestHook";

// parameters
var data = new Dictionary<string, object>
{
    {"name", "MyNameIs"},
    {"value", 1},
};

var result1 = await rustApiClient.CallHookAsync<ExpectedResultType>(name, data);
// var result1 = await rustApiClient.CallHookAsync<ExpectedResultType>(name);
// await rustApiClient.CallHookAsync(name, data);
// await rustApiClient.CallHookAsync(name);

Or you can execute Api commands:

// name of command
var name = "test_arguments_3";

// parameters
var data = new Dictionary<string, object>
{
    {"p1", "1"},
    {"p2", 1},
    {"p3", true},
};

var result1 = await rustApiClient.SendCommandAsync<string>(name, data);
// var result1 = await rustApiClient.SendCommandAsync<string>(name);
// await rustApiClient.SendCommandAsync(name, data);
// await rustApiClient.SendCommandAsync(name);

Or just check if server is online:

var result = await rustApiClient.SystemPing();
if (result != "Pong"){
    // oops
}

About

.net library to connect to Rust api server

Resources

License

Stars

Watchers

Forks

Languages