Refactor code to extract GitHub API requests from middleware
Refactor code to extract GitHub API requests from middleware

As suggested by @mikz this commit moves the code that makes requests to
GitHub API to helper functions. This update allows a faster implementation
of new middlewares with the same logic.

APItools/middleware