magnetar/magnetar_sdk/src/types/mod.rs

69 lines
1.3 KiB
Rust

pub mod drive;
pub mod emoji;
pub mod instance;
pub mod note;
pub mod timeline;
pub mod user;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use std::ops::RangeInclusive;
use ts_rs::TS;
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
pub enum RangeFilter {
TimeRange(RangeInclusive<DateTime<Utc>>),
TimeStart(DateTime<Utc>),
TimeEnd(DateTime<Utc>),
}
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
#[ts(export)]
#[repr(transparent)]
pub struct Id {
pub id: String,
}
impl<T: AsRef<str>> From<T> for Id {
fn from(id: T) -> Self {
Self {
id: id.as_ref().to_string(),
}
}
}
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
#[ts(export)]
#[repr(transparent)]
pub struct MmXml(pub String);
#[derive(Copy, Clone, Debug, Deserialize, Serialize, TS)]
#[ts(export)]
pub enum NotificationType {
Follow,
Mention,
Reply,
Renote,
Quote,
Reaction,
PollVote,
PollEnded,
FollowRequest,
FollowRequestAccepted,
App,
}
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
#[ts(export)]
pub struct NotificationSettings {
pub enabled: Vec<NotificationType>,
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, TS)]
#[ts(export)]
pub enum FollowVisibility {
Public,
Followers,
Private,
}