summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients')
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs4
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs18
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs8
3 files changed, 29 insertions, 1 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
index f4909155..0f1b29d5 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusMod.cs
@@ -21,6 +21,10 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
[JsonProperty("mod_page_uri")]
public string Url { get; set; }
+ /// <summary>The mod's publication status.</summary>
+ [JsonIgnore]
+ public NexusModStatus Status { get; set; } = NexusModStatus.Ok;
+
/// <summary>A user-friendly error which indicates why fetching the mod info failed (if applicable).</summary>
[JsonIgnore]
public string Error { get; set; }
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs
new file mode 100644
index 00000000..c5723093
--- /dev/null
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusModStatus.cs
@@ -0,0 +1,18 @@
+namespace StardewModdingAPI.Web.Framework.Clients.Nexus
+{
+ /// <summary>The status of a Nexus mod.</summary>
+ internal enum NexusModStatus
+ {
+ /// <summary>The mod is published and valid.</summary>
+ Ok,
+
+ /// <summary>The mod is hidden by the author.</summary>
+ Hidden,
+
+ /// <summary>The mod hasn't been published yet.</summary>
+ NotPublished,
+
+ /// <summary>The Nexus API returned an unhandled error.</summary>
+ Other
+ }
+}
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
index e83a6041..061de5de 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
@@ -74,8 +74,14 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
case "not found":
return null;
+ case "hidden mod":
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.Hidden };
+
+ case "not published":
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.NotPublished };
+
default:
- return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText})." };
+ return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = NexusModStatus.Other };
}
}