Current section
Files
Jump to
Current section
Files
lib/bibbidi/commands/network/continue_response.ex
# Generated by mix bibbidi.gen — do not edit manually
defmodule Bibbidi.Commands.Network.ContinueResponse do
@moduledoc """
Command struct for `network.continueResponse`.
[WebDriver BiDi Spec](https://w3c.github.io/webdriver-bidi/#command-network-continueResponse)
## Fields
- `request` - `t:Bibbidi.Types.Network.Request.t/0` (required)
- `cookies` - list of `t:Bibbidi.Types.Network.SetCookieHeader.t/0` (optional)
- `credentials` - `t:Bibbidi.Types.Network.AuthCredentials.t/0` (optional)
- `headers` - list of `t:Bibbidi.Types.Network.Header.t/0` (optional)
- `reason_phrase` - `String.t()` (optional)
- `status_code` - `t:Bibbidi.Types.JsUint.t/0` (optional)
"""
@derive Bibbidi.Telemetry.Metadata
@schema Zoi.struct(__MODULE__, %{
request: Bibbidi.Types.Network.Request.schema(),
cookies: Zoi.list(Bibbidi.Types.Network.SetCookieHeader.schema()) |> Zoi.optional(),
credentials: Bibbidi.Types.Network.AuthCredentials.schema() |> Zoi.optional(),
headers: Zoi.list(Bibbidi.Types.Network.Header.schema()) |> Zoi.optional(),
reason_phrase: Zoi.string() |> Zoi.optional(),
status_code: Bibbidi.Types.JsUint.schema() |> Zoi.optional(),
meta: Zoi.any() |> Zoi.optional()
})
@opts_schema Zoi.keyword(
cookies: Zoi.list(Zoi.any()) |> Zoi.optional(),
credentials: Zoi.any() |> Zoi.optional(),
headers: Zoi.list(Zoi.any()) |> Zoi.optional(),
reason_phrase: Zoi.string() |> Zoi.optional(),
status_code: Zoi.any() |> Zoi.optional()
)
@result_schema Zoi.map(Zoi.string(), Zoi.any())
@type t :: unquote(Zoi.type_spec(@schema))
@type opts :: unquote(Zoi.type_spec(@opts_schema))
@type result :: unquote(Zoi.type_spec(@result_schema))
@enforce_keys Zoi.Struct.enforce_keys(@schema)
defstruct Zoi.Struct.struct_fields(@schema)
@doc "Returns the Zoi schema for this command struct."
def schema, do: @schema
@doc "Returns the Zoi schema for the keyword options."
def opts_schema, do: @opts_schema
@doc "Returns the Zoi schema for the result type."
def result_schema, do: @result_schema
defimpl Bibbidi.Encodable do
def method(_), do: "network.continueResponse"
def params(cmd) do
optional = [
{:cookies, cmd.cookies},
{:credentials, cmd.credentials},
{:headers, cmd.headers},
{:reasonPhrase, cmd.reason_phrase},
{:statusCode, cmd.status_code}
]
Enum.reduce(optional, %{request: cmd.request}, fn
{_key, nil}, acc -> acc
{key, value}, acc -> Map.put(acc, key, value)
end)
end
end
end