azure-devops 0.1.0

Idiomatic Rust client for Azure DevOps REST APIs
Documentation
use super::super::models::{JsonPatchOperation, WorkItem};
use super::super::options::UpdateWorkItemOptions;
use super::super::WorkItemsClient;
use crate::constants::ApiPath;
use crate::error::Result;

impl WorkItemsClient<'_> {
    /// Update an existing work item with additional options.
    ///
    /// # Arguments
    ///
    /// * `id` — The work item ID to update.
    /// * `patch_document` — A slice of [`JsonPatchOperation`] describing the fields to modify.
    /// * `options` — [`UpdateWorkItemOptions`] for validation, rule bypass, and notifications.
    ///
    /// # Returns
    ///
    /// The updated [`WorkItem`].
    pub async fn update_with_options(
        &self,
        id: i64,
        patch_document: &[JsonPatchOperation],
        options: &UpdateWorkItemOptions,
    ) -> Result<WorkItem> {
        let qp = options.to_query_params();
        let q = crate::util::ref_query(&qp);
        let body = crate::work_items::helpers::serialize_patch(patch_document)?;
        let p = ApiPath::work_item(id);
        self.http.patch_json_patch(&p, &q, &body).await
    }
}