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
use derive_builder::Builder;
use crate::api::endpoint_prelude::*;
#[derive(Debug, Builder)]
#[builder(setter(strip_option))]
pub struct DeployKeys {
#[builder(default)]
pub public: Option<bool>,
}
impl DeployKeys {
pub fn builder() -> DeployKeysBuilder {
DeployKeysBuilder::default()
}
}
impl<'a> Endpoint for DeployKeys {
fn method(&self) -> Method {
Method::GET
}
fn endpoint(&self) -> Cow<'static, str> {
"deploy_keys".into()
}
fn parameters(&self) -> QueryParams {
let mut params = QueryParams::default();
params.push_opt("public", self.public);
params
}
}
impl<'a> Pageable for DeployKeys {}
#[cfg(test)]
mod tests {
use crate::api::deploy_keys::DeployKeys;
use crate::api::{self, Query};
use crate::test::client::{ExpectedUrl, SingleTestClient};
#[test]
fn endpoint() {
let endpoint = ExpectedUrl::builder()
.endpoint("deploy_keys")
.build()
.unwrap();
let client = SingleTestClient::new_raw(endpoint, "");
let endpoint = DeployKeys::builder().build().unwrap();
api::ignore(endpoint).query(&client).unwrap();
}
#[test]
fn endpoint_public() {
let endpoint = ExpectedUrl::builder()
.endpoint("deploy_keys")
.add_query_params(&[("public", "true")])
.build()
.unwrap();
let client = SingleTestClient::new_raw(endpoint, "");
let endpoint = DeployKeys::builder().public(true).build().unwrap();
api::ignore(endpoint).query(&client).unwrap();
}
}