Take a look how it's done in https://github.com/jcabi/jcabi-github/pull/110 (I like this approach)