MCPcopy
hub / github.com/segmentio/kafka-go / ApiVersions

Method ApiVersions

apiversions.go:41–72  ·  view source on GitHub ↗
(
	ctx context.Context,
	req *ApiVersionsRequest,
)

Source from the content-addressed store, hash-verified

39}
40
41func (c *Client) ApiVersions(
42 ctx context.Context,
43 req *ApiVersionsRequest,
44) (*ApiVersionsResponse, error) {
45 apiReq := &apiversions.Request{}
46 protoResp, err := c.roundTrip(
47 ctx,
48 req.Addr,
49 apiReq,
50 )
51 if err != nil {
52 return nil, err
53 }
54 apiResp := protoResp.(*apiversions.Response)
55
56 resp := &ApiVersionsResponse{
57 Error: makeError(apiResp.ErrorCode, ""),
58 }
59 for _, apiKey := range apiResp.ApiKeys {
60 resp.ApiKeys = append(
61 resp.ApiKeys,
62 ApiVersionsResponseApiKey{
63 ApiKey: int(apiKey.ApiKey),
64 ApiName: protocol.ApiKey(apiKey.ApiKey).String(),
65 MinVersion: int(apiKey.MinVersion),
66 MaxVersion: int(apiKey.MaxVersion),
67 },
68 )
69 }
70
71 return resp, err
72}

Callers

nothing calls this directly

Calls 4

roundTripMethod · 0.95
ApiKeyTypeAlias · 0.92
makeErrorFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected