using System.Linq; using StardewModdingAPI.Toolkit.Utilities; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi { /// Specifies mods whose update-check info to fetch. public class ModSearchModel { /********* ** Accessors *********/ /// The mods for which to find data. public ModSearchEntryModel[] Mods { get; set; } /// Whether to include extended metadata for each mod. public bool IncludeExtendedMetadata { get; set; } /// The SMAPI version installed by the player. This is used for version mapping in some cases. public ISemanticVersion ApiVersion { get; set; } /// The Stardew Valley version installed by the player. public ISemanticVersion GameVersion { get; set; } /// The OS on which the player plays. public Platform? Platform { get; set; } /********* ** Public methods *********/ /// Construct an empty instance. public ModSearchModel() { // needed for JSON deserializing } /// Construct an instance. /// The mods to search. /// The SMAPI version installed by the player. If this is null, the API won't provide a recommended update. /// The Stardew Valley version installed by the player. /// The OS on which the player plays. /// Whether to include extended metadata for each mod. public ModSearchModel(ModSearchEntryModel[] mods, ISemanticVersion apiVersion, ISemanticVersion gameVersion, Platform platform, bool includeExtendedMetadata) { this.Mods = mods.ToArray(); this.ApiVersion = apiVersion; this.GameVersion = gameVersion; this.Platform = platform; this.IncludeExtendedMetadata = includeExtendedMetadata; } } }