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::{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
28/** Response marker for the `app.bsky.graph.muteThread` procedure.
29
30Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `()` for this endpoint.*/
31pub 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
47/** Endpoint marker for the `app.bsky.graph.muteThread` procedure.
48
49Path: `/xrpc/app.bsky.graph.muteThread`. The request payload type is `MuteThread<S>`; send that request with `jacquard::Client` or use this marker through lower-level `XrpcEndpoint` APIs.*/
50pub 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    /// State trait tracking which required fields have been set
69    pub trait State: sealed::Sealed {
70        type Root;
71    }
72    /// Empty state - all required fields are unset
73    pub struct Empty(());
74    impl sealed::Sealed for Empty {}
75    impl State for Empty {
76        type Root = Unset;
77    }
78    ///State transition - sets the `root` field to Set
79    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    /// Marker types for field names
85    #[allow(non_camel_case_types)]
86    pub mod members {
87        ///Marker type for the `root` field
88        pub struct root(());
89    }
90}
91
92/// Builder for constructing an instance of this type.
93pub 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    /// Create a new builder for this type, using the default string type (DefaultStr = SmolStr) if needed
101    pub fn new() -> MuteThreadBuilder<mute_thread_state::Empty, DefaultStr> {
102        MuteThreadBuilder::new()
103    }
104}
105
106impl<S: BosStr> MuteThread<S> {
107    /// Create a new builder for this type
108    pub fn builder() -> MuteThreadBuilder<mute_thread_state::Empty, S> {
109        MuteThreadBuilder::builder()
110    }
111}
112
113impl MuteThreadBuilder<mute_thread_state::Empty, DefaultStr> {
114    /// Create a new builder with all fields unset, using the default string type, if needed
115    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    /// Create a new builder with all fields unset
126    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    /// Set the `root` field (required)
141    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    /// Build the final struct.
160    pub fn build(self) -> MuteThread<S> {
161        MuteThread {
162            root: self._fields.0.unwrap(),
163            extra_data: Default::default(),
164        }
165    }
166    /// Build the final struct with custom extra_data.
167    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}