Skip to main content

atrium_api/app/bsky/feed/
search_posts_v2.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `app.bsky.feed.searchPostsV2` namespace.
3pub const NSID: &str = "app.bsky.feed.searchPostsV2";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct ParametersData {
7    ///Search the full index instead of the recent-post window.
8    #[serde(skip_serializing_if = "core::option::Option::is_none")]
9    pub all_time: core::option::Option<bool>,
10    ///Include posts by any of these authors. Handles are resolved to DIDs before searching.
11    #[serde(skip_serializing_if = "core::option::Option::is_none")]
12    pub authors: core::option::Option<Vec<crate::types::string::AtIdentifier>>,
13    ///Optional pagination cursor.
14    #[serde(skip_serializing_if = "core::option::Option::is_none")]
15    pub cursor: core::option::Option<String>,
16    ///Include posts that link to any of these domains.
17    #[serde(skip_serializing_if = "core::option::Option::is_none")]
18    pub domains: core::option::Option<Vec<String>>,
19    ///Include posts that embed any of these AT URIs.
20    #[serde(skip_serializing_if = "core::option::Option::is_none")]
21    pub embedded_at_uris: core::option::Option<Vec<String>>,
22    ///Exclude posts by any of these authors. Handles are resolved to DIDs before searching.
23    #[serde(skip_serializing_if = "core::option::Option::is_none")]
24    pub exclude_authors: core::option::Option<Vec<crate::types::string::AtIdentifier>>,
25    ///Exclude posts that link to any of these domains.
26    #[serde(skip_serializing_if = "core::option::Option::is_none")]
27    pub exclude_domains: core::option::Option<Vec<String>>,
28    ///Exclude posts that embed any of these AT URIs.
29    #[serde(skip_serializing_if = "core::option::Option::is_none")]
30    pub exclude_embedded_at_uris: core::option::Option<Vec<String>>,
31    ///Exclude posts tagged with any of these hashtags. Do not include the hash (#) prefix.
32    #[serde(skip_serializing_if = "core::option::Option::is_none")]
33    pub exclude_hashtags: core::option::Option<Vec<String>>,
34    ///Exclude posts whose language matches any of these language codes.
35    #[serde(skip_serializing_if = "core::option::Option::is_none")]
36    pub exclude_languages: core::option::Option<Vec<crate::types::string::Language>>,
37    ///Exclude posts that mention any of these accounts. Handles are resolved to DIDs before searching.
38    #[serde(skip_serializing_if = "core::option::Option::is_none")]
39    pub exclude_mentions: core::option::Option<Vec<crate::types::string::AtIdentifier>>,
40    ///Exclude replies from results. Mutually exclusive with repliesOnly.
41    #[serde(skip_serializing_if = "core::option::Option::is_none")]
42    pub exclude_replies: core::option::Option<bool>,
43    ///Exclude posts that link to any of these URLs.
44    #[serde(skip_serializing_if = "core::option::Option::is_none")]
45    pub exclude_urls: core::option::Option<Vec<String>>,
46    ///Include only posts from accounts followed by the viewer.
47    #[serde(skip_serializing_if = "core::option::Option::is_none")]
48    pub following: core::option::Option<bool>,
49    ///Include only posts with media.
50    #[serde(skip_serializing_if = "core::option::Option::is_none")]
51    pub has_media: core::option::Option<bool>,
52    ///Include only posts with video.
53    #[serde(skip_serializing_if = "core::option::Option::is_none")]
54    pub has_video: core::option::Option<bool>,
55    ///Include posts tagged with any of these hashtags. Do not include the hash (#) prefix.
56    #[serde(skip_serializing_if = "core::option::Option::is_none")]
57    pub hashtags: core::option::Option<Vec<String>>,
58    ///Include posts whose language matches any of these language codes.
59    #[serde(skip_serializing_if = "core::option::Option::is_none")]
60    pub languages: core::option::Option<Vec<crate::types::string::Language>>,
61    ///Maximum number of results to return.
62    #[serde(skip_serializing_if = "core::option::Option::is_none")]
63    pub limit: core::option::Option<crate::types::LimitedNonZeroU8<100u8>>,
64    ///Include posts that mention any of these accounts. Handles are resolved to DIDs before searching.
65    #[serde(skip_serializing_if = "core::option::Option::is_none")]
66    pub mentions: core::option::Option<Vec<crate::types::string::AtIdentifier>>,
67    ///Search query string. A query or at least one filter is required.
68    #[serde(skip_serializing_if = "core::option::Option::is_none")]
69    pub query: core::option::Option<String>,
70    ///Language analyzer hint for the query text. If unset, the server auto-detects when possible.
71    #[serde(skip_serializing_if = "core::option::Option::is_none")]
72    pub query_language: core::option::Option<String>,
73    ///Include only replies. Mutually exclusive with excludeReplies.
74    #[serde(skip_serializing_if = "core::option::Option::is_none")]
75    pub replies_only: core::option::Option<bool>,
76    ///Include only direct replies to this parent post URI.
77    #[serde(skip_serializing_if = "core::option::Option::is_none")]
78    pub reply_parent_uri: core::option::Option<String>,
79    ///Include posts indexed at or after this timestamp. Can be a datetime, or just an ISO date (YYYY-MM-DD).
80    #[serde(skip_serializing_if = "core::option::Option::is_none")]
81    pub since: core::option::Option<String>,
82    ///Ranking order for results. 'recent' sorts by recency; 'top' uses search ranking.
83    #[serde(skip_serializing_if = "core::option::Option::is_none")]
84    pub sort: core::option::Option<String>,
85    ///Include only posts in the thread rooted at this post URI.
86    #[serde(skip_serializing_if = "core::option::Option::is_none")]
87    pub thread_root_uri: core::option::Option<String>,
88    ///Include posts indexed before this timestamp. Defaults to the current time. Can be a datetime, or just an ISO date (YYYY-MM-DD).
89    #[serde(skip_serializing_if = "core::option::Option::is_none")]
90    pub until: core::option::Option<String>,
91    ///Include posts that link to any of these URLs.
92    #[serde(skip_serializing_if = "core::option::Option::is_none")]
93    pub urls: core::option::Option<Vec<String>>,
94}
95pub type Parameters = crate::types::Object<ParametersData>;
96#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
97#[serde(rename_all = "camelCase")]
98pub struct OutputData {
99    ///Cursor for the next page of results.
100    #[serde(skip_serializing_if = "core::option::Option::is_none")]
101    pub cursor: core::option::Option<String>,
102    ///Query languages detected for CJK, Thai, or Arabic text. Empty or omitted for other scripts.
103    #[serde(skip_serializing_if = "core::option::Option::is_none")]
104    pub detected_query_languages: core::option::Option<Vec<String>>,
105    ///Estimated total number of matching hits. May be rounded or truncated.
106    #[serde(skip_serializing_if = "core::option::Option::is_none")]
107    pub hits_total: core::option::Option<i64>,
108    ///Hydrated views of matching posts.
109    pub posts: Vec<crate::app::bsky::feed::defs::PostView>,
110}
111pub type Output = crate::types::Object<OutputData>;
112#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
113#[serde(tag = "error", content = "message")]
114pub enum Error {
115    BadQueryString(Option<String>),
116}
117impl std::fmt::Display for Error {
118    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
119        match self {
120            Error::BadQueryString(msg) => {
121                write!(_f, "BadQueryString")?;
122                if let Some(msg) = msg {
123                    write!(_f, ": {msg}")?;
124                }
125            }
126        }
127        Ok(())
128    }
129}