[api] initial refactoring of request history handling

This should be generic enough to log also readable histories
for other objects like projects and packages.