Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/natlibfi/melinda-api-legacy-client
JS client for using Melinda API (Union catalogue of the National library of Finland)
https://github.com/natlibfi/melinda-api-legacy-client
melinda
Last synced: 9 days ago
JSON representation
JS client for using Melinda API (Union catalogue of the National library of Finland)
- Host: GitHub
- URL: https://github.com/natlibfi/melinda-api-legacy-client
- Owner: NatLibFi
- License: lgpl-3.0
- Created: 2015-04-24T11:49:07.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-09T06:44:00.000Z (about 1 year ago)
- Last Synced: 2025-01-03T10:03:02.190Z (28 days ago)
- Topics: melinda
- Language: JavaScript
- Homepage:
- Size: 236 KB
- Stars: 0
- Watchers: 9
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# melinda-api-client [![NPM Version](https://img.shields.io/npm/v/@natlibfi/melinda-api-client.svg)](https://npmjs.org/package/@natlibfi/melinda-api-client) [![Build Status](https://travis-ci.org/NatLibFi/melinda-api-client.svg)](https://travis-ci.org/NatLibFi/melinda-api-client) [![Test Coverage](https://codeclimate.com/github/NatLibFi/melinda-api-client/badges/coverage.svg)](https://codeclimate.com/github/NatLibFi/melinda-api-client/coverage)
JS client for using Melinda API (Union catalogue of the National library of Finland)
## Installation
```
npm install melinda-api-client
```## Usage
Usage examples can be found from the test/ directory. Each function returns a promise.
```
var MelindaClient = require('@natlibfi/melinda-api-client');
var client = new MelindaClient(config);
```
config should be in following format:
```
{
endpoint: "API-ENDPOINT-URL",
user: "USERNAME",
password: "PASSWORD"
}
```To retrieve a record from Melinda use loadRecord
```
client.loadRecord(30000).then(function(record) {
// do something with record
}).done();```
The records are marc-record-js instances.To update or create a record in Melinda use updateRecord and createRecord respectively
```
client.updateRecord(record).then(function(response) {
// contains reponse from Melinda
}).done();client.createRecord(record).then(function(response) {
// contains reponse from Melinda
}).done();```
The responses are in the following format:
```
{
messages: [arrayOfMessages],
errors: [arrayOfErrors],
triggers: [arrayOfTriggerMessages],
warnings: [arrayOfWarnings]
recordId: "id of the changed/created record"
}
```## Contributions
The grunt default task will run jshint, tests and coverage for the module. Tests can be found from test/ directory.
To test that everything is ok, just run:
```
grunt
```The ci will do the same when commits are pushed to this repository.
## License and copyright
Copyright (c) 2015-2017 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of **GNU Lesser General Public License Version 3**.