diff --git a/src/response.js b/src/response.js index 0bf71f7..ee47181 100644 --- a/src/response.js +++ b/src/response.js @@ -55,6 +55,17 @@ class ApiResponse { return null; } + /** + * Bib available in the response if requested via `options.include=bib`. Specialised classes provide extracted meta data depending on context. + * @return {object} + */ + getBib() { + if('bib' in this.raw) { + return this.raw.bib; + } + return null; + } + /** * Value of the "Last-Modified-Version" header in response if present. Specialised classes provide version depending on context @@ -144,6 +155,14 @@ module:zotero-api-client~MultiReadResponse#getData} return this.raw.map(r => 'meta' in r && r.meta || null); } + /** + * @return {Array} a list of formatted references (if requested via `options.include=bib`), indexes of the array match indexes of entities in {@link +module:zotero-api-client~MultiReadResponse#getData} + */ + getBib() { + return this.raw.map(r => 'bib' in r && r.bib || null); + } + /** * @return {?number} Total number of results */