use serde::{Serialize, Deserialize};
use serde_json::Value as JsonValue;
pub type RequestId = String;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
pub enum RequestStage {
#[default]
Request,
Response,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct RequestPattern {
#[serde(skip_serializing_if = "Option::is_none")]
pub urlPattern: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub resourceType: Option<crate::network::ResourceType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub requestStage: Option<RequestStage>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct HeaderEntry {
pub name: String,
pub value: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AuthChallenge {
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<String>,
pub origin: String,
pub scheme: String,
pub realm: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct AuthChallengeResponse {
pub response: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub password: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct DisableParams {}
impl DisableParams { pub const METHOD: &'static str = "Fetch.disable"; }
impl crate::CdpCommand for DisableParams {
const METHOD: &'static str = "Fetch.disable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct EnableParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub patterns: Option<Vec<RequestPattern>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub handleAuthRequests: Option<bool>,
}
impl EnableParams { pub const METHOD: &'static str = "Fetch.enable"; }
impl crate::CdpCommand for EnableParams {
const METHOD: &'static str = "Fetch.enable";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct FailRequestParams {
pub requestId: RequestId,
pub errorReason: crate::network::ErrorReason,
}
impl FailRequestParams { pub const METHOD: &'static str = "Fetch.failRequest"; }
impl crate::CdpCommand for FailRequestParams {
const METHOD: &'static str = "Fetch.failRequest";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct FulfillRequestParams {
pub requestId: RequestId,
pub responseCode: i64,
#[serde(skip_serializing_if = "Option::is_none")]
pub responseHeaders: Option<Vec<HeaderEntry>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub binaryResponseHeaders: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub body: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub responsePhrase: Option<String>,
}
impl FulfillRequestParams { pub const METHOD: &'static str = "Fetch.fulfillRequest"; }
impl crate::CdpCommand for FulfillRequestParams {
const METHOD: &'static str = "Fetch.fulfillRequest";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ContinueRequestParams {
pub requestId: RequestId,
#[serde(skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub postData: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub headers: Option<Vec<HeaderEntry>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub interceptResponse: Option<bool>,
}
impl ContinueRequestParams { pub const METHOD: &'static str = "Fetch.continueRequest"; }
impl crate::CdpCommand for ContinueRequestParams {
const METHOD: &'static str = "Fetch.continueRequest";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ContinueWithAuthParams {
pub requestId: RequestId,
pub authChallengeResponse: AuthChallengeResponse,
}
impl ContinueWithAuthParams { pub const METHOD: &'static str = "Fetch.continueWithAuth"; }
impl crate::CdpCommand for ContinueWithAuthParams {
const METHOD: &'static str = "Fetch.continueWithAuth";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct ContinueResponseParams {
pub requestId: RequestId,
#[serde(skip_serializing_if = "Option::is_none")]
pub responseCode: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub responsePhrase: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub responseHeaders: Option<Vec<HeaderEntry>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub binaryResponseHeaders: Option<String>,
}
impl ContinueResponseParams { pub const METHOD: &'static str = "Fetch.continueResponse"; }
impl crate::CdpCommand for ContinueResponseParams {
const METHOD: &'static str = "Fetch.continueResponse";
type Response = crate::EmptyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetResponseBodyParams {
pub requestId: RequestId,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct GetResponseBodyReturns {
pub body: String,
pub base64Encoded: bool,
}
impl GetResponseBodyParams { pub const METHOD: &'static str = "Fetch.getResponseBody"; }
impl crate::CdpCommand for GetResponseBodyParams {
const METHOD: &'static str = "Fetch.getResponseBody";
type Response = GetResponseBodyReturns;
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TakeResponseBodyAsStreamParams {
pub requestId: RequestId,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
#[serde(rename_all = "camelCase")]
pub struct TakeResponseBodyAsStreamReturns {
pub stream: crate::io::StreamHandle,
}
impl TakeResponseBodyAsStreamParams { pub const METHOD: &'static str = "Fetch.takeResponseBodyAsStream"; }
impl crate::CdpCommand for TakeResponseBodyAsStreamParams {
const METHOD: &'static str = "Fetch.takeResponseBodyAsStream";
type Response = TakeResponseBodyAsStreamReturns;
}