jacquard_api/app_bsky/feed/
send_interactions.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::types::string::AtUri;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16use crate::app_bsky::feed::Interaction;
17
18#[lexicon]
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
20#[serde(rename_all = "camelCase")]
21pub struct SendInteractions<'a> {
22 #[serde(skip_serializing_if = "Option::is_none")]
23 #[serde(borrow)]
24 pub feed: Option<AtUri<'a>>,
25 #[serde(borrow)]
26 pub interactions: Vec<Interaction<'a>>,
27}
28
29
30#[lexicon]
31#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
32#[serde(rename_all = "camelCase")]
33pub struct SendInteractionsOutput<'a> {}
34pub struct SendInteractionsResponse;
36impl jacquard_common::xrpc::XrpcResp for SendInteractionsResponse {
37 const NSID: &'static str = "app.bsky.feed.sendInteractions";
38 const ENCODING: &'static str = "application/json";
39 type Output<'de> = SendInteractionsOutput<'de>;
40 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
41}
42
43impl<'a> jacquard_common::xrpc::XrpcRequest for SendInteractions<'a> {
44 const NSID: &'static str = "app.bsky.feed.sendInteractions";
45 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
46 "application/json",
47 );
48 type Response = SendInteractionsResponse;
49}
50
51pub struct SendInteractionsRequest;
53impl jacquard_common::xrpc::XrpcEndpoint for SendInteractionsRequest {
54 const PATH: &'static str = "/xrpc/app.bsky.feed.sendInteractions";
55 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
56 "application/json",
57 );
58 type Request<'de> = SendInteractions<'de>;
59 type Response = SendInteractionsResponse;
60}
61
62pub mod send_interactions_state {
63
64 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
65 #[allow(unused)]
66 use ::core::marker::PhantomData;
67 mod sealed {
68 pub trait Sealed {}
69 }
70 pub trait State: sealed::Sealed {
72 type Interactions;
73 }
74 pub struct Empty(());
76 impl sealed::Sealed for Empty {}
77 impl State for Empty {
78 type Interactions = Unset;
79 }
80 pub struct SetInteractions<S: State = Empty>(PhantomData<fn() -> S>);
82 impl<S: State> sealed::Sealed for SetInteractions<S> {}
83 impl<S: State> State for SetInteractions<S> {
84 type Interactions = Set<members::interactions>;
85 }
86 #[allow(non_camel_case_types)]
88 pub mod members {
89 pub struct interactions(());
91 }
92}
93
94pub struct SendInteractionsBuilder<'a, S: send_interactions_state::State> {
96 _state: PhantomData<fn() -> S>,
97 _fields: (Option<AtUri<'a>>, Option<Vec<Interaction<'a>>>),
98 _lifetime: PhantomData<&'a ()>,
99}
100
101impl<'a> SendInteractions<'a> {
102 pub fn new() -> SendInteractionsBuilder<'a, send_interactions_state::Empty> {
104 SendInteractionsBuilder::new()
105 }
106}
107
108impl<'a> SendInteractionsBuilder<'a, send_interactions_state::Empty> {
109 pub fn new() -> Self {
111 SendInteractionsBuilder {
112 _state: PhantomData,
113 _fields: (None, None),
114 _lifetime: PhantomData,
115 }
116 }
117}
118
119impl<'a, S: send_interactions_state::State> SendInteractionsBuilder<'a, S> {
120 pub fn feed(mut self, value: impl Into<Option<AtUri<'a>>>) -> Self {
122 self._fields.0 = value.into();
123 self
124 }
125 pub fn maybe_feed(mut self, value: Option<AtUri<'a>>) -> Self {
127 self._fields.0 = value;
128 self
129 }
130}
131
132impl<'a, S> SendInteractionsBuilder<'a, S>
133where
134 S: send_interactions_state::State,
135 S::Interactions: send_interactions_state::IsUnset,
136{
137 pub fn interactions(
139 mut self,
140 value: impl Into<Vec<Interaction<'a>>>,
141 ) -> SendInteractionsBuilder<'a, send_interactions_state::SetInteractions<S>> {
142 self._fields.1 = Option::Some(value.into());
143 SendInteractionsBuilder {
144 _state: PhantomData,
145 _fields: self._fields,
146 _lifetime: PhantomData,
147 }
148 }
149}
150
151impl<'a, S> SendInteractionsBuilder<'a, S>
152where
153 S: send_interactions_state::State,
154 S::Interactions: send_interactions_state::IsSet,
155{
156 pub fn build(self) -> SendInteractions<'a> {
158 SendInteractions {
159 feed: self._fields.0,
160 interactions: self._fields.1.unwrap(),
161 extra_data: Default::default(),
162 }
163 }
164 pub fn build_with_data(
166 self,
167 extra_data: BTreeMap<
168 jacquard_common::deps::smol_str::SmolStr,
169 jacquard_common::types::value::Data<'a>,
170 >,
171 ) -> SendInteractions<'a> {
172 SendInteractions {
173 feed: self._fields.0,
174 interactions: self._fields.1.unwrap(),
175 extra_data: Some(extra_data),
176 }
177 }
178}