Skip to main content

cdp_driver/protocol/
file_system.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! The `FileSystem` domain.
5//!
6//! Types, command parameters and event payloads for the `FileSystem`
7//! domain. The method-name constants for the same domain are in
8//! [`crate::methods`].
9//!
10//! This domain is experimental and may change without notice.
11
12use serde::{Deserialize, Serialize};
13
14#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
15pub struct File {
16    pub name: String,
17    /// Timestamp
18    #[serde(rename = "lastModified")]
19    pub last_modified: crate::protocol::network::TimeSinceEpoch,
20    /// Size in bytes
21    pub size: f64,
22    pub r#type: String,
23}
24
25#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
26pub struct Directory {
27    pub name: String,
28    #[serde(rename = "nestedDirectories")]
29    pub nested_directories: Vec<String>,
30    /// Files that are directly nested under this directory.
31    #[serde(rename = "nestedFiles")]
32    pub nested_files: Vec<File>,
33}
34
35#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
36pub struct BucketFileSystemLocator {
37    /// Storage key
38    #[serde(rename = "storageKey")]
39    pub storage_key: crate::protocol::storage::SerializedStorageKey,
40    /// Bucket name. Not passing a `bucketName` will retrieve the default Bucket.
41    /// (<https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#storage_buckets>)
42    #[serde(
43        rename = "bucketName",
44        default,
45        skip_serializing_if = "Option::is_none"
46    )]
47    pub bucket_name: Option<String>,
48    /// Path to the directory using each path component as an array item.
49    #[serde(rename = "pathComponents")]
50    pub path_components: Vec<String>,
51}
52
53/// Parameters of `FileSystem.getDirectory`.
54#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
55pub struct GetDirectoryParams {
56    #[serde(rename = "bucketFileSystemLocator")]
57    pub bucket_file_system_locator: BucketFileSystemLocator,
58}
59
60/// What `FileSystem.getDirectory` answers with.
61#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
62pub struct GetDirectoryReturns {
63    /// Returns the directory object at the path.
64    pub directory: Directory,
65}
66
67impl crate::typed::Command for GetDirectoryParams {
68    const METHOD: &'static str = "FileSystem.getDirectory";
69    type Returns = GetDirectoryReturns;
70}