Skip to main content

azure_devops/work_items/methods/
get_with_options.rs

1use super::super::models::WorkItem;
2use super::super::options::GetWorkItemOptions;
3use super::super::WorkItemsClient;
4use crate::constants::ApiPath;
5use crate::error::Result;
6
7impl WorkItemsClient<'_> {
8    /// Get a single work item with extended options.
9    ///
10    /// # Arguments
11    ///
12    /// * `id` — The work item ID.
13    /// * `options` — [`GetWorkItemOptions`] for field selection, expansion, as-of date, etc.
14    ///
15    /// # Returns
16    ///
17    /// The [`WorkItem`] with requested fields and expansions.
18    pub async fn get_with_options(
19        &self,
20        id: i64,
21        options: &GetWorkItemOptions,
22    ) -> Result<WorkItem> {
23        let qp = options.to_query_params();
24        let q = crate::util::ref_query(&qp);
25        let p = ApiPath::work_item(id);
26        self.http.get(&p, &q).await
27    }
28}