MCPcopy Create free account
hub / github.com/bufbuild/buf-examples / Example

Function Example

bsr/api-access/example/example.go:11–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9 "connectrpc.com/connect/v2"
10 "connectrpc.com/connect/v2/connecthttp"
11)
12
13func Example() (*reflectv1beta1.GetFileDescriptorSetResponse, error) {
14 client := reflectv1beta1connect.NewFileDescriptorSetServiceClient(connect.NewClient(
15 connecthttp.NewTransport(http.DefaultClient, "https://buf.build"),
16 ))
17 request := &reflectv1beta1.GetFileDescriptorSetRequest{
18 Module: "buf.build/connectrpc/eliza",
19 }
20 ctx := context.Background()
21 // If you're using a private BSR, set your Authorization header to a
22 // BUF_TOKEN value.
23 //
24 // ctx, info := connect.NewClientContext(ctx)
25 // info.RequestHeader().Set("Authorization", "Bearer <BUF_TOKEN>")
26 response, err := client.GetFileDescriptorSet(ctx, request)
27 if err != nil {
28 return nil, err
29 }
30
31 return response, nil
32}

Callers 1

TestGetFileDescriptorSetFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetFileDescriptorSetFunction · 0.68