UNPKG

get-wikipedia-article

Version:

Fetch Wikipedia article resources (e.g. title, body, links...).

30 lines (25 loc) 813 B
import { articleType, wikipediaLanguageType, formatType, } from 'fullfiller-common/src/types'; /** which resources to include in the return object */ type includeType = Array<keyof articleType>; type optionsType = Partial<{ language: wikipediaLanguageType; include: includeType; format: formatType; }>; /** * Fetch Wikipedia article's resources (e.g. title, body, links...). * @param query Search string. * @param options Miscellaneous options. * @throws Error if `query` doesn't return any results. * @throws Error if `article.title` points to a disambiguation page. * @returns Object containing requested resources. */ declare function getWikipediaArticle( query: string, { language, include, format }?: optionsType ): Promise<articleType>; export { getWikipediaArticle as default };