using System; using System.Linq; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi { /// Specifies the identifiers for a mod to match. public class ModSearchEntryModel { /********* ** Accessors *********/ /// The unique mod ID. public string ID { get; } /// The namespaced mod update keys (if available). public string[] UpdateKeys { get; private set; } /// The mod version installed by the local player. This is used for version mapping in some cases. public ISemanticVersion? InstalledVersion { get; } /// Whether the installed version is broken or could not be loaded. public bool IsBroken { get; } /********* ** Public methods *********/ /// Construct an instance. /// The unique mod ID. /// The version installed by the local player. This is used for version mapping in some cases. /// The namespaced mod update keys (if available). /// Whether the installed version is broken or could not be loaded. public ModSearchEntryModel(string id, ISemanticVersion? installedVersion, string[]? updateKeys, bool isBroken = false) { this.ID = id; this.InstalledVersion = installedVersion; this.UpdateKeys = updateKeys ?? Array.Empty(); this.IsBroken = isBroken; } /// Add update keys for the mod. /// The update keys to add. public void AddUpdateKeys(params string[] updateKeys) { this.UpdateKeys = this.UpdateKeys.Concat(updateKeys).ToArray(); } } }