Javascript client for accessing services using Skosmos, like Finto. The client provides a Promise-based interface and uses the HTTP REST API of Skosmos behind the scenes.
AS OF NOW, ONLY A FEW SKOSMOS METHODS ARE IMPLEMENTED BY THIS MODULE
The module returns a factory function that takes a single argument which is an object. The object has a mandatory property url which denotes the URL of the Skosmos endpoint. The factory function returns an object with the following methods:
- vocabularies (lang): Returns an array of vocabulary objects (
/vocabularies
) - vocabulary (name, lang): Returns an object which contains information about the vocabulary name (
/<vocid>/
)- lookup (name, label, lang): Searches label from vocabulary name. Returns an array of label objects (
/<vocid>/lookup
)
- lookup (name, label, lang): Searches label from vocabulary name. Returns an array of label objects (
var skosmos_client = require('skosmos-api-client/lib/nodejs')({
url: 'https://api.finto.fi/rest/v1'
});
return skosmos_client.vocabulary.lookup('yso', 'cat', 'en').then(function(result) {
// Do something with the result
});
define(['skosmos-api-client/lib/browser'], function(skosmosClientFactory) {
var skosmos_client = skosmosClientFactory({
url: 'https://api.finto.fi/rest/v1'
});
return skosmos_client.vocabulary.lookup('yso', 'cat', 'en').then(function(result) {
// Do something with the result
});
});
Clone the sources and install the package using npm
:
npm install
Run the following NPM script to lint, test and check coverage of the code:
npm run check
Copyright (c) 2016-2017 University Of Helsinki (The National Library Of Finland)
This project's source code is licensed under the terms of MIT License.