Read api collect

'collect' functionality for:

 - single group,
 - multigroup (period + group_by)

Not supported:
 - period query without a group_by