# `Wardrik.AgentID`

Parses agent IDs.

    Wardrik.AgentID.parse("acme/@jon/triage/C1-1696.1234")
    #=> {:ok, %Wardrik.AgentID{owner: "acme/@jon", name: "triage", conversation: "C1-1696.1234"}}

An ID is one of:

  * `acme/triage` - an org's agent.
  * `acme/@jon/triage` - a person's agent.
  * `acme/triage/C1-1696.1234` or `acme/@jon/triage/C1-1696.1234` - a conversation. It runs on
    its agent's definition, with its own history.

No segment may be empty or contain `:`, `*` or `?`. `:` marks people known elsewhere, as
`slack:T0123/U024BE7LH`. `*` and `?` are for patterns.

# `t`

```elixir
@type t() :: %Wardrik.AgentID{
  conversation: String.t() | nil,
  name: String.t(),
  owner: String.t()
}
```

# `agent`

```elixir
@spec agent(String.t()) :: String.t()
```

Returns the ID of the agent whose definition `id` runs on.

    Wardrik.AgentID.agent("acme/triage/C1-1696.1234")
    #=> "acme/triage"

Returns `id` unchanged if it's an agent ID or doesn't parse.

# `conversation?`

```elixir
@spec conversation?(String.t()) :: boolean()
```

Returns `true` if `id` is a conversation ID.

# `parse`

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

Parses `id`. Returns `:error` if it isn't an agent or conversation ID.

---

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