DocsMonoGame SDKAPI Reference

MonoGame SDK API Reference

Complete API documentation for the Shard MonoGame SDK.


ShardSDK

Static class providing access to all SDK services.

Properties

PropertyTypeDescription
ConfigShardConfigSDK configuration
RecordingRecordingServiceRecording service instance
MonitorMonitorServiceMonitor service instance
SocialSocialServiceSocial service instance
IsInitializedboolWhether 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

PropertyTypeDefaultDescription
LauncherUrlstring"http://localhost:9876"URL of the Shard Launcher
EnableRecordingbooltrueEnable recording event triggers
EnableMonitorbooltrueEnable monitor/error reporting
EnableSocialbooltrueEnable 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 message
  • stackTrace (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": "..." }