We have a new APIReturn type for the summary API added recently. Both of them extends APIResult. Have replaced : 
APIResult r = new ProcessInstancesResult();  by APIResult r ; , in updated commit.