pub struct CasePatch { /* private fields */ }Expand description
Changes to one case. Only the fields set here are sent. Unset fields retain their server values; an empty tag list removes all tags.
Implementations§
Source§impl CasePatch
impl CasePatch
Sourcepub fn new(id: impl Into<String>, version: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, version: impl Into<String>) -> Self
version must come from the most recent read; stale versions fail with HTTP 409.
pub fn status(self, status: CaseStatus) -> Self
pub fn title(self, title: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
pub fn severity(self, severity: Severity) -> Self
Sourcepub fn field(self, name: &str, value: impl Serialize) -> Result<Self>
pub fn field(self, name: &str, value: impl Serialize) -> Result<Self>
Sets an additional patchable field. The case ID and concurrency version
are reserved; supply them through Self::new.
use security_client_rs::{Error, cases::CasePatch};
use serde_json::{json, to_value};
let patch = CasePatch::new("case-a", "version-1");
assert!(matches!(patch.clone().field("id", "case-b"), Err(Error::InvalidRequest(_))));
assert!(matches!(patch.clone().field("version", "version-2"), Err(Error::InvalidRequest(_))));
let body = to_value(patch.field("assignees", json!([]))?)?;
assert_eq!(body["id"], "case-a");
assert_eq!(body["version"], "version-1");Trait Implementations§
Auto Trait Implementations§
impl Freeze for CasePatch
impl RefUnwindSafe for CasePatch
impl Send for CasePatch
impl Sync for CasePatch
impl Unpin for CasePatch
impl UnsafeUnpin for CasePatch
impl UnwindSafe for CasePatch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more