diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-23 21:55:11 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-05-23 21:55:11 -0400 |
commit | 786077340f2cea37d82455fc413535ae82a912ee (patch) | |
tree | 588d6755b1001bd7eb218dcf9b332feb933e180b /src/SMAPI.Web/Framework/IModPage.cs | |
parent | d7add894419543667e60569bfeb439e8e797a4d1 (diff) | |
download | SMAPI-786077340f2cea37d82455fc413535ae82a912ee.tar.gz SMAPI-786077340f2cea37d82455fc413535ae82a912ee.tar.bz2 SMAPI-786077340f2cea37d82455fc413535ae82a912ee.zip |
refactor update check API
This simplifies the logic for individual clients, centralises common logic, and prepares for upcoming features.
Diffstat (limited to 'src/SMAPI.Web/Framework/IModPage.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/IModPage.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/SMAPI.Web/Framework/IModPage.cs b/src/SMAPI.Web/Framework/IModPage.cs new file mode 100644 index 00000000..e66d401f --- /dev/null +++ b/src/SMAPI.Web/Framework/IModPage.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using StardewModdingAPI.Toolkit.Framework.UpdateData; + +namespace StardewModdingAPI.Web.Framework +{ + /// <summary>Generic metadata about a mod page.</summary> + internal interface IModPage + { + /********* + ** Accessors + *********/ + /// <summary>The mod site containing the mod.</summary> + ModSiteKey Site { get; } + + /// <summary>The mod's unique ID within the site.</summary> + string Id { get; } + + /// <summary>The mod name.</summary> + string Name { get; } + + /// <summary>The mod's semantic version number.</summary> + string Version { get; } + + /// <summary>The mod's web URL.</summary> + string Url { get; } + + /// <summary>The mod downloads.</summary> + IModDownload[] Downloads { get; } + + /// <summary>The mod page status.</summary> + RemoteModStatus Status { get; } + + /// <summary>A user-friendly error which indicates why fetching the mod info failed (if applicable).</summary> + string Error { get; } + + + /********* + ** Methods + *********/ + /// <summary>Set the fetched mod info.</summary> + /// <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="downloads">The mod downloads.</param> + IModPage SetInfo(string name, string version, string url, IEnumerable<IModDownload> downloads); + + /// <summary>Set a mod fetch error.</summary> + /// <param name="status">The mod availability status on the remote site.</param> + /// <param name="error">A user-friendly error which indicates why fetching the mod info failed (if applicable).</param> + IModPage SetError(RemoteModStatus status, string error); + } +} |