2024-04-23 15:46:57 +02:00
|
|
|
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
|
|
|
|
|
|
|
|
use super::SearchResultPB;
|
|
|
|
|
|
|
|
#[derive(ProtoBuf, Default, Debug, Clone)]
|
|
|
|
pub struct SearchResultNotificationPB {
|
|
|
|
#[pb(index = 1)]
|
|
|
|
pub items: Vec<SearchResultPB>,
|
|
|
|
|
|
|
|
#[pb(index = 2)]
|
2024-06-13 01:37:19 +02:00
|
|
|
pub sends: u64,
|
2024-04-23 15:46:57 +02:00
|
|
|
|
|
|
|
#[pb(index = 3, one_of)]
|
|
|
|
pub channel: Option<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(ProtoBuf_Enum, Debug, Default)]
|
|
|
|
pub enum SearchNotification {
|
|
|
|
#[default]
|
|
|
|
Unknown = 0,
|
|
|
|
DidUpdateResults = 1,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::convert::From<SearchNotification> for i32 {
|
|
|
|
fn from(notification: SearchNotification) -> Self {
|
|
|
|
notification as i32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::convert::From<i32> for SearchNotification {
|
|
|
|
fn from(notification: i32) -> Self {
|
|
|
|
match notification {
|
|
|
|
1 => SearchNotification::DidUpdateResults,
|
|
|
|
_ => SearchNotification::Unknown,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|