// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: place.stream.server.createWebhook // // 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, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] #[builder(start_fn = new)] pub struct CreateWebhook<'a> { /// Whether this webhook should be active upon creation. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] pub active: Option, /// A description of what this webhook is used for. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub description: Option>, /// The types of events this webhook should receive. #[serde(borrow)] pub events: Vec>, /// Words to filter out from chat messages. Messages containing any of these words will not be forwarded. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub mute_words: Option>>, /// A user-friendly name for this webhook. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub name: Option>, /// Text to prepend to webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub prefix: Option>, /// Text replacement rules for webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub rewrite: Option>>, /// Text to append to webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub suffix: Option>, /// The webhook URL where events will be sent. #[serde(borrow)] pub url: jacquard_common::types::string::Uri<'a>, #[serde(flatten)] #[serde(borrow)] #[builder(default)] pub extra_data: ::std::collections::BTreeMap< ::jacquard_common::smol_str::SmolStr, ::jacquard_common::types::value::Data<'a>, >, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct CreateWebhookOutput<'a> { #[serde(borrow)] pub webhook: crate::place_stream::server::Webhook<'a>, } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum CreateWebhookError<'a> { /// The provided webhook URL is invalid or unreachable. #[serde(rename = "InvalidUrl")] InvalidUrl(std::option::Option), /// A webhook with this URL already exists for this user. #[serde(rename = "DuplicateWebhook")] DuplicateWebhook(std::option::Option), /// The user has reached their maximum number of webhooks. #[serde(rename = "TooManyWebhooks")] TooManyWebhooks(std::option::Option), } impl std::fmt::Display for CreateWebhookError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::InvalidUrl(msg) => { write!(f, "InvalidUrl")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::DuplicateWebhook(msg) => { write!(f, "DuplicateWebhook")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::TooManyWebhooks(msg) => { write!(f, "TooManyWebhooks")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } ///Response type for ///place.stream.server.createWebhook pub struct CreateWebhookResponse; impl jacquard_common::xrpc::XrpcResp for CreateWebhookResponse { const NSID: &'static str = "place.stream.server.createWebhook"; const ENCODING: &'static str = "application/json"; type Output<'de> = CreateWebhookOutput<'de>; type Err<'de> = CreateWebhookError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for CreateWebhook<'a> { const NSID: &'static str = "place.stream.server.createWebhook"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = CreateWebhookResponse; } ///Endpoint type for ///place.stream.server.createWebhook pub struct CreateWebhookRequest; impl jacquard_common::xrpc::XrpcEndpoint for CreateWebhookRequest { const PATH: &'static str = "/xrpc/place.stream.server.createWebhook"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = CreateWebhook<'de>; type Response = CreateWebhookResponse; }