2021-12-13 02:29:02 +08:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
2021-12-14 15:54:24 +08:00
|
|
|
/// Define the `profiles.yaml` schema
|
2021-12-13 02:29:02 +08:00
|
|
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
2021-12-14 00:40:41 +08:00
|
|
|
pub struct ProfilesConfig {
|
2021-12-13 02:29:02 +08:00
|
|
|
/// current profile's name
|
|
|
|
pub current: Option<u32>,
|
|
|
|
|
|
|
|
/// profile list
|
2021-12-14 00:40:41 +08:00
|
|
|
pub items: Option<Vec<ProfileItem>>,
|
2021-12-13 02:29:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
2021-12-14 00:40:41 +08:00
|
|
|
pub struct ProfileItem {
|
2021-12-13 02:29:02 +08:00
|
|
|
/// profile name
|
|
|
|
pub name: Option<String>,
|
|
|
|
/// profile file
|
|
|
|
pub file: Option<String>,
|
|
|
|
/// current mode
|
|
|
|
pub mode: Option<String>,
|
|
|
|
/// source url
|
|
|
|
pub url: Option<String>,
|
|
|
|
/// selected infomation
|
|
|
|
pub selected: Option<Vec<ProfileSelected>>,
|
|
|
|
/// user info
|
2021-12-14 00:40:41 +08:00
|
|
|
pub extra: Option<ProfileExtra>,
|
2021-12-13 02:29:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
|
|
|
pub struct ProfileSelected {
|
|
|
|
pub name: Option<String>,
|
|
|
|
pub now: Option<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Default, Debug, Clone, Copy, Deserialize, Serialize)]
|
2021-12-14 00:40:41 +08:00
|
|
|
pub struct ProfileExtra {
|
2021-12-13 02:29:02 +08:00
|
|
|
pub upload: u64,
|
|
|
|
pub download: u64,
|
|
|
|
pub total: u64,
|
|
|
|
pub expire: u64,
|
|
|
|
}
|
2021-12-14 22:33:42 +08:00
|
|
|
|
|
|
|
#[derive(Default, Debug, Clone, Deserialize, Serialize)]
|
|
|
|
/// the result from url
|
|
|
|
pub struct ProfileResponse {
|
|
|
|
pub name: String,
|
|
|
|
pub file: String,
|
|
|
|
pub data: String,
|
|
|
|
pub extra: ProfileExtra,
|
|
|
|
}
|