apiGenerator: set callback param only if it is not nil