Noizu.Comms.Target (noizu_comms v0.1.0)

Copy Markdown View Source

A parsed outbound target.

URI forms (contract):

URIchannelkind
discord://channel/<snowflake>:discord:channel
discord://webhook/<alias>:discord:webhook
slack://channel/<id>:slack:channel
slack://webhook/<alias>:slack:webhook
telegram://chat/<id or @username>:telegram:chat
whatsapp://<E.164> (+ ?template=&lang=):whatsapp:phone
test://<name>:test:sink
<alias> (bare word)resolved from config:alias

Alias targets carry :alias (the config name) and :allow_write; the Router fills both after resolving the config entry.

Summary

Functions

Stable policy/telemetry key: alias:<name> or <channel>:<kind>:<id>.

Parses a target URI or bare alias.

True when the target was a raw URI (not resolved through a config alias).

Like key/1 but masks secret/PII-bearing ids (phone numbers, webhook ids) for use in error messages and logs — errors never carry them (see Error).

Types

kind()

@type kind() :: :channel | :webhook | :chat | :phone | :sink | :alias

t()

@type t() :: %Noizu.Comms.Target{
  alias: String.t() | nil,
  allow_write: boolean() | nil,
  channel: atom() | nil,
  id: String.t() | nil,
  kind: kind(),
  query: %{required(String.t()) => String.t()}
}

Functions

key(target)

@spec key(t()) :: String.t()

Stable policy/telemetry key: alias:<name> or <channel>:<kind>:<id>.

parse(target)

@spec parse(String.t()) :: {:ok, t()} | {:error, Noizu.Comms.Error.t()}

Parses a target URI or bare alias.

raw?(target)

@spec raw?(t()) :: boolean()

True when the target was a raw URI (not resolved through a config alias).

redacted_key(t)

@spec redacted_key(t()) :: String.t()

Like key/1 but masks secret/PII-bearing ids (phone numbers, webhook ids) for use in error messages and logs — errors never carry them (see Error).