# `Dagger.Function`
[🔗](https://github.com/dagger/dagger/blob/v0.20.5/sdk/elixir/lib/dagger/gen/function.ex#L2)

Function represents a resolver provided by a Module.

A function always evaluates against a parent object and is given a set of named arguments.

# `t`

```elixir
@type t() :: %Dagger.Function{client: term(), query_builder: term()}
```

# `args`

```elixir
@spec args(t()) :: {:ok, [Dagger.FunctionArg.t()]} | {:error, term()}
```

Arguments accepted by the function, if any.

# `deprecated`

```elixir
@spec deprecated(t()) :: {:ok, String.t() | nil} | {:error, term()}
```

The reason this function is deprecated, if any.

# `description`

```elixir
@spec description(t()) :: {:ok, String.t()} | {:error, term()}
```

A doc string for the function, if any.

# `id`

```elixir
@spec id(t()) :: {:ok, Dagger.FunctionID.t()} | {:error, term()}
```

A unique identifier for this Function.

# `name`

```elixir
@spec name(t()) :: {:ok, String.t()} | {:error, term()}
```

The name of the function.

# `return_type`

```elixir
@spec return_type(t()) :: Dagger.TypeDef.t()
```

The type returned by the function.

# `source_map`

```elixir
@spec source_map(t()) :: Dagger.SourceMap.t() | nil
```

The location of this function declaration.

# `with_arg`

```elixir
@spec with_arg(t(), String.t(), Dagger.TypeDef.t(),
  description: String.t() | nil,
  default_value: Dagger.JSON.t() | nil,
  default_path: String.t() | nil,
  ignore: [String.t()],
  source_map: Dagger.SourceMapID.t() | nil,
  deprecated: String.t() | nil
) :: t()
```

Returns the function with the provided argument

# `with_cache_policy`

```elixir
@spec with_cache_policy(t(), Dagger.FunctionCachePolicy.t(), [
  {:time_to_live, String.t() | nil}
]) :: t()
```

Returns the function updated to use the provided cache policy.

# `with_check`

```elixir
@spec with_check(t()) :: t()
```

Returns the function with a flag indicating it's a check.

# `with_deprecated`

```elixir
@spec with_deprecated(t(), [{:reason, String.t() | nil}]) :: t()
```

Returns the function with the provided deprecation reason.

# `with_description`

```elixir
@spec with_description(t(), String.t()) :: t()
```

Returns the function with the given doc string.

# `with_source_map`

```elixir
@spec with_source_map(t(), Dagger.SourceMap.t()) :: t()
```

Returns the function with the given source map.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
