Afaik the official way in Plasma 5 was using the executable Datasource (ala [1]).
As far as I understand Datatsource is deprecated in Plasma 6 but still available through org.kde.plasma.plasma5support.
Question: Is there an official replacement or should we use the Plasma5Support compatibility layer for now?
[1] plasma-applet-lib/package/contents/ui/lib/ExecUtil.qml at master · Zren/plasma-applet-lib · GitHub