1use crate::types::FormatType;
2use serde::Serialize;
3
4#[derive(Debug, Serialize)]
5#[cfg_attr(feature = "specta", derive(specta::Type))]
6pub struct WebdownloadRequestLinkQuery {
7 #[cfg_attr(feature = "specta", specta(skip))]
9 pub(crate) token: String,
10 pub web_id: u32,
12 pub files_id: Option<Vec<u32>>,
14 pub zip_link: bool,
16 pub user_ip: Option<String>,
20 pub redirect: bool,
24}
25
26impl Default for WebdownloadRequestLinkQuery {
27 fn default() -> Self {
28 Self {
29 token: String::new(),
30 web_id: 0,
31 files_id: None,
32 zip_link: false,
33 user_ip: None,
34 redirect: false,
35 }
36 }
37}
38
39#[derive(Debug, Serialize)]
40#[cfg_attr(feature = "specta", derive(specta::Type))]
41pub struct WebdownloadControlQuery {
42 pub bypass_cache: bool,
43}
44
45impl Default for WebdownloadControlQuery {
46 fn default() -> Self {
47 Self {
48 bypass_cache: false,
49 }
50 }
51}
52
53#[derive(Debug, Serialize)]
57#[cfg_attr(feature = "specta", derive(specta::Type))]
58pub struct ListWebdownloadsQuery {
59 id: Option<u32>,
60 pub bypass_cache: Option<bool>,
65 pub offset: Option<u32>,
69 pub limit: Option<u32>,
73}
74
75impl Default for ListWebdownloadsQuery {
76 fn default() -> Self {
77 Self {
78 id: None,
79 bypass_cache: None,
80 offset: None,
81 limit: None,
82 }
83 }
84}
85
86#[derive(Debug, Serialize)]
87#[cfg_attr(feature = "specta", derive(specta::Type))]
88pub struct WebdownloadCachedAvailabilityQuery {
89 #[serde(serialize_with = "serialize_comma_separated")]
90 pub hash: Vec<String>,
91 pub format: FormatType,
92}
93
94fn serialize_comma_separated<S>(vec: &[String], serializer: S) -> Result<S::Ok, S::Error>
95where
96 S: serde::Serializer,
97{
98 serializer.serialize_str(&vec.join(","))
99}
100
101impl Default for WebdownloadCachedAvailabilityQuery {
102 fn default() -> Self {
103 Self {
104 hash: Vec::new(),
105 format: FormatType::List,
106 }
107 }
108}