Skip to content

blua-blue/blua-blue-node-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

nodeJS sdk for blua.blue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published