azure-devops 0.1.0

Idiomatic Rust client for Azure DevOps REST APIs
Documentation
use super::super::models::BuildDefinition;
use super::super::BuildsClient;
use crate::constants;
use crate::constants::ApiPath;
use crate::error::Result;

impl BuildsClient<'_> {
    /// List build definitions in a project.
    ///
    /// # Arguments
    ///
    /// * `project` — The project name.
    /// * `name` — Optional name filter.
    /// * `top` — Optional maximum number of definitions to return.
    ///
    /// # Returns
    ///
    /// A `Vec<BuildDefinition>`.
    pub async fn list_definitions(
        &self,
        project: &str,
        name: Option<&str>,
        top: Option<i32>,
    ) -> Result<Vec<BuildDefinition>> {
        let mut qp: Vec<(String, String)> = Vec::new();
        if let Some(n) = name {
            qp.push((constants::query::NAME.into(), n.into()));
        }
        if let Some(t) = top {
            qp.push((constants::query::TOP.into(), t.to_string()));
        }
        self.http
            .get(
                &ApiPath::build_definitions(project),
                &crate::util::ref_query(&qp),
            )
            .await
    }
}