0.1.4 • Published 4 years ago
konfigs-sdk v0.1.4
How to use the library
Required Values
- API key
- Node Id
- Application ID
Optional Values
- Endpoint (optional)
- Profile (optional)
Install the SDK
Install konfigs-sdk using npm
npm install konfigs-sdkor through yarn
yard add konfigs-sdkImport and Consume
For importing we have 2 Ways:
1. Through direct function call
- Import function
import {getHydratedConfigs} from "konfigs"- Add this piece to your code to fetch configs
const data = await getHydratedConfigs("<Your API Key>","<Node ID>","<Application ID>","<Profile 'Optional!'>","<Endpoint 'Optional!'>'")- To see fetched data you can write
console.log(data)2. Through default module konfigsSDK
- Import default module
import KonfigsSdk from 'konfigs-sdk'- Initialize object
const konfigsSdkObject = new KonfigsSdk("<Your API Key>","<Application ID>","<Profile 'Optional!'>","<Endpoint 'Optional!'>'")- Use the following to fetch configs
const data = konfigsSdkObject.getHydratedConfigs("<Node ID>")Output
When using console.log(data) the returned data object is going to be in the following shape which allows you to map and consume easily in your system:
Returned Object
{
nodeId: '<Node ID>',
data: [An Array of Configs]
}
Configs Array sturcture
{
key: '<Key Name>',
value: {
value: '<Config Value>',
datatype: '<Data type of this value>'
}
}