javascript library to consume sherpa API's
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
package.json
sherpa.js

README.md

sherpa.js

Sherpa.js is a pure JavaScript library that helps consuming a sherpa API.

Available as npm package sherpajs.

Use sherpats if you want to generate a typescript client library module from sherpadoc.

Usage

You need to know the baseURL for the API, e.g. "https://www.sherpadoc.org/example/".

sherpa.load('https://www.sherpadoc.org/example/')
	.then(function(example) {
		example.requestCount()
		.then(function(result) {
			alert('Number of requests: '+result);
		}, function(error) {
			alert('Error: '+JSON.stringify(error));
		});
	}, function(error) {
		alert('Error loading API: '+JSON.stringify(error));
	});

Or if you know the functions you need:

var sherpaJSON = {functions: ['requestCount']} // loaded from https://www.sherpadoc.org/example/sherpa.json
var example = sherpa.init('https://www.sherpadoc.org/example/', sherpaJSON);
example.requestCount()
	.then(function(result) {
		alert('Number of requests: '+result);
	}, function(error) {
		alert('Error: '+JSON.stringify(error));
	});