atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.ageassurance.getState
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct GetState<'a> {
19 #[serde(borrow)]
20 pub country_code: jacquard_common::CowStr<'a>,
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 pub region_code: std::option::Option<jacquard_common::CowStr<'a>>,
24}
25
26pub mod get_state_state {
27
28 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
29 #[allow(unused)]
30 use ::core::marker::PhantomData;
31 mod sealed {
32 pub trait Sealed {}
33 }
34 /// State trait tracking which required fields have been set
35 pub trait State: sealed::Sealed {
36 type CountryCode;
37 }
38 /// Empty state - all required fields are unset
39 pub struct Empty(());
40 impl sealed::Sealed for Empty {}
41 impl State for Empty {
42 type CountryCode = Unset;
43 }
44 ///State transition - sets the `country_code` field to Set
45 pub struct SetCountryCode<S: State = Empty>(PhantomData<fn() -> S>);
46 impl<S: State> sealed::Sealed for SetCountryCode<S> {}
47 impl<S: State> State for SetCountryCode<S> {
48 type CountryCode = Set<members::country_code>;
49 }
50 /// Marker types for field names
51 #[allow(non_camel_case_types)]
52 pub mod members {
53 ///Marker type for the `country_code` field
54 pub struct country_code(());
55 }
56}
57
58/// Builder for constructing an instance of this type
59pub struct GetStateBuilder<'a, S: get_state_state::State> {
60 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
61 __unsafe_private_named: (
62 ::core::option::Option<jacquard_common::CowStr<'a>>,
63 ::core::option::Option<jacquard_common::CowStr<'a>>,
64 ),
65 _phantom: ::core::marker::PhantomData<&'a ()>,
66}
67
68impl<'a> GetState<'a> {
69 /// Create a new builder for this type
70 pub fn new() -> GetStateBuilder<'a, get_state_state::Empty> {
71 GetStateBuilder::new()
72 }
73}
74
75impl<'a> GetStateBuilder<'a, get_state_state::Empty> {
76 /// Create a new builder with all fields unset
77 pub fn new() -> Self {
78 GetStateBuilder {
79 _phantom_state: ::core::marker::PhantomData,
80 __unsafe_private_named: (None, None),
81 _phantom: ::core::marker::PhantomData,
82 }
83 }
84}
85
86impl<'a, S> GetStateBuilder<'a, S>
87where
88 S: get_state_state::State,
89 S::CountryCode: get_state_state::IsUnset,
90{
91 /// Set the `countryCode` field (required)
92 pub fn country_code(
93 mut self,
94 value: impl Into<jacquard_common::CowStr<'a>>,
95 ) -> GetStateBuilder<'a, get_state_state::SetCountryCode<S>> {
96 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
97 GetStateBuilder {
98 _phantom_state: ::core::marker::PhantomData,
99 __unsafe_private_named: self.__unsafe_private_named,
100 _phantom: ::core::marker::PhantomData,
101 }
102 }
103}
104
105impl<'a, S: get_state_state::State> GetStateBuilder<'a, S> {
106 /// Set the `regionCode` field (optional)
107 pub fn region_code(
108 mut self,
109 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
110 ) -> Self {
111 self.__unsafe_private_named.1 = value.into();
112 self
113 }
114 /// Set the `regionCode` field to an Option value (optional)
115 pub fn maybe_region_code(
116 mut self,
117 value: Option<jacquard_common::CowStr<'a>>,
118 ) -> Self {
119 self.__unsafe_private_named.1 = value;
120 self
121 }
122}
123
124impl<'a, S> GetStateBuilder<'a, S>
125where
126 S: get_state_state::State,
127 S::CountryCode: get_state_state::IsSet,
128{
129 /// Build the final struct
130 pub fn build(self) -> GetState<'a> {
131 GetState {
132 country_code: self.__unsafe_private_named.0.unwrap(),
133 region_code: self.__unsafe_private_named.1,
134 }
135 }
136}
137
138#[jacquard_derive::lexicon]
139#[derive(
140 serde::Serialize,
141 serde::Deserialize,
142 Debug,
143 Clone,
144 PartialEq,
145 Eq,
146 jacquard_derive::IntoStatic
147)]
148#[serde(rename_all = "camelCase")]
149pub struct GetStateOutput<'a> {
150 #[serde(borrow)]
151 pub metadata: crate::app_bsky::ageassurance::StateMetadata<'a>,
152 #[serde(borrow)]
153 pub state: crate::app_bsky::ageassurance::State<'a>,
154}
155
156/// Response type for
157///app.bsky.ageassurance.getState
158pub struct GetStateResponse;
159impl jacquard_common::xrpc::XrpcResp for GetStateResponse {
160 const NSID: &'static str = "app.bsky.ageassurance.getState";
161 const ENCODING: &'static str = "application/json";
162 type Output<'de> = GetStateOutput<'de>;
163 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
164}
165
166impl<'a> jacquard_common::xrpc::XrpcRequest for GetState<'a> {
167 const NSID: &'static str = "app.bsky.ageassurance.getState";
168 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
169 type Response = GetStateResponse;
170}
171
172/// Endpoint type for
173///app.bsky.ageassurance.getState
174pub struct GetStateRequest;
175impl jacquard_common::xrpc::XrpcEndpoint for GetStateRequest {
176 const PATH: &'static str = "/xrpc/app.bsky.ageassurance.getState";
177 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
178 type Request<'de> = GetState<'de>;
179 type Response = GetStateResponse;
180}