We could probably generalize the API a bit. See https://github.com/jenkinsci/jenkins/pull/4271#pullrequestreview-341032013