atrium_api/app/bsky/feed/
search_posts.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `app.bsky.feed.searchPosts` namespace.
3pub const NSID: &str = "app.bsky.feed.searchPosts";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct ParametersData {
7    ///Filter to posts by the given account. Handles are resolved to DID before query-time.
8    #[serde(skip_serializing_if = "core::option::Option::is_none")]
9    pub author: core::option::Option<crate::types::string::AtIdentifier>,
10    ///Optional pagination mechanism; may not necessarily allow scrolling through entire result set.
11    #[serde(skip_serializing_if = "core::option::Option::is_none")]
12    pub cursor: core::option::Option<String>,
13    ///Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization.
14    #[serde(skip_serializing_if = "core::option::Option::is_none")]
15    pub domain: core::option::Option<String>,
16    ///Filter to posts in the given language. Expected to be based on post language field, though server may override language detection.
17    #[serde(skip_serializing_if = "core::option::Option::is_none")]
18    pub lang: core::option::Option<crate::types::string::Language>,
19    #[serde(skip_serializing_if = "core::option::Option::is_none")]
20    pub limit: core::option::Option<crate::types::LimitedNonZeroU8<100u8>>,
21    ///Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions.
22    #[serde(skip_serializing_if = "core::option::Option::is_none")]
23    pub mentions: core::option::Option<crate::types::string::AtIdentifier>,
24    ///Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended.
25    pub q: String,
26    ///Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD).
27    #[serde(skip_serializing_if = "core::option::Option::is_none")]
28    pub since: core::option::Option<String>,
29    ///Specifies the ranking order of results.
30    #[serde(skip_serializing_if = "core::option::Option::is_none")]
31    pub sort: core::option::Option<String>,
32    ///Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching.
33    #[serde(skip_serializing_if = "core::option::Option::is_none")]
34    pub tag: core::option::Option<Vec<String>>,
35    ///Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD).
36    #[serde(skip_serializing_if = "core::option::Option::is_none")]
37    pub until: core::option::Option<String>,
38    ///Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching.
39    #[serde(skip_serializing_if = "core::option::Option::is_none")]
40    pub url: core::option::Option<String>,
41}
42pub type Parameters = crate::types::Object<ParametersData>;
43#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
44#[serde(rename_all = "camelCase")]
45pub struct OutputData {
46    #[serde(skip_serializing_if = "core::option::Option::is_none")]
47    pub cursor: core::option::Option<String>,
48    ///Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits.
49    #[serde(skip_serializing_if = "core::option::Option::is_none")]
50    pub hits_total: core::option::Option<i64>,
51    pub posts: Vec<crate::app::bsky::feed::defs::PostView>,
52}
53pub type Output = crate::types::Object<OutputData>;
54#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
55#[serde(tag = "error", content = "message")]
56pub enum Error {
57    BadQueryString(Option<String>),
58}
59impl std::fmt::Display for Error {
60    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
61        match self {
62            Error::BadQueryString(msg) => {
63                write!(_f, "BadQueryString")?;
64                if let Some(msg) = msg {
65                    write!(_f, ": {msg}")?;
66                }
67            }
68        }
69        Ok(())
70    }
71}