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
use super::Client;
use serde_json;
#[derive(Clone, Debug, Deserialize)]
pub struct Project {
pub url: String,
pub description: Option<String>,
pub name: String
}
#[derive(Clone)]
pub struct ProjectService<'a> {
client: &'a Client<'a>
}
impl<'a> ProjectService<'a> {
pub fn from_client(client: &'a Client) -> Result<Self, ()>
{
Ok(Self {
client
})
}
pub fn list(&self) -> Vec<Project> {
let mut filters: Vec<&str> = Vec::new();
let ret = self.client.perform_get("projects", &mut filters);
serde_json::from_str(&ret).unwrap()
}
}