browser-commander 0.17.0

Universal browser automation library that supports multiple browser engines with a unified API
Documentation
// @generated by scripts/generate-puppeteer-bindings.mjs from
// rust/protocol/puppeteer/api.json. Do not edit by hand.

#![allow(clippy::all, missing_docs, unused_imports, non_snake_case)]

use serde_json::Value;

use super::*;
use crate::puppeteer::bridge::{binary, remote_type, BridgeError, JsFunction, Remote};

remote_type!(
    /// Puppeteer's `BluetoothEmulation` (puppeteer-core 25.10.0), a remote object
    /// served by `browser-commander serve --stdio`.
    BluetoothEmulation
);

impl BluetoothEmulation {
    /// `BluetoothEmulation.emulateAdapter`
    ///
    /// ```text
    /// emulateAdapter(state: AdapterState, leSupported?: boolean): Promise<void>
    /// ```
    pub async fn emulate_adapter(&self, state: &str, le_supported: Option<bool>) -> Result<(), BridgeError> {
        self.remote.call("emulateAdapter", vec![Some(Value::from(state)), le_supported.map(|x| Value::from(x))]).await
    }

    /// `BluetoothEmulation.disableEmulation`
    ///
    /// ```text
    /// disableEmulation(): Promise<void>
    /// ```
    pub async fn disable_emulation(&self) -> Result<(), BridgeError> {
        self.remote.call("disableEmulation", vec![]).await
    }

    /// `BluetoothEmulation.simulatePreconnectedPeripheral`
    ///
    /// ```text
    /// simulatePreconnectedPeripheral(preconnectedPeripheral: PreconnectedPeripheral): Promise<void>
    /// ```
    pub async fn simulate_preconnected_peripheral(&self, preconnected_peripheral: Value) -> Result<(), BridgeError> {
        self.remote.call("simulatePreconnectedPeripheral", vec![Some(preconnected_peripheral)]).await
    }
}