Amarula.Protocol.USync.Protocols (amarula v0.1.0)

View Source

USync protocol definitions.

Port of src/WAUSync/Protocols/. Each protocol contributes three things to a USync query:

  • query_element/1 — the node placed inside <query> (what to fetch)
  • user_element/2 — the per-user node placed inside <user> (may be nil)
  • parse/2 — turns a result child node into a parsed value

Protocols are addressed by atom (:devices, :contact, :status, :disappearing_mode, :bot_profile, :lid, :username). parse/2 is also keyed by the wire tag string so the result parser can dispatch directly.

Summary

Functions

Parse a result child node by its wire tag. Returns nil when the value should be dropped from the result map (matches Baileys' null filtering).

Functions

parse(arg1, node)

Parse a result child node by its wire tag. Returns nil when the value should be dropped from the result map (matches Baileys' null filtering).

query_element(atom)

@spec query_element(atom()) :: Amarula.Protocol.Binary.Node.t()

user_element(atom, user)

@spec user_element(atom(), map()) :: Amarula.Protocol.Binary.Node.t() | nil