Current section
Files
Jump to
Current section
Files
lib/bibbidi/commands/browsing_context/close.ex
# Generated by mix bibbidi.gen — do not edit manually
defmodule Bibbidi.Commands.BrowsingContext.Close do
@moduledoc """
Command struct for `browsingContext.close`.
"""
@schema Zoi.struct(__MODULE__, %{
context: Zoi.any(),
prompt_unload: Zoi.boolean() |> Zoi.optional()
})
@opts_schema Zoi.keyword(prompt_unload: Zoi.boolean() |> 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: "browsingContext.close"
def params(cmd) do
optional = [
{:promptUnload, cmd.prompt_unload}
]
Enum.reduce(optional, %{context: cmd.context}, fn
{_key, nil}, acc -> acc
{key, value}, acc -> Map.put(acc, key, value)
end)
end
end
end