Skip to main content

browser_protocol/filesystem/
mod.rs

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