| 37 | } |
| 38 | |
| 39 | func (c *Client) ListGroups( |
| 40 | ctx context.Context, |
| 41 | req *ListGroupsRequest, |
| 42 | ) (*ListGroupsResponse, error) { |
| 43 | protoResp, err := c.roundTrip(ctx, req.Addr, &listgroups.Request{}) |
| 44 | if err != nil { |
| 45 | return nil, err |
| 46 | } |
| 47 | apiResp := protoResp.(*listgroups.Response) |
| 48 | resp := &ListGroupsResponse{ |
| 49 | Error: makeError(apiResp.ErrorCode, ""), |
| 50 | } |
| 51 | |
| 52 | for _, apiGroupInfo := range apiResp.Groups { |
| 53 | resp.Groups = append(resp.Groups, ListGroupsResponseGroup{ |
| 54 | GroupID: apiGroupInfo.GroupID, |
| 55 | Coordinator: int(apiGroupInfo.BrokerID), |
| 56 | ProtocolType: apiGroupInfo.ProtocolType, |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | return resp, nil |
| 61 | } |
| 62 | |
| 63 | // TODO: Remove everything below and use protocol-based version above everywhere. |
| 64 | type listGroupsRequestV1 struct { |