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 SystemInfo domain defines methods and events for querying low-level
//! system information.
//!
//! Types, command parameters and event payloads for the `SystemInfo`
//! 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};

/// Describes a single graphics processor (GPU).
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GpuDevice {
    /// PCI ID of the GPU vendor, if available; 0 otherwise.
    #[serde(rename = "vendorId")]
    pub vendor_id: f64,
    /// PCI ID of the GPU device, if available; 0 otherwise.
    #[serde(rename = "deviceId")]
    pub device_id: f64,
    /// Sub sys ID of the GPU, only available on Windows.
    #[serde(rename = "subSysId", default, skip_serializing_if = "Option::is_none")]
    pub sub_sys_id: Option<f64>,
    /// Revision of the GPU, only available on Windows.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub revision: Option<f64>,
    /// String description of the GPU vendor, if the PCI ID is not available.
    #[serde(rename = "vendorString")]
    pub vendor_string: String,
    /// String description of the GPU device, if the PCI ID is not available.
    #[serde(rename = "deviceString")]
    pub device_string: String,
    /// String description of the GPU driver vendor.
    #[serde(rename = "driverVendor")]
    pub driver_vendor: String,
    /// String description of the GPU driver version.
    #[serde(rename = "driverVersion")]
    pub driver_version: String,
}

/// Describes the width and height dimensions of an entity.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Size {
    /// Width in pixels.
    pub width: i64,
    /// Height in pixels.
    pub height: i64,
}

/// Describes a supported video decoding profile with its associated minimum
/// and maximum resolutions.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct VideoDecodeAcceleratorCapability {
    /// Video codec profile that is supported, e.g. VP9 Profile 2.
    pub profile: String,
    /// Maximum video dimensions in pixels supported for this |profile|.
    #[serde(rename = "maxResolution")]
    pub max_resolution: Size,
    /// Minimum video dimensions in pixels supported for this |profile|.
    #[serde(rename = "minResolution")]
    pub min_resolution: Size,
}

/// Describes a supported video encoding profile with its associated maximum
/// resolution and maximum framerate.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct VideoEncodeAcceleratorCapability {
    /// Video codec profile that is supported, e.g H264 Main.
    pub profile: String,
    /// Maximum video dimensions in pixels supported for this |profile|.
    #[serde(rename = "maxResolution")]
    pub max_resolution: Size,
    /// Maximum encoding framerate in frames per second supported for this
    /// |profile|, as fraction's numerator and denominator, e.g. 24/1 fps,
    /// 24000/1001 fps, etc.
    #[serde(rename = "maxFramerateNumerator")]
    pub max_framerate_numerator: i64,
    #[serde(rename = "maxFramerateDenominator")]
    pub max_framerate_denominator: i64,
}

/// YUV subsampling type of the pixels of a given image.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SubsamplingFormat {
    /// `yuv420`
    #[serde(rename = "yuv420")]
    Yuv420,
    /// `yuv422`
    #[serde(rename = "yuv422")]
    Yuv422,
    /// `yuv444`
    #[serde(rename = "yuv444")]
    Yuv444,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Image format of a given image.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ImageType {
    /// `jpeg`
    #[serde(rename = "jpeg")]
    Jpeg,
    /// `webp`
    #[serde(rename = "webp")]
    Webp,
    /// `unknown`
    #[serde(rename = "unknown")]
    Unknown,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// Provides information about the GPU(s) on the system.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GpuInfo {
    /// The graphics devices on the system. Element 0 is the primary GPU.
    pub devices: Vec<GpuDevice>,
    /// An optional dictionary of additional GPU related attributes.
    #[serde(
        rename = "auxAttributes",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub aux_attributes: Option<serde_json::Value>,
    /// An optional dictionary of graphics features and their status.
    #[serde(
        rename = "featureStatus",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub feature_status: Option<serde_json::Value>,
    /// An optional array of GPU driver bug workarounds.
    #[serde(rename = "driverBugWorkarounds")]
    pub driver_bug_workarounds: Vec<String>,
    /// Supported accelerated video decoding capabilities.
    #[serde(rename = "videoDecoding")]
    pub video_decoding: Vec<VideoDecodeAcceleratorCapability>,
    /// Supported accelerated video encoding capabilities.
    #[serde(rename = "videoEncoding")]
    pub video_encoding: Vec<VideoEncodeAcceleratorCapability>,
}

/// Represents process info.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ProcessInfo {
    /// Specifies process type.
    pub r#type: String,
    /// Specifies process id.
    pub id: i64,
    /// Specifies cumulative CPU usage in seconds across all threads of the
    /// process since the process start.
    #[serde(rename = "cpuTime")]
    pub cpu_time: f64,
}

/// Returns information about the system.
///
/// Parameters of `SystemInfo.getInfo`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetInfoParams {}

/// What `SystemInfo.getInfo` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetInfoReturns {
    /// Information about the GPUs on the system.
    pub gpu: GpuInfo,
    /// A platform-dependent description of the model of the machine. On Mac OS,
    /// this is, for example, 'MacBookPro'. Will be the empty string if not
    /// supported.
    #[serde(rename = "modelName")]
    pub model_name: String,
    /// A platform-dependent description of the version of the machine. On Mac OS,
    /// this is, for example, '10.1'. Will be the empty string if not supported.
    #[serde(rename = "modelVersion")]
    pub model_version: String,
    /// The command line string used to launch the browser. Will be the empty
    /// string if not supported.
    #[serde(rename = "commandLine")]
    pub command_line: String,
}

impl crate::typed::Command for GetInfoParams {
    const METHOD: &'static str = "SystemInfo.getInfo";
    type Returns = GetInfoReturns;
}

/// Returns information about the feature state.
///
/// Parameters of `SystemInfo.getFeatureState`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetFeatureStateParams {
    #[serde(rename = "featureState")]
    pub feature_state: String,
}

/// What `SystemInfo.getFeatureState` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetFeatureStateReturns {
    #[serde(rename = "featureEnabled")]
    pub feature_enabled: bool,
}

impl crate::typed::Command for GetFeatureStateParams {
    const METHOD: &'static str = "SystemInfo.getFeatureState";
    type Returns = GetFeatureStateReturns;
}

/// Returns information about all running processes.
///
/// Parameters of `SystemInfo.getProcessInfo`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetProcessInfoParams {}

/// What `SystemInfo.getProcessInfo` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetProcessInfoReturns {
    /// An array of process info blocks.
    #[serde(rename = "processInfo")]
    pub process_info: Vec<ProcessInfo>,
}

impl crate::typed::Command for GetProcessInfoParams {
    const METHOD: &'static str = "SystemInfo.getProcessInfo";
    type Returns = GetProcessInfoReturns;
}