Skip to content

mjl-/sherpajs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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));
	});

About

javascript library to consume sherpa API's

Resources

License

Stars

Watchers

Forks

Packages

No packages published