# `ADK.Event`
[🔗](https://github.com/zeroasterisk/adk-elixir/blob/main/lib/adk/event.ex#L15)

Represents an event in the ADK.

# `t`

```elixir
@type t() :: %ADK.Event{
  actions: ADK.EventActions.t() | nil,
  author: String.t() | nil,
  branch: String.t() | nil,
  content: map() | nil,
  custom_metadata: map(),
  data: any(),
  error: String.t() | nil,
  id: String.t() | nil,
  input_transcription: map() | nil,
  invocation_id: String.t() | nil,
  output_transcription: map() | nil,
  partial: boolean() | nil,
  timestamp: DateTime.t() | nil,
  type: atom() | nil
}
```

# `compaction?`

```elixir
@spec compaction?(t()) :: boolean()
```

Returns true if this is a compaction event.

# `error`

```elixir
@spec error(term(), map() | keyword()) :: t()
```

Create an error event.

# `final_response?`

```elixir
@spec final_response?(t()) :: boolean()
```

Returns true if this event is a final response (not partial, no transfer, no tool calls).

# `from_map`

```elixir
@spec from_map(map()) :: t()
```

Reconstruct an event from a map (string or atom keys).

# `function_calls`

```elixir
@spec function_calls(t()) :: [map()]
```

Extract function call parts from the event's content.

# `function_responses`

```elixir
@spec function_responses(t()) :: [map()]
```

Extract function response parts from the event's content.

# `has_function_calls?`

```elixir
@spec has_function_calls?(t()) :: boolean()
```

Returns true if the event contains at least one function call.

# `has_function_responses?`

```elixir
@spec has_function_responses?(t()) :: boolean()
```

Returns true if the event contains at least one function response.

# `new`

```elixir
@spec new(map() | keyword()) :: t()
```

Create a new event with auto-generated ID and timestamp.

# `on_branch?`

```elixir
@spec on_branch?(t(), String.t() | nil) :: boolean()
```

Check if an event is visible on a given branch.

# `text`

```elixir
@spec text(t()) :: String.t() | nil
```

Extract text from the event's content parts, falling back to error.

# `text?`

```elixir
@spec text?(t()) :: boolean()
```

Returns true if the event has text content (not just tool calls).

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Convert an event to a plain map, serializing timestamps and actions.

---

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