From 6ee2f277d88ee6bad274d7466e13d7c4dc906c39 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Mon, 2 Jan 2023 06:37:19 -0500 Subject: [PATCH] Move legacy Filter type to mod v1; publish fields --- entities/src/filter.rs | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/entities/src/filter.rs b/entities/src/filter.rs index 0e8a28c..5d4c470 100644 --- a/entities/src/filter.rs +++ b/entities/src/filter.rs @@ -1,16 +1,29 @@ use serde::{Deserialize, Serialize}; -use time::{serde::iso8601, OffsetDateTime}; -/// Represents a single Filter -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Filter { - id: String, - phrase: String, - context: Vec, - #[serde(with = "iso8601::option")] - expires_at: Option, - irreversible: bool, - whole_word: bool, +mod v1 { + pub use super::FilterContext; + use serde::{Deserialize, Serialize}; + use time::{serde::iso8601, OffsetDateTime}; + + /// Represents a single Filter + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] + pub struct Filter { + /// The ID of the Filter in the database. + pub id: String, + /// The text to be filtered. + pub phrase: String, + /// The contexts in which the filter should be applied. + pub context: Vec, + /// When the filter should no longer be applied. + /// + /// `None` indicates that the filter does not expire. + #[serde(with = "iso8601::option")] + pub expires_at: Option, + /// Should matching entities in home and notifications be dropped by the server? + pub irreversible: bool, + /// Should the filter consider word boundaries? + pub whole_word: bool, + } } /// Represents the various types of Filter contexts