Packages
dagger
0.8.8
0.21.7
0.21.6
0.21.5
0.21.4
0.21.3
0.21.2
0.21.1
0.21.0
0.20.8
0.20.7
0.20.6
0.20.5
0.20.4
0.20.3
0.20.2
0.20.1
0.20.0
0.19.11
0.19.10
0.19.9
0.19.8
0.19.7
0.19.6
0.19.5
0.19.4
0.19.3
0.19.2
0.19.1
0.19.0
0.18.19
0.18.18
0.18.17
0.18.16
0.18.15
0.18.14
0.18.13
0.18.12
0.18.11
0.18.10
0.18.9
0.18.8
0.18.7
0.18.5
0.18.4
0.18.3
0.18.2
0.18.1
0.18.0
0.17.2
0.17.1
0.17.0
0.16.3
0.16.2
0.16.1
0.16.0
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.0
0.13.7
0.13.6
0.13.5
0.13.4
0.13.3
0.13.2
0.13.1
0.13.0
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
0.11.9
0.11.8
0.11.7
0.11.6
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.3
0.10.2
0.10.1
0.10.0
0.9.11
0.9.10
0.9.9
0.9.8
0.9.7
0.9.6
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.2
0.0.0
retired
Dagger SDK for Elixir
Current section
Files
Jump to
Current section
Files
lib/dagger/gen/function.ex
# This file generated by `mix dagger.gen`. Please DO NOT EDIT.
defmodule Dagger.Function do
@moduledoc "Function represents a resolver provided by a Module.\n\nA function always evaluates against a parent object and is given a set of\nnamed arguments."
use Dagger.QueryBuilder
@type t() :: %__MODULE__{}
defstruct [:selection, :client]
(
@doc "Arguments accepted by this function, if any"
@spec args(t()) :: {:ok, [Dagger.FunctionArg.t()] | nil} | {:error, term()}
def args(%__MODULE__{} = function) do
selection = select(function.selection, "args")
execute(selection, function.client)
end
)
(
@doc "Execute this function using dynamic input+output types.\n\nTypically, it's preferable to invoke a function using a type\nsafe graphql query rather than using this call field. However,\ncall is useful for some advanced use cases where dynamically\nloading arbitrary modules and invoking functions in them is\nrequired.\n\n\n\n## Optional Arguments\n\n* `input` -"
@spec call(t(), keyword()) :: {:ok, Dagger.JSON.t()} | {:error, term()}
def call(%__MODULE__{} = function, optional_args \\ []) do
selection = select(function.selection, "call")
selection =
if is_nil(optional_args[:input]) do
selection
else
arg(selection, "input", optional_args[:input])
end
execute(selection, function.client)
end
)
(
@doc "A doc string for the function, if any"
@spec description(t()) :: {:ok, Dagger.String.t() | nil} | {:error, term()}
def description(%__MODULE__{} = function) do
selection = select(function.selection, "description")
execute(selection, function.client)
end
)
(
@doc "The ID of the function"
@spec id(t()) :: {:ok, Dagger.FunctionID.t()} | {:error, term()}
def id(%__MODULE__{} = function) do
selection = select(function.selection, "id")
execute(selection, function.client)
end
)
(
@doc "The name of the function"
@spec name(t()) :: {:ok, Dagger.String.t()} | {:error, term()}
def name(%__MODULE__{} = function) do
selection = select(function.selection, "name")
execute(selection, function.client)
end
)
(
@doc "The type returned by this function"
@spec return_type(t()) :: Dagger.TypeDef.t()
def return_type(%__MODULE__{} = function) do
selection = select(function.selection, "returnType")
%Dagger.TypeDef{selection: selection, client: function.client}
end
)
(
@doc "Returns the function with the provided argument\n\n## Required Arguments\n\n* `name` - The name of the argument\n* `type_def` - The type of the argument\n\n## Optional Arguments\n\n* `description` - A doc string for the argument, if any\n* `default_value` - A default value to use for this argument if not explicitly set by the caller, if any"
@spec with_arg(t(), Dagger.String.t(), Dagger.TypeDef.t(), keyword()) :: Dagger.Function.t()
def with_arg(%__MODULE__{} = function, name, type_def, optional_args \\ []) do
selection = select(function.selection, "withArg")
selection = arg(selection, "name", name)
selection = arg(selection, "typeDef", type_def)
selection =
if is_nil(optional_args[:description]) do
selection
else
arg(selection, "description", optional_args[:description])
end
selection =
if is_nil(optional_args[:default_value]) do
selection
else
arg(selection, "defaultValue", optional_args[:default_value])
end
%Dagger.Function{selection: selection, client: function.client}
end
)
(
@doc "Returns the function with the doc string\n\n## Required Arguments\n\n* `description` -"
@spec with_description(t(), Dagger.String.t()) :: Dagger.Function.t()
def with_description(%__MODULE__{} = function, description) do
selection = select(function.selection, "withDescription")
selection = arg(selection, "description", description)
%Dagger.Function{selection: selection, client: function.client}
end
)
end