MCPcopy Index your code
hub / github.com/akuity/grpc-gateway-client

github.com/akuity/grpc-gateway-client @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
319 symbols 700 edges 35 files 38 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

grpc-gateway-client

The grpc-gateway-client is a high quality REST client generator for gRPC services that are fronted by grpc-gateway.

Features

  • Strongly typed client interface.
  • Supports all gRPC features including streaming.
  • Supports all grpc-gateway features including custom query parameters, and request body.
  • Battle tested by Akuity's production services.

Usage

  1. Install grpc-gateway-client:

    bash $ go install github.com/akuity/grpc-gateway-client/protoc-gen-grpc-gateway-client@latest 1. Add plugin in your buf.gen.yaml:

    ```yaml version: v1 managed: enabled: true

    plugins: - name: gateway-client path: protoc-gen-grpc-gateway-client out: pkg/api/gen opt: - paths=source_relative `` 1. Generate client usingbuf generate` and use it in your code:

go client := grpc_gateway_client_example.NewGreeterGatewayClient(gateway.NewClient(baseURL)) resp, err := client.SayHello(context.Background(), &grpc_gateway_client_example.HelloRequest{Name: "World"}) if err != nil { panic(err) } fmt.Println(resp.Message)

See example for a complete example.

Extension points exported contracts — how you extend this code

GreeterGatewayClient (Interface)
GreeterGatewayClient is the interface for Greeter service client. [4 implementers]
example/pkg/api/gen/helloworld.gw.client.go
TestServiceGatewayClient (Interface)
TestServiceGatewayClient is the interface for TestService service client. [4 implementers]
internal/test/gen/testv1/test.gw.client.go
WrappedRoundTripper (Interface)
(no doc) [2 implementers]
pkg/http/roundtripper/roundtripper.go
Client (Interface)
(no doc) [1 implementers]
pkg/grpc/gateway/client.go
ClientOption (FuncType)
(no doc)
pkg/grpc/gateway/options.go

Core symbols most depended-on inside this repo

NewRequest
called by 12
pkg/grpc/gateway/client.go
getMessageIdentifier
called by 10
internal/generator/packages.go
Unmarshal
called by 8
pkg/grpc/gateway/client.go
DoStreamingRequest
called by 6
pkg/grpc/gateway/request.go
newStructAccessor
called by 6
internal/generator/types.go
Decode
called by 4
pkg/grpc/gateway/marshaller.go
Marshal
called by 4
pkg/grpc/gateway/client.go
NewEventStreamMarshaller
called by 3
pkg/grpc/gateway/marshaller.go

Shape

Method 177
Function 82
Struct 41
Interface 16
TypeAlias 2
FuncType 1

Languages

Go100%

Modules by API surface

internal/test/gen/testv1/test.pb.go90 symbols
internal/test/gen/testv1/test_grpc.pb.go59 symbols
example/pkg/api/gen/helloworld.pb.go18 symbols
example/pkg/api/gen/helloworld_grpc.pb.go15 symbols
internal/test/gen/testv1/test.gw.client.go13 symbols
internal/test/gen/testv1/test.pb.gw.go11 symbols
pkg/grpc/gateway/request_test.go9 symbols
pkg/grpc/gateway/marshaller.go9 symbols
pkg/grpc/gateway/client.go9 symbols
internal/generator/gateway.go8 symbols
internal/test/server/server.go7 symbols
internal/test/client/client_test.go7 symbols

For agents

$ claude mcp add grpc-gateway-client \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact