brendanhay / gogol

A comprehensive Google Services SDK for Haskell.
Other
282 stars 105 forks source link

Support for batching requests #128

Open agrue opened 5 years ago

agrue commented 5 years ago

Some Google APIs support a batch endpoint that lets you combine multiple API calls into a single HTTP request. The specific one I'm interested in is Gmail (https://developers.google.com/gmail/api/guides/batch) though others support it too (e.g. Drive: https://developers.google.com/drive/api/v3/batch)

AFAICT the library doesn't currently support this. I've started taking a look at this myself; the sort of API I have in mind would automatically give you the instance GoogleRequest a => GoogleRequest (Batch a) (with Batch a being some kind of wrapper over multiple a). But the current implementation doesn't support this easily; to give one example, the response parsers in GClient can't be easily combined into a batch parser because they consume all their input.

Anyway, I'm sure this is possible with enough work, but I thought I should post about it here in case you have your own ideas about how to do this. Cheers!