Skip to main content

jacquard_api/app_bsky/graph/
mute_thread.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.graph.muteThread
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::string::AtUri;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16
17#[lexicon]
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct MuteThread<'a> {
21    #[serde(borrow)]
22    pub root: AtUri<'a>,
23}
24
25/// Response type for app.bsky.graph.muteThread
26pub struct MuteThreadResponse;
27impl jacquard_common::xrpc::XrpcResp for MuteThreadResponse {
28    const NSID: &'static str = "app.bsky.graph.muteThread";
29    const ENCODING: &'static str = "application/json";
30    type Output<'de> = ();
31    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
32}
33
34impl<'a> jacquard_common::xrpc::XrpcRequest for MuteThread<'a> {
35    const NSID: &'static str = "app.bsky.graph.muteThread";
36    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
37        "application/json",
38    );
39    type Response = MuteThreadResponse;
40}
41
42/// Endpoint type for app.bsky.graph.muteThread
43pub struct MuteThreadRequest;
44impl jacquard_common::xrpc::XrpcEndpoint for MuteThreadRequest {
45    const PATH: &'static str = "/xrpc/app.bsky.graph.muteThread";
46    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
47        "application/json",
48    );
49    type Request<'de> = MuteThread<'de>;
50    type Response = MuteThreadResponse;
51}
52
53pub mod mute_thread_state {
54
55    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
56    #[allow(unused)]
57    use ::core::marker::PhantomData;
58    mod sealed {
59        pub trait Sealed {}
60    }
61    /// State trait tracking which required fields have been set
62    pub trait State: sealed::Sealed {
63        type Root;
64    }
65    /// Empty state - all required fields are unset
66    pub struct Empty(());
67    impl sealed::Sealed for Empty {}
68    impl State for Empty {
69        type Root = Unset;
70    }
71    ///State transition - sets the `root` field to Set
72    pub struct SetRoot<S: State = Empty>(PhantomData<fn() -> S>);
73    impl<S: State> sealed::Sealed for SetRoot<S> {}
74    impl<S: State> State for SetRoot<S> {
75        type Root = Set<members::root>;
76    }
77    /// Marker types for field names
78    #[allow(non_camel_case_types)]
79    pub mod members {
80        ///Marker type for the `root` field
81        pub struct root(());
82    }
83}
84
85/// Builder for constructing an instance of this type
86pub struct MuteThreadBuilder<'a, S: mute_thread_state::State> {
87    _state: PhantomData<fn() -> S>,
88    _fields: (Option<AtUri<'a>>,),
89    _lifetime: PhantomData<&'a ()>,
90}
91
92impl<'a> MuteThread<'a> {
93    /// Create a new builder for this type
94    pub fn new() -> MuteThreadBuilder<'a, mute_thread_state::Empty> {
95        MuteThreadBuilder::new()
96    }
97}
98
99impl<'a> MuteThreadBuilder<'a, mute_thread_state::Empty> {
100    /// Create a new builder with all fields unset
101    pub fn new() -> Self {
102        MuteThreadBuilder {
103            _state: PhantomData,
104            _fields: (None,),
105            _lifetime: PhantomData,
106        }
107    }
108}
109
110impl<'a, S> MuteThreadBuilder<'a, S>
111where
112    S: mute_thread_state::State,
113    S::Root: mute_thread_state::IsUnset,
114{
115    /// Set the `root` field (required)
116    pub fn root(
117        mut self,
118        value: impl Into<AtUri<'a>>,
119    ) -> MuteThreadBuilder<'a, mute_thread_state::SetRoot<S>> {
120        self._fields.0 = Option::Some(value.into());
121        MuteThreadBuilder {
122            _state: PhantomData,
123            _fields: self._fields,
124            _lifetime: PhantomData,
125        }
126    }
127}
128
129impl<'a, S> MuteThreadBuilder<'a, S>
130where
131    S: mute_thread_state::State,
132    S::Root: mute_thread_state::IsSet,
133{
134    /// Build the final struct
135    pub fn build(self) -> MuteThread<'a> {
136        MuteThread {
137            root: self._fields.0.unwrap(),
138            extra_data: Default::default(),
139        }
140    }
141    /// Build the final struct with custom extra_data
142    pub fn build_with_data(
143        self,
144        extra_data: BTreeMap<
145            jacquard_common::deps::smol_str::SmolStr,
146            jacquard_common::types::value::Data<'a>,
147        >,
148    ) -> MuteThread<'a> {
149        MuteThread {
150            root: self._fields.0.unwrap(),
151            extra_data: Some(extra_data),
152        }
153    }
154}