Skip to main content

browser_protocol/filesystem/
mod.rs

1use serde::{Serialize, Deserialize};
2
3
4#[derive(Debug, Clone, Serialize, Deserialize, Default)]
5#[serde(rename_all = "camelCase")]
6pub struct File {
7
8    pub name: String,
9    /// Timestamp
10
11    pub lastModified: crate::network::TimeSinceEpoch,
12    /// Size in bytes
13
14    pub size: f64,
15
16    #[serde(rename = "type")]
17    pub type_: String,
18}
19
20
21#[derive(Debug, Clone, Serialize, Deserialize, Default)]
22#[serde(rename_all = "camelCase")]
23pub struct Directory {
24
25    pub name: String,
26
27    pub nestedDirectories: Vec<String>,
28    /// Files that are directly nested under this directory.
29
30    pub nestedFiles: Vec<File>,
31}
32
33
34#[derive(Debug, Clone, Serialize, Deserialize, Default)]
35#[serde(rename_all = "camelCase")]
36pub struct BucketFileSystemLocator {
37    /// Storage key
38
39    pub storageKey: crate::storage::SerializedStorageKey,
40    /// Bucket name. Not passing a 'bucketName' will retrieve the default Bucket. (<https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#storage_buckets>)
41
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub bucketName: Option<String>,
44    /// Path to the directory using each path component as an array item.
45
46    pub pathComponents: Vec<String>,
47}
48
49
50#[derive(Debug, Clone, Serialize, Deserialize, Default)]
51#[serde(rename_all = "camelCase")]
52pub struct GetDirectoryParams {
53
54    pub bucketFileSystemLocator: BucketFileSystemLocator,
55}
56
57
58#[derive(Debug, Clone, Serialize, Deserialize, Default)]
59#[serde(rename_all = "camelCase")]
60pub struct GetDirectoryReturns {
61    /// Returns the directory object at the path.
62
63    pub directory: Directory,
64}