Keyword/filtering API
This adds the 5 methods for the mastodon API that deal with keyword filtering: GET /api/v1/filters POST /api/v1/filters GET /api/v1/filters/:id PUT /api/v1/filters/:id DELETE /api/v1/filters/:id Closes #71
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/// Represents a single Filter
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Filter {
|
||||
id: String,
|
||||
phrase: String,
|
||||
context: Vec<FilterContext>,
|
||||
expires_at: Option<String>, // TODO: timestamp
|
||||
irreversible: bool,
|
||||
whole_word: bool,
|
||||
}
|
||||
|
||||
/// Represents the various types of Filter contexts
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
pub enum FilterContext {
|
||||
/// Represents the "home" context
|
||||
#[serde(rename = "home")]
|
||||
Home,
|
||||
/// Represents the "notifications" context
|
||||
#[serde(rename = "notifications")]
|
||||
Notifications,
|
||||
/// Represents the "public" context
|
||||
#[serde(rename = "public")]
|
||||
Public,
|
||||
/// Represents the "thread" context
|
||||
#[serde(rename = "thread")]
|
||||
Thread,
|
||||
}
|
||||
@@ -6,6 +6,8 @@ pub mod attachment;
|
||||
pub mod card;
|
||||
/// Data structures for ser/de of contetx-related resources
|
||||
pub mod context;
|
||||
/// Data structures for ser/de of filter-related resources
|
||||
pub mod filter;
|
||||
/// Data structures for ser/de of instance-related resources
|
||||
pub mod instance;
|
||||
pub(crate) mod itemsiter;
|
||||
@@ -39,6 +41,7 @@ pub mod prelude {
|
||||
attachment::{Attachment, MediaType},
|
||||
card::Card,
|
||||
context::Context,
|
||||
filter::{Filter, FilterContext},
|
||||
instance::*,
|
||||
list::List,
|
||||
mention::Mention,
|
||||
|
||||
Reference in New Issue
Block a user