Comparing version 1.1.5 to 1.1.6
@@ -56,1 +56,4 @@ export declare class wikiError extends Error { | ||
} | ||
export declare class citationError extends wikiError { | ||
constructor(message: string); | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pdfError = exports.eventsError = exports.mediaError = exports.relatedError = exports.introError = exports.preloadError = exports.infoboxError = exports.coordinatesError = exports.geoSearchError = exports.linksError = exports.categoriesError = exports.contentError = exports.htmlError = exports.imageError = exports.summaryError = exports.pageError = exports.searchError = exports.wikiError = void 0; | ||
exports.citationError = exports.pdfError = exports.eventsError = exports.mediaError = exports.relatedError = exports.introError = exports.preloadError = exports.infoboxError = exports.coordinatesError = exports.geoSearchError = exports.linksError = exports.categoriesError = exports.contentError = exports.htmlError = exports.imageError = exports.summaryError = exports.pageError = exports.searchError = exports.wikiError = void 0; | ||
class wikiError extends Error { | ||
@@ -131,1 +131,8 @@ constructor(message, code) { | ||
exports.pdfError = pdfError; | ||
class citationError extends wikiError { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'citationError'; | ||
} | ||
} | ||
exports.citationError = citationError; |
@@ -270,2 +270,11 @@ import { pageOptions, searchOptions, geoOptions, listOptions, eventOptions, pdfOptions } from './optionTypes'; | ||
pdf(title: string, pdfOptions?: pdfOptions | undefined): Promise<any>; | ||
/** | ||
* Returns citation of a given page, or query string | ||
* | ||
* @param format - the format of the citation result | ||
* @param query - url or query string | ||
* @param language - if you want lanuage enabled results | ||
* @returns Returns citation data | ||
*/ | ||
citation(query: string, format?: "mediawiki" | "mediawiki-basefields" | "zotero" | "bibtex" | "wikibase" | undefined, language?: string | undefined): Promise<any>; | ||
}; | ||
@@ -272,0 +281,0 @@ export default wiki; |
@@ -586,2 +586,19 @@ "use strict"; | ||
}; | ||
/** | ||
* Returns citation of a given page, or query string | ||
* | ||
* @param format - the format of the citation result | ||
* @param query - url or query string | ||
* @param language - if you want lanuage enabled results | ||
* @returns Returns citation data | ||
*/ | ||
wiki.citation = async (query, format, language) => { | ||
try { | ||
const result = await page_1.citation(query, format, language); | ||
return result; | ||
} | ||
catch (error) { | ||
throw new errors_1.citationError(error); | ||
} | ||
}; | ||
exports.default = wiki; | ||
@@ -588,0 +605,0 @@ // For CommonJS default export support |
@@ -35,1 +35,2 @@ export interface searchOptions { | ||
} | ||
export declare type citationFormat = 'mediawiki' | 'mediawiki-basefields' | 'zotero' | 'bibtex' | 'wikibase'; |
@@ -405,2 +405,11 @@ import { coordinatesResult, imageResult, langLinksResult, notFound, pageResult, relatedResult, wikiMediaResult, wikiSummary } from './resultTypes'; | ||
export declare const pdf: (title: string, pdfOptions?: pdfOptions | undefined) => Promise<string>; | ||
/** | ||
* Returns citation of a given page, or query string | ||
* | ||
* @param format - the format of the citation result | ||
* @param query - url or query string | ||
* @param language - if you want lanuage enabled results | ||
* @returns Returns ciation data | ||
*/ | ||
export declare const citation: (query: string, format?: "mediawiki" | "mediawiki-basefields" | "zotero" | "bibtex" | "wikibase" | undefined, language?: string | undefined) => Promise<any>; | ||
export default Page; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pdf = exports.mobileHtml = exports.media = exports.related = exports.summary = exports.rawInfo = exports.tables = exports.infobox = exports.langLinks = exports.coordinates = exports.references = exports.links = exports.categories = exports.content = exports.html = exports.intro = exports.images = exports.Page = void 0; | ||
exports.citation = exports.pdf = exports.mobileHtml = exports.media = exports.related = exports.summary = exports.rawInfo = exports.tables = exports.infobox = exports.langLinks = exports.coordinates = exports.references = exports.links = exports.categories = exports.content = exports.html = exports.intro = exports.images = exports.Page = void 0; | ||
const errors_1 = require("./errors"); | ||
@@ -828,2 +828,23 @@ const request_1 = require("./request"); | ||
}; | ||
/** | ||
* Returns citation of a given page, or query string | ||
* | ||
* @param format - the format of the citation result | ||
* @param query - url or query string | ||
* @param language - if you want lanuage enabled results | ||
* @returns Returns ciation data | ||
*/ | ||
exports.citation = async (query, format, language) => { | ||
try { | ||
let path = `data/citation`; | ||
path += format ? `/${format}` : `/mediawiki`; | ||
path += `/${query}`; | ||
language ? path += `/${language}` : null; | ||
const result = await request_1.makeRestRequest(path); | ||
return result; | ||
} | ||
catch (error) { | ||
throw new errors_1.citationError(error); | ||
} | ||
}; | ||
exports.default = Page; |
{ | ||
"name": "wikipedia", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "A JavaScript wrapper for the wikipedia apis", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105078
2782