federicotdn / verb

Organize and send HTTP requests from Emacs
https://melpa.org/#/verb
GNU General Public License v3.0
540 stars 20 forks source link

Allow lambda expression as Verb-Map-Request #47

Closed bigodel closed 1 year ago

bigodel commented 2 years ago

This PR allows the user to specify a lambda expression as :Verb-Map-Request:. Also, in order to implement said functionality, I made it so that Verb is also aware, and doesn't get confused, with properties spanning multiple lines, such as

:PROPERTIES:
:verb-foo: hi
:VERB-Foo+: there
:END:

which results in ("VERB-FOO" . "hi there") being added to the metadata.

Another small change made in the PR is that, instead of using fixed values when looking for Verb-Store and Verb-Map-Request, we get the value by concatenating verb--metadata-prefix to the appropriate suffix. I understand that this might have been a purposeful design choice, but I thought, given that both the store and map-request are under the metadata slot in the request spec, they should also respect the metadata prefix. Please, let me know if you agree or not with said change.

bigodel commented 2 years ago

also, similarly to what i did in #46, i tried formatting the tests file, but i've also done it as the last commit, making it easy to revert it.

there is one function which i've changed on both PRs, so it would be interesting if #46 was merged before this one -- though i can always handle the conflict manually :D

bigodel commented 2 years ago

i have also devised a way to have functions map on response, but it could be achieved with verb-post-response-hook, albeit not as elegantly as with the request mapping. i could share it here for you to analyze and, if approved, i could create another PR.

federicotdn commented 2 years ago

Hi! This PR is a bit more complex than #46 - let's merge that one first and then I can look into this one.

bigodel commented 1 year ago

can we take a look at this now? i will have a bit more free time from now on

bigodel commented 1 year ago

also, i have a couple more proposals for Verb, but i would like to discuss them with you before creating a PR, is there any channel we can talk about it, if you're open for it?

federicotdn commented 1 year ago

Hey, sorry again for the delays. @bigodel could you update your branch to be up to date with main? In regards with discussions, I am open to suggestions. Maybe the Discussions feature of GitHub would be a good candidate?

bigodel commented 1 year ago

Hey, sorry again for the delays.

no worries, i know how life be sometimes :D

@bigodel could you update your branch to be up to date with main?

yeah, sure!

In regards with discussions, I am open to suggestions. Maybe the Discussions feature of GitHub would be a good candidate?

welp, i've never used it myself, but magit seems to be using it effectively, so maybe it is indeed a good candidate.

federicotdn commented 1 year ago

Merged! Thanks for the contribution. Not using verb--metadata-prefix in those two places was definitely an oversight of mine. I've opened the discussions page, btw: https://github.com/federicotdn/verb/discussions

bigodel commented 1 year ago

Merged! Thanks for the contribution.

that's great! and thank you for such an amazing package!

I've opened the discussions page, btw: https://github.com/federicotdn/verb/discussions

all righty. i've been kinda busy lately, but i have some ideas on some notes on my PC, as soon as i have time i'll open up some discussions there.