jacquard_api/app_bsky/feed/
get_posts.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::PostView;
17
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct GetPosts<'a> {
21 #[serde(borrow)]
22 pub uris: Vec<AtUri<'a>>,
23}
24
25
26#[lexicon]
27#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
28#[serde(rename_all = "camelCase")]
29pub struct GetPostsOutput<'a> {
30 #[serde(borrow)]
31 pub posts: Vec<PostView<'a>>,
32}
33
34pub struct GetPostsResponse;
36impl jacquard_common::xrpc::XrpcResp for GetPostsResponse {
37 const NSID: &'static str = "app.bsky.feed.getPosts";
38 const ENCODING: &'static str = "application/json";
39 type Output<'de> = GetPostsOutput<'de>;
40 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
41}
42
43impl<'a> jacquard_common::xrpc::XrpcRequest for GetPosts<'a> {
44 const NSID: &'static str = "app.bsky.feed.getPosts";
45 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
46 type Response = GetPostsResponse;
47}
48
49pub struct GetPostsRequest;
51impl jacquard_common::xrpc::XrpcEndpoint for GetPostsRequest {
52 const PATH: &'static str = "/xrpc/app.bsky.feed.getPosts";
53 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
54 type Request<'de> = GetPosts<'de>;
55 type Response = GetPostsResponse;
56}
57
58pub mod get_posts_state {
59
60 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
61 #[allow(unused)]
62 use ::core::marker::PhantomData;
63 mod sealed {
64 pub trait Sealed {}
65 }
66 pub trait State: sealed::Sealed {
68 type Uris;
69 }
70 pub struct Empty(());
72 impl sealed::Sealed for Empty {}
73 impl State for Empty {
74 type Uris = Unset;
75 }
76 pub struct SetUris<S: State = Empty>(PhantomData<fn() -> S>);
78 impl<S: State> sealed::Sealed for SetUris<S> {}
79 impl<S: State> State for SetUris<S> {
80 type Uris = Set<members::uris>;
81 }
82 #[allow(non_camel_case_types)]
84 pub mod members {
85 pub struct uris(());
87 }
88}
89
90pub struct GetPostsBuilder<'a, S: get_posts_state::State> {
92 _state: PhantomData<fn() -> S>,
93 _fields: (Option<Vec<AtUri<'a>>>,),
94 _lifetime: PhantomData<&'a ()>,
95}
96
97impl<'a> GetPosts<'a> {
98 pub fn new() -> GetPostsBuilder<'a, get_posts_state::Empty> {
100 GetPostsBuilder::new()
101 }
102}
103
104impl<'a> GetPostsBuilder<'a, get_posts_state::Empty> {
105 pub fn new() -> Self {
107 GetPostsBuilder {
108 _state: PhantomData,
109 _fields: (None,),
110 _lifetime: PhantomData,
111 }
112 }
113}
114
115impl<'a, S> GetPostsBuilder<'a, S>
116where
117 S: get_posts_state::State,
118 S::Uris: get_posts_state::IsUnset,
119{
120 pub fn uris(
122 mut self,
123 value: impl Into<Vec<AtUri<'a>>>,
124 ) -> GetPostsBuilder<'a, get_posts_state::SetUris<S>> {
125 self._fields.0 = Option::Some(value.into());
126 GetPostsBuilder {
127 _state: PhantomData,
128 _fields: self._fields,
129 _lifetime: PhantomData,
130 }
131 }
132}
133
134impl<'a, S> GetPostsBuilder<'a, S>
135where
136 S: get_posts_state::State,
137 S::Uris: get_posts_state::IsSet,
138{
139 pub fn build(self) -> GetPosts<'a> {
141 GetPosts {
142 uris: self._fields.0.unwrap(),
143 }
144 }
145}