This patch changed adds support for making conditional HTTP requests to the API, and introduces a new way to check rate-limits. I switched from merging the keys directly into the response to supplying them under a certain meta key because the merge policy was problematic for the API routes that returned vectors and not a map.
When returning a lazy seq, metadata cannot be maintained on the response itself so this patch adds on each object of the seq the metadata that corresponds to the request with which it was received.
added handling of useful headers information as meta on responses, and
support for conditional requests
added api-meta and updated tests
Ugh. I didn't know it was broken with vectors. I haven't used new versions recently. I'm definitely interested in this, just please give me a couple of days to look over it. I'm moving to California in the morning and such, so it's really busy at the moment.
Of course, take your time. Also, I'm not completely sold on the names used for the returned meta and the api-meta function, so feel free to change them.
I prefer this PR over the one that's currently in master, but it still has issues. Namely, tentacles.users/emails returns a vector of strings, which safe-parse chokes on, because it assumes each item in the vector implements IObj.
If the metadata is constant, why add it to each item, rather than the returned vector?
I forgot all about this issue in the chaos. I'll take a look asap.
The problem is that I don't think you can hang metadata on the returned lazy-seq (not a vector). Also, when the lazy-seq paginates, the metadata is actually changing for each batch of results. Not sure how to handle the seq of Strings, but I could at least handle the error. I'll modify the PR, and see if I can find something better.
I'm going to work off of this and see if I can fix it tonight.