jacquard_api/app_bsky/graph/
mute_thread.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::{BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::string::AtUri;
16use jacquard_common::types::value::Data;
17use jacquard_derive::IntoStatic;
18use serde::{Serialize, Deserialize};
19
20#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
21#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
22pub struct MuteThread<S: BosStr = DefaultStr> {
23 pub root: AtUri<S>,
24 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
25 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
26}
27
28pub struct MuteThreadResponse;
32impl jacquard_common::xrpc::XrpcResp for MuteThreadResponse {
33 const NSID: &'static str = "app.bsky.graph.muteThread";
34 const ENCODING: &'static str = "application/json";
35 type Output<S: BosStr> = ();
36 type Err = jacquard_common::xrpc::GenericError;
37}
38
39impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for MuteThread<S> {
40 const NSID: &'static str = "app.bsky.graph.muteThread";
41 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
42 "application/json",
43 );
44 type Response = MuteThreadResponse;
45}
46
47pub struct MuteThreadRequest;
51impl jacquard_common::xrpc::XrpcEndpoint for MuteThreadRequest {
52 const PATH: &'static str = "/xrpc/app.bsky.graph.muteThread";
53 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
54 "application/json",
55 );
56 type Request<S: BosStr> = MuteThread<S>;
57 type Response = MuteThreadResponse;
58}
59
60pub mod mute_thread_state {
61
62 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
63 #[allow(unused)]
64 use ::core::marker::PhantomData;
65 mod sealed {
66 pub trait Sealed {}
67 }
68 pub trait State: sealed::Sealed {
70 type Root;
71 }
72 pub struct Empty(());
74 impl sealed::Sealed for Empty {}
75 impl State for Empty {
76 type Root = Unset;
77 }
78 pub struct SetRoot<St: State = Empty>(PhantomData<fn() -> St>);
80 impl<St: State> sealed::Sealed for SetRoot<St> {}
81 impl<St: State> State for SetRoot<St> {
82 type Root = Set<members::root>;
83 }
84 #[allow(non_camel_case_types)]
86 pub mod members {
87 pub struct root(());
89 }
90}
91
92pub struct MuteThreadBuilder<St: mute_thread_state::State, S: BosStr = DefaultStr> {
94 _state: PhantomData<fn() -> St>,
95 _fields: (Option<AtUri<S>>,),
96 _type: PhantomData<fn() -> S>,
97}
98
99impl MuteThread<DefaultStr> {
100 pub fn new() -> MuteThreadBuilder<mute_thread_state::Empty, DefaultStr> {
102 MuteThreadBuilder::new()
103 }
104}
105
106impl<S: BosStr> MuteThread<S> {
107 pub fn builder() -> MuteThreadBuilder<mute_thread_state::Empty, S> {
109 MuteThreadBuilder::builder()
110 }
111}
112
113impl MuteThreadBuilder<mute_thread_state::Empty, DefaultStr> {
114 pub fn new() -> Self {
116 MuteThreadBuilder {
117 _state: PhantomData,
118 _fields: (None,),
119 _type: PhantomData,
120 }
121 }
122}
123
124impl<S: BosStr> MuteThreadBuilder<mute_thread_state::Empty, S> {
125 pub fn builder() -> Self {
127 MuteThreadBuilder {
128 _state: PhantomData,
129 _fields: (None,),
130 _type: PhantomData,
131 }
132 }
133}
134
135impl<St, S: BosStr> MuteThreadBuilder<St, S>
136where
137 St: mute_thread_state::State,
138 St::Root: mute_thread_state::IsUnset,
139{
140 pub fn root(
142 mut self,
143 value: impl Into<AtUri<S>>,
144 ) -> MuteThreadBuilder<mute_thread_state::SetRoot<St>, S> {
145 self._fields.0 = Option::Some(value.into());
146 MuteThreadBuilder {
147 _state: PhantomData,
148 _fields: self._fields,
149 _type: PhantomData,
150 }
151 }
152}
153
154impl<St, S: BosStr> MuteThreadBuilder<St, S>
155where
156 St: mute_thread_state::State,
157 St::Root: mute_thread_state::IsSet,
158{
159 pub fn build(self) -> MuteThread<S> {
161 MuteThread {
162 root: self._fields.0.unwrap(),
163 extra_data: Default::default(),
164 }
165 }
166 pub fn build_with_data(
168 self,
169 extra_data: BTreeMap<SmolStr, Data<S>>,
170 ) -> MuteThread<S> {
171 MuteThread {
172 root: self._fields.0.unwrap(),
173 extra_data: Some(extra_data),
174 }
175 }
176}