Amarula.Protocol.Binary.Node (amarula v0.1.0)
View SourceBinary node structure for WhatsApp protocol.
Represents a node in the WhatsApp binary protocol tree structure. Each node has a tag, attributes, and content.
Summary
Functions
Gets the number of child nodes.
Creates a new node with the given tag, attributes, and content. This is an alias for new/3 for compatibility with the messages module.
Checks if the node has no content.
Gets a child node by index.
Checks if the node has binary content.
Checks if a node has children (nested nodes).
Checks if the node has string content.
Creates a new node with the given tag, attributes, and content.
Types
Functions
@spec child_count(t()) :: non_neg_integer()
Gets the number of child nodes.
Creates a new node with the given tag, attributes, and content. This is an alias for new/3 for compatibility with the messages module.
Checks if the node has no content.
@spec get_child(t(), non_neg_integer()) :: t() | nil
Gets a child node by index.
Checks if the node has binary content.
Checks if a node has children (nested nodes).
Checks if the node has string content.
Creates a new node with the given tag, attributes, and content.
Examples
iex> Node.new("iq", %{id: "1"}, nil)
%Node{tag: "iq", attrs: %{id: "1"}, content: nil}
iex> Node.new("message", %{}, "Hello")
%Node{tag: "message", attrs: %{}, content: "Hello"}