use of org.eclipse.openvsx.json.ReviewListJson in project openvsx by eclipse.
the class RegistryAPITest method reviewsJson.
private String reviewsJson(Consumer<ReviewListJson> content) throws JsonProcessingException {
var json = new ReviewListJson();
json.reviews = new ArrayList<>();
content.accept(json);
return new ObjectMapper().writeValueAsString(json);
}
use of org.eclipse.openvsx.json.ReviewListJson in project openvsx by eclipse.
the class LocalRegistryService method getReviews.
@Override
public ReviewListJson getReviews(String namespace, String extensionName) {
var extension = repositories.findExtension(extensionName, namespace);
if (extension == null || !extension.isActive())
throw new NotFoundException();
var list = new ReviewListJson();
var serverUrl = UrlUtil.getBaseUrl();
list.postUrl = createApiUrl(serverUrl, "api", extension.getNamespace().getName(), extension.getName(), "review");
list.deleteUrl = createApiUrl(serverUrl, "api", extension.getNamespace().getName(), extension.getName(), "review", "delete");
list.reviews = repositories.findActiveReviews(extension).map(extReview -> extReview.toReviewJson()).toList();
return list;
}
Aggregations