summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2019-11-24 13:49:30 -0500
commita3f21685049cabf2d824c8060dc0b1de47e9449e (patch)
treead9add30e9da2a50e0ea0245f1546b7378f0d282 /src/SMAPI.Web/Framework
parent6521df7b131924835eb797251c1e956fae0d6e13 (diff)
parent277bf082675b98b95bf6184fe3c7a45b969c7ac2 (diff)
downloadSMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.gz
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.tar.bz2
SMAPI-a3f21685049cabf2d824c8060dc0b1de47e9449e.zip
Merge branch 'develop' into stable
Diffstat (limited to 'src/SMAPI.Web/Framework')
-rw-r--r--src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs2
-rw-r--r--src/SMAPI.Web/Framework/Caching/BaseCacheRepository.cs19
-rw-r--r--src/SMAPI.Web/Framework/Caching/ICacheRepository.cs13
-rw-r--r--src/SMAPI.Web/Framework/Caching/Mods/CachedMod.cs107
-rw-r--r--src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs31
-rw-r--r--src/SMAPI.Web/Framework/Caching/Mods/ModCacheRepository.cs104
-rw-r--r--src/SMAPI.Web/Framework/Caching/UtcDateTimeOffsetSerializer.cs40
-rw-r--r--src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs43
-rw-r--r--src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs230
-rw-r--r--src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs30
-rw-r--r--src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheRepository.cs73
-rw-r--r--src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs113
-rw-r--r--src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeMod.cs23
-rw-r--r--src/SMAPI.Web/Framework/Clients/CurseForge/ICurseForgeClient.cs17
-rw-r--r--src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs12
-rw-r--r--src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs18
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs39
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs20
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs20
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs5
-rw-r--r--src/SMAPI.Web/Framework/Clients/ModDrop/ModDropMod.cs3
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs225
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs4
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs21
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs146
-rw-r--r--src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs3
-rw-r--r--src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs35
-rw-r--r--src/SMAPI.Web/Framework/Compression/GzipHelper.cs89
-rw-r--r--src/SMAPI.Web/Framework/Compression/IGzipHelper.cs17
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs16
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/BackgroundServicesConfig.cs12
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ModCompatibilityListConfig.cs6
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs4
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/MongoDbConfig.cs38
-rw-r--r--src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs3
-rw-r--r--src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs34
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs2
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/BaseRepository.cs6
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ChucklefishRepository.cs12
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/CurseForgeRepository.cs63
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/GitHubRepository.cs24
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ModDropRepository.cs12
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/ModInfoModel.cs66
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/NexusRepository.cs16
-rw-r--r--src/SMAPI.Web/Framework/ModRepositories/RemoteModStatus.cs18
46 files changed, 1587 insertions, 249 deletions
diff --git a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
index 5dc0feb6..864aa215 100644
--- a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
+++ b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs
@@ -36,7 +36,7 @@ namespace StardewModdingAPI.Web.Framework
}
/// <summary>Called early in the filter pipeline to confirm request is authorized.</summary>
- /// <param name="context">The authorisation filter context.</param>
+ /// <param name="context">The authorization filter context.</param>
public void OnAuthorization(AuthorizationFilterContext context)
{
IFeatureCollection features = context.HttpContext.Features;
diff --git a/src/SMAPI.Web/Framework/Caching/BaseCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/BaseCacheRepository.cs
new file mode 100644
index 00000000..f5354b93
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/BaseCacheRepository.cs
@@ -0,0 +1,19 @@
+using System;
+
+namespace StardewModdingAPI.Web.Framework.Caching
+{
+ /// <summary>The base logic for a cache repository.</summary>
+ internal abstract class BaseCacheRepository
+ {
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Whether cached data is stale.</summary>
+ /// <param name="lastUpdated">The date when the data was updated.</param>
+ /// <param name="staleMinutes">The age in minutes before data is considered stale.</param>
+ public bool IsStale(DateTimeOffset lastUpdated, int staleMinutes)
+ {
+ return lastUpdated < DateTimeOffset.UtcNow.AddMinutes(-staleMinutes);
+ }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs b/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs
new file mode 100644
index 00000000..5de7e731
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/ICacheRepository.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace StardewModdingAPI.Web.Framework.Caching
+{
+ /// <summary>Encapsulates logic for accessing data in the cache.</summary>
+ internal interface ICacheRepository
+ {
+ /// <summary>Whether cached data is stale.</summary>
+ /// <param name="lastUpdated">The date when the data was updated.</param>
+ /// <param name="staleMinutes">The age in minutes before data is considered stale.</param>
+ bool IsStale(DateTimeOffset lastUpdated, int staleMinutes);
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/Mods/CachedMod.cs b/src/SMAPI.Web/Framework/Caching/Mods/CachedMod.cs
new file mode 100644
index 00000000..96eca847
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/Mods/CachedMod.cs
@@ -0,0 +1,107 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
+using StardewModdingAPI.Web.Framework.ModRepositories;
+
+namespace StardewModdingAPI.Web.Framework.Caching.Mods
+{
+ /// <summary>The model for cached mod data.</summary>
+ internal class CachedMod
+ {
+ /*********
+ ** Accessors
+ *********/
+ /****
+ ** Tracking
+ ****/
+ /// <summary>The internal MongoDB ID.</summary>
+ [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Named per MongoDB conventions.")]
+ [BsonIgnoreIfDefault]
+ public ObjectId _id { get; set; }
+
+ /// <summary>When the data was last updated.</summary>
+ public DateTimeOffset LastUpdated { get; set; }
+
+ /// <summary>When the data was last requested through the web API.</summary>
+ public DateTimeOffset LastRequested { get; set; }
+
+ /****
+ ** Metadata
+ ****/
+ /// <summary>The mod site on which the mod is found.</summary>
+ public ModRepositoryKey Site { get; set; }
+
+ /// <summary>The mod's unique ID within the <see cref="Site"/>.</summary>
+ public string ID { get; set; }
+
+ /// <summary>The mod availability status on the remote site.</summary>
+ public RemoteModStatus FetchStatus { get; set; }
+
+ /// <summary>The error message providing more info for the <see cref="FetchStatus"/>, if applicable.</summary>
+ public string FetchError { get; set; }
+
+
+ /****
+ ** Mod info
+ ****/
+ /// <summary>The mod's display name.</summary>
+ public string Name { get; set; }
+
+ /// <summary>The mod's latest version.</summary>
+ public string MainVersion { get; set; }
+
+ /// <summary>The mod's latest optional or prerelease version, if newer than <see cref="MainVersion"/>.</summary>
+ public string PreviewVersion { get; set; }
+
+ /// <summary>The URL for the mod page.</summary>
+ public string Url { get; set; }
+
+ /// <summary>The license URL, if available.</summary>
+ public string LicenseUrl { get; set; }
+
+ /// <summary>The license name, if available.</summary>
+ public string LicenseName { get; set; }
+
+
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>Construct an instance.</summary>
+ public CachedMod() { }
+
+ /// <summary>Construct an instance.</summary>
+ /// <param name="site">The mod site on which the mod is found.</param>
+ /// <param name="id">The mod's unique ID within the <paramref name="site"/>.</param>
+ /// <param name="mod">The mod data.</param>
+ public CachedMod(ModRepositoryKey site, string id, ModInfoModel mod)
+ {
+ // tracking
+ this.LastUpdated = DateTimeOffset.UtcNow;
+ this.LastRequested = DateTimeOffset.UtcNow;
+
+ // metadata
+ this.Site = site;
+ this.ID = id;
+ this.FetchStatus = mod.Status;
+ this.FetchError = mod.Error;
+
+ // mod info
+ this.Name = mod.Name;
+ this.MainVersion = mod.Version;
+ this.PreviewVersion = mod.PreviewVersion;
+ this.Url = mod.Url;
+ this.LicenseUrl = mod.LicenseUrl;
+ this.LicenseName = mod.LicenseName;
+ }
+
+ /// <summary>Get the API model for the cached data.</summary>
+ public ModInfoModel GetModel()
+ {
+ return new ModInfoModel(name: this.Name, version: this.MainVersion, url: this.Url, previewVersion: this.PreviewVersion)
+ .SetLicense(this.LicenseUrl, this.LicenseName)
+ .SetError(this.FetchStatus, this.FetchError);
+ }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs
new file mode 100644
index 00000000..bcec8b36
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs
@@ -0,0 +1,31 @@
+using System;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
+using StardewModdingAPI.Web.Framework.ModRepositories;
+
+namespace StardewModdingAPI.Web.Framework.Caching.Mods
+{
+ /// <summary>Encapsulates logic for accessing the mod data cache.</summary>
+ internal interface IModCacheRepository : ICacheRepository
+ {
+ /*********
+ ** Methods
+ *********/
+ /// <summary>Get the cached mod data.</summary>
+ /// <param name="site">The mod site to search.</param>
+ /// <param name="id">The mod's unique ID within the <paramref name="site"/>.</param>
+ /// <param name="mod">The fetched mod.</param>
+ /// <param name="markRequested">Whether to update the mod's 'last requested' date.</param>
+ bool TryGetMod(ModRepositoryKey site, string id, out CachedMod mod, bool markRequested = true);
+
+ /// <summary>Save data fetched for a mod.</summary>
+ /// <param name="site">The mod site on which the mod is found.</param>
+ /// <param name="id">The mod's unique ID within the <paramref name="site"/>.</param>
+ /// <param name="mod">The mod data.</param>
+ /// <param name="cachedMod">The stored mod record.</param>
+ void SaveMod(ModRepositoryKey site, string id, ModInfoModel mod, out CachedMod cachedMod);
+
+ /// <summary>Delete data for mods which haven't been requested within a given time limit.</summary>
+ /// <param name="age">The minimum age for which to remove mods.</param>
+ void RemoveStaleMods(TimeSpan age);
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheRepository.cs
new file mode 100644
index 00000000..2e7804a7
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheRepository.cs
@@ -0,0 +1,104 @@
+using System;
+using MongoDB.Driver;
+using StardewModdingAPI.Toolkit.Framework.UpdateData;
+using StardewModdingAPI.Web.Framework.ModRepositories;
+
+namespace StardewModdingAPI.Web.Framework.Caching.Mods
+{
+ /// <summary>Encapsulates logic for accessing the mod data cache.</summary>
+ internal class ModCacheRepository : BaseCacheRepository, IModCacheRepository
+ {
+ /*********
+ ** Fields
+ *********/
+ /// <summary>The collection for cached mod data.</summary>
+ private readonly IMongoCollection<CachedMod> Mods;
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="database">The authenticated MongoDB database.</param>
+ public ModCacheRepository(IMongoDatabase database)
+ {
+ // get collections
+ this.Mods = database.GetCollection<CachedMod>("mods");
+
+ // add indexes if needed
+ this.Mods.Indexes.CreateOne(new CreateIndexModel<CachedMod>(Builders<CachedMod>.IndexKeys.Ascending(p => p.ID).Ascending(p => p.Site)));
+ }
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Get the cached mod data.</summary>
+ /// <param name="site">The mod site to search.</param>
+ /// <param name="id">The mod's unique ID within the <paramref name="site"/>.</param>
+ /// <param name="mod">The fetched mod.</param>
+ /// <param name="markRequested">Whether to update the mod's 'last requested' date.</param>
+ public bool TryGetMod(ModRepositoryKey site, string id, out CachedMod mod, bool markRequested = true)
+ {
+ // get mod
+ id = this.NormalizeId(id);
+ mod = this.Mods.Find(entry => entry.ID == id && entry.Site == site).FirstOrDefault();
+ if (mod == null)
+ return false;
+
+ // bump 'last requested'
+ if (markRequested)
+ {
+ mod.LastRequested = DateTimeOffset.UtcNow;
+ mod = this.SaveMod(mod);
+ }
+
+ return true;
+ }
+
+ /// <summary>Save data fetched for a mod.</summary>
+ /// <param name="site">The mod site on which the mod is found.</param>
+ /// <param name="id">The mod's unique ID within the <paramref name="site"/>.</param>
+ /// <param name="mod">The mod data.</param>
+ /// <param name="cachedMod">The stored mod record.</param>
+ public void SaveMod(ModRepositoryKey site, string id, ModInfoModel mod, out CachedMod cachedMod)
+ {
+ id = this.NormalizeId(id);
+
+ cachedMod = this.SaveMod(new CachedMod(site, id, mod));
+ }
+
+ /// <summary>Delete data for mods which haven't been requested within a given time limit.</summary>
+ /// <param name="age">The minimum age for which to remove mods.</param>
+ public void RemoveStaleMods(TimeSpan age)
+ {
+ DateTimeOffset minDate = DateTimeOffset.UtcNow.Subtract(age);
+ var result = this.Mods.DeleteMany(p => p.LastRequested < minDate);
+ }
+
+
+ /*********
+ ** Private methods
+ *********/
+ /// <summary>Save data fetched for a mod.</summary>
+ /// <param name="mod">The mod data.</param>
+ public CachedMod SaveMod(CachedMod mod)
+ {
+ string id = this.NormalizeId(mod.ID);
+
+ this.Mods.ReplaceOne(
+ entry => entry.ID == id && entry.Site == mod.Site,
+ mod,
+ new UpdateOptions { IsUpsert = true }
+ );
+
+ return mod;
+ }
+
+ /// <summary>Normalize a mod ID for case-insensitive search.</summary>
+ /// <param name="id">The mod ID.</param>
+ public string NormalizeId(string id)
+ {
+ return id.Trim().ToLower();
+ }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/UtcDateTimeOffsetSerializer.cs b/src/SMAPI.Web/Framework/Caching/UtcDateTimeOffsetSerializer.cs
new file mode 100644
index 00000000..6a103e37
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/UtcDateTimeOffsetSerializer.cs
@@ -0,0 +1,40 @@
+using System;
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization;
+using MongoDB.Bson.Serialization.Serializers;
+
+namespace StardewModdingAPI.Web.Framework.Caching
+{
+ /// <summary>Serializes <see cref="DateTimeOffset"/> to a UTC date field instead of the default array.</summary>
+ public class UtcDateTimeOffsetSerializer : StructSerializerBase<DateTimeOffset>
+ {
+ /*********
+ ** Fields
+ *********/
+ /// <summary>The underlying date serializer.</summary>
+ private static readonly DateTimeSerializer DateTimeSerializer = new DateTimeSerializer(DateTimeKind.Utc, BsonType.DateTime);
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Deserializes a value.</summary>
+ /// <param name="context">The deserialization context.</param>
+ /// <param name="args">The deserialization args.</param>
+ /// <returns>A deserialized value.</returns>
+ public override DateTimeOffset Deserialize(BsonDeserializationContext context, BsonDeserializationArgs args)
+ {
+ DateTime date = UtcDateTimeOffsetSerializer.DateTimeSerializer.Deserialize(context, args);
+ return new DateTimeOffset(date, TimeSpan.Zero);
+ }
+
+ /// <summary>Serializes a value.</summary>
+ /// <param name="context">The serialization context.</param>
+ /// <param name="args">The serialization args.</param>
+ /// <param name="value">The object.</param>
+ public override void Serialize(BsonSerializationContext context, BsonSerializationArgs args, DateTimeOffset value)
+ {
+ UtcDateTimeOffsetSerializer.DateTimeSerializer.Serialize(context, args, value.UtcDateTime);
+ }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs
new file mode 100644
index 00000000..6a560eb4
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMetadata.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Diagnostics.CodeAnalysis;
+using MongoDB.Bson;
+
+namespace StardewModdingAPI.Web.Framework.Caching.Wiki
+{
+ /// <summary>The model for cached wiki metadata.</summary>
+ internal class CachedWikiMetadata
+ {
+ /*********
+ ** Accessors
+ *********/
+ /// <summary>The internal MongoDB ID.</summary>
+ [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Named per MongoDB conventions.")]
+ public ObjectId _id { get; set; }
+
+ /// <summary>When the data was last updated.</summary>
+ public DateTimeOffset LastUpdated { get; set; }
+
+ /// <summary>The current stable Stardew Valley version.</summary>
+ public string StableVersion { get; set; }
+
+ /// <summary>The current beta Stardew Valley version.</summary>
+ public string BetaVersion { get; set; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ public CachedWikiMetadata() { }
+
+ /// <summary>Construct an instance.</summary>
+ /// <param name="stableVersion">The current stable Stardew Valley version.</param>
+ /// <param name="betaVersion">The current beta Stardew Valley version.</param>
+ public CachedWikiMetadata(string stableVersion, string betaVersion)
+ {
+ this.StableVersion = stableVersion;
+ this.BetaVersion = betaVersion;
+ this.LastUpdated = DateTimeOffset.UtcNow;
+ }
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs
new file mode 100644
index 00000000..8569984a
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs
@@ -0,0 +1,230 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using MongoDB.Bson;
+using MongoDB.Bson.Serialization.Attributes;
+using MongoDB.Bson.Serialization.Options;
+using StardewModdingAPI.Toolkit;
+using StardewModdingAPI.Toolkit.Framework.Clients.Wiki;
+
+namespace StardewModdingAPI.Web.Framework.Caching.Wiki
+{
+ /// <summary>The model for cached wiki mods.</summary>
+ internal class CachedWikiMod
+ {
+ /*********
+ ** Accessors
+ *********/
+ /****
+ ** Tracking
+ ****/
+ /// <summary>The internal MongoDB ID.</summary>
+ [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Named per MongoDB conventions.")]
+ public ObjectId _id { get; set; }
+
+ /// <summary>When the data was last updated.</summary>
+ public DateTimeOffset LastUpdated { get; set; }
+
+ /****
+ ** Mod info
+ ****/
+ /// <summary>The mod's unique ID. If the mod has alternate/old IDs, they're listed in latest to newest order.</summary>
+ public string[] ID { get; set; }
+
+ /// <summary>The mod's display name. If the mod has multiple names, the first one is the most canonical name.</summary>
+ public string[] Name { get; set; }
+
+ /// <summary>The mod's author name. If the author has multiple names, the first one is the most canonical name.</summary>
+ public string[] Author { get; set; }
+
+ /// <summary>The mod ID on Nexus.</summary>
+ public int? NexusID { get; set; }
+
+ /// <summary>The mod ID in the Chucklefish mod repo.</summary>
+ public int? ChucklefishID { get; set; }
+
+ /// <summary>The mod ID in the CurseForge mod repo.</summary>
+ public int? CurseForgeID { get; set; }
+
+ /// <summary>The mod key in the CurseForge mod repo (used in mod page URLs).</summary>
+ public string CurseForgeKey { get; set; }
+
+ /// <summary>The mod ID in the ModDrop mod repo.</summary>
+ public int? ModDropID { get; set; }
+
+ /// <summary>The GitHub repository in the form 'owner/repo'.</summary>
+ public string GitHubRepo { get; set; }
+
+ /// <summary>The URL to a non-GitHub source repo.</summary>
+ public string CustomSourceUrl { get; set; }
+
+ /// <summary>The custom mod page URL (if applicable).</summary>
+ public string CustomUrl { get; set; }
+
+ /// <summary>The name of the mod which loads this content pack, if applicable.</summary>
+ public string ContentPackFor { get; set; }
+
+ /// <summary>The human-readable warnings for players about this mod.</summary>
+ public string[] Warnings { get; set; }
+
+ /// <summary>Extra metadata links (usually for open pull requests).</summary>
+ public Tuple<Uri, string>[] MetadataLinks { get; set; }
+
+ /// <summary>Special notes intended for developers who maintain unofficial updates or submit pull requests. </summary>
+ public string DevNote { get; set; }
+
+ /// <summary>The link anchor for the mod entry in the wiki compatibility list.</summary>
+ public string Anchor { get; set; }
+
+ /****
+ ** Stable compatibility
+ ****/
+ /// <summary>The compatibility status.</summary>
+ public WikiCompatibilityStatus MainStatus { get; set; }
+
+ /// <summary>The human-readable summary of the compatibility status or workaround, without HTML formatting.</summary>
+ public string MainSummary { get; set; }
+
+ /// <summary>The game or SMAPI version which broke this mod (if applicable).</summary>
+ public string MainBrokeIn { get; set; }
+
+ /// <summary>The version of the latest unofficial update, if applicable.</summary>
+ public string MainUnofficialVersion { get; set; }
+
+ /// <summary>The URL to the latest unofficial update, if applicable.</summary>
+ public string MainUnofficialUrl { get; set; }
+
+ /****
+ ** Beta compatibility
+ ****/
+ /// <summary>The compatibility status.</summary>
+ public WikiCompatibilityStatus? BetaStatus { get; set; }
+
+ /// <summary>The human-readable summary of the compatibility status or workaround, without HTML formatting.</summary>
+ public string BetaSummary { get; set; }
+
+ /// <summary>The game or SMAPI version which broke this mod (if applicable).</summary>
+ public string BetaBrokeIn { get; set; }
+
+ /// <summary>The version of the latest unofficial update, if applicable.</summary>
+ public string BetaUnofficialVersion { get; set; }
+
+ /// <summary>The URL to the latest unofficial update, if applicable.</summary>
+ public string BetaUnofficialUrl { get; set; }
+
+ /****
+ ** Version maps
+ ****/
+ /// <summary>Maps local versions to a semantic version for update checks.</summary>
+ [BsonDictionaryOptions(Representation = DictionaryRepresentation.ArrayOfArrays)]
+ public IDictionary<string, string> MapLocalVersions { get; set; }
+
+ /// <summary>Maps remote versions to a sema