// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: place.stream.server.updateWebhook // // 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, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct UpdateWebhook<'a> { /// Whether this webhook should be active. #[serde(skip_serializing_if = "std::option::Option::is_none")] pub active: std::option::Option, /// A description of what this webhook is used for. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub description: std::option::Option>, /// The types of events this webhook should receive. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub events: std::option::Option>>, /// The ID of the webhook to update. #[serde(borrow)] pub id: jacquard_common::CowStr<'a>, /// 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")] #[serde(borrow)] pub mute_words: std::option::Option>>, /// A user-friendly name for this webhook. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub name: std::option::Option>, /// Text to prepend to webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub prefix: std::option::Option>, /// Text replacement rules for webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub rewrite: std::option::Option>>, /// Text to append to webhook messages. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub suffix: std::option::Option>, /// The webhook URL where events will be sent. #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub url: std::option::Option>, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct UpdateWebhookOutput<'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 UpdateWebhookError<'a> { /// The specified webhook was not found. #[serde(rename = "WebhookNotFound")] WebhookNotFound(std::option::Option), /// The authenticated user does not have access to this webhook. #[serde(rename = "Unauthorized")] Unauthorized(std::option::Option), /// 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), } impl std::fmt::Display for UpdateWebhookError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::WebhookNotFound(msg) => { write!(f, "WebhookNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unauthorized(msg) => { write!(f, "Unauthorized")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } 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::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } ///Response type for ///place.stream.server.updateWebhook pub struct UpdateWebhookResponse; impl jacquard_common::xrpc::XrpcResp for UpdateWebhookResponse { const NSID: &'static str = "place.stream.server.updateWebhook"; const ENCODING: &'static str = "application/json"; type Output<'de> = UpdateWebhookOutput<'de>; type Err<'de> = UpdateWebhookError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for UpdateWebhook<'a> { const NSID: &'static str = "place.stream.server.updateWebhook"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = UpdateWebhookResponse; } ///Endpoint type for ///place.stream.server.updateWebhook pub struct UpdateWebhookRequest; impl jacquard_common::xrpc::XrpcEndpoint for UpdateWebhookRequest { const PATH: &'static str = "/xrpc/place.stream.server.updateWebhook"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<'de> = UpdateWebhook<'de>; type Response = UpdateWebhookResponse; }