azure_devops/builds/options/
list_builds_options_impl.rs1use super::list_builds_options::ListBuildsOptions;
2use crate::constants;
3
4impl ListBuildsOptions {
5 pub fn to_query_params(&self) -> Vec<(String, String)> {
6 let mut p = Vec::new();
7 if let Some(ref defs) = self.definitions {
8 p.push((
9 constants::query::DEFINITIONS.into(),
10 defs.iter()
11 .map(|d| d.to_string())
12 .collect::<Vec<_>>()
13 .join(","),
14 ));
15 }
16 if let Some(ref s) = self.status_filter {
17 p.push((
18 constants::query::STATUS_FILTER.into(),
19 crate::util::enum_to_str(s),
20 ));
21 }
22 if let Some(ref r) = self.reason_filter {
23 p.push((
24 constants::query::REASON_FILTER.into(),
25 crate::util::enum_to_str(r),
26 ));
27 }
28 if let Some(ref r) = self.result_filter {
29 p.push((
30 constants::query::RESULT_FILTER.into(),
31 crate::util::enum_to_str(r),
32 ));
33 }
34 if let Some(ref tags) = self.tag_filters {
35 p.push((constants::query::TAG_FILTERS.into(), tags.join(",")));
36 }
37 if let Some(ref b) = self.branch_name {
38 p.push((constants::query::BRANCH_NAME.into(), b.clone()));
39 }
40 if let Some(ref r) = self.requested_for {
41 p.push((constants::query::REQUESTED_FOR.into(), r.clone()));
42 }
43 if let Some(ref t) = self.min_time {
44 p.push((constants::query::MIN_TIME.into(), t.to_rfc3339()));
45 }
46 if let Some(ref t) = self.max_time {
47 p.push((constants::query::MAX_TIME.into(), t.to_rfc3339()));
48 }
49 if let Some(ref q) = self.query_order {
50 p.push((
51 constants::query::QUERY_ORDER.into(),
52 crate::util::enum_to_str(q),
53 ));
54 }
55 if let Some(t) = self.top {
56 p.push((constants::query::TOP.into(), t.to_string()));
57 }
58 if let Some(ref d) = self.deleted_filter {
59 p.push((
60 constants::query::DELETED_FILTER.into(),
61 crate::util::enum_to_str(d),
62 ));
63 }
64 if let Some(ref id) = self.repository_id {
65 p.push((constants::query::REPOSITORY_ID.into(), id.clone()));
66 }
67 if let Some(ref t) = self.repository_type {
68 p.push((constants::query::REPOSITORY_TYPE.into(), t.clone()));
69 }
70 p
71 }
72}