A better Rust ATProto crate
at main 3.8 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: tools.ozone.safelink.removeRule 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[jacquard_derive::lexicon] 9#[derive( 10 serde::Serialize, 11 serde::Deserialize, 12 Debug, 13 Clone, 14 PartialEq, 15 Eq, 16 bon::Builder, 17 jacquard_derive::IntoStatic 18)] 19#[serde(rename_all = "camelCase")] 20#[builder(start_fn = new)] 21pub struct RemoveRule<'a> { 22 /// Optional comment about why the rule is being removed 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[builder(into)] 25 #[serde(borrow)] 26 pub comment: Option<jacquard_common::CowStr<'a>>, 27 /// Optional DID of the user. Only respected when using admin auth. 28 #[serde(skip_serializing_if = "std::option::Option::is_none")] 29 #[builder(into)] 30 #[serde(borrow)] 31 pub created_by: Option<jacquard_common::types::string::Did<'a>>, 32 #[serde(borrow)] 33 pub pattern: crate::tools_ozone::safelink::PatternType<'a>, 34 /// The URL or domain to remove the rule for 35 #[serde(borrow)] 36 #[builder(into)] 37 pub url: jacquard_common::CowStr<'a>, 38 #[serde(flatten)] 39 #[serde(borrow)] 40 #[builder(default)] 41 pub extra_data: ::std::collections::BTreeMap< 42 ::jacquard_common::smol_str::SmolStr, 43 ::jacquard_common::types::value::Data<'a>, 44 >, 45} 46 47#[jacquard_derive::lexicon] 48#[derive( 49 serde::Serialize, 50 serde::Deserialize, 51 Debug, 52 Clone, 53 PartialEq, 54 Eq, 55 jacquard_derive::IntoStatic 56)] 57#[serde(rename_all = "camelCase")] 58pub struct RemoveRuleOutput<'a> { 59 #[serde(flatten)] 60 #[serde(borrow)] 61 pub value: crate::tools_ozone::safelink::Event<'a>, 62} 63 64#[jacquard_derive::open_union] 65#[derive( 66 serde::Serialize, 67 serde::Deserialize, 68 Debug, 69 Clone, 70 PartialEq, 71 Eq, 72 thiserror::Error, 73 miette::Diagnostic, 74 jacquard_derive::IntoStatic 75)] 76#[serde(tag = "error", content = "message")] 77#[serde(bound(deserialize = "'de: 'a"))] 78pub enum RemoveRuleError<'a> { 79 /// No active rule found for this URL/domain 80 #[serde(rename = "RuleNotFound")] 81 RuleNotFound(std::option::Option<String>), 82} 83 84impl std::fmt::Display for RemoveRuleError<'_> { 85 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 86 match self { 87 Self::RuleNotFound(msg) => { 88 write!(f, "RuleNotFound")?; 89 if let Some(msg) = msg { 90 write!(f, ": {}", msg)?; 91 } 92 Ok(()) 93 } 94 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 95 } 96 } 97} 98 99///Response type for 100///tools.ozone.safelink.removeRule 101pub struct RemoveRuleResponse; 102impl jacquard_common::xrpc::XrpcResp for RemoveRuleResponse { 103 const NSID: &'static str = "tools.ozone.safelink.removeRule"; 104 const ENCODING: &'static str = "application/json"; 105 type Output<'de> = RemoveRuleOutput<'de>; 106 type Err<'de> = RemoveRuleError<'de>; 107} 108 109impl<'a> jacquard_common::xrpc::XrpcRequest for RemoveRule<'a> { 110 const NSID: &'static str = "tools.ozone.safelink.removeRule"; 111 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 112 "application/json", 113 ); 114 type Response = RemoveRuleResponse; 115} 116 117///Endpoint type for 118///tools.ozone.safelink.removeRule 119pub struct RemoveRuleRequest; 120impl jacquard_common::xrpc::XrpcEndpoint for RemoveRuleRequest { 121 const PATH: &'static str = "/xrpc/tools.ozone.safelink.removeRule"; 122 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 123 "application/json", 124 ); 125 type Request<'de> = RemoveRule<'de>; 126 type Response = RemoveRuleResponse; 127}