// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: tools.ozone.safelink.removeRule // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder )] #[serde(rename_all = "camelCase")] #[builder(start_fn = new)] pub struct RemoveRule<'a> { ///Optional comment about why the rule is being removed #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub comment: std::option::Option>, ///Optional DID of the user. Only respected when using admin auth. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub created_by: std::option::Option>, #[serde(borrow)] pub pattern: crate::tools_ozone::safelink::PatternType<'a>, ///The URL or domain to remove the rule for #[serde(borrow)] #[builder(into)] pub url: jacquard_common::CowStr<'a>, #[serde(flatten)] #[serde(borrow)] #[builder(default)] pub extra_data: ::std::collections::BTreeMap< ::jacquard_common::smol_str::SmolStr, ::jacquard_common::types::value::Data<'a>, >, } impl jacquard_common::IntoStatic for RemoveRule<'_> { type Output = RemoveRule<'static>; fn into_static(self) -> Self::Output { RemoveRule { comment: self.comment.into_static(), created_by: self.created_by.into_static(), pattern: self.pattern.into_static(), url: self.url.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::lexicon] #[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "camelCase")] pub struct RemoveRuleOutput<'a> { #[serde(flatten)] #[serde(borrow)] pub value: crate::tools_ozone::safelink::Event<'a>, } impl jacquard_common::IntoStatic for RemoveRuleOutput<'_> { type Output = RemoveRuleOutput<'static>; fn into_static(self) -> Self::Output { RemoveRuleOutput { value: self.value.into_static(), extra_data: self.extra_data.into_static(), } } } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum RemoveRuleError<'a> { ///No active rule found for this URL/domain #[serde(rename = "RuleNotFound")] RuleNotFound(std::option::Option), } impl std::fmt::Display for RemoveRuleError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::RuleNotFound(msg) => { write!(f, "RuleNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } impl jacquard_common::IntoStatic for RemoveRuleError<'_> { type Output = RemoveRuleError<'static>; fn into_static(self) -> Self::Output { match self { RemoveRuleError::RuleNotFound(v) => { RemoveRuleError::RuleNotFound(v.into_static()) } RemoveRuleError::Unknown(v) => RemoveRuleError::Unknown(v.into_static()), } } } impl jacquard_common::types::xrpc::XrpcRequest for RemoveRule<'_> { const NSID: &'static str = "tools.ozone.safelink.removeRule"; const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure( "application/json", ); const OUTPUT_ENCODING: &'static str = "application/json"; type Output<'de> = RemoveRuleOutput<'de>; type Err<'de> = RemoveRuleError<'de>; }