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