summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs')
-rw-r--r--src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs
index 383775d2..9de6f020 100644
--- a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs
+++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs
@@ -1,5 +1,4 @@
-#nullable disable
-
+using System;
using Newtonsoft.Json;
namespace StardewModdingAPI.Web.Framework.Clients.GitHub
@@ -12,24 +11,45 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub
*********/
/// <summary>The display name.</summary>
[JsonProperty("name")]
- public string Name { get; set; }
+ public string Name { get; }
/// <summary>The semantic version string.</summary>
[JsonProperty("tag_name")]
- public string Tag { get; set; }
+ public string Tag { get; }
/// <summary>The Markdown description for the release.</summary>
- public string Body { get; set; }
+ public string Body { get; internal set; }
/// <summary>Whether this is a draft version.</summary>
[JsonProperty("draft")]
- public bool IsDraft { get; set; }
+ public bool IsDraft { get; }
/// <summary>Whether this is a prerelease version.</summary>
[JsonProperty("prerelease")]
- public bool IsPrerelease { get; set; }
+ public bool IsPrerelease { get; }
/// <summary>The attached files.</summary>
- public GitAsset[] Assets { get; set; }
+ public GitAsset[] Assets { get; }
+
+
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ /// <param name="name">The display name.</param>
+ /// <param name="tag">The semantic version string.</param>
+ /// <param name="body">The Markdown description for the release.</param>
+ /// <param name="isDraft">Whether this is a draft version.</param>
+ /// <param name="isPrerelease">Whether this is a prerelease version.</param>
+ /// <param name="assets">The attached files.</param>
+ public GitRelease(string name, string tag, string? body, bool isDraft, bool isPrerelease, GitAsset[]? assets)
+ {
+ this.Name = name;
+ this.Tag = tag;
+ this.Body = body ?? string.Empty;
+ this.IsDraft = isDraft;
+ this.IsPrerelease = isPrerelease;
+ this.Assets = assets ?? Array.Empty<GitAsset>();
+ }
}
}