Replicating logic from Gelly with API calls - Gadget Developers