# `BaileysEx.WAM`
[🔗](https://github.com/jeffhuen/baileys_ex/blob/main/lib/baileys_ex/wam.ex#L1)

WhatsApp Analytics/Metrics helpers backed by the Baileys rc9 event registry.

# `event_input`

```elixir
@type event_input() :: BaileysEx.WAM.BinaryInfo.event_input()
```

One event entry for a WAM buffer.

# `ordered_values`

```elixir
@type ordered_values() :: BaileysEx.WAM.BinaryInfo.ordered_values()
```

Ordered WAM key/value pairs.

# `value`

```elixir
@type value() :: BaileysEx.WAM.BinaryInfo.value()
```

Scalar values accepted by the WAM encoder.

# `clear_events`

```elixir
@spec clear_events(BaileysEx.WAM.BinaryInfo.t()) :: BaileysEx.WAM.BinaryInfo.t()
```

Clear buffered events while preserving the current sequence.

# `encode`

```elixir
@spec encode(BaileysEx.WAM.BinaryInfo.t()) :: binary()
```

Encode a WAM buffer into the rc9 binary wire format.

# `event`

```elixir
@spec event(String.t() | atom(), ordered_values(), ordered_values()) :: event_input()
```

Build an ordered WAM event payload.

# `increment_sequence`

```elixir
@spec increment_sequence(BaileysEx.WAM.BinaryInfo.t()) :: BaileysEx.WAM.BinaryInfo.t()
```

Increment the WAM buffer sequence.

# `new`

```elixir
@spec new(keyword()) :: BaileysEx.WAM.BinaryInfo.t()
```

Create a new WAM buffer.

# `put_event`

```elixir
@spec put_event(BaileysEx.WAM.BinaryInfo.t(), event_input()) ::
  BaileysEx.WAM.BinaryInfo.t()
```

Append a WAM event entry to the buffer.

# `put_event`

```elixir
@spec put_event(
  BaileysEx.WAM.BinaryInfo.t(),
  String.t() | atom(),
  ordered_values(),
  ordered_values()
) ::
  BaileysEx.WAM.BinaryInfo.t()
```

Append a named WAM event to the buffer.

---

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