glendam/protocol

This module is generated from the Chrome DevTools Protocol schema.

Do not edit this file manually. Generator: dev/codegen/generate_bindings.gleam Regenerate with:

gleam run -m codegen/generate_bindings

Protocol version: 1.3

For reference: See the DevTools Protocol API Docs

This module is the entrypoint for the generated Chrome DevTools Protocol bindings and exposes the protocol version used during generation.

Important limitations

Prefer Runtime-domain JavaScript evaluation over direct DOM-domain automation. The Runtime approach follows the same compatibility reasoning documented in the Puppeteer project.

CDP schema fields declared as any cannot be represented bidirectionally by the generated Gleam types. Decoders preserve them as dynamic protocol values, while generated encoders emit JSON null rather than silently claiming to support arbitrary values. Use a handwritten protocol call such as glendam.call_custom_function_on when an operation must send arbitrary JavaScript values.

Structure

Each domain in the protocol is represented as a module under protocol/.

The generator consumes the published DevTools Protocol JSON schema and applies documented compatibility patches in apply_protocol_patches. Cross-domain type references are preserved when possible; references that would create a circular Gleam module dependency are replaced with their underlying type.

Types

Each schema type has internal encode__ and decode__ functions used by the generated command API. Object types without declared properties are represented as Dict(String, String). Enum properties and command response records receive additional generated types so callers do not need to handle raw strings.

Commands

Each command becomes a snake-case function that encodes its request and decodes its response. A decoding failure returns chrome.ProtocolError, indicating a schema mismatch or generator defect.

The first parameter is a callback with the following shape:


fn(String, option.Option(json.Json)) ->
  Result(dynamic.Dynamic, chrome.RequestError)

The callback lets callers select a browser or page target and attach additional transport context such as a CDP session identifier.

Events

Generated event records and decoders are available, while listener lifecycle is managed by the higher-level Glendam browser APIs.

Values

pub fn version() -> #(String, String)

Get the protocol version as a tuple of major and minor version

Search Document