Retrieving all commits for a merge request

I am writing a BitBucket plugin to do merge protection. I want to be able to look at all the commits in a pull request and evaluate whether the merge should be allowed based on info in the commits. How do I find all the commits in a merge request?

So far it seems like it has something to do with CommitService.getCommitsBetween, but my merge check module doesn’t have a CommitService to use and I cant call the function statically since CommitService is an interface.