Skip to main content

jacquard_api/app_bsky/feed/
get_feed_generators.rs

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