Amarula.Protocol.Profile.Ops (amarula v0.1.0)
View SourceProfile operations: build the IQs that read/change your (or a target's) profile
picture and status, and parse their replies. Port of the profile-picture/status
builders in Baileys chats.ts (profilePictureUrl, updateProfilePicture,
removeProfilePicture, updateProfileStatus).
Pure: builders return a %Node{}, parsers turn the reply node into a value. The
IQ round-trip lives in Amarula.Connection (via query_iq/3). target is the
jid being acted on, or nil for your own profile — Baileys omits the target
attr entirely for self (sending it for your own jid makes the server never reply).
Summary
Functions
Pull the URL from a w:profile:picture reply (<picture url="...">), or nil.
Fetch a profile picture URL. target is the jid to look up (a user or group jid);
type is :preview (small) or :image (full). Reply parsed by parse_url/1.
Remove a profile picture. target is the jid, or nil for your own profile.
Set a profile picture from already-encoded JPEG bytes. target is the jid being
updated, or nil for your own profile. WhatsApp expects a small square JPEG; the
caller is responsible for sizing it (Baileys resizes to 640px q50 before upload —
Amarula does not resize, to avoid a native image dependency).
Set your own profile status/bio text.
Types
Functions
@spec parse_url(Amarula.Protocol.Binary.Node.t()) :: String.t() | nil
Pull the URL from a w:profile:picture reply (<picture url="...">), or nil.
@spec picture_url_query(String.t(), pic_type()) :: Amarula.Protocol.Binary.Node.t()
Fetch a profile picture URL. target is the jid to look up (a user or group jid);
type is :preview (small) or :image (full). Reply parsed by parse_url/1.
@spec remove_picture(String.t() | nil) :: Amarula.Protocol.Binary.Node.t()
Remove a profile picture. target is the jid, or nil for your own profile.
@spec set_picture(String.t() | nil, binary()) :: Amarula.Protocol.Binary.Node.t()
Set a profile picture from already-encoded JPEG bytes. target is the jid being
updated, or nil for your own profile. WhatsApp expects a small square JPEG; the
caller is responsible for sizing it (Baileys resizes to 640px q50 before upload —
Amarula does not resize, to avoid a native image dependency).
@spec set_status(String.t()) :: Amarula.Protocol.Binary.Node.t()
Set your own profile status/bio text.