Basic Issue data structures
parent: tbd commit: 509aa4e
1 | |
2 | |
3 | |
4 | |
5 | use ; |
6 | |
7 | use IssueTimeline; |
8 | use ; |
9 | |
10 | use crate::; |
11 | |
12 | /// An issue, defined by the [`Repository`] it is related to along with |
13 | /// its id. |
14 | /// |
15 | /// # Textual Format |
16 | /// An issue's textual reference is defined as: |
17 | /// |
18 | /// `#{id: u64}:{repository: Repository}` |
19 | |
20 | |
21 | pub id: u64, |
22 | /// The repository the issue is related to |
23 | pub repository: Repository, |
24 | |
25 | |
26 | |
27 | |
28 | "issue" |
29 | |
30 | |
31 | |
32 | self.repository.home_uri |
33 | |
34 | |
35 | |
36 | Ok |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | f.write_str |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | ; |
49 | |
50 | |
51 | type Err = IssueParseError; |
52 | |
53 | |
54 | // Remove the pound from the start |
55 | let s = s |
56 | .starts_with |
57 | .then |
58 | .ok_or?; |
59 | // Split the id from the repository |
60 | let = s.split_once .ok_or?; |
61 | |
62 | // Parse the id and the repository |
63 | let id: u64 = id.parse .map_err?; |
64 | let repository = from_str .map_err?; |
65 | |
66 | Ok |
67 | |
68 | |
69 | |
70 | |
71 | |
72 | #[serde(flatten)] |
73 | pub basic: IssueInfoBasic, |
74 | pub body: String, |
75 | pub timeline: IssueTimeline, |
76 | |
77 | |
78 | |
79 | |
80 | pub id: u64, |
81 | pub status: IssueStatus, |
82 | pub title: String, |
83 | pub tags: , |
84 | pub last_activity: , |
85 | pub created: , |
86 | pub creator: User, |
87 | pub statistics: IssueStatistics, |
88 | pub assignees: , |
89 | |
90 | |
91 | |
92 | |
93 | pub comments: u64, |
94 | |
95 | |
96 | /// Tag (sometimes referred to as label) to categorize issues. |
97 | |
98 | |
99 | pub category: String, |
100 | pub sub_category: , |
101 | pub description: , |
102 | |
103 | |
104 | |
105 | |
106 | Open, |
107 | Closed, |
108 | |
109 | |
110 | |
111 | |
112 | match self |
113 | => f.write_str, | Open
114 | => f.write_str, | Closed
115 | |
116 | |
117 | |
118 | |
119 | |
120 | |
121 | /// Event id |
122 | pub id: u64, |
123 | /// Creation date |
124 | pub created: , |
125 | /// The user who created the comment |
126 | pub creator: User, |
127 | /// Body of the comment |
128 | pub body: String, |
129 | |
130 | |
131 | |
132 | |
133 | /// Event id |
134 | pub id: u64, |
135 | /// Creation date |
136 | pub created: , |
137 | /// Body of the comment |
138 | pub body: String, |
139 | |
140 |