|
1 | | -using System; |
2 | | -using System.Collections.Generic; |
3 | | -using System.Threading.Tasks; |
4 | | - |
5 | | -namespace Open_Rails_Triage_Bot.Launchpad |
6 | | -{ |
7 | | - #pragma warning disable CS0649 |
8 | | - |
9 | | - class JsonBugTaskCollection |
10 | | - { |
11 | | - public JsonBugTask[] entries; |
12 | | - public string next_collection_link; |
13 | | - public JsonBugTaskCollection(string url) => next_collection_link = url; |
14 | | - } |
15 | | - |
16 | | - class JsonBugTask |
17 | | - { |
18 | | - public string self_link; |
19 | | - public string status; |
20 | | - public string bug_link; |
21 | | - public string web_link; |
22 | | - } |
23 | | - |
24 | | - #pragma warning restore CS0649 |
25 | | - |
26 | | - public enum Status |
27 | | - { |
28 | | - Unknown, |
29 | | - New, |
30 | | - Incomplete, |
31 | | - Opinion, |
32 | | - Invalid, |
33 | | - WontFix, |
34 | | - Expired, |
35 | | - Confirmed, |
36 | | - Triaged, |
37 | | - InProgress, |
38 | | - FixCommitted, |
39 | | - FixReleased, |
40 | | - } |
41 | | - |
42 | | - public class BugTask |
43 | | - { |
44 | | - static Dictionary<string, Status> StatusMapping = new Dictionary<string, Status>() |
45 | | - { |
46 | | - { "New", Status.New }, |
47 | | - { "Incomplete", Status.Incomplete }, |
48 | | - { "Opinion", Status.Opinion }, |
49 | | - { "Invalid", Status.Invalid }, |
50 | | - { "Won't Fix", Status.WontFix }, |
51 | | - { "Expired", Status.Expired }, |
52 | | - { "Confirmed", Status.Confirmed }, |
53 | | - { "Triaged", Status.Triaged }, |
54 | | - { "In Progress", Status.InProgress }, |
55 | | - { "Fix Committed", Status.FixCommitted }, |
56 | | - { "Fix Released", Status.FixReleased }, |
57 | | - }; |
58 | | - |
59 | | - public Status Status => StatusMapping[Json.status]; |
60 | | - public async Task<Bug> GetBug() => await Cache.GetBug(Json.bug_link); |
61 | | - |
62 | | - internal readonly Cache Cache; |
63 | | - internal readonly JsonBugTask Json; |
64 | | - |
65 | | - internal BugTask(Cache cache, JsonBugTask json) => (Cache, Json) = (cache, json); |
66 | | - } |
67 | | -} |
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Threading.Tasks; |
| 4 | + |
| 5 | +namespace Open_Rails_Triage_Bot.Launchpad |
| 6 | +{ |
| 7 | +#pragma warning disable CS0649 |
| 8 | + |
| 9 | + class JsonBugTaskCollection |
| 10 | + { |
| 11 | + public JsonBugTask[] entries = new JsonBugTask[0]; |
| 12 | + public string next_collection_link; |
| 13 | + public JsonBugTaskCollection(string url) => next_collection_link = url; |
| 14 | + } |
| 15 | + |
| 16 | + class JsonBugTask |
| 17 | + { |
| 18 | + public string self_link = ""; |
| 19 | + public string status = ""; |
| 20 | + public string bug_link = ""; |
| 21 | + public string web_link = ""; |
| 22 | + } |
| 23 | + |
| 24 | +#pragma warning restore CS0649 |
| 25 | + |
| 26 | + public enum Status |
| 27 | + { |
| 28 | + Unknown, |
| 29 | + New, |
| 30 | + Incomplete, |
| 31 | + Opinion, |
| 32 | + Invalid, |
| 33 | + WontFix, |
| 34 | + Expired, |
| 35 | + Confirmed, |
| 36 | + Triaged, |
| 37 | + InProgress, |
| 38 | + FixCommitted, |
| 39 | + FixReleased, |
| 40 | + } |
| 41 | + |
| 42 | + public class BugTask |
| 43 | + { |
| 44 | + static readonly Dictionary<string, Status> StatusMapping = new() |
| 45 | + { |
| 46 | + { "New", Status.New }, |
| 47 | + { "Incomplete", Status.Incomplete }, |
| 48 | + { "Opinion", Status.Opinion }, |
| 49 | + { "Invalid", Status.Invalid }, |
| 50 | + { "Won't Fix", Status.WontFix }, |
| 51 | + { "Expired", Status.Expired }, |
| 52 | + { "Confirmed", Status.Confirmed }, |
| 53 | + { "Triaged", Status.Triaged }, |
| 54 | + { "In Progress", Status.InProgress }, |
| 55 | + { "Fix Committed", Status.FixCommitted }, |
| 56 | + { "Fix Released", Status.FixReleased }, |
| 57 | + }; |
| 58 | + |
| 59 | + public Status Status => StatusMapping[Json.status]; |
| 60 | + public async Task<Bug> GetBug() => await Cache.GetBug(Json.bug_link); |
| 61 | + |
| 62 | + internal readonly Cache Cache; |
| 63 | + internal readonly JsonBugTask Json; |
| 64 | + |
| 65 | + internal BugTask(Cache cache, JsonBugTask json) => (Cache, Json) = (cache, json); |
| 66 | + } |
| 67 | +} |
0 commit comments