Skip to main content

jacquard_api/app_bsky/draft/
delete_draft.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.draft.deleteDraft
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::string::Tid;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16
17#[lexicon]
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct DeleteDraft<'a> {
21    pub id: Tid,
22}
23
24/// Response type for app.bsky.draft.deleteDraft
25pub struct DeleteDraftResponse;
26impl jacquard_common::xrpc::XrpcResp for DeleteDraftResponse {
27    const NSID: &'static str = "app.bsky.draft.deleteDraft";
28    const ENCODING: &'static str = "application/json";
29    type Output<'de> = ();
30    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
31}
32
33impl<'a> jacquard_common::xrpc::XrpcRequest for DeleteDraft<'a> {
34    const NSID: &'static str = "app.bsky.draft.deleteDraft";
35    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
36        "application/json",
37    );
38    type Response = DeleteDraftResponse;
39}
40
41/// Endpoint type for app.bsky.draft.deleteDraft
42pub struct DeleteDraftRequest;
43impl jacquard_common::xrpc::XrpcEndpoint for DeleteDraftRequest {
44    const PATH: &'static str = "/xrpc/app.bsky.draft.deleteDraft";
45    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
46        "application/json",
47    );
48    type Request<'de> = DeleteDraft<'de>;
49    type Response = DeleteDraftResponse;
50}
51
52pub mod delete_draft_state {
53
54    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
55    #[allow(unused)]
56    use ::core::marker::PhantomData;
57    mod sealed {
58        pub trait Sealed {}
59    }
60    /// State trait tracking which required fields have been set
61    pub trait State: sealed::Sealed {
62        type Id;
63    }
64    /// Empty state - all required fields are unset
65    pub struct Empty(());
66    impl sealed::Sealed for Empty {}
67    impl State for Empty {
68        type Id = Unset;
69    }
70    ///State transition - sets the `id` field to Set
71    pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
72    impl<S: State> sealed::Sealed for SetId<S> {}
73    impl<S: State> State for SetId<S> {
74        type Id = Set<members::id>;
75    }
76    /// Marker types for field names
77    #[allow(non_camel_case_types)]
78    pub mod members {
79        ///Marker type for the `id` field
80        pub struct id(());
81    }
82}
83
84/// Builder for constructing an instance of this type
85pub struct DeleteDraftBuilder<'a, S: delete_draft_state::State> {
86    _state: PhantomData<fn() -> S>,
87    _fields: (Option<Tid>,),
88    _lifetime: PhantomData<&'a ()>,
89}
90
91impl<'a> DeleteDraft<'a> {
92    /// Create a new builder for this type
93    pub fn new() -> DeleteDraftBuilder<'a, delete_draft_state::Empty> {
94        DeleteDraftBuilder::new()
95    }
96}
97
98impl<'a> DeleteDraftBuilder<'a, delete_draft_state::Empty> {
99    /// Create a new builder with all fields unset
100    pub fn new() -> Self {
101        DeleteDraftBuilder {
102            _state: PhantomData,
103            _fields: (None,),
104            _lifetime: PhantomData,
105        }
106    }
107}
108
109impl<'a, S> DeleteDraftBuilder<'a, S>
110where
111    S: delete_draft_state::State,
112    S::Id: delete_draft_state::IsUnset,
113{
114    /// Set the `id` field (required)
115    pub fn id(
116        mut self,
117        value: impl Into<Tid>,
118    ) -> DeleteDraftBuilder<'a, delete_draft_state::SetId<S>> {
119        self._fields.0 = Option::Some(value.into());
120        DeleteDraftBuilder {
121            _state: PhantomData,
122            _fields: self._fields,
123            _lifetime: PhantomData,
124        }
125    }
126}
127
128impl<'a, S> DeleteDraftBuilder<'a, S>
129where
130    S: delete_draft_state::State,
131    S::Id: delete_draft_state::IsSet,
132{
133    /// Build the final struct
134    pub fn build(self) -> DeleteDraft<'a> {
135        DeleteDraft {
136            id: self._fields.0.unwrap(),
137            extra_data: Default::default(),
138        }
139    }
140    /// Build the final struct with custom extra_data
141    pub fn build_with_data(
142        self,
143        extra_data: BTreeMap<
144            jacquard_common::deps::smol_str::SmolStr,
145            jacquard_common::types::value::Data<'a>,
146        >,
147    ) -> DeleteDraft<'a> {
148        DeleteDraft {
149            id: self._fields.0.unwrap(),
150            extra_data: Some(extra_data),
151        }
152    }
153}