use serde::{Deserialize, Serialize};
pub type BrowserContextId = String;
pub type WindowId = i64;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum WindowState {
#[serde(rename = "normal")]
Normal,
#[serde(rename = "minimized")]
Minimized,
#[serde(rename = "maximized")]
Maximized,
#[serde(rename = "fullscreen")]
Fullscreen,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Bounds {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub left: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub top: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
#[serde(
rename = "windowState",
default,
skip_serializing_if = "Option::is_none"
)]
pub window_state: Option<WindowState>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PermissionType {
#[serde(rename = "ar")]
Ar,
#[serde(rename = "audioCapture")]
AudioCapture,
#[serde(rename = "automaticFullscreen")]
AutomaticFullscreen,
#[serde(rename = "backgroundFetch")]
BackgroundFetch,
#[serde(rename = "backgroundSync")]
BackgroundSync,
#[serde(rename = "cameraPanTiltZoom")]
CameraPanTiltZoom,
#[serde(rename = "capturedSurfaceControl")]
CapturedSurfaceControl,
#[serde(rename = "clipboardReadWrite")]
ClipboardReadWrite,
#[serde(rename = "clipboardSanitizedWrite")]
ClipboardSanitizedWrite,
#[serde(rename = "displayCapture")]
DisplayCapture,
#[serde(rename = "durableStorage")]
DurableStorage,
#[serde(rename = "geolocation")]
Geolocation,
#[serde(rename = "handTracking")]
HandTracking,
#[serde(rename = "idleDetection")]
IdleDetection,
#[serde(rename = "keyboardLock")]
KeyboardLock,
#[serde(rename = "localFonts")]
LocalFonts,
#[serde(rename = "localNetwork")]
LocalNetwork,
#[serde(rename = "localNetworkAccess")]
LocalNetworkAccess,
#[serde(rename = "loopbackNetwork")]
LoopbackNetwork,
#[serde(rename = "midi")]
Midi,
#[serde(rename = "midiSysex")]
MidiSysex,
#[serde(rename = "nfc")]
Nfc,
#[serde(rename = "notifications")]
Notifications,
#[serde(rename = "paymentHandler")]
PaymentHandler,
#[serde(rename = "periodicBackgroundSync")]
PeriodicBackgroundSync,
#[serde(rename = "pointerLock")]
PointerLock,
#[serde(rename = "protectedMediaIdentifier")]
ProtectedMediaIdentifier,
#[serde(rename = "sensors")]
Sensors,
#[serde(rename = "smartCard")]
SmartCard,
#[serde(rename = "speakerSelection")]
SpeakerSelection,
#[serde(rename = "storageAccess")]
StorageAccess,
#[serde(rename = "videoCapture")]
VideoCapture,
#[serde(rename = "vr")]
Vr,
#[serde(rename = "wakeLockScreen")]
WakeLockScreen,
#[serde(rename = "wakeLockSystem")]
WakeLockSystem,
#[serde(rename = "webAppInstallation")]
WebAppInstallation,
#[serde(rename = "webPrinting")]
WebPrinting,
#[serde(rename = "windowManagement")]
WindowManagement,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum PermissionSetting {
#[serde(rename = "granted")]
Granted,
#[serde(rename = "denied")]
Denied,
#[serde(rename = "prompt")]
Prompt,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct PermissionDescriptor {
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sysex: Option<bool>,
#[serde(
rename = "userVisibleOnly",
default,
skip_serializing_if = "Option::is_none"
)]
pub user_visible_only: Option<bool>,
#[serde(
rename = "allowWithoutSanitization",
default,
skip_serializing_if = "Option::is_none"
)]
pub allow_without_sanitization: Option<bool>,
#[serde(
rename = "allowWithoutGesture",
default,
skip_serializing_if = "Option::is_none"
)]
pub allow_without_gesture: Option<bool>,
#[serde(
rename = "panTiltZoom",
default,
skip_serializing_if = "Option::is_none"
)]
pub pan_tilt_zoom: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum BrowserCommandId {
#[serde(rename = "openTabSearch")]
OpenTabSearch,
#[serde(rename = "closeTabSearch")]
CloseTabSearch,
#[serde(rename = "openGlic")]
OpenGlic,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Bucket {
pub low: i64,
pub high: i64,
pub count: i64,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Histogram {
pub name: String,
pub sum: i64,
pub count: i64,
pub buckets: Vec<Bucket>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetPermissionParams {
pub permission: PermissionDescriptor,
pub setting: PermissionSetting,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub origin: Option<String>,
#[serde(
rename = "embeddedOrigin",
default,
skip_serializing_if = "Option::is_none"
)]
pub embedded_origin: Option<String>,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<BrowserContextId>,
}
impl crate::typed::Command for SetPermissionParams {
const METHOD: &'static str = "Browser.setPermission";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GrantPermissionsParams {
pub permissions: Vec<PermissionType>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub origin: Option<String>,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<BrowserContextId>,
}
impl crate::typed::Command for GrantPermissionsParams {
const METHOD: &'static str = "Browser.grantPermissions";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ResetPermissionsParams {
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<BrowserContextId>,
}
impl crate::typed::Command for ResetPermissionsParams {
const METHOD: &'static str = "Browser.resetPermissions";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SetDownloadBehaviorParams {
pub behavior: SetDownloadBehaviorBehavior,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<BrowserContextId>,
#[serde(
rename = "downloadPath",
default,
skip_serializing_if = "Option::is_none"
)]
pub download_path: Option<String>,
#[serde(
rename = "eventsEnabled",
default,
skip_serializing_if = "Option::is_none"
)]
pub events_enabled: Option<bool>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SetDownloadBehaviorBehavior {
#[serde(rename = "deny")]
Deny,
#[serde(rename = "allow")]
Allow,
#[serde(rename = "allowAndName")]
AllowAndName,
#[serde(rename = "default")]
Default,
#[serde(untagged)]
Unrecognized(String),
}
impl crate::typed::Command for SetDownloadBehaviorParams {
const METHOD: &'static str = "Browser.setDownloadBehavior";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CancelDownloadParams {
pub guid: String,
#[serde(
rename = "browserContextId",
default,
skip_serializing_if = "Option::is_none"
)]
pub browser_context_id: Option<BrowserContextId>,
}
impl crate::typed::Command for CancelDownloadParams {
const METHOD: &'static str = "Browser.cancelDownload";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CloseParams {}
impl crate::typed::Command for CloseParams {
const METHOD: &'static str = "Browser.close";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CrashParams {}
impl crate::typed::Command for CrashParams {
const METHOD: &'static str = "Browser.crash";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CrashGpuProcessParams {}
impl crate::typed::Command for CrashGpuProcessParams {
const METHOD: &'static str = "Browser.crashGpuProcess";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetVersionParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetVersionReturns {
#[serde(rename = "protocolVersion")]
pub protocol_version: String,
pub product: String,
pub revision: String,
#[serde(rename = "userAgent")]
pub user_agent: String,
#[serde(rename = "jsVersion")]
pub js_version: String,
}
impl crate::typed::Command for GetVersionParams {
const METHOD: &'static str = "Browser.getVersion";
type Returns = GetVersionReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserCommandLineParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetBrowserCommandLineReturns {
pub arguments: Vec<String>,
}
impl crate::typed::Command for GetBrowserCommandLineParams {
const METHOD: &'static str = "Browser.getBrowserCommandLine";
type Returns = GetBrowserCommandLineReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddMockCameraParams {
#[serde(rename = "deviceId")]
pub device_id: String,
}
impl crate::typed::Command for AddMockCameraParams {
const METHOD: &'static str = "Browser.addMockCamera";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetHistogramsParams {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub query: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub delta: Option<bool>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetHistogramsReturns {
pub histograms: Vec<Histogram>,
}
impl crate::typed::Command for GetHistogramsParams {
const METHOD: &'static str = "Browser.getHistograms";
type Returns = GetHistogramsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetHistogramParams {
pub name: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub delta: Option<bool>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetHistogramReturns {
pub histogram: Histogram,
}
impl crate::typed::Command for GetHistogramParams {
const METHOD: &'static str = "Browser.getHistogram";
type Returns = GetHistogramReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWindowBoundsParams {
#[serde(rename = "windowId")]
pub window_id: WindowId,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWindowBoundsReturns {
pub bounds: Bounds,
}
impl crate::typed::Command for GetWindowBoundsParams {
const METHOD: &'static str = "Browser.getWindowBounds";
type Returns = GetWindowBoundsReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWindowForTargetParams {
#[serde(rename = "targetId", default, skip_serializing_if = "Option::is_none")]
pub target_id: Option<crate::protocol::target::TargetId>,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetWindowForTargetReturns {
#[serde(rename = "windowId")]
pub window_id: WindowId,
pub bounds: Bounds,
}
impl crate::typed::Command for GetWindowForTargetParams {
const METHOD: &'static str = "Browser.getWindowForTarget";
type Returns = GetWindowForTargetReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetWindowBoundsParams {
#[serde(rename = "windowId")]
pub window_id: WindowId,
pub bounds: Bounds,
}
impl crate::typed::Command for SetWindowBoundsParams {
const METHOD: &'static str = "Browser.setWindowBounds";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetContentsSizeParams {
#[serde(rename = "windowId")]
pub window_id: WindowId,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
}
impl crate::typed::Command for SetContentsSizeParams {
const METHOD: &'static str = "Browser.setContentsSize";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetDockTileParams {
#[serde(
rename = "badgeLabel",
default,
skip_serializing_if = "Option::is_none"
)]
pub badge_label: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
}
impl crate::typed::Command for SetDockTileParams {
const METHOD: &'static str = "Browser.setDockTile";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct ExecuteBrowserCommandParams {
#[serde(rename = "commandId")]
pub command_id: BrowserCommandId,
}
impl crate::typed::Command for ExecuteBrowserCommandParams {
const METHOD: &'static str = "Browser.executeBrowserCommand";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddPrivacySandboxEnrollmentOverrideParams {
pub url: String,
}
impl crate::typed::Command for AddPrivacySandboxEnrollmentOverrideParams {
const METHOD: &'static str = "Browser.addPrivacySandboxEnrollmentOverride";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetGlobalPrivacyControlParams {}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetGlobalPrivacyControlReturns {
pub gpc: bool,
}
impl crate::typed::Command for GetGlobalPrivacyControlParams {
const METHOD: &'static str = "Browser.getGlobalPrivacyControl";
type Returns = GetGlobalPrivacyControlReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetGlobalPrivacyControlParams {
pub gpc: bool,
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetGlobalPrivacyControlReturns {
pub gpc: bool,
}
impl crate::typed::Command for SetGlobalPrivacyControlParams {
const METHOD: &'static str = "Browser.setGlobalPrivacyControl";
type Returns = SetGlobalPrivacyControlReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DownloadWillBeginEvent {
#[serde(rename = "frameId")]
pub frame_id: crate::protocol::page::FrameId,
pub guid: String,
pub url: String,
#[serde(rename = "suggestedFilename")]
pub suggested_filename: String,
}
impl crate::typed::Event for DownloadWillBeginEvent {
const METHOD: &'static str = "Browser.downloadWillBegin";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DownloadProgressEvent {
pub guid: String,
#[serde(rename = "totalBytes")]
pub total_bytes: f64,
#[serde(rename = "receivedBytes")]
pub received_bytes: f64,
pub state: DownloadProgressState,
#[serde(rename = "filePath", default, skip_serializing_if = "Option::is_none")]
pub file_path: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum DownloadProgressState {
#[serde(rename = "inProgress")]
InProgress,
#[serde(rename = "completed")]
Completed,
#[serde(rename = "canceled")]
Canceled,
#[serde(untagged)]
Unrecognized(String),
}
impl crate::typed::Event for DownloadProgressEvent {
const METHOD: &'static str = "Browser.downloadProgress";
}