namespace StardewModdingAPI.Web.Framework.ModRepositories { /// Generic metadata about a mod. internal class ModInfoModel { /********* ** Accessors *********/ /// The mod name. public string Name { get; set; } /// The mod's latest version. public string Version { get; set; } /// The mod's latest optional or prerelease version, if newer than . public string PreviewVersion { get; set; } /// The mod's web URL. public string Url { get; set; } /// The mod availability status on the remote site. public RemoteModStatus Status { get; set; } = RemoteModStatus.Ok; /// The error message indicating why the mod is invalid (if applicable). public string Error { get; set; } /********* ** Public methods *********/ /// Construct an empty instance. public ModInfoModel() { } /// Construct an instance. /// The mod name. /// The semantic version for the mod's latest release. /// The semantic version for the mod's latest preview release, if available and different from . /// The mod's web URL. public ModInfoModel(string name, string version, string url, string previewVersion = null) { this.Name = name; this.Version = version; this.PreviewVersion = previewVersion; this.Url = url; } /// Set a mod error. /// The mod availability status on the remote site. /// The error message indicating why the mod is invalid (if applicable). public ModInfoModel WithError(RemoteModStatus status, string error) { this.Status = status; this.Error = error; return this; } } }