azure_devops/projects/methods/
list_with_options.rs1use super::super::models::{ListProjectsOptions, ProjectList};
2use super::super::ProjectsClient;
3use crate::constants;
4use crate::constants::ApiPath;
5use crate::error::Result;
6
7impl ProjectsClient<'_> {
8 pub async fn list_with_options(&self, options: &ListProjectsOptions) -> Result<ProjectList> {
19 let mut qp: Vec<(String, String)> = Vec::new();
20 if let Some(ref f) = options.state_filter {
21 qp.push((constants::query::STATE_FILTER.into(), f.as_str().into()));
22 }
23 if let Some(t) = options.top {
24 qp.push((constants::query::TOP.into(), t.to_string()));
25 }
26 if let Some(s) = options.skip {
27 qp.push((constants::query::SKIP.into(), s.to_string()));
28 }
29 if let Some(c) = options.continuation_token {
30 qp.push((constants::query::CT.into(), c.to_string()));
31 }
32 let q: Vec<(&str, &str)> = qp.iter().map(|(k, v)| (k.as_str(), v.as_str())).collect();
33 self.http.get(&ApiPath::projects(), &q).await
34 }
35}