mirror of
https://github.com/ckaczor/ChrisKaczor.ApplicationUpdate.git
synced 2026-02-16 10:58:31 -05:00
Initial commit
This commit is contained in:
42
GitHubRelease.cs
Normal file
42
GitHubRelease.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ChrisKaczor.ApplicationUpdate
|
||||
{
|
||||
public partial class GitHubRelease
|
||||
{
|
||||
[JsonProperty("tag_name")]
|
||||
public string? TagName { get; set; }
|
||||
|
||||
[JsonProperty("assets")]
|
||||
public List<Asset>? Assets { get; set; }
|
||||
}
|
||||
|
||||
public class Asset
|
||||
{
|
||||
[JsonProperty("created_at")]
|
||||
public DateTimeOffset? CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("browser_download_url")]
|
||||
public string? BrowserDownloadUrl { get; set; }
|
||||
}
|
||||
|
||||
public partial class GitHubRelease
|
||||
{
|
||||
public static GitHubRelease? FromJson(string json) => JsonConvert.DeserializeObject<GitHubRelease>(json, Converter.Settings);
|
||||
}
|
||||
|
||||
internal class Converter
|
||||
{
|
||||
public static readonly JsonSerializerSettings Settings = new()
|
||||
{
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters =
|
||||
{
|
||||
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user