MonoGame SDK API Reference
Complete API documentation for the Shard MonoGame SDK.
ShardSDK
Static class providing access to all SDK services.
Properties
| Property | Type | Description |
|---|---|---|
Config | ShardConfig | SDK configuration |
Recording | RecordingService | Recording service instance |
Monitor | MonitorService | Monitor service instance |
Social | SocialService | Social service instance |
IsInitialized | bool | Whether the SDK has been initialized |
Methods
Initialize()
Initialize the SDK with default configuration.
ShardSDK.Initialize();Initialize(ShardConfig config)
Initialize the SDK with custom configuration.
ShardSDK.Initialize(new ShardConfig
{
LauncherUrl = "http://localhost:9876",
EnableRecording = true,
EnableMonitor = true,
EnableSocial = true
});ShardConfig
Configuration class for the SDK.
Properties
| Property | Type | Default | Description |
|---|---|---|---|
LauncherUrl | string | "http://localhost:9876" | URL of the Shard Launcher |
EnableRecording | bool | true | Enable recording event triggers |
EnableMonitor | bool | true | Enable monitor/error reporting |
EnableSocial | bool | true | Enable social event triggers |
RecordingService
Service for triggering recording events.
Methods
TriggerEvent(string eventId)
Triggers a recording event in the Shard Launcher.
Parameters:
eventId(string): The event ID to trigger
Example:
ShardSDK.Recording.TriggerEvent("myGame_bossDefeated");HTTP Request:
- Endpoint:
POST /api/recording/trigger - Payload:
{ "eventId": "...", "timestamp": "..." }
MonitorService
Service for reporting errors and diagnostics.
Methods
ReportError(string message, string stackTrace = null)
Reports an error to the Shard Launcher.
Parameters:
message(string): Error or diagnostic messagestackTrace(string, optional): Stack trace information
Example:
// Without stack trace
ShardSDK.Monitor.ReportError("Player position invalid");
// With stack trace
ShardSDK.Monitor.ReportError("NullReferenceException", ex.StackTrace);HTTP Request:
- Endpoint:
POST /api/monitor/report - Payload:
{ "message": "...", "stackTrace": "...", "timestamp": "..." }
SocialService
Service for triggering social events.
Methods
TriggerEvent(string eventId)
Triggers a social event in the Shard Launcher.
Parameters:
eventId(string): The event ID to trigger
Example:
ShardSDK.Social.TriggerEvent("myGame_achievementUnlocked");HTTP Request:
- Endpoint:
POST /api/social/trigger - Payload:
{ "eventId": "...", "timestamp": "..." }