vrai-client-sdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i vrai-client-sdk

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

30.6 kB

Total Files

12

Last publish

Collaborators

  • bisfrim