Move middleware package to api package

All middlewares could be used only for api stuff, so, moving them to the
api package.

Change-Id: I1303f4b3c3bd2a8b4a883d86ba4f91aba92496e0
Merge "Move middleware package to api package"