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

Add export to `grpcurl` #71

Open federicotdn opened 4 months ago

federicotdn commented 4 months ago

Verb could also export to https://github.com/fullstorydev/grpcurl. Though the requests definitions in Verb are technically for HTTP/1.1, the syntax could kind of work for unary gRPC requests (not streams).

The only extra piece of data needed would be the location of the .proto file. Here's what it could look like:

* gRPC Example
:properties:
:Verb-Grpc-Proto: path/to/file/example.proto
:end:
template my-grpc-server.org:443
Foobar: Value 1234

** My Service
template /namespace.MyService

*** Get user
get /RetrieveUser

*** Add user
post /AddUser

{
    "name": "fede"
}

Here it is not clear if the user should use get or post or whatever, because technically they are all incorrect. But assuming any option is valid, the last header would be exported to:

grpcurl -H 'Foobar: Value 1234' -import-path /path/to/file -proto example.proto -d '{"name":"fede"}' namespace.MyService.AddUser

If the user tries to actually send the request via Verb, then it would need to error out in a friendly way.

federicotdn commented 3 months ago

Correction: it should be all POST and not GET.