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