atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.graph.getList
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 GetList<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 #[serde(borrow)]
21 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
22 ///(default: 50, min: 1, max: 100)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub limit: std::option::Option<i64>,
25 #[serde(borrow)]
26 pub list: jacquard_common::types::string::AtUri<'a>,
27}
28
29pub mod get_list_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 List;
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 List = Unset;
46 }
47 ///State transition - sets the `list` field to Set
48 pub struct SetList<S: State = Empty>(PhantomData<fn() -> S>);
49 impl<S: State> sealed::Sealed for SetList<S> {}
50 impl<S: State> State for SetList<S> {
51 type List = Set<members::list>;
52 }
53 /// Marker types for field names
54 #[allow(non_camel_case_types)]
55 pub mod members {
56 ///Marker type for the `list` field
57 pub struct list(());
58 }
59}
60
61/// Builder for constructing an instance of this type
62pub struct GetListBuilder<'a, S: get_list_state::State> {
63 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
64 __unsafe_private_named: (
65 ::core::option::Option<jacquard_common::CowStr<'a>>,
66 ::core::option::Option<i64>,
67 ::core::option::Option<jacquard_common::types::string::AtUri<'a>>,
68 ),
69 _phantom: ::core::marker::PhantomData<&'a ()>,
70}
71
72impl<'a> GetList<'a> {
73 /// Create a new builder for this type
74 pub fn new() -> GetListBuilder<'a, get_list_state::Empty> {
75 GetListBuilder::new()
76 }
77}
78
79impl<'a> GetListBuilder<'a, get_list_state::Empty> {
80 /// Create a new builder with all fields unset
81 pub fn new() -> Self {
82 GetListBuilder {
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: get_list_state::State> GetListBuilder<'a, S> {
91 /// Set the `cursor` field (optional)
92 pub fn cursor(
93 mut self,
94 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
95 ) -> Self {
96 self.__unsafe_private_named.0 = value.into();
97 self
98 }
99 /// Set the `cursor` field to an Option value (optional)
100 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
101 self.__unsafe_private_named.0 = value;
102 self
103 }
104}
105
106impl<'a, S: get_list_state::State> GetListBuilder<'a, S> {
107 /// Set the `limit` field (optional)
108 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
109 self.__unsafe_private_named.1 = value.into();
110 self
111 }
112 /// Set the `limit` field to an Option value (optional)
113 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
114 self.__unsafe_private_named.1 = value;
115 self
116 }
117}
118
119impl<'a, S> GetListBuilder<'a, S>
120where
121 S: get_list_state::State,
122 S::List: get_list_state::IsUnset,
123{
124 /// Set the `list` field (required)
125 pub fn list(
126 mut self,
127 value: impl Into<jacquard_common::types::string::AtUri<'a>>,
128 ) -> GetListBuilder<'a, get_list_state::SetList<S>> {
129 self.__unsafe_private_named.2 = ::core::option::Option::Some(value.into());
130 GetListBuilder {
131 _phantom_state: ::core::marker::PhantomData,
132 __unsafe_private_named: self.__unsafe_private_named,
133 _phantom: ::core::marker::PhantomData,
134 }
135 }
136}
137
138impl<'a, S> GetListBuilder<'a, S>
139where
140 S: get_list_state::State,
141 S::List: get_list_state::IsSet,
142{
143 /// Build the final struct
144 pub fn build(self) -> GetList<'a> {
145 GetList {
146 cursor: self.__unsafe_private_named.0,
147 limit: self.__unsafe_private_named.1,
148 list: self.__unsafe_private_named.2.unwrap(),
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 GetListOutput<'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 items: Vec<crate::sh_weaver::graph::ListItemView<'a>>,
170 #[serde(borrow)]
171 pub list: crate::sh_weaver::graph::ListView<'a>,
172}
173
174#[jacquard_derive::open_union]
175#[derive(
176 serde::Serialize,
177 serde::Deserialize,
178 Debug,
179 Clone,
180 PartialEq,
181 Eq,
182 thiserror::Error,
183 miette::Diagnostic,
184 jacquard_derive::IntoStatic
185)]
186#[serde(tag = "error", content = "message")]
187#[serde(bound(deserialize = "'de: 'a"))]
188pub enum GetListError<'a> {
189 #[serde(rename = "ListNotFound")]
190 ListNotFound(std::option::Option<jacquard_common::CowStr<'a>>),
191}
192
193impl core::fmt::Display for GetListError<'_> {
194 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
195 match self {
196 Self::ListNotFound(msg) => {
197 write!(f, "ListNotFound")?;
198 if let Some(msg) = msg {
199 write!(f, ": {}", msg)?;
200 }
201 Ok(())
202 }
203 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
204 }
205 }
206}
207
208/// Response type for
209///sh.weaver.graph.getList
210pub struct GetListResponse;
211impl jacquard_common::xrpc::XrpcResp for GetListResponse {
212 const NSID: &'static str = "sh.weaver.graph.getList";
213 const ENCODING: &'static str = "application/json";
214 type Output<'de> = GetListOutput<'de>;
215 type Err<'de> = GetListError<'de>;
216}
217
218impl<'a> jacquard_common::xrpc::XrpcRequest for GetList<'a> {
219 const NSID: &'static str = "sh.weaver.graph.getList";
220 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
221 type Response = GetListResponse;
222}
223
224/// Endpoint type for
225///sh.weaver.graph.getList
226pub struct GetListRequest;
227impl jacquard_common::xrpc::XrpcEndpoint for GetListRequest {
228 const PATH: &'static str = "/xrpc/sh.weaver.graph.getList";
229 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
230 type Request<'de> = GetList<'de>;
231 type Response = GetListResponse;
232}