1use chrono::{DateTime, FixedOffset};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Serialize, Deserialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct WebdownloadCreationResponse {
7 pub hash: String,
8 pub webdownload_id: u32,
9 pub auth_id: String,
10}
11#[derive(Debug, Serialize, Deserialize)]
12#[cfg_attr(feature = "specta", derive(specta::Type))]
13pub struct WebdownloadFile {
14 pub id: u64,
15 pub md5: Option<String>,
16 pub s3_path: String,
17 pub name: String,
18 pub size: u64,
19 pub zipped: bool,
20 pub infected: bool,
21 pub opensubtitles_hash: Option<String>,
22 pub mimetype: String,
23 pub short_name: String,
24 pub absolute_path: String,
25}
26
27#[derive(Debug, Serialize, Deserialize)]
28#[cfg_attr(feature = "specta", derive(specta::Type))]
29pub struct WebdownloadStatus {
30 pub id: u64,
31 pub hash: String,
32 pub created_at: DateTime<FixedOffset>,
33 pub updated_at: DateTime<FixedOffset>,
34 pub size: u64,
35 pub active: bool,
36 pub auth_id: String,
37 pub download_state: String,
38 pub progress: f64,
39 pub download_speed: u64,
40 pub original_url: String,
41 pub name: String,
42 pub eta: u64,
43 pub server: u64,
44 pub expires_at: Option<DateTime<FixedOffset>>,
45 pub download_present: bool,
46 pub download_finished: bool,
47 pub error: Option<String>,
48 pub cached: bool,
49 pub cached_at: Option<DateTime<FixedOffset>>,
50 pub download_id: Option<String>,
51 pub files: Vec<WebdownloadFile>,
52 pub alternative_hashes: Vec<String>,
53 pub tags: Vec<String>,
54}
55
56#[derive(Debug, Serialize, Deserialize)]
57#[cfg_attr(feature = "specta", derive(specta::Type))]
58pub struct HosterInfo {
59 pub name: String,
60
61 #[serde(default)]
62 pub domains: Vec<String>,
63
64 #[serde(default, rename = "domais")]
65 pub domais: Option<Vec<String>>,
66
67 pub url: String,
68 pub icon: String,
69 pub status: bool,
70
71 #[serde(rename = "type")]
72 pub kind: String,
73
74 pub note: Option<String>,
75 pub daily_link_limit: u64,
76 pub daily_link_used: u64,
77 pub daily_bandwidth_limit: u64,
78 pub daily_bandwidth_used: u64,
79
80 #[serde(default)]
81 pub limit: Option<u64>,
82}
83
84#[derive(Debug, Serialize, Deserialize)]
85#[cfg_attr(feature = "specta", derive(specta::Type))]
86pub struct WebDownloadCacheAvailability {
87 pub name: String,
88 pub size: u64,
89 pub hash: String,
90
91 pub files: Option<WebdownloadFile>,
92}
93
94#[derive(Debug, Serialize, Deserialize)]
95#[cfg_attr(feature = "specta", derive(specta::Type))]
96#[serde(rename_all = "snake_case")]
97pub enum WebdownloadHosterKind {
98 Hoster,
99 Stream,
100}
101
102#[derive(Debug, Serialize, Deserialize)]
103#[cfg_attr(feature = "specta", derive(specta::Type))]
104pub struct WebdownloadHosterList {
105 pub id: u32,
106 pub name: String,
107 pub domains: Vec<String>,
108 pub url: String,
109 pub icon: String,
110 pub status: bool,
111
112 #[serde(rename = "type")]
113 pub kind: WebdownloadHosterKind,
114
115 pub note: Option<String>,
116 pub nsfw: bool,
117
118 pub daily_link_limit: u32,
119 pub daily_link_used: u32,
120
121 pub daily_bandwidth_limit: u64,
122 pub daily_bandwidth_used: u64,
123 pub per_link_size_limit: u64,
124
125 pub regex: String,
126}