wikipedia
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -0,0 +0,0 @@ export declare class wikiError extends Error { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -300,2 +300,8 @@ import { pageOptions, searchOptions, geoOptions, listOptions, eventOptions, fcOptions, randomFormats, pdfOptions, citationFormat, autocompletionOptions } from './optionTypes'; | ||
autocompletions(query: string, autocompletionOptions?: autocompletionOptions | undefined): Promise<Array<string>>; | ||
/** | ||
* Change the default user agent for wikipedia | ||
* | ||
* @param userAgent - The new custom userAgent | ||
*/ | ||
setUserAgent(userAgent: string): void; | ||
}; | ||
@@ -302,0 +308,0 @@ export default wiki; |
@@ -655,2 +655,10 @@ "use strict"; | ||
}; | ||
/** | ||
* Change the default user agent for wikipedia | ||
* | ||
* @param userAgent - The new custom userAgent | ||
*/ | ||
wiki.setUserAgent = (userAgent) => { | ||
(0, request_1.setUserAgent)(userAgent); | ||
}; | ||
exports.default = wiki; | ||
@@ -657,0 +665,0 @@ // For CommonJS default export support |
@@ -0,0 +0,0 @@ export declare const MSGS: { |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ export interface searchOptions { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ import { coordinatesResult, imageResult, langLinksResult, notFound, pageResult, relatedResult, wikiMediaResult, wikiSummary } from './resultTypes'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -5,2 +5,3 @@ declare function makeRequest(params: any, redirect?: boolean): Promise<any>; | ||
export declare function setAPIUrl(prefix: string): string; | ||
export declare function setUserAgent(userAgent: string): void; | ||
export default makeRequest; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setAPIUrl = exports.returnRestUrl = exports.makeRestRequest = void 0; | ||
exports.setUserAgent = exports.setAPIUrl = exports.returnRestUrl = exports.makeRestRequest = void 0; | ||
const axios_1 = require("axios"); | ||
const errors_1 = require("./errors"); | ||
let API_URL = 'https://en.wikipedia.org/w/api.php?', REST_API_URL = 'https://en.wikipedia.org/api/rest_v1/'; | ||
let API_URL = 'https://en.wikipedia.org/w/api.php?', REST_API_URL = 'https://en.wikipedia.org/api/rest_v1/', | ||
// RATE_LIMIT = false, | ||
// RATE_LIMIT_MIN_WAIT = undefined, | ||
// RATE_LIMIT_LAST_CALL = undefined, | ||
const USER_AGENT = 'wikipedia (https://github.com/dopecodez/Wikipedia/)'; | ||
USER_AGENT = 'wikipedia (https://github.com/dopecodez/Wikipedia/)'; | ||
async function callAPI(url) { | ||
@@ -62,2 +62,7 @@ const options = { | ||
exports.setAPIUrl = setAPIUrl; | ||
//change user agent | ||
function setUserAgent(userAgent) { | ||
USER_AGENT = userAgent; | ||
} | ||
exports.setUserAgent = setUserAgent; | ||
exports.default = makeRequest; |
@@ -0,0 +0,0 @@ export interface wikiSearchResult { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ export declare function isString(title: any): boolean; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "wikipedia", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "A JavaScript wrapper for the wikipedia apis", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -103,3 +103,3 @@ # WIKIPEDIA [![build](https://github.com/dopecodez/Wikipedia/workflows/build/badge.svg)](https://github.com/dopecodez/Wikipedia/actions) [![Test Coverage](https://api.codeclimate.com/v1/badges/a44c826dbef8c7f5ea45/test_coverage)](https://codeclimate.com/github/dopecodez/Wikipedia/test_coverage) [![Contributions](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/dopecodez/Wikipedia/issues) [![npm version](https://badge.fury.io/js/wikipedia.svg)](https://badge.fury.io/js/wikipedia) | ||
There are other methods like `search()`, `geoSearch()`, `suggest()`, `setLang()` which should be called on the wiki object directly. Read up on the [wiki documentation][4] to see a complete list of methods available on the wiki default object. | ||
There are other methods like `search()`, `geoSearch()`, `suggest()`, `setLang()`, `setUserAgent()` which should be called on the wiki object directly. Read up on the [wiki documentation][4] to see a complete list of methods available on the wiki default object. | ||
@@ -106,0 +106,0 @@ ```js |
2987
111682