## Alma Search (npm package)

This is intended to be an importable npm package for searching Alma APIs from ExLibris.

### Requirements

You will need an Alma API key with bib read permissions to use this.

### SearchBibs

The first (only so far) module is SearchBibs. It allows searching by barcode, mms_id, holdings_id, ie_id, representation_id, nz_mms_id, cz_mms_id, or other_system_id.

Import the package with

```
import {SearchBibs} from @kenxirwin/alma-search
```

Instantiate the search object with:

```
const searchBibs = new SearchBibs({
baseUrl: 'https://api-na.hosted.exlibrisgroup.com', // or other regional url
apiKey: 'your-api-key',
});
```

For barcode searching use:

```
searchBibs.barcodeLookup('123456789');
```

For other ids, use something like:

```
const response = await searchBibs.bibById({
mms_id: '99939650000541,99939680000541', // supports multiple ids
});
```

Once you receive the bib item record by a lookup process, you can view holdings details looking up by mms_id, e.g.:

```
const response = await searchBibs.holdingsByMmsId('99939650000541');
```

You can also follow any of the links returned to you by earlier searches with the `followLink` method. As with other methods, the API key will be added to the search by by the `followLink` method. Example:

```
const response = await searchBibs.followLink(
'https://api-na.hosted.exlibrisgroup.com/almaws/v1/bibs/99939680000541/holdings'
);
```
