public static ApiVersionCollection collectApis(
        Set<ApiKeys> apiKeys,
        boolean enableUnstableLastVersion
    ) {
        ApiVersionCollection res = new ApiVersionCollection();
        for (ApiKeys apiKey : apiKeys) {
            apiKey.toApiVersion(enableUnstableLastVersion).ifPresent(res::add);
        }
        return res;
    }
Possible error codes:
- {@link Errors#UNSUPPORTED_VERSION}
- {@link Errors#INVALID_REQUEST}
clients/src/main/java/org/apache/kafka/common/requests/ApiVersionsResponse.java