add includeExtendedMetadata option to toolkit client (#532)

This commit is contained in:
Jesse Plamondon-Willard 2018-06-29 01:50:06 -04:00
parent 68287c983c
commit c0370c5411
3 changed files with 7 additions and 4 deletions

View File

@ -595,7 +595,7 @@ namespace StardewModdingAPI
ISemanticVersion updateFound = null; ISemanticVersion updateFound = null;
try try
{ {
ModEntryModel response = client.GetModInfo(new ModSearchEntryModel("Pathoschild.SMAPI", new[] { $"GitHub:{this.Settings.GitHubProjectName}" })).Single().Value; ModEntryModel response = client.GetModInfo(new[] { new ModSearchEntryModel("Pathoschild.SMAPI", new[] { $"GitHub:{this.Settings.GitHubProjectName}" }) }).Single().Value;
ISemanticVersion latestStable = response.Main?.Version; ISemanticVersion latestStable = response.Main?.Version;
ISemanticVersion latestBeta = response.Optional?.Version; ISemanticVersion latestBeta = response.Optional?.Version;

View File

@ -31,9 +31,11 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
/// <summary>Construct an instance.</summary> /// <summary>Construct an instance.</summary>
/// <param name="mods">The mods to search.</param> /// <param name="mods">The mods to search.</param>
public ModSearchModel(ModSearchEntryModel[] mods) /// <param name="includeExtendedMetadata">Whether to include extended metadata for each mod.</param>
public ModSearchModel(ModSearchEntryModel[] mods, bool includeExtendedMetadata)
{ {
this.Mods = mods.ToArray(); this.Mods = mods.ToArray();
this.IncludeExtendedMetadata = includeExtendedMetadata;
} }
} }
} }

View File

@ -33,11 +33,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
/// <summary>Get metadata about a set of mods from the web API.</summary> /// <summary>Get metadata about a set of mods from the web API.</summary>
/// <param name="mods">The mod keys for which to fetch the latest version.</param> /// <param name="mods">The mod keys for which to fetch the latest version.</param>
public IDictionary<string, ModEntryModel> GetModInfo(params ModSearchEntryModel[] mods) /// <param name="includeExtendedMetadata">Whether to include extended metadata for each mod.</param>
public IDictionary<string, ModEntryModel> GetModInfo(ModSearchEntryModel[] mods, bool includeExtendedMetadata = false)
{ {
return this.Post<ModSearchModel, ModEntryModel[]>( return this.Post<ModSearchModel, ModEntryModel[]>(
$"v{this.Version}/mods", $"v{this.Version}/mods",
new ModSearchModel(mods) new ModSearchModel(mods, includeExtendedMetadata)
).ToDictionary(p => p.ID); ).ToDictionary(p => p.ID);
} }