Skip to main content

azure_devops/work_items/methods/
get_many_with_options.rs

1use super::super::models::WorkItem;
2use super::super::options::GetWorkItemOptions;
3use super::super::WorkItemsClient;
4use crate::constants;
5use crate::constants::ApiPath;
6use crate::error::Result;
7
8impl WorkItemsClient<'_> {
9    /// Get multiple work items with extended options.
10    ///
11    /// # Arguments
12    ///
13    /// * `ids` — A slice of work item IDs to fetch.
14    /// * `options` — [`GetWorkItemOptions`] for field selection, expansion, etc.
15    ///
16    /// # Returns
17    ///
18    /// A `Vec<WorkItem>` with the requested options applied.
19    pub async fn get_many_with_options(
20        &self,
21        ids: &[i64],
22        options: &GetWorkItemOptions,
23    ) -> Result<Vec<WorkItem>> {
24        let ids_str = ids
25            .iter()
26            .map(|id| id.to_string())
27            .collect::<Vec<_>>()
28            .join(",");
29        let mut query = options.to_query_params();
30        query.push((constants::query::IDS.into(), ids_str));
31        let p = ApiPath::work_items();
32        self.http.get(&p, &crate::util::ref_query(&query)).await
33    }
34}