Integration SDK Quick Start
Quick Start
Section titled “Quick Start”Start SecRandom and install SecRandom.Integration.Client. This example lists rosters and draws using SecRandom’s current settings:
using SecRandom.Integration;using SecRandom.Integration.Client;
var client = new AutomationClient();try{ var lists = await client.GetRosterListsAsync(); Console.WriteLine(string.Join(", ", lists.Students)); var result = await client.DrawAsync(DrawChannel.RollCall); Console.WriteLine(result);}catch (AutomationException ex){ Console.Error.WriteLine($"{ex.Code}: {ex.Message}");}Pass new DrawOptions(List: "Class A", Count: 2) to override a roll call or lottery without changing the default roster. Use ActivateRosterAsync only when the default should change. Quick draw uses SecRandom’s own settings; 1.2 rejects quick-draw overrides. Connection failures, cancellation, and timeouts can also throw standard .NET exceptions.
Draw overrides require a SecRandom build containing the IPC parameter normalization fix; older builds may return invalid_parameter. C# 1.2 also supports lottery prize tags and recipient filters through DrawOptions.Conditions. Recipient gender or group requires StudentList.
Versions 1.1.0 and 1.2.0 both support generic v2 calls:
var response = await client.CallAsync("state.draw");Console.WriteLine(response.Result);Use system.capabilities to check the target version. Do not blindly retry a draw after a timeout: it may already have completed.
Python example:
from secrandom_integration import AutomationClient, DrawChannel
client = AutomationClient()print(client.roster_lists())print(client.draw(DrawChannel.ROLL_CALL))print(client.call("state.draw")["result"])See the adapter READMEs for Rust and C++. All adapters expose a generic call; C++ returns raw JSON for the caller to parse.