wiki-entity
Version:
Wiki entity fetcher
32 lines (31 loc) • 1.04 kB
TypeScript
import { StringPlainObject } from "../utils";
export declare type ExtractType = {
pageid: number;
title: string;
extract: string;
};
export declare type ExtractsParamsType = {
lang: string;
titles: string[];
sentences?: number;
};
export declare type ApiResult = {
pageid: number;
title: string;
extract?: string;
categories?: string[];
redirects?: string[];
};
export declare class Api {
private qs;
private httpTimeout?;
constructor(qs?: StringPlainObject, httpTimeout?: number);
query(lang: string, qs?: StringPlainObject): Promise<ApiResult[]>;
redirects(): this;
categories(): this;
extract(sentences?: number): this;
private addField;
}
export declare function getExtracts(params: ExtractsParamsType): Promise<ExtractType[]>;
export declare const getExtract: (lang: string, title: string, sentences?: number) => Promise<ExtractType | null>;
export declare function getRedirects(lang: string, title: string): Promise<string[]>;