A better Rust ATProto crate
at main 3.6 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: place.stream.server.listWebhooks 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 ListWebhooks<'a> { 21 #[serde(skip_serializing_if = "std::option::Option::is_none")] 22 pub active: std::option::Option<bool>, 23 #[serde(skip_serializing_if = "std::option::Option::is_none")] 24 #[serde(borrow)] 25 #[builder(into)] 26 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[serde(borrow)] 29 #[builder(into)] 30 pub event: std::option::Option<jacquard_common::CowStr<'a>>, 31 ///(default: 50, min: 1, max: 100) 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 pub limit: std::option::Option<i64>, 34} 35 36#[jacquard_derive::lexicon] 37#[derive( 38 serde::Serialize, 39 serde::Deserialize, 40 Debug, 41 Clone, 42 PartialEq, 43 Eq, 44 jacquard_derive::IntoStatic 45)] 46#[serde(rename_all = "camelCase")] 47pub struct ListWebhooksOutput<'a> { 48 /// A cursor for pagination, if there are more results. 49 #[serde(skip_serializing_if = "std::option::Option::is_none")] 50 #[serde(borrow)] 51 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>, 52 #[serde(borrow)] 53 pub webhooks: Vec<crate::place_stream::server::Webhook<'a>>, 54} 55 56#[jacquard_derive::open_union] 57#[derive( 58 serde::Serialize, 59 serde::Deserialize, 60 Debug, 61 Clone, 62 PartialEq, 63 Eq, 64 thiserror::Error, 65 miette::Diagnostic, 66 jacquard_derive::IntoStatic 67)] 68#[serde(tag = "error", content = "message")] 69#[serde(bound(deserialize = "'de: 'a"))] 70pub enum ListWebhooksError<'a> { 71 /// The provided cursor is invalid or expired. 72 #[serde(rename = "InvalidCursor")] 73 InvalidCursor(std::option::Option<String>), 74} 75 76impl std::fmt::Display for ListWebhooksError<'_> { 77 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 78 match self { 79 Self::InvalidCursor(msg) => { 80 write!(f, "InvalidCursor")?; 81 if let Some(msg) = msg { 82 write!(f, ": {}", msg)?; 83 } 84 Ok(()) 85 } 86 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 87 } 88 } 89} 90 91///Response type for 92///place.stream.server.listWebhooks 93pub struct ListWebhooksResponse; 94impl jacquard_common::xrpc::XrpcResp for ListWebhooksResponse { 95 const NSID: &'static str = "place.stream.server.listWebhooks"; 96 const ENCODING: &'static str = "application/json"; 97 type Output<'de> = ListWebhooksOutput<'de>; 98 type Err<'de> = ListWebhooksError<'de>; 99} 100 101impl<'a> jacquard_common::xrpc::XrpcRequest for ListWebhooks<'a> { 102 const NSID: &'static str = "place.stream.server.listWebhooks"; 103 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 104 type Response = ListWebhooksResponse; 105} 106 107///Endpoint type for 108///place.stream.server.listWebhooks 109pub struct ListWebhooksRequest; 110impl jacquard_common::xrpc::XrpcEndpoint for ListWebhooksRequest { 111 const PATH: &'static str = "/xrpc/place.stream.server.listWebhooks"; 112 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 113 type Request<'de> = ListWebhooks<'de>; 114 type Response = ListWebhooksResponse; 115}