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