Something went wrong. Try again.
atproto made easy crates.io/crates/jacquard
atproto rust
Something went wrong. Try again.
7.6 kB · 234 lines
Rust
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: stream.kralsei.pushInteraction//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
#[allow(unused_imports)]use alloc::collections::BTreeMap;
#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::deps::smol_str::SmolStr;use jacquard_common::types::value::Data;use jacquard_common::{BosStr, CowStr, DefaultStr, FromStaticStr};use jacquard_derive::IntoStatic;use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]#[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct PushInteraction<S: BosStr = DefaultStr> { /// The character the interaction with is #[serde(skip_serializing_if = "Option::is_none")] pub character: Option<PushInteractionCharacter<S>>, /// Type of interaction #[serde(skip_serializing_if = "Option::is_none")] pub interaction: Option<PushInteractionInteraction<S>>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/// The character the interaction with is
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum PushInteractionCharacter<S: BosStr = DefaultStr> { Kris, Ralsei, Other(S),}
impl<S: BosStr> PushInteractionCharacter<S> { pub fn as_str(&self) -> &str { match self { Self::Kris => "kris", Self::Ralsei => "ralsei", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "kris" => Self::Kris, "ralsei" => Self::Ralsei, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for PushInteractionCharacter<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for PushInteractionCharacter<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for PushInteractionCharacter<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for PushInteractionCharacter<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for PushInteractionCharacter<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for PushInteractionCharacter<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = PushInteractionCharacter<S::Output>; fn into_static(self) -> Self::Output { match self { PushInteractionCharacter::Kris => PushInteractionCharacter::Kris, PushInteractionCharacter::Ralsei => PushInteractionCharacter::Ralsei, PushInteractionCharacter::Other(v) => PushInteractionCharacter::Other(v.into_static()), } }}
/// Type of interaction
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum PushInteractionInteraction<S: BosStr = DefaultStr> { Boop, Hug, Other(S),}
impl<S: BosStr> PushInteractionInteraction<S> { pub fn as_str(&self) -> &str { match self { Self::Boop => "boop", Self::Hug => "hug", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "boop" => Self::Boop, "hug" => Self::Hug, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for PushInteractionInteraction<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for PushInteractionInteraction<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for PushInteractionInteraction<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de> for PushInteractionInteraction<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for PushInteractionInteraction<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for PushInteractionInteraction<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = PushInteractionInteraction<S::Output>; fn into_static(self) -> Self::Output { match self { PushInteractionInteraction::Boop => PushInteractionInteraction::Boop, PushInteractionInteraction::Hug => PushInteractionInteraction::Hug, PushInteractionInteraction::Other(v) => { PushInteractionInteraction::Other(v.into_static()) } } }}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde( rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct PushInteractionOutput<S: BosStr = DefaultStr> { pub success: bool, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/** Response marker for the `stream.kralsei.pushInteraction` procedure.
Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `PushInteractionOutput<S>` for this endpoint.*/pub struct PushInteractionResponse;impl jacquard_common::xrpc::XrpcResp for PushInteractionResponse { const NSID: &'static str = "stream.kralsei.pushInteraction"; const ENCODING: &'static str = "application/json"; type Output<S: BosStr> = PushInteractionOutput<S>; type Err = jacquard_common::xrpc::GenericError;}
impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for PushInteraction<S> { const NSID: &'static str = "stream.kralsei.pushInteraction"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); type Response = PushInteractionResponse;}
/** Endpoint marker for the `stream.kralsei.pushInteraction` procedure.
Path: `/xrpc/stream.kralsei.pushInteraction`. The request payload type is `PushInteraction<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/pub struct PushInteractionRequest;impl jacquard_common::xrpc::XrpcEndpoint for PushInteractionRequest { const PATH: &'static str = "/xrpc/stream.kralsei.pushInteraction"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure("application/json"); type Request<S: BosStr> = PushInteraction<S>; type Response = PushInteractionResponse;}