A better Rust ATProto crate
at main 3.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.stream.server.getWebhook 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[derive( 9 serde::Serialize, 10 serde::Deserialize, 11 Debug, 12 Clone, 13 PartialEq, 14 Eq, 15 bon::Builder, 16 jacquard_derive::IntoStatic 17)] 18#[builder(start_fn = new)] 19#[serde(rename_all = "camelCase")] 20pub struct GetWebhook<'a> { 21 #[serde(borrow)] 22 #[builder(into)] 23 pub id: jacquard_common::CowStr<'a>, 24} 25 26#[jacquard_derive::lexicon] 27#[derive( 28 serde::Serialize, 29 serde::Deserialize, 30 Debug, 31 Clone, 32 PartialEq, 33 Eq, 34 jacquard_derive::IntoStatic 35)] 36#[serde(rename_all = "camelCase")] 37pub struct GetWebhookOutput<'a> { 38 #[serde(borrow)] 39 pub webhook: crate::place_stream::server::Webhook<'a>, 40} 41 42#[jacquard_derive::open_union] 43#[derive( 44 serde::Serialize, 45 serde::Deserialize, 46 Debug, 47 Clone, 48 PartialEq, 49 Eq, 50 thiserror::Error, 51 miette::Diagnostic, 52 jacquard_derive::IntoStatic 53)] 54#[serde(tag = "error", content = "message")] 55#[serde(bound(deserialize = "'de: 'a"))] 56pub enum GetWebhookError<'a> { 57 /// The specified webhook was not found. 58 #[serde(rename = "WebhookNotFound")] 59 WebhookNotFound(std::option::Option<String>), 60 /// The authenticated user does not have access to this webhook. 61 #[serde(rename = "Unauthorized")] 62 Unauthorized(std::option::Option<String>), 63} 64 65impl std::fmt::Display for GetWebhookError<'_> { 66 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 67 match self { 68 Self::WebhookNotFound(msg) => { 69 write!(f, "WebhookNotFound")?; 70 if let Some(msg) = msg { 71 write!(f, ": {}", msg)?; 72 } 73 Ok(()) 74 } 75 Self::Unauthorized(msg) => { 76 write!(f, "Unauthorized")?; 77 if let Some(msg) = msg { 78 write!(f, ": {}", msg)?; 79 } 80 Ok(()) 81 } 82 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 83 } 84 } 85} 86 87///Response type for 88///place.stream.server.getWebhook 89pub struct GetWebhookResponse; 90impl jacquard_common::xrpc::XrpcResp for GetWebhookResponse { 91 const NSID: &'static str = "place.stream.server.getWebhook"; 92 const ENCODING: &'static str = "application/json"; 93 type Output<'de> = GetWebhookOutput<'de>; 94 type Err<'de> = GetWebhookError<'de>; 95} 96 97impl<'a> jacquard_common::xrpc::XrpcRequest for GetWebhook<'a> { 98 const NSID: &'static str = "place.stream.server.getWebhook"; 99 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 100 type Response = GetWebhookResponse; 101} 102 103///Endpoint type for 104///place.stream.server.getWebhook 105pub struct GetWebhookRequest; 106impl jacquard_common::xrpc::XrpcEndpoint for GetWebhookRequest { 107 const PATH: &'static str = "/xrpc/place.stream.server.getWebhook"; 108 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 109 type Request<'de> = GetWebhook<'de>; 110 type Response = GetWebhookResponse; 111}