0.1.4 • Published 7 years ago

sierra-wrapper v0.1.4

Weekly downloads
3
License
Apache-2
Repository
github
Last release
7 years ago

sierra-wrapper

A basic node wrapper for the III Sierra v3 API

The wrapper currently only supports:

  • Authorizing
  • Returning a single, multiple and range Bib records
  • Returning a single, multiple and range Item records
  • Returning item records beloning to a single Bib record

More endpoint will be added as the need arises.


To use make sure you have your credentials stored in a json file in the format:

{
	"key": "YOURKEY",
	"secret": "YOURSECRET",
	"base": "https://your.domain.name.org/iii/sierra-api/v3/"
}

You then authorize and request by

var wrapper = require('sierra-wrapper')

var loadedConfig = wrapper.loadConfig('./path/to/config.json')
wrapper.auth((error, results) => {
  if (error) console.log(error)
  wrapper.requestSingleBib('14628261', (errorBibReq, results) => {
    if (errorBibReq) console.log(errorBibReq)
    console.log(results)
  })
})

You can also set your credentials via enviorment variables: SIERRA_KEY, SIERRA_SECRET, SIERRA_BASE


Functions

loadConfig(configOrFile) ⇒ boolean

Loads a congig object, passed or from disk

Kind: global function Returns: boolean - did it load or not

ParamTypeDescription
configOrFileobject | stringThe object with the credentials or a path to a json file with the credentials

auth(cb)

Requests an auth token from the sierra API and stores it for future use, it also setups a time to renew the token

Kind: global function

ParamTypeDescription
cbfunctioncallback

requestSingleBib(bibId, cb)

Requests a single bib data from the API

Return format: { data: { total: 1, entries: [ Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/bibs/17292415?fields=default,fixedFields,varFields,normTitle,normAuthor,orders,locations' }

Kind: global function

ParamTypeDescription
bibIdstringthe bnumber of the bib you want to request
cbfunctioncallback

requestRangeBib(bibIdStart, bibIdEnd, cb)

Requests a bib range from the API

Return format: { data: { total: 1, entries: [ Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/bibs/?limit=1&id=17292415&fields=default,fixedFields,varFields,normTitle,normAuthor,orders,locations' }

Kind: global function

ParamTypeDescription
bibIdStartstringthe bnumber of the bib you want to request
bibIdEndstringthe bnumber of the bib you want to request
cbfunctioncallback

requestRangeItem(itemIdStart, itemIdEnd, cb)

Requests an item range from the API

Return format: { data: { total: 1, entries: [ Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/items/?limit=1&id=17292415&fields=default,fixedFields,varFields,normTitle,normAuthor,orders,locations' }

Kind: global function

ParamTypeDescription
itemIdStartstringthe bnumber of the bib you want to request
itemIdEndstringthe bnumber of the bib you want to request
cbfunctioncallback

requestBibItems(bibId, cb)

Requests all the items of a specified bib id Return format: { data: { total: 2, entries: [ Object, Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/items/?bibIds=17292415&fields=default,fixedFields,varFields&offset=0' }

Kind: global function

ParamTypeDescription
bibIdstringthe bnumber of the bib you want to request
cbfunctioncallback

requestMultiBibBasic(bibsIds, cb)

Requests multiple bibs, but no orders or locations

Return format: { data: { total: 1, entries: [ Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/bibs/?id=14628261,14628262,14628263,14628264,14628265,14628266,14628267,14628268,14628269,14628270&fields=default,fixedFields,varFields,normTitle,normAuthor' }

Kind: global function

ParamTypeDescription
bibsIdsarrayan array of bib id strings
cbfunctioncallback

requestMultiItemBasic(itemIds, cb)

Requests multiple items

Return format: { data: { total: 1, entries: [ Object ] }, url: 'https://catalog.library.org/iii/sierra-api/v3/items/?id=10000000,10000100,10000200,10000300,10000400,10000500,10000600,10000700,10000800,10000900,10001000&fields=default,fixedFields,varFields' }

Kind: global function

ParamTypeDescription
itemIdsarrayarray of item ids
cbfunctioncallback
0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.0

7 years ago