diff options
Diffstat (limited to 'src/StardewModdingAPI.Web/Models')
-rw-r--r-- | src/StardewModdingAPI.Web/Models/ModGenericModel.cs | 37 | ||||
-rw-r--r-- | src/StardewModdingAPI.Web/Models/ModSearchModel.cs | 6 |
2 files changed, 20 insertions, 23 deletions
diff --git a/src/StardewModdingAPI.Web/Models/ModGenericModel.cs b/src/StardewModdingAPI.Web/Models/ModGenericModel.cs index dc36c7f4..88a6e4bd 100644 --- a/src/StardewModdingAPI.Web/Models/ModGenericModel.cs +++ b/src/StardewModdingAPI.Web/Models/ModGenericModel.cs @@ -1,3 +1,5 @@ +using Newtonsoft.Json; + namespace StardewModdingAPI.Web.Models { /// <summary>Generic metadata about a mod.</summary> @@ -6,53 +8,48 @@ namespace StardewModdingAPI.Web.Models /********* ** Accessors *********/ - /// <summary>The unique mod ID.</summary> - public int ID { get; } + /// <summary>The namespaced mod key.</summary> + public string ModKey { get; } /// <summary>The mod name.</summary> public string Name { get; } - /// <summary>The mod's vendor ID.</summary> - public string Vendor { get; } - /// <summary>The mod's semantic version number.</summary> public string Version { get; } /// <summary>The mod's web URL.</summary> public string Url { get; } - /// <summary>Whether the mod is valid.</summary> - public bool Valid { get; } + /// <summary>The error message indicating why the mod is invalid (if applicable).</summary> + public string Error { get; } /********* ** Public methods *********/ /// <summary>Construct a valid instance.</summary> - /// <param name="vendor">The mod's vendor ID.</param> - /// <param name="id">The unique mod ID.</param> + /// <param name="modKey">The namespaced mod key.</param> /// <param name="name">The mod name.</param> /// <param name="version">The mod's semantic version number.</param> /// <param name="url">The mod's web URL.</param> - /// <param name="valid">Whether the mod is valid.</param> - public ModGenericModel(string vendor, int id, string name, string version, string url, bool valid = true) + /// <param name="error">The error message indicating why the mod is invalid (if applicable).</param> + [JsonConstructor] + public ModGenericModel(string modKey, string name, string version, string url, string error = null) { - this.Vendor = vendor; - this.ID = id; + this.ModKey = modKey; this.Name = name; this.Version = version; this.Url = url; - this.Valid = valid; + this.Error = error; // mainly initialised here for the JSON deserialiser } /// <summary>Construct an valid instance.</summary> - /// <param name="vendor">The mod's vendor ID.</param> - /// <param name="id">The unique mod ID.</param> - public ModGenericModel(string vendor, int id) + /// <param name="modKey">The namespaced mod key.</param> + /// <param name="error">The error message indicating why the mod is invalid.</param> + public ModGenericModel(string modKey, string error) { - this.Vendor = vendor; - this.ID = id; - this.Valid = false; + this.ModKey = modKey; + this.Error = error; } } } diff --git a/src/StardewModdingAPI.Web/Models/ModSearchModel.cs b/src/StardewModdingAPI.Web/Models/ModSearchModel.cs index eb9ac920..852ea439 100644 --- a/src/StardewModdingAPI.Web/Models/ModSearchModel.cs +++ b/src/StardewModdingAPI.Web/Models/ModSearchModel.cs @@ -1,9 +1,9 @@ namespace StardewModdingAPI.Web.Models { - /// <summary>The search criteria for a mod.</summary> + /// <summary>The mod update search criteria.</summary> public class ModSearchModel { - /// <summary>The Nexus Mods ID (if any).</summary> - public int? NexusID { get; set; } + /// <summary>The namespaced mod keys to search.</summary> + public string[] ModKeys { get; set; } } } |