atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.getFeedGenerator
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 GetFeedGenerator<'a> {
19 #[serde(borrow)]
20 pub feed: jacquard_common::types::string::AtUri<'a>,
21}
22
23pub mod get_feed_generator_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 Feed;
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 Feed = Unset;
40 }
41 ///State transition - sets the `feed` field to Set
42 pub struct SetFeed<S: State = Empty>(PhantomData<fn() -> S>);
43 impl<S: State> sealed::Sealed for SetFeed<S> {}
44 impl<S: State> State for SetFeed<S> {
45 type Feed = Set<members::feed>;
46 }
47 /// Marker types for field names
48 #[allow(non_camel_case_types)]
49 pub mod members {
50 ///Marker type for the `feed` field
51 pub struct feed(());
52 }
53}
54
55/// Builder for constructing an instance of this type
56pub struct GetFeedGeneratorBuilder<'a, S: get_feed_generator_state::State> {
57 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
58 __unsafe_private_named: (
59 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
60 ),
61 _phantom: ::core::marker::PhantomData<&'a ()>,
62}
63
64impl<'a> GetFeedGenerator<'a> {
65 /// Create a new builder for this type
66 pub fn new() -> GetFeedGeneratorBuilder<'a, get_feed_generator_state::Empty> {
67 GetFeedGeneratorBuilder::new()
68 }
69}
70
71impl<'a> GetFeedGeneratorBuilder<'a, get_feed_generator_state::Empty> {
72 /// Create a new builder with all fields unset
73 pub fn new() -> Self {
74 GetFeedGeneratorBuilder {
75 _phantom_state: ::core::marker::PhantomData,
76 __unsafe_private_named: (None,),
77 _phantom: ::core::marker::PhantomData,
78 }
79 }
80}
81
82impl<'a, S> GetFeedGeneratorBuilder<'a, S>
83where
84 S: get_feed_generator_state::State,
85 S::Feed: get_feed_generator_state::IsUnset,
86{
87 /// Set the `feed` field (required)
88 pub fn feed(
89 mut self,
90 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
91 ) -> GetFeedGeneratorBuilder<'a, get_feed_generator_state::SetFeed<S>> {
92 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
93 GetFeedGeneratorBuilder {
94 _phantom_state: ::core::marker::PhantomData,
95 __unsafe_private_named: self.__unsafe_private_named,
96 _phantom: ::core::marker::PhantomData,
97 }
98 }
99}
100
101impl<'a, S> GetFeedGeneratorBuilder<'a, S>
102where
103 S: get_feed_generator_state::State,
104 S::Feed: get_feed_generator_state::IsSet,
105{
106 /// Build the final struct
107 pub fn build(self) -> GetFeedGenerator<'a> {
108 GetFeedGenerator {
109 feed: self.__unsafe_private_named.0.unwrap(),
110 }
111 }
112}
113
114#[jacquard_derive::lexicon]
115#[derive(
116 serde::Serialize,
117 serde::Deserialize,
118 Debug,
119 Clone,
120 PartialEq,
121 Eq,
122 jacquard_derive::IntoStatic
123)]
124#[serde(rename_all = "camelCase")]
125pub struct GetFeedGeneratorOutput<'a> {
126 /// Indicates whether the feed generator service has been online recently, or else seems to be inactive.
127 pub is_online: bool,
128 /// Indicates whether the feed generator service is compatible with the record declaration.
129 pub is_valid: bool,
130 #[serde(borrow)]
131 pub view: crate::app_bsky::feed::GeneratorView<'a>,
132}
133
134/// Response type for
135///app.bsky.feed.getFeedGenerator
136pub struct GetFeedGeneratorResponse;
137impl jacquard_common::xrpc::XrpcResp for GetFeedGeneratorResponse {
138 const NSID: &'static str = "app.bsky.feed.getFeedGenerator";
139 const ENCODING: &'static str = "application/json";
140 type Output<'de> = GetFeedGeneratorOutput<'de>;
141 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
142}
143
144impl<'a> jacquard_common::xrpc::XrpcRequest for GetFeedGenerator<'a> {
145 const NSID: &'static str = "app.bsky.feed.getFeedGenerator";
146 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
147 type Response = GetFeedGeneratorResponse;
148}
149
150/// Endpoint type for
151///app.bsky.feed.getFeedGenerator
152pub struct GetFeedGeneratorRequest;
153impl jacquard_common::xrpc::XrpcEndpoint for GetFeedGeneratorRequest {
154 const PATH: &'static str = "/xrpc/app.bsky.feed.getFeedGenerator";
155 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
156 type Request<'de> = GetFeedGenerator<'de>;
157 type Response = GetFeedGeneratorResponse;
158}