rs_uptobox/input/
get_files_from_public_folder.rs

1use serde::Serialize;
2
3/// Input
4#[derive(Serialize, Debug)]
5#[serde(rename_all = "camelCase")]
6pub struct GetFilesFromPublicFolder {
7    /// The folder id
8    folder: usize,
9
10    /// The folder hash
11    hash: String,
12
13    /// Number of files to retrieve
14    limit: usize,
15
16    /// Retrieve from the specified offset
17    offset: usize,
18}
19
20impl GetFilesFromPublicFolder {
21    /// Create a new instance
22    pub fn new(folder: usize, hash: impl Into<String>) -> Self {
23        Self {
24            folder,
25            hash: hash.into(),
26            ..Default::default()
27        }
28    }
29
30    /// Set the limit of files to retrieve
31    pub fn limit(&mut self, limit: usize) -> &mut Self {
32        self.limit = limit;
33        self
34    }
35
36    /// Set the offset of the directory
37    pub fn offset(&mut self, offset: usize) -> &mut Self {
38        self.offset = offset;
39        self
40    }
41}
42
43impl Default for GetFilesFromPublicFolder {
44    fn default() -> Self {
45        Self {
46            folder: 0,
47            hash: "".into(),
48            limit: 100,
49            offset: 0,
50        }
51    }
52}