Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
keymetrics-api
Advanced tools
This module lets you implement a fully customizable Keymetrics client, receiving live data from the Keymetrics API.
You will need to retrieve your Keymetrics user token to use it.
For more informations about the data structures and API calls check out the documentation.
We designed 2 ways to start the module: via callback or events.
With NPM:
$ npm install keymetrics-api --save
With YARN:
$ yarn add keymetrics-api
var Keymetrics = require('keymetrics-api');
var km = new Keymetrics({
refresh_token: '[token]',
token_type: 'refresh_token',
public_key: '[public_key]',
realtime: true
});
km.init(function(err, res) {
if (err) return console.log(err);
//Get user role
km.bucket.fetchUserRole(function(err, res) {
console.log('Current permissions: ' + res);
});
//Print received status
km.bus.on('data:*:status', function(data) {
console.log(data);
});
});
refresh_token
(Required): Refresh token obtained from the Keymetrics dashboard.token_type
(Required): Token type (refresh_token
or access_token
)public_key
(Optional): When defined, lets you retrieve the correct bucket.realtime
(Optional): When defined with public_key, launches the websocket session at start.This snippet makes 3 successive calls (if all options are set):
bus
is broadcasting events corresponding to every step of the authentication process.
In this example we start the authentication, then retrieve the bucket and finally start the realtime interaction.
var km = new Keymetrics({
refresh_token: '[token]',
token_type: 'refresh_token'
});
//When authenticated
km.bus.on('auth:ready', function(token) {
//Retrieve bucket
km.bucket.connect('[public_key]');
});
//When bucket is retrieved
km.bus.on('bucket:active', function(id) {
//Fetch user role
km.bucket.fetchUserRole(function(err, res) {
console.log('Current permissions: ' + res);
});
//Start realtime
km.realtime.init();
});
//When realtime starts
km.bus.on('realtime:on', function() {
console.log('Realtime started!')
});
//Retrieve access_token
km.init();
DEBUG=*
allows verbose mode for received realtime data.
Apache 2.0
FAQs
Keymetrics API Wrapper
The npm package keymetrics-api receives a total of 12 weekly downloads. As such, keymetrics-api popularity was classified as not popular.
We found that keymetrics-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.