atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.graph.getFollowers
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 GetFollowers<'a> {
19 #[serde(borrow)]
20 pub actor: jacquard_common::types::ident::AtIdentifier<'a>,
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
24 ///(default: 50, min: 1, max: 100)
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 pub limit: std::option::Option<i64>,
27}
28
29pub mod get_followers_state {
30
31 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
32 #[allow(unused)]
33 use ::core::marker::PhantomData;
34 mod sealed {
35 pub trait Sealed {}
36 }
37 /// State trait tracking which required fields have been set
38 pub trait State: sealed::Sealed {
39 type Actor;
40 }
41 /// Empty state - all required fields are unset
42 pub struct Empty(());
43 impl sealed::Sealed for Empty {}
44 impl State for Empty {
45 type Actor = Unset;
46 }
47 ///State transition - sets the `actor` field to Set
48 pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
49 impl<S: State> sealed::Sealed for SetActor<S> {}
50 impl<S: State> State for SetActor<S> {
51 type Actor = Set<members::actor>;
52 }
53 /// Marker types for field names
54 #[allow(non_camel_case_types)]
55 pub mod members {
56 ///Marker type for the `actor` field
57 pub struct actor(());
58 }
59}
60
61/// Builder for constructing an instance of this type
62pub struct GetFollowersBuilder<'a, S: get_followers_state::State> {
63 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
64 __unsafe_private_named: (
65 ::core::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>,
66 ::core::option::Option<jacquard_common::CowStr<'a>>,
67 ::core::option::Option<i64>,
68 ),
69 _phantom: ::core::marker::PhantomData<&'a ()>,
70}
71
72impl<'a> GetFollowers<'a> {
73 /// Create a new builder for this type
74 pub fn new() -> GetFollowersBuilder<'a, get_followers_state::Empty> {
75 GetFollowersBuilder::new()
76 }
77}
78
79impl<'a> GetFollowersBuilder<'a, get_followers_state::Empty> {
80 /// Create a new builder with all fields unset
81 pub fn new() -> Self {
82 GetFollowersBuilder {
83 _phantom_state: ::core::marker::PhantomData,
84 __unsafe_private_named: (None, None, None),
85 _phantom: ::core::marker::PhantomData,
86 }
87 }
88}
89
90impl<'a, S> GetFollowersBuilder<'a, S>
91where
92 S: get_followers_state::State,
93 S::Actor: get_followers_state::IsUnset,
94{
95 /// Set the `actor` field (required)
96 pub fn actor(
97 mut self,
98 value: impl Into<jacquard_common::types::ident::AtIdentifier<'a>>,
99 ) -> GetFollowersBuilder<'a, get_followers_state::SetActor<S>> {
100 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
101 GetFollowersBuilder {
102 _phantom_state: ::core::marker::PhantomData,
103 __unsafe_private_named: self.__unsafe_private_named,
104 _phantom: ::core::marker::PhantomData,
105 }
106 }
107}
108
109impl<'a, S: get_followers_state::State> GetFollowersBuilder<'a, S> {
110 /// Set the `cursor` field (optional)
111 pub fn cursor(
112 mut self,
113 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
114 ) -> Self {
115 self.__unsafe_private_named.1 = value.into();
116 self
117 }
118 /// Set the `cursor` field to an Option value (optional)
119 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
120 self.__unsafe_private_named.1 = value;
121 self
122 }
123}
124
125impl<'a, S: get_followers_state::State> GetFollowersBuilder<'a, S> {
126 /// Set the `limit` field (optional)
127 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
128 self.__unsafe_private_named.2 = value.into();
129 self
130 }
131 /// Set the `limit` field to an Option value (optional)
132 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
133 self.__unsafe_private_named.2 = value;
134 self
135 }
136}
137
138impl<'a, S> GetFollowersBuilder<'a, S>
139where
140 S: get_followers_state::State,
141 S::Actor: get_followers_state::IsSet,
142{
143 /// Build the final struct
144 pub fn build(self) -> GetFollowers<'a> {
145 GetFollowers {
146 actor: self.__unsafe_private_named.0.unwrap(),
147 cursor: self.__unsafe_private_named.1,
148 limit: self.__unsafe_private_named.2,
149 }
150 }
151}
152
153#[jacquard_derive::lexicon]
154#[derive(
155 serde::Serialize,
156 serde::Deserialize,
157 Debug,
158 Clone,
159 PartialEq,
160 Eq,
161 jacquard_derive::IntoStatic
162)]
163#[serde(rename_all = "camelCase")]
164pub struct GetFollowersOutput<'a> {
165 #[serde(skip_serializing_if = "std::option::Option::is_none")]
166 #[serde(borrow)]
167 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
168 #[serde(borrow)]
169 pub followers: Vec<crate::app_bsky::actor::ProfileView<'a>>,
170 #[serde(borrow)]
171 pub subject: crate::app_bsky::actor::ProfileView<'a>,
172}
173
174/// Response type for
175///app.bsky.graph.getFollowers
176pub struct GetFollowersResponse;
177impl jacquard_common::xrpc::XrpcResp for GetFollowersResponse {
178 const NSID: &'static str = "app.bsky.graph.getFollowers";
179 const ENCODING: &'static str = "application/json";
180 type Output<'de> = GetFollowersOutput<'de>;
181 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
182}
183
184impl<'a> jacquard_common::xrpc::XrpcRequest for GetFollowers<'a> {
185 const NSID: &'static str = "app.bsky.graph.getFollowers";
186 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
187 type Response = GetFollowersResponse;
188}
189
190/// Endpoint type for
191///app.bsky.graph.getFollowers
192pub struct GetFollowersRequest;
193impl jacquard_common::xrpc::XrpcEndpoint for GetFollowersRequest {
194 const PATH: &'static str = "/xrpc/app.bsky.graph.getFollowers";
195 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
196 type Request<'de> = GetFollowers<'de>;
197 type Response = GetFollowersResponse;
198}