atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.sync.getCheckout
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 GetCheckout<'a> {
19 #[serde(borrow)]
20 pub did: jacquard_common::types::string::Did<'a>,
21}
22
23pub mod get_checkout_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 Did;
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 Did = Unset;
40 }
41 ///State transition - sets the `did` field to Set
42 pub struct SetDid<S: State = Empty>(PhantomData<fn() -> S>);
43 impl<S: State> sealed::Sealed for SetDid<S> {}
44 impl<S: State> State for SetDid<S> {
45 type Did = Set<members::did>;
46 }
47 /// Marker types for field names
48 #[allow(non_camel_case_types)]
49 pub mod members {
50 ///Marker type for the `did` field
51 pub struct did(());
52 }
53}
54
55/// Builder for constructing an instance of this type
56pub struct GetCheckoutBuilder<'a, S: get_checkout_state::State> {
57 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
58 __unsafe_private_named: (
59 ::core::option::Option<jacquard_common::types::string::Did<'a>>,
60 ),
61 _phantom: ::core::marker::PhantomData<&'a ()>,
62}
63
64impl<'a> GetCheckout<'a> {
65 /// Create a new builder for this type
66 pub fn new() -> GetCheckoutBuilder<'a, get_checkout_state::Empty> {
67 GetCheckoutBuilder::new()
68 }
69}
70
71impl<'a> GetCheckoutBuilder<'a, get_checkout_state::Empty> {
72 /// Create a new builder with all fields unset
73 pub fn new() -> Self {
74 GetCheckoutBuilder {
75 _phantom_state: ::core::marker::PhantomData,
76 __unsafe_private_named: (None,),
77 _phantom: ::core::marker::PhantomData,
78 }
79 }
80}
81
82impl<'a, S> GetCheckoutBuilder<'a, S>
83where
84 S: get_checkout_state::State,
85 S::Did: get_checkout_state::IsUnset,
86{
87 /// Set the `did` field (required)
88 pub fn did(
89 mut self,
90 value: impl Into<jacquard_common::types::string::Did<'a>>,
91 ) -> GetCheckoutBuilder<'a, get_checkout_state::SetDid<S>> {
92 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
93 GetCheckoutBuilder {
94 _phantom_state: ::core::marker::PhantomData,
95 __unsafe_private_named: self.__unsafe_private_named,
96 _phantom: ::core::marker::PhantomData,
97 }
98 }
99}
100
101impl<'a, S> GetCheckoutBuilder<'a, S>
102where
103 S: get_checkout_state::State,
104 S::Did: get_checkout_state::IsSet,
105{
106 /// Build the final struct
107 pub fn build(self) -> GetCheckout<'a> {
108 GetCheckout {
109 did: self.__unsafe_private_named.0.unwrap(),
110 }
111 }
112}
113
114#[derive(
115 serde::Serialize,
116 serde::Deserialize,
117 Debug,
118 Clone,
119 PartialEq,
120 Eq,
121 jacquard_derive::IntoStatic
122)]
123#[serde(rename_all = "camelCase")]
124pub struct GetCheckoutOutput {
125 pub body: bytes::Bytes,
126}
127
128/// Response type for
129///com.atproto.sync.getCheckout
130pub struct GetCheckoutResponse;
131impl jacquard_common::xrpc::XrpcResp for GetCheckoutResponse {
132 const NSID: &'static str = "com.atproto.sync.getCheckout";
133 const ENCODING: &'static str = "application/vnd.ipld.car";
134 type Output<'de> = GetCheckoutOutput;
135 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
136 fn encode_output(
137 output: &Self::Output<'_>,
138 ) -> Result<Vec<u8>, jacquard_common::xrpc::EncodeError> {
139 Ok(output.body.to_vec())
140 }
141 fn decode_output<'de>(
142 body: &'de [u8],
143 ) -> Result<Self::Output<'de>, jacquard_common::error::DecodeError>
144 where
145 Self::Output<'de>: serde::Deserialize<'de>,
146 {
147 Ok(GetCheckoutOutput {
148 body: bytes::Bytes::copy_from_slice(body),
149 })
150 }
151}
152
153impl<'a> jacquard_common::xrpc::XrpcRequest for GetCheckout<'a> {
154 const NSID: &'static str = "com.atproto.sync.getCheckout";
155 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
156 type Response = GetCheckoutResponse;
157}
158
159/// Endpoint type for
160///com.atproto.sync.getCheckout
161pub struct GetCheckoutRequest;
162impl jacquard_common::xrpc::XrpcEndpoint for GetCheckoutRequest {
163 const PATH: &'static str = "/xrpc/com.atproto.sync.getCheckout";
164 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
165 type Request<'de> = GetCheckout<'de>;
166 type Response = GetCheckoutResponse;
167}