diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-12 19:15:39 -0400 |
commit | 0b48c1748b354458059c7607415288de072b01e9 (patch) | |
tree | f63fd950f565d363414eb692be9024895cdea174 /src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs | |
parent | 9fbed0fa1f28a9b0fe0b952a78b10e2d475adb03 (diff) | |
download | SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.gz SMAPI-0b48c1748b354458059c7607415288de072b01e9.tar.bz2 SMAPI-0b48c1748b354458059c7607415288de072b01e9.zip |
enable nullable annotations in the web project & related code (#837)
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs | 36 |
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>(); + } } } |