misskey_api/model/
chart.rs

1use serde::{Deserialize, Serialize};
2use thiserror::Error;
3
4#[derive(Deserialize, Serialize, PartialEq, Eq, Clone, Debug, Copy)]
5#[serde(rename_all = "camelCase")]
6pub enum ChartSpan {
7    Day,
8    Hour,
9}
10
11#[derive(Debug, Error, Clone)]
12#[error("invalid chart span")]
13pub struct ParseChartSpanError {
14    _priv: (),
15}
16
17impl std::str::FromStr for ChartSpan {
18    type Err = ParseChartSpanError;
19
20    fn from_str(s: &str) -> Result<ChartSpan, Self::Err> {
21        match s {
22            "day" | "Day" => Ok(ChartSpan::Day),
23            "hour" | "Hour" => Ok(ChartSpan::Hour),
24            _ => Err(ParseChartSpanError { _priv: () }),
25        }
26    }
27}
28
29#[derive(Serialize, Deserialize, Debug, Clone)]
30#[serde(rename_all = "camelCase")]
31pub struct DriveChart {
32    #[serde(alias = "totalFiles")]
33    pub total_count: Vec<u64>,
34    #[serde(alias = "totalUsage")]
35    pub total_size: Vec<u64>,
36    #[serde(alias = "incFiles")]
37    pub inc_count: Vec<u64>,
38    #[serde(alias = "incUsage")]
39    pub inc_size: Vec<u64>,
40    #[serde(alias = "decFiles")]
41    pub dec_count: Vec<u64>,
42    #[serde(alias = "decUsage")]
43    pub dec_size: Vec<u64>,
44}
45
46#[derive(Serialize, Deserialize, Debug, Clone)]
47#[serde(rename_all = "camelCase")]
48pub struct FederationChart {
49    pub total: Vec<u64>,
50    pub inc: Vec<u64>,
51    pub dec: Vec<u64>,
52}
53
54#[derive(Serialize, Deserialize, Debug, Clone)]
55#[serde(rename_all = "camelCase")]
56pub struct ActiveUsersChart {
57    pub count: Vec<u64>,
58}
59
60#[derive(Serialize, Deserialize, Debug, Clone)]
61#[serde(rename_all = "camelCase")]
62pub struct HashtagChart {
63    pub count: Vec<u64>,
64}
65
66#[derive(Serialize, Deserialize, Debug, Clone)]
67#[serde(rename_all = "camelCase")]
68pub struct RequestsChart {
69    pub failed: Vec<u64>,
70    pub succeeded: Vec<u64>,
71    pub received: Vec<u64>,
72}
73
74#[derive(Serialize, Deserialize, Debug, Clone)]
75#[serde(rename_all = "camelCase")]
76pub struct NotesChart {
77    pub total: Vec<u64>,
78    pub inc: Vec<u64>,
79    pub dec: Vec<u64>,
80    pub diffs: NotesDiffsChart,
81}
82
83#[derive(Serialize, Deserialize, Debug, Clone)]
84#[serde(rename_all = "camelCase")]
85pub struct NotesDiffsChart {
86    pub normal: Vec<u64>,
87    pub reply: Vec<u64>,
88    pub renote: Vec<u64>,
89}
90
91#[derive(Serialize, Deserialize, Debug, Clone)]
92#[serde(rename_all = "camelCase")]
93pub struct UsersChart {
94    pub total: Vec<u64>,
95    pub inc: Vec<u64>,
96    pub dec: Vec<u64>,
97}
98
99#[derive(Serialize, Deserialize, Debug, Clone)]
100#[serde(rename_all = "camelCase")]
101pub struct FollowingChart {
102    pub total: Vec<u64>,
103    pub inc: Vec<u64>,
104    pub dec: Vec<u64>,
105}
106
107#[derive(Serialize, Deserialize, Debug, Clone)]
108#[serde(rename_all = "camelCase")]
109pub struct FollowersChart {
110    pub total: Vec<u64>,
111    pub inc: Vec<u64>,
112    pub dec: Vec<u64>,
113}
114
115#[derive(Serialize, Deserialize, Debug, Clone)]
116#[serde(rename_all = "camelCase")]
117pub struct NetworkChart {
118    pub incoming_requests: Vec<u64>,
119    pub outgoing_requests: Vec<u64>,
120    pub total_time: Vec<u64>,
121    pub incoming_bytes: Vec<u64>,
122    pub outgoing_bytes: Vec<u64>,
123}
124
125#[derive(Serialize, Deserialize, Debug, Clone)]
126#[serde(rename_all = "camelCase")]
127pub struct ReactionsChart {
128    pub count: Vec<u64>,
129}