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
use super::{Github, Result};
use rep::{Comment, CommentListOptions};
pub struct Comments<'a> {
github: &'a Github<'a>,
owner: String,
repo: String,
number: u64,
}
impl<'a> Comments<'a> {
pub fn new<O, R>(github: &'a Github<'a>, owner: O, repo: R, number: u64) -> Comments<'a>
where O: Into<String>,
R: Into<String>
{
Comments {
github: github,
owner: owner.into(),
repo: repo.into(),
number: number,
}
}
pub fn list(&self, options: &CommentListOptions) -> Result<Vec<Comment>> {
let mut uri = vec![format!("/repos/{}/{}/issues/{}/comments",
self.owner,
self.repo,
self.number)];
if let Some(query) = options.serialize() {
uri.push(query);
}
self.github.get::<Vec<Comment>>(&uri.join("?"))
}
}