Add concept of image to What's New API

Last modified by Vincent Massol on 2023/04/17 10:44

In preparation for displaying images in the What's New UI for news items, the What's New API has been updated to support getting images for news items.

@Inject
@Named("xwikiblog")
private NewsSourceFactory factory;

@Inject
@Named("xwikiblog")
private NewsConfiguration configuration;

...
List<NewsSourceDescriptor> descriptors = this.configuration.getNewsSourceDescriptors();
NewsSourceDescriptor descriptor = descriptors.get(0);
List<NewsSourceItem> items = this.factory.create(descriptor.getParameters())
  .forUser(...)
  .forCategories(...)
  .build()
String imageURL = items.get(0).getImageURL().get();
...

Get Connected