Function article

Source
pub fn article(response: &Json, id: &str, preferred: &[&str]) -> Option<Article>
Expand description

The article to read, from a Special:EntityData document.

preferred is tried in order, so a caller can ask for the reader’s own language and fall back rather than choosing between “always English” and “nothing”.

The document is keyed by entity id at the top, and an EntityData response may carry redirects — asking for Q1 and being answered about Q2 — so the id asked for is looked up first and, failing that, the single entity the document does carry is used. Guessing between several would be a coin toss, so several is None.