1.0.4 • Published 2 years ago

vrai-client-sdk v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vrai-client-sdk

Javascript/Typescript wrapper for the Vrai API

Installing

npm install vrai-client-sdk

Instantiate client

const VraiClient = require('vrai-client-sdk')
const client = new VraiClient({
    baseUrl: 'https://some-url',
    apiKey: YOUR_API_KEY
})

Usage

All methods return a promise. The success case includes the returned object from the response. Use the API method via:

const opts = {
    locale: 'en_US' // country locale required - choose from de,fr,es,en_US
    limit: 1-100 // optional default is 100  
    skip: 1 // optional page skip default is 1
}

client.home(opts).then(result => {
    console.log(result)
})
.catch(err => {
    console.error(err)
})

client.footer(opts).then(result => {
    console.log(result)
})
.catch(err => {
    console.error(err)
})

client.header(opts).then(result => {
    console.log(result)
})
.catch(err => {
    console.error(err)
})

client.standardPage(slugType, opts).then(result => {
    console.log(result)
})
.catch(err => {
    console.error(err)
})

client.listPage(slugType, opts).then(result => {
    console.log(result)
})
.catch(err => {
    console.error(err)
})

Typescript

You may use this library in your Typescript project via:

import VraiClient from 'vrai-client-sdk';

const client = new VraiClient({ baseUrl: 'https://some-url', apikey: YOUR_API_KEY });