use super::super::models::{ListProjectsOptions, ProjectList};
use super::super::ProjectsClient;
use crate::constants;
use crate::constants::ApiPath;
use crate::error::Result;
impl ProjectsClient<'_> {
pub async fn list_with_options(&self, options: &ListProjectsOptions) -> Result<ProjectList> {
let mut qp: Vec<(String, String)> = Vec::new();
if let Some(ref f) = options.state_filter {
qp.push((constants::query::STATE_FILTER.into(), f.as_str().into()));
}
if let Some(t) = options.top {
qp.push((constants::query::TOP.into(), t.to_string()));
}
if let Some(s) = options.skip {
qp.push((constants::query::SKIP.into(), s.to_string()));
}
if let Some(c) = options.continuation_token {
qp.push((constants::query::CT.into(), c.to_string()));
}
let q: Vec<(&str, &str)> = qp.iter().map(|(k, v)| (k.as_str(), v.as_str())).collect();
self.http.get(&ApiPath::projects(), &q).await
}
}