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