Skip to main content

azure_devops/builds/methods/
list_definitions.rs

1use super::super::models::BuildDefinition;
2use super::super::BuildsClient;
3use crate::constants;
4use crate::constants::ApiPath;
5use crate::error::Result;
6
7impl BuildsClient<'_> {
8    /// List build definitions in a project.
9    ///
10    /// # Arguments
11    ///
12    /// * `project` — The project name.
13    /// * `name` — Optional name filter.
14    /// * `top` — Optional maximum number of definitions to return.
15    ///
16    /// # Returns
17    ///
18    /// A `Vec<BuildDefinition>`.
19    pub async fn list_definitions(
20        &self,
21        project: &str,
22        name: Option<&str>,
23        top: Option<i32>,
24    ) -> Result<Vec<BuildDefinition>> {
25        let mut qp: Vec<(String, String)> = Vec::new();
26        if let Some(n) = name {
27            qp.push((constants::query::NAME.into(), n.into()));
28        }
29        if let Some(t) = top {
30            qp.push((constants::query::TOP.into(), t.to_string()));
31        }
32        self.http
33            .get(
34                &ApiPath::build_definitions(project),
35                &crate::util::ref_query(&qp),
36            )
37            .await
38    }
39}