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
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Todo {
pub id: u32,
pub name: String,
pub done: bool,
pub github: Option<GitHub>,
}
impl Todo {
pub fn new(id: u32, name: &str, github: Option<GitHub>) -> Todo {
Todo {
id: id,
name: name.to_string(),
done: false,
github: github,
}
}
pub fn edit(&mut self, new_name: &str) {
self.name = new_name.to_string();
}
pub fn set_done(&mut self) {
self.done = true;
}
pub fn set_undone(&mut self) {
self.done = false;
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GitHub {
pub repo: String,
pub issue_number: u32,
}
impl GitHub {
pub fn new(repo: &str, issue_number: u32) -> GitHub {
GitHub {
repo: repo.to_owned(),
issue_number: issue_number,
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GHIssueResponse {
pub url: String,
pub number: u32,
pub state: String,
pub title: String,
}