Skip to main content

azure_devops/work_items/methods/
update_with_options.rs

1use super::super::models::{JsonPatchOperation, WorkItem};
2use super::super::options::UpdateWorkItemOptions;
3use super::super::WorkItemsClient;
4use crate::constants::ApiPath;
5use crate::error::Result;
6
7impl WorkItemsClient<'_> {
8    /// Update an existing work item with additional options.
9    ///
10    /// # Arguments
11    ///
12    /// * `id` — The work item ID to update.
13    /// * `patch_document` — A slice of [`JsonPatchOperation`] describing the fields to modify.
14    /// * `options` — [`UpdateWorkItemOptions`] for validation, rule bypass, and notifications.
15    ///
16    /// # Returns
17    ///
18    /// The updated [`WorkItem`].
19    pub async fn update_with_options(
20        &self,
21        id: i64,
22        patch_document: &[JsonPatchOperation],
23        options: &UpdateWorkItemOptions,
24    ) -> Result<WorkItem> {
25        let qp = options.to_query_params();
26        let q = crate::util::ref_query(&qp);
27        let body = crate::work_items::helpers::serialize_patch(patch_document)?;
28        let p = ApiPath::work_item(id);
29        self.http.patch_json_patch(&p, &q, &body).await
30    }
31}