A better Rust ATProto crate
at lifetimes 4.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.stream.server.deleteWebhook 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 DeleteWebhook<'a> { 22 ///The ID of the webhook to delete. 23 #[serde(borrow)] 24 #[builder(into)] 25 pub id: jacquard_common::CowStr<'a>, 26 #[serde(flatten)] 27 #[serde(borrow)] 28 #[builder(default)] 29 pub extra_data: ::std::collections::BTreeMap< 30 ::jacquard_common::smol_str::SmolStr, 31 ::jacquard_common::types::value::Data<'a>, 32 >, 33} 34 35#[jacquard_derive::lexicon] 36#[derive( 37 serde::Serialize, 38 serde::Deserialize, 39 Debug, 40 Clone, 41 PartialEq, 42 Eq, 43 jacquard_derive::IntoStatic 44)] 45#[serde(rename_all = "camelCase")] 46pub struct DeleteWebhookOutput<'a> { 47 ///Whether the webhook was successfully deleted. 48 pub success: bool, 49} 50 51#[jacquard_derive::open_union] 52#[derive( 53 serde::Serialize, 54 serde::Deserialize, 55 Debug, 56 Clone, 57 PartialEq, 58 Eq, 59 thiserror::Error, 60 miette::Diagnostic 61)] 62#[serde(tag = "error", content = "message")] 63#[serde(bound(deserialize = "'de: 'a"))] 64pub enum DeleteWebhookError<'a> { 65 ///The specified webhook was not found. 66 #[serde(rename = "WebhookNotFound")] 67 WebhookNotFound(std::option::Option<String>), 68 ///The authenticated user does not have access to this webhook. 69 #[serde(rename = "Unauthorized")] 70 Unauthorized(std::option::Option<String>), 71} 72 73impl std::fmt::Display for DeleteWebhookError<'_> { 74 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 75 match self { 76 Self::WebhookNotFound(msg) => { 77 write!(f, "WebhookNotFound")?; 78 if let Some(msg) = msg { 79 write!(f, ": {}", msg)?; 80 } 81 Ok(()) 82 } 83 Self::Unauthorized(msg) => { 84 write!(f, "Unauthorized")?; 85 if let Some(msg) = msg { 86 write!(f, ": {}", msg)?; 87 } 88 Ok(()) 89 } 90 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 91 } 92 } 93} 94 95impl jacquard_common::IntoStatic for DeleteWebhookError<'_> { 96 type Output = DeleteWebhookError<'static>; 97 fn into_static(self) -> Self::Output { 98 match self { 99 DeleteWebhookError::WebhookNotFound(v) => { 100 DeleteWebhookError::WebhookNotFound(v.into_static()) 101 } 102 DeleteWebhookError::Unauthorized(v) => { 103 DeleteWebhookError::Unauthorized(v.into_static()) 104 } 105 DeleteWebhookError::Unknown(v) => { 106 DeleteWebhookError::Unknown(v.into_static()) 107 } 108 } 109 } 110} 111 112///Response type for 113///place.stream.server.deleteWebhook 114pub struct DeleteWebhookResponse; 115impl jacquard_common::xrpc::XrpcResp for DeleteWebhookResponse { 116 const NSID: &'static str = "place.stream.server.deleteWebhook"; 117 const ENCODING: &'static str = "application/json"; 118 type Output<'de> = DeleteWebhookOutput<'de>; 119 type Err<'de> = DeleteWebhookError<'de>; 120} 121 122impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for DeleteWebhook<'de> { 123 const NSID: &'static str = "place.stream.server.deleteWebhook"; 124 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 125 "application/json", 126 ); 127 type Response = DeleteWebhookResponse; 128} 129 130///Endpoint type for 131///place.stream.server.deleteWebhook 132pub struct DeleteWebhookRequest; 133impl jacquard_common::xrpc::XrpcEndpoint for DeleteWebhookRequest { 134 const PATH: &'static str = "/xrpc/place.stream.server.deleteWebhook"; 135 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 136 "application/json", 137 ); 138 type Request<'de> = DeleteWebhook<'de>; 139 type Response = DeleteWebhookResponse; 140}