1.0.6 • Published 4 years ago

blua-blue-node-sdk v1.0.6

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

blua.blue nodeJS SDK

Build Status Maintainability Test Coverage

Easily integrate your blua.blue content into your nodeJS application.

Installation

npm i blua-blue-node-sdk

Usage

const client = require('blua-blue-node-sdk');

let articles = [], article = {};

client.init('user-name', 'password').then(async () => {
    
    // my articles
    articles = await client.getArticleList();
    // a particular article
    article = await client.getArticle('my-article');
});

init()

parameters

  • string: userName
  • string: password
  • string: api-base-uri (optional, needed for self-hosted instances)

Returns a promise resolving true or rejecting false. Successful authentication results in setting

  • currentUser
  • token (JWT)
const client = require('blua-blue-node-sdk');

client.init('user-name', 'password').then(() => {
    console.log(client.currentUser);
});

getArticleList()

parameter

  • object: condition (optional)

Returns articles met by the condition object. The condition defaults to all articles by current user. Please see the blua.blue API specs to see possible conditions.

NOTE: performance/speed: This call caches the fetched articles. When gathering all articles (e.g. to render a menu / links), it is recommended to call (and wait for) this call first before retrieving a single article.

getArticle()

parameter

  • string: slugOrId

Returns an article object. Accepts the UUID or the unique article-slug of an article.

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago