Implement a method for GET /api/v2/search

This commit is contained in:
Paul Woolcock
2018-09-07 12:20:23 -04:00
parent 67242c8f4b
commit 28192e1188
5 changed files with 74 additions and 10 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ pub mod prelude {
notification::Notification,
relationship::Relationship,
report::Report,
search_result::SearchResult,
search_result::{SearchResult, SearchResultV2},
status::{Application, Emoji, Status},
Empty,
};
+16 -1
View File
@@ -1,6 +1,9 @@
//! A module containing info relating to a search result.
use super::prelude::{Account, Status};
use super::{
prelude::{Account, Status},
status::Tag,
};
/// A struct containing results of a search.
#[derive(Debug, Clone, Deserialize)]
@@ -12,3 +15,15 @@ pub struct SearchResult {
/// An array of matched hashtags, as strings.
pub hashtags: Vec<String>,
}
/// A struct containing results of a search, with `Tag` objects in the
/// `hashtags` field
#[derive(Debug, Clone, Deserialize)]
pub struct SearchResultV2 {
/// An array of matched Accounts.
pub accounts: Vec<Account>,
/// An array of matched Statuses.
pub statuses: Vec<Status>,
/// An array of matched hashtags, as `Tag` objects.
pub hashtags: Vec<Tag>,
}