browser-commander 0.14.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 `HTTPResponse` (puppeteer-core 25.10.0), a remote object
    /// served by `browser-commander serve --stdio`.
    HTTPResponse
);

impl HTTPResponse {
    /// `HTTPResponse.remoteAddress`
    ///
    /// ```text
    /// remoteAddress(): RemoteAddress
    /// ```
    pub async fn remote_address(&self) -> Result<Value, BridgeError> {
        self.remote.call("remoteAddress", vec![]).await
    }

    /// `HTTPResponse.url`
    ///
    /// ```text
    /// url(): string
    /// ```
    pub async fn url(&self) -> Result<String, BridgeError> {
        self.remote.call("url", vec![]).await
    }

    /// `HTTPResponse.ok`
    ///
    /// ```text
    /// ok(): boolean
    /// ```
    pub async fn ok(&self) -> Result<bool, BridgeError> {
        self.remote.call("ok", vec![]).await
    }

    /// `HTTPResponse.status`
    ///
    /// ```text
    /// status(): number
    /// ```
    pub async fn status(&self) -> Result<f64, BridgeError> {
        self.remote.call("status", vec![]).await
    }

    /// `HTTPResponse.statusText`
    ///
    /// ```text
    /// statusText(): string
    /// ```
    pub async fn status_text(&self) -> Result<String, BridgeError> {
        self.remote.call("statusText", vec![]).await
    }

    /// `HTTPResponse.headers`
    ///
    /// ```text
    /// headers(): Record<string, string>
    /// ```
    pub async fn headers(&self) -> Result<Value, BridgeError> {
        self.remote.call("headers", vec![]).await
    }

    /// `HTTPResponse.securityDetails`
    ///
    /// ```text
    /// securityDetails(): SecurityDetails | null
    /// ```
    pub async fn security_details(&self) -> Result<Option<SecurityDetails>, BridgeError> {
        self.remote.call("securityDetails", vec![]).await
    }

    /// `HTTPResponse.timing`
    ///
    /// ```text
    /// timing(): Protocol.Network.ResourceTiming | null
    /// ```
    pub async fn timing(&self) -> Result<Option<Value>, BridgeError> {
        self.remote.call("timing", vec![]).await
    }

    /// `HTTPResponse.content`
    ///
    /// ```text
    /// content(): Promise<Uint8Array>
    /// ```
    pub async fn content(&self) -> Result<Vec<u8>, BridgeError> {
        self.remote.call("content", vec![]).await
    }

    /// `HTTPResponse.buffer`
    ///
    /// ```text
    /// buffer(): Promise<Buffer>
    /// ```
    pub async fn buffer(&self) -> Result<Vec<u8>, BridgeError> {
        self.remote.call("buffer", vec![]).await
    }

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

    /// `HTTPResponse.json`
    ///
    /// ```text
    /// json(): Promise<any>
    /// ```
    pub async fn json(&self) -> Result<Value, BridgeError> {
        self.remote.call("json", vec![]).await
    }

    /// `HTTPResponse.request`
    ///
    /// ```text
    /// request(): HTTPRequest
    /// ```
    pub async fn request(&self) -> Result<HTTPRequest, BridgeError> {
        self.remote.call("request", vec![]).await
    }

    /// `HTTPResponse.fromCache`
    ///
    /// ```text
    /// fromCache(): boolean
    /// ```
    pub async fn from_cache(&self) -> Result<bool, BridgeError> {
        self.remote.call("fromCache", vec![]).await
    }

    /// `HTTPResponse.fromServiceWorker`
    ///
    /// ```text
    /// fromServiceWorker(): boolean
    /// ```
    pub async fn from_service_worker(&self) -> Result<bool, BridgeError> {
        self.remote.call("fromServiceWorker", vec![]).await
    }

    /// `HTTPResponse.frame`
    ///
    /// ```text
    /// frame(): Frame | null
    /// ```
    pub async fn frame(&self) -> Result<Option<Frame>, BridgeError> {
        self.remote.call("frame", vec![]).await
    }
}