@nypl/scsb-rest-client

A light wrapper around SCSB's RESTful interface

Usage no npm install needed!

<script type="module">
  import nyplScsbRestClient from 'https://cdn.skypack.dev/@nypl/scsb-rest-client';
</script>

README

SCSBRestClient

This is a light wrapper around SCSB's RESTful interace.

Version

1.0.6

Install

With Github

"@nypl/scsb-rest-client": "https://github.com/NYPL/scsb-rest-client.git#BRANCH-OR-TAG-NAME"

With NPM

npm i @nypl/scsb-rest-client --save

Usage


const SCSBRestClient = require('@nypl/scsb-rest-client')

let scsbClient = new SCSBRestClient({ url: "http://theurl.example.com:theports", apiKey: "anAPIKEY" })

let myResponse = scsbClient.getItemsAvailabilityForBarcodes(this.barcodes)
.then((response) => {
  // do something with the response
})
.catch((error) => {
  // log this error and...
  return Promise.reject(error)
})

Supported Endpoints

See the SCSB swagger documentation for the authoritative documentation of each endpoint's params.

Method Endpoint
getItemsAvailabilityForBarcodes(barcodes = []) /sharedCollection/itemAvailabilityStatus
addRequestItem(data = {}) /requestItem/requestItem
search(data = {}) /searchService/search
searchByParam(queryParams = {}) /searchService/searchByParam(deprecated)

Git Workflow

When you accept a PR - you should:

  • Do a version bump in master.
  • push a tag named "vTHEVERSION" (e.g. "v1.0.1")

Changelog

v1.0.2

Added

  • Added new function addRequestItem to SCSBClient.
  • Added unit tests via chai-as-promised to test new function addRequestItem.

Updated

  • Updated ReadMe to reflect new version and added documentation for addRequestItem function.

v1.0.3

Added

  • .search()

Deprecated

  • .searchByParam()

v1.0.4

Updated

  • Updated NPM packages to address npm request module bug #1595

v1.0.5

Updated

  • Updated request, mocha, standard to address vulnerabilities

v1.0.6

  • Updated dependencies for vulnerabilities