summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs')
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs
index aef90ede..3155cfda 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs
@@ -1,3 +1,4 @@
+using System;
using Newtonsoft.Json;
namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels
@@ -9,25 +10,53 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels
** Accessors
*********/
/// <summary>The mod name.</summary>
- public string Name { get; set; }
+ public string? Name { get; }
/// <summary>The mod's semantic version number.</summary>
- public string Version { get; set; }
+ public string? Version { get; }
/// <summary>The mod's web URL.</summary>
[JsonProperty("mod_page_uri")]
- public string Url { get; set; }
+ public string? Url { get; }
/// <summary>The mod's publication status.</summary>
[JsonIgnore]
- public NexusModStatus Status { get; set; } = NexusModStatus.Ok;
+ public NexusModStatus Status { get; }
/// <summary>The files available to download.</summary>
[JsonIgnore]
- public IModDownload[] Downloads { get; set; }
+ public IModDownload[] Downloads { get; }
/// <summary>A custom user-friendly error which indicates why fetching the mod info failed (if applicable).</summary>
[JsonIgnore]
- public string Error { get; set; }
+ public string? Error { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</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 files available to download.</param>
+ public NexusMod(string name, string? version, string url, IModDownload[] downloads)
+ {
+ this.Name = name;
+ this.Version = version;
+ this.Url = url;
+ this.Status = NexusModStatus.Ok;
+ this.Downloads = downloads;
+ }
+
+ /// <summary>Construct an instance.</summary>
+ /// <param name="status">The mod's publication status.</param>
+ /// <param name="error">A custom user-friendly error which indicates why fetching the mod info failed (if applicable).</param>
+ public NexusMod(NexusModStatus status, string error)
+ {
+ this.Status = status;
+ this.Error = error;
+ this.Downloads = Array.Empty<IModDownload>();
+ }
}
}