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