1.0.1 • Published 4 years ago

lyrid-js-sdk-dev v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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.

Installation

Node.js

npm i lyrid-js-sdk-dev

import Lyrid from 'lyrid-js-sdk-dev'

Use the SDK as single js file

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