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.

//! This domain allows interacting with the Digital Credentials API for
//! automation.
//!
//! Types, command parameters and event payloads for the `DigitalCredentials`
//! 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};

/// The type of virtual wallet action.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum VirtualWalletAction {
    /// `respond`
    #[serde(rename = "respond")]
    Respond,
    /// `decline`
    #[serde(rename = "decline")]
    Decline,
    /// `wait`
    #[serde(rename = "wait")]
    Wait,
    /// `clear`
    #[serde(rename = "clear")]
    Clear,
    /// 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),
}

/// Sets the behavior of the virtual wallet for digital credential requests
/// issued from this frame.
///
/// Parameters of `DigitalCredentials.setVirtualWalletBehavior`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetVirtualWalletBehaviorParams {
    /// The action of the virtual wallet.
    pub action: VirtualWalletAction,
    /// The protocol identifier (e.g. "openid4vp"). Required when |action| is
    /// "respond", forbidden otherwise.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub protocol: Option<String>,
    /// The response data object returned by the wallet. Required when |action| is
    /// "respond", forbidden otherwise.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub response: Option<serde_json::Value>,
    /// The frame to scope the virtual wallet behavior to.
    #[serde(rename = "frameId", default, skip_serializing_if = "Option::is_none")]
    pub frame_id: Option<crate::protocol::page::FrameId>,
}

impl crate::typed::Command for SetVirtualWalletBehaviorParams {
    const METHOD: &'static str = "DigitalCredentials.setVirtualWalletBehavior";
    type Returns = crate::typed::NoReturns;
}