rs_uptobox/input/
update_file.rs1use serde::Serialize;
2
3#[derive(Serialize, Debug)]
5pub struct UpdateFile {
6 file_code: String,
8
9 #[serde(skip_serializing_if = "Option::is_none")]
11 new_name: Option<String>,
12
13 #[serde(skip_serializing_if = "Option::is_none")]
15 description: Option<String>,
16
17 #[serde(skip_serializing_if = "Option::is_none")]
19 password: Option<String>,
20
21 #[serde(skip_serializing_if = "Option::is_none")]
23 public: Option<bool>,
24}
25
26impl UpdateFile {
27 pub fn new(file_code: impl Into<String>) -> Self {
31 Self {
32 file_code: file_code.into(),
33 ..Default::default()
34 }
35 }
36
37 pub fn name(&mut self, name: impl Into<String>) -> &mut Self {
39 let _ = self.new_name.insert(name.into());
40 self
41 }
42
43 pub fn description(&mut self, description: impl Into<String>) -> &mut Self {
45 let _ = self.description.insert(description.into());
46 self
47 }
48
49 pub fn password(&mut self, password: impl Into<String>) -> &mut Self {
51 let _ = self.password.insert(password.into());
52 self
53 }
54
55 pub fn public(&mut self, public: bool) -> &mut Self {
57 let _ = self.public.insert(public);
58 self
59 }
60}
61
62impl Default for UpdateFile {
63 fn default() -> Self {
64 Self {
65 file_code: "".into(),
66 new_name: None,
67 description: None,
68 password: None,
69 public: None,
70 }
71 }
72}