- ASP.NET Core 8 REST API server - 12 API endpoints matching EA Synergy protocol - SQLite database with Entity Framework Core - Web admin panel with Bootstrap 5 - User, Catalog, Session, Purchase management - Comprehensive documentation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
91 lines
2.7 KiB
C#
91 lines
2.7 KiB
C#
namespace RR3CommunityServer.Models;
|
|
|
|
// Standard Synergy API response wrapper
|
|
public class SynergyResponse<T>
|
|
{
|
|
public int resultCode { get; set; } = 0; // 0 = success, negative = error
|
|
public string? message { get; set; }
|
|
public T? data { get; set; }
|
|
}
|
|
|
|
// User models
|
|
public class DeviceIdResponse
|
|
{
|
|
public string deviceId { get; set; } = string.Empty;
|
|
public string synergyId { get; set; } = string.Empty;
|
|
public long timestamp { get; set; }
|
|
}
|
|
|
|
public class AnonUidResponse
|
|
{
|
|
public string anonUid { get; set; } = string.Empty;
|
|
public long expiresAt { get; set; }
|
|
}
|
|
|
|
// Product/Catalog models
|
|
public class CatalogItem
|
|
{
|
|
public string itemId { get; set; } = string.Empty;
|
|
public string sku { get; set; } = string.Empty;
|
|
public string name { get; set; } = string.Empty;
|
|
public string description { get; set; } = string.Empty;
|
|
public string category { get; set; } = string.Empty;
|
|
public decimal price { get; set; }
|
|
public string currency { get; set; } = "USD";
|
|
public Dictionary<string, object> metadata { get; set; } = new();
|
|
}
|
|
|
|
public class CatalogCategory
|
|
{
|
|
public string categoryId { get; set; } = string.Empty;
|
|
public string name { get; set; } = string.Empty;
|
|
public List<string> itemIds { get; set; } = new();
|
|
}
|
|
|
|
// DRM models
|
|
public class DrmNonceResponse
|
|
{
|
|
public string nonce { get; set; } = string.Empty;
|
|
public long expiresAt { get; set; }
|
|
}
|
|
|
|
public class PurchasedItem
|
|
{
|
|
public string itemId { get; set; } = string.Empty;
|
|
public string sku { get; set; } = string.Empty;
|
|
public string orderId { get; set; } = string.Empty;
|
|
public long purchaseTime { get; set; }
|
|
public string token { get; set; } = string.Empty;
|
|
}
|
|
|
|
public class PurchaseVerificationRequest
|
|
{
|
|
public string receipt { get; set; } = string.Empty;
|
|
public string signature { get; set; } = string.Empty;
|
|
public string sku { get; set; } = string.Empty;
|
|
public string orderId { get; set; } = string.Empty;
|
|
}
|
|
|
|
// Tracking models
|
|
public class TrackingEvent
|
|
{
|
|
public string eventType { get; set; } = string.Empty;
|
|
public long timestamp { get; set; }
|
|
public Dictionary<string, object> properties { get; set; } = new();
|
|
}
|
|
|
|
// Director/Service Discovery
|
|
public class DirectorResponse
|
|
{
|
|
public Dictionary<string, string> serverUrls { get; set; } = new()
|
|
{
|
|
{ "synergy.product", "https://localhost:5001" },
|
|
{ "synergy.drm", "https://localhost:5001" },
|
|
{ "synergy.user", "https://localhost:5001" },
|
|
{ "synergy.tracking", "https://localhost:5001" },
|
|
{ "synergy.s2s", "https://localhost:5001" }
|
|
};
|
|
public string environment { get; set; } = "COMMUNITY";
|
|
public string version { get; set; } = "1.0.0";
|
|
}
|