lyrid-js-sdk v1.0.2
Lyrid JavaScript SDK
A NPM package that consume Lyrid functions.
Requirements
To use this SDK, you will need:
Node installation will include NPM, which is responsible for dependency management.
Build from code
npm install
npm run-script build
The resulting outputs are:
.\lib\lyrid.js - For react compatible js build
.\dist\lyrid.js - For running on any javascript engine
Installation
Node.js
By default the latest build will be automatically pushed into npm, and user will be able to install and use it as following:
npm i lyrid-js-sdk-dev
import Lyrid from 'lyrid-js-sdk-dev'
Use the SDK as single js file
We also deliver our Javascript compatible build into our CDN:
<script src="https://cdn.jsdelivr.net/gh/darian68/lyrid-js-sdk@latest/lyrid.js" type="text/javascript"></script>
Usage
This SDK relies heavily on Promises,
making it easier to handle the asynchronous requests made to the API. The SDK
provides a Lyrid
object containing several methods which map to the
calls and parameters described in
Lyrid REST API.
The following snippet is a generic example of how to use the SDK. If you need details for a specific module, refer to the samples.
Before executing any request, you need to provide key and secret to the API:
Create Lyrid object
const lyrid = new Lyrid(<key>, <secret>);
You can provide the token also if you alrady have it
const lyrid = new Lyrid(<key>, <secret>, <token>);
Making requests
lyrid.execute(<function ID>, <framework>, <input>).then(data =>{
console.log(data);
}, () =>{
console.log("Error on execute function");
});
4 years ago