use super::commit_search_criteria::CommitSearchCriteria;
use crate::constants;
impl CommitSearchCriteria {
pub fn to_query_params(&self) -> Vec<(String, String)> {
let mut p = Vec::new();
if let Some(ref v) = self.item_version {
if let Some(ref ver) = v.version {
p.push((
format!("{}itemVersion.version", constants::query::SEARCH_PFX),
ver.clone(),
));
}
if let Some(ref t) = v.version_type {
p.push((
format!("{}itemVersion.versionType", constants::query::SEARCH_PFX),
crate::util::enum_to_str(t),
));
}
}
if let Some(ref v) = self.compare_version {
if let Some(ref ver) = v.version {
p.push((
format!("{}compareVersion.version", constants::query::SEARCH_PFX),
ver.clone(),
));
}
}
if let Some(ref v) = self.from_date {
p.push((
format!("{}fromDate", constants::query::SEARCH_PFX),
v.clone(),
));
}
if let Some(ref v) = self.to_date {
p.push((format!("{}toDate", constants::query::SEARCH_PFX), v.clone()));
}
if let Some(ref v) = self.author {
p.push((format!("{}author", constants::query::SEARCH_PFX), v.clone()));
}
if let Some(ref v) = self.user {
p.push((format!("{}user", constants::query::SEARCH_PFX), v.clone()));
}
if let Some(t) = self.top {
p.push((constants::query::TOP.into(), t.to_string()));
}
if let Some(s) = self.skip {
p.push((constants::query::SKIP.into(), s.to_string()));
}
p
}
}