1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.feed.getFeed
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 bon::Builder
16)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct GetFeed<'a> {
20 #[serde(skip_serializing_if = "std::option::Option::is_none")]
21 #[serde(borrow)]
22 #[builder(into)]
23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
24 #[serde(borrow)]
25 pub feed: jacquard_common::types::string::AtUri<'a>,
26 ///(default: 50, min: 1, max: 100)
27 #[serde(skip_serializing_if = "std::option::Option::is_none")]
28 pub limit: std::option::Option<i64>,
29}
30
31impl jacquard_common::IntoStatic for GetFeed<'_> {
32 type Output = GetFeed<'static>;
33 fn into_static(self) -> Self::Output {
34 GetFeed {
35 cursor: self.cursor.into_static(),
36 feed: self.feed.into_static(),
37 limit: self.limit.into_static(),
38 }
39 }
40}
41
42#[jacquard_derive::lexicon]
43#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
44#[serde(rename_all = "camelCase")]
45pub struct GetFeedOutput<'a> {
46 #[serde(skip_serializing_if = "std::option::Option::is_none")]
47 #[serde(borrow)]
48 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
49 #[serde(borrow)]
50 pub feed: Vec<crate::app_bsky::feed::FeedViewPost<'a>>,
51}
52
53impl jacquard_common::IntoStatic for GetFeedOutput<'_> {
54 type Output = GetFeedOutput<'static>;
55 fn into_static(self) -> Self::Output {
56 GetFeedOutput {
57 cursor: self.cursor.into_static(),
58 feed: self.feed.into_static(),
59 extra_data: self.extra_data.into_static(),
60 }
61 }
62}
63
64#[jacquard_derive::open_union]
65#[derive(
66 serde::Serialize,
67 serde::Deserialize,
68 Debug,
69 Clone,
70 PartialEq,
71 Eq,
72 thiserror::Error,
73 miette::Diagnostic
74)]
75#[serde(tag = "error", content = "message")]
76#[serde(bound(deserialize = "'de: 'a"))]
77pub enum GetFeedError<'a> {
78 #[serde(rename = "UnknownFeed")]
79 UnknownFeed(std::option::Option<String>),
80}
81
82impl std::fmt::Display for GetFeedError<'_> {
83 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
84 match self {
85 Self::UnknownFeed(msg) => {
86 write!(f, "UnknownFeed")?;
87 if let Some(msg) = msg {
88 write!(f, ": {}", msg)?;
89 }
90 Ok(())
91 }
92 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
93 }
94 }
95}
96
97impl jacquard_common::IntoStatic for GetFeedError<'_> {
98 type Output = GetFeedError<'static>;
99 fn into_static(self) -> Self::Output {
100 match self {
101 GetFeedError::UnknownFeed(v) => GetFeedError::UnknownFeed(v.into_static()),
102 GetFeedError::Unknown(v) => GetFeedError::Unknown(v.into_static()),
103 }
104 }
105}
106
107impl jacquard_common::types::xrpc::XrpcRequest for GetFeed<'_> {
108 const NSID: &'static str = "app.bsky.feed.getFeed";
109 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
110 const OUTPUT_ENCODING: &'static str = "application/json";
111 type Output<'de> = GetFeedOutput<'de>;
112 type Err<'de> = GetFeedError<'de>;
113}