summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs
blob: 9de6f020d0618b6691681c2acf054c9c3d331f58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using Newtonsoft.Json;

namespace StardewModdingAPI.Web.Framework.Clients.GitHub
{
    /// <summary>A GitHub project release.</summary>
    internal class GitRelease
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The display name.</summary>
        [JsonProperty("name")]
        public string Name { get; }

        /// <summary>The semantic version string.</summary>
        [JsonProperty("tag_name")]
        public string Tag { get; }

        /// <summary>The Markdown description for the release.</summary>
        public string Body { get; internal set; }

        /// <summary>Whether this is a draft version.</summary>
        [JsonProperty("draft")]
        public bool IsDraft { get; }

        /// <summary>Whether this is a prerelease version.</summary>
        [JsonProperty("prerelease")]
        public bool IsPrerelease { get; }

        /// <summary>The attached files.</summary>
        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>();
        }
    }
}