I am using Golang as my backend and proto3 as my API definitions. I have grpc-gateway to support http along with grpc.
My use case is To have a webhook API which gets in some payload and processes it. I don't have control over the client and nor do i have surety about the payload structure.
How do i define my Request object?
example :
service RepoService {
rpc PostGitPR(PostGitPREventRequest) returns (PostGitPREventResponse) {
option (google.api.http) = {
post: "/git/pr/event"
body: "*"
};
}
Do i use any.proto or []byte? I am not sure both will work.
If it's impossible to predict a payload you can use
google.api.HttpBodyas your request object in the proto file. See this: https://github.com/googleapis/googleapis/blob/master/google/api/httpbody.proto