What's New API

Last modified by Vincent Massol on 2023/02/21

New experimental API to gather external news related to XWiki.

Example to get news items from a xwikiblog source, for a given user, filtered by a category:

@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()
NewsContent content = items.get(0).getDescription().get();
String itemDescription = content.getContent();
Syntax itemSyntax = content.getSyntax();
...
Tags:
   

Get Connected