Skip to content

WACore API

MediaType

Bases: Enum

Supported media categories for upload and download operations.

Node

Node(
    tag: str,
    attrs: list[Attrs],
    content: NodeContent | None,
)

Generic protocol node structure used by low-level event payloads.

Create a protocol node object.

PARAMETER DESCRIPTION
tag

Node tag name.

TYPE: str

attrs

List of attribute entries.

TYPE: list[Attrs]

content

Optional payload content.

TYPE: NodeContent | None

Example::

node = Node(
    tag='message',
    attrs=[Attrs('to', NodeValue.jid(JID('123', 's.whatsapp.net')))],
    content=None,
)

Methods:

NodeValue

NodeValue(value: str)

Represents a node attribute value.

A node value can be a plain string or a JID object.

Create a NodeValue from a string.

PARAMETER DESCRIPTION
value

Initial string value.

TYPE: str

Example::

val = NodeValue('hello')
print(val.value)  # 'hello'
Source code in python/tryx/wacore.py
from ._tryx import wacore  # type: ignore

for name in dir(wacore):  # type: ignore
    obj = getattr(wacore, name)  # type: ignore
    if isinstance(obj, type):
        globals()[name] = obj

__all__ = [name for name in dir(wacore) if isinstance(getattr(wacore, name), type)]  # type: ignore

Attributes

value property writable

value: str | JID

Return the current value as either a string or JID.

RETURNS DESCRIPTION
str | JID

The attribute value (str or JID).

RAISES DESCRIPTION
TypeError

If the internal type is neither str nor JID.

Methods:

jid staticmethod

jid(value: JID) -> NodeValue

Create a NodeValue from a JID.

PARAMETER DESCRIPTION
value

JID to wrap.

TYPE: JID

RETURNS DESCRIPTION
NodeValue

NodeValue wrapping the JID.

Example::

val = NodeValue.jid(JID('123', 's.whatsapp.net'))
print(val.value)  # JID object

set_string

set_string(value: str) -> None

Replace the current value with a string.

PARAMETER DESCRIPTION
value

New string value.

TYPE: str

Example::

val = NodeValue('old')
val.set_string('new')

set_jid

set_jid(value: JID) -> None

Replace the current value with a JID.

PARAMETER DESCRIPTION
value

New JID value.

TYPE: JID

Example::

val = NodeValue('default')
val.set_jid(JID('123', 's.whatsapp.net'))

tryx.wacore exposes lower-level protocol-facing types.

MediaType

Enum for media upload/download classification.

Node Tree Types

  • NodeValue
  • NodeContent
  • Attrs
  • Node

These are useful for advanced debugging or when you need access to protocol node shape in events such as stream errors or notifications.

Business and Key Metadata

  • KeyIndexInfo
  • BusinessSubscription

These appear in device/business sync event payloads.

When to Use WACore Types

Use these types only when high-level client/event abstractions are not enough. For normal client logic, prefer typed event payload objects and client namespace methods.