eldur/jwbf

make multiple API calls easier to combine

fhocutt opened this issue · 6 comments

Make efficient usage of API calls easier, possibly by creating a method that combines calls for multiple items (e.g. title1|title2|title3|...).

I assume you check the code and found an inefficient section, can you give me a hint like a class or method ? ;-)

It's not that there's a particularly inefficient section; it's that I didn't find anything besides createNsString, SiteInfo, and generateRequest (from LogEvents.java) that joined items with | as would be needed to create an API request that would get information on multiple pages at the same time. So instead of one call with titles=title1 and a second with titles=title2, a method that combined API calls like this would allow the same data to be fetched in one call with titles=title1|title2.

There should be something like:

public synchronized Article[] getArticles(final String names[], final int properties)
public synchronized SimpleArticle[] readData(final String names[], final int properties)

Combining calls is not just about efficiency but also a recommendation from MediaWiki (e.g. in this page: https://www.mediawiki.org/wiki/API:Query, among other places) to reduce the burden on the server side.

Okay it is about, reading content from more than one title.

I'll write short draft, so we have a better view, about the target of this task.

I tend to close this issue because no we have

ImmutableList<SimpleArticle> articles = bot.readData("ArticleNameA", "ArticleNameB", ...