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