cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! The `FileSystem` domain.
//!
//! Types, command parameters and event payloads for the `FileSystem`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
//!
//! This domain is experimental and may change without notice.

use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct File {
    pub name: String,
    /// Timestamp
    #[serde(rename = "lastModified")]
    pub last_modified: crate::protocol::network::TimeSinceEpoch,
    /// Size in bytes
    pub size: f64,
    pub r#type: String,
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Directory {
    pub name: String,
    #[serde(rename = "nestedDirectories")]
    pub nested_directories: Vec<String>,
    /// Files that are directly nested under this directory.
    #[serde(rename = "nestedFiles")]
    pub nested_files: Vec<File>,
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct BucketFileSystemLocator {
    /// Storage key
    #[serde(rename = "storageKey")]
    pub storage_key: crate::protocol::storage::SerializedStorageKey,
    /// Bucket name. Not passing a `bucketName` will retrieve the default Bucket.
    /// (<https://developer.mozilla.org/en-US/docs/Web/API/Storage_API#storage_buckets>)
    #[serde(
        rename = "bucketName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub bucket_name: Option<String>,
    /// Path to the directory using each path component as an array item.
    #[serde(rename = "pathComponents")]
    pub path_components: Vec<String>,
}

/// Parameters of `FileSystem.getDirectory`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDirectoryParams {
    #[serde(rename = "bucketFileSystemLocator")]
    pub bucket_file_system_locator: BucketFileSystemLocator,
}

/// What `FileSystem.getDirectory` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetDirectoryReturns {
    /// Returns the directory object at the path.
    pub directory: Directory,
}

impl crate::typed::Command for GetDirectoryParams {
    const METHOD: &'static str = "FileSystem.getDirectory";
    type Returns = GetDirectoryReturns;
}