forked from Slazanger/SMT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GitHubRelease.cs
196 lines (142 loc) · 5.13 KB
/
GitHubRelease.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
// <auto-generated />
//
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
//
// using GitHubRelease;
//
// var release = Release.FromJson(jsonString);
namespace GitHubRelease
{
using System;
using System.Collections.Generic;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
public partial class Release
{
[JsonProperty("url")]
public Uri Url { get; set; }
[JsonProperty("assets_url")]
public Uri AssetsUrl { get; set; }
[JsonProperty("upload_url")]
public string UploadUrl { get; set; }
[JsonProperty("html_url")]
public Uri HtmlUrl { get; set; }
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("node_id")]
public string NodeId { get; set; }
[JsonProperty("tag_name")]
public string TagName { get; set; }
[JsonProperty("target_commitish")]
public string TargetCommitish { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("draft")]
public bool Draft { get; set; }
[JsonProperty("author")]
public Author Author { get; set; }
[JsonProperty("prerelease")]
public bool Prerelease { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("published_at")]
public DateTimeOffset PublishedAt { get; set; }
[JsonProperty("assets")]
public Asset[] Assets { get; set; }
[JsonProperty("tarball_url")]
public Uri TarballUrl { get; set; }
[JsonProperty("zipball_url")]
public Uri ZipballUrl { get; set; }
[JsonProperty("body")]
public string Body { get; set; }
}
public partial class Asset
{
[JsonProperty("url")]
public Uri Url { get; set; }
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("node_id")]
public string NodeId { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("label")]
public object Label { get; set; }
[JsonProperty("uploader")]
public Author Uploader { get; set; }
[JsonProperty("content_type")]
public string ContentType { get; set; }
[JsonProperty("state")]
public string State { get; set; }
[JsonProperty("size")]
public long Size { get; set; }
[JsonProperty("download_count")]
public long DownloadCount { get; set; }
[JsonProperty("created_at")]
public DateTimeOffset CreatedAt { get; set; }
[JsonProperty("updated_at")]
public DateTimeOffset UpdatedAt { get; set; }
[JsonProperty("browser_download_url")]
public Uri BrowserDownloadUrl { get; set; }
}
public partial class Author
{
[JsonProperty("login")]
public string Login { get; set; }
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("node_id")]
public string NodeId { get; set; }
[JsonProperty("avatar_url")]
public Uri AvatarUrl { get; set; }
[JsonProperty("gravatar_id")]
public string GravatarId { get; set; }
[JsonProperty("url")]
public Uri Url { get; set; }
[JsonProperty("html_url")]
public Uri HtmlUrl { get; set; }
[JsonProperty("followers_url")]
public Uri FollowersUrl { get; set; }
[JsonProperty("following_url")]
public string FollowingUrl { get; set; }
[JsonProperty("gists_url")]
public string GistsUrl { get; set; }
[JsonProperty("starred_url")]
public string StarredUrl { get; set; }
[JsonProperty("subscriptions_url")]
public Uri SubscriptionsUrl { get; set; }
[JsonProperty("organizations_url")]
public Uri OrganizationsUrl { get; set; }
[JsonProperty("repos_url")]
public Uri ReposUrl { get; set; }
[JsonProperty("events_url")]
public string EventsUrl { get; set; }
[JsonProperty("received_events_url")]
public Uri ReceivedEventsUrl { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("site_admin")]
public bool SiteAdmin { get; set; }
}
public partial class Release
{
public static Release FromJson(string json) => JsonConvert.DeserializeObject<Release>(json, GitHubRelease.Converter.Settings);
}
public static class Serialize
{
public static string ToJson(this Release self) => JsonConvert.SerializeObject(self, GitHubRelease.Converter.Settings);
}
internal static class Converter
{
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
{
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
{
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
},
};
}
}