1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.label.subscribeLabels
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
10#[serde(rename_all = "camelCase")]
11pub struct Info<'a> {
12 #[serde(skip_serializing_if = "std::option::Option::is_none")]
13 #[serde(borrow)]
14 pub message: std::option::Option<jacquard_common::CowStr<'a>>,
15 #[serde(borrow)]
16 pub name: jacquard_common::CowStr<'a>,
17}
18
19impl jacquard_common::IntoStatic for Info<'_> {
20 type Output = Info<'static>;
21 fn into_static(self) -> Self::Output {
22 Info {
23 message: self.message.into_static(),
24 name: self.name.into_static(),
25 extra_data: self.extra_data.into_static(),
26 }
27 }
28}
29
30#[jacquard_derive::lexicon]
31#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
32#[serde(rename_all = "camelCase")]
33pub struct Labels<'a> {
34 #[serde(borrow)]
35 pub labels: Vec<crate::com_atproto::label::Label<'a>>,
36 pub seq: i64,
37}
38
39impl jacquard_common::IntoStatic for Labels<'_> {
40 type Output = Labels<'static>;
41 fn into_static(self) -> Self::Output {
42 Labels {
43 labels: self.labels.into_static(),
44 seq: self.seq.into_static(),
45 extra_data: self.extra_data.into_static(),
46 }
47 }
48}
49
50#[derive(
51 serde::Serialize,
52 serde::Deserialize,
53 Debug,
54 Clone,
55 PartialEq,
56 Eq,
57 bon::Builder
58)]
59#[builder(start_fn = new)]
60#[serde(rename_all = "camelCase")]
61pub struct SubscribeLabels {
62 #[serde(skip_serializing_if = "std::option::Option::is_none")]
63 pub cursor: std::option::Option<i64>,
64}
65
66impl jacquard_common::IntoStatic for SubscribeLabels {
67 type Output = SubscribeLabels;
68 fn into_static(self) -> Self::Output {
69 self
70 }
71}
72
73#[jacquard_derive::open_union]
74#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
75#[serde(tag = "$type")]
76#[serde(bound(deserialize = "'de: 'a"))]
77pub enum SubscribeLabelsMessage<'a> {
78 #[serde(rename = "#labels")]
79 Labels(Box<jacquard_common::types::value::Data<'a>>),
80 #[serde(rename = "#info")]
81 Info(Box<jacquard_common::types::value::Data<'a>>),
82}
83
84impl jacquard_common::IntoStatic for SubscribeLabelsMessage<'_> {
85 type Output = SubscribeLabelsMessage<'static>;
86 fn into_static(self) -> Self::Output {
87 match self {
88 SubscribeLabelsMessage::Labels(v) => {
89 SubscribeLabelsMessage::Labels(v.into_static())
90 }
91 SubscribeLabelsMessage::Info(v) => {
92 SubscribeLabelsMessage::Info(v.into_static())
93 }
94 SubscribeLabelsMessage::Unknown(v) => {
95 SubscribeLabelsMessage::Unknown(v.into_static())
96 }
97 }
98 }
99}
100
101#[jacquard_derive::open_union]
102#[derive(
103 serde::Serialize,
104 serde::Deserialize,
105 Debug,
106 Clone,
107 PartialEq,
108 Eq,
109 thiserror::Error,
110 miette::Diagnostic
111)]
112#[serde(tag = "error", content = "message")]
113#[serde(bound(deserialize = "'de: 'a"))]
114pub enum SubscribeLabelsError<'a> {
115 #[serde(rename = "FutureCursor")]
116 FutureCursor(std::option::Option<String>),
117}
118
119impl std::fmt::Display for SubscribeLabelsError<'_> {
120 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
121 match self {
122 Self::FutureCursor(msg) => {
123 write!(f, "FutureCursor")?;
124 if let Some(msg) = msg {
125 write!(f, ": {}", msg)?;
126 }
127 Ok(())
128 }
129 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
130 }
131 }
132}
133
134impl jacquard_common::IntoStatic for SubscribeLabelsError<'_> {
135 type Output = SubscribeLabelsError<'static>;
136 fn into_static(self) -> Self::Output {
137 match self {
138 SubscribeLabelsError::FutureCursor(v) => {
139 SubscribeLabelsError::FutureCursor(v.into_static())
140 }
141 SubscribeLabelsError::Unknown(v) => {
142 SubscribeLabelsError::Unknown(v.into_static())
143 }
144 }
145 }
146}