Server-Side Commands
Every entity type in Nexudus can have server-side commands — special operations that go beyond standard CRUD. The SDK lets you discover available commands and execute them with or without parameters.
Discover available commands
Use GetCommandsAsync to list all commands available for an entity type:
var endpoint = new CoworkerEndpoint(client);
List<CommandInfo> commands = await endpoint.GetCommandsAsync();
foreach (var cmd in commands)
{
Console.WriteLine($"{cmd.Key}: {cmd.Name}");
Console.WriteLine($" Needs entities: {cmd.NeedsEntitiesToRun}");
Console.WriteLine($" Single only: {cmd.AppliesOnlyToOneEntity}");
Console.WriteLine($" Parameters: {cmd.RequiresParameters.Count}");
}
CommandInfo properties
| Property | Type | Description |
|---|
Key | string | The unique identifier used when running the command. |
Name | string | Human-readable command name. |
NeedsEntitiesToRun | bool | Whether the command requires entity IDs. |
AppliesOnlyToOneEntity | bool | Whether the command can only target a single entity. |
RequiresParameters | List<CommandParameter> | Parameters the command accepts. |
Run a command on one entity
await endpoint.RunCommandAsync("commandKey", ids: coworkerId);
Run a command on multiple entities
await endpoint.RunCommandAsync("commandKey", ids: new long[] { 100, 200, 300 });
Run a command with parameters
Some commands require additional parameters. Build a list of CommandParameter objects:
var parameters = new List<CommandParameter>
{
new() { Name = "Date", Type = "datetime", Value = "2026-04-03T00:00:00Z" },
new() { Name = "Amount", Type = "int", Value = "100" }
};
await endpoint.RunCommandAsync("commandKey", parameters, entityId);
CommandParameter properties
| Property | Type | Description |
|---|
Name | string | The parameter name as defined by the command. |
Type | string | The parameter type (string, int, datetime, etc). |
Value | string | The parameter value, serialised as a string. |
Use GetCommandsAsync first to inspect the RequiresParameters list for each command. This tells you exactly which parameters are needed and their expected types.