# `Caracola.Tokens`
[🔗](https://github.com/netkubes/caracola/blob/v0.1.0-rc.1/lib/caracola/tokens.ex#L1)

Parser for comma-separated token lists with parameters, as used in headers
like `Content-Type`, `Accept`, `Supported` or `Event`. Port of NkLIB's
`nklib_parse_tokens`.

    iex> Caracola.Tokens.parse("multipart/mixed;boundary=7a9c, text/plain")
    {:ok, [{"multipart/mixed", [{"boundary", "7a9c"}]}, {"text/plain", []}]}

# `token`

```elixir
@type token() :: {String.t(), [Caracola.URI.param()]}
```

A token with its parameters.

# `encode`

```elixir
@spec encode(token() | [token()]) :: iodata()
```

Serializes a token or token list.

# `parse`

```elixir
@spec parse(binary() | [binary()]) :: {:ok, [token()]} | :error
```

Parses a token list, or a list of such binaries.

---

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