npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ninja-rmm-node

v2.0.0

Published

Module to query NinjaOne RMM API

Downloads

2

Readme

ninja-rmm-node

Installation

npm install ninja-rmm-node

Usage

CommonJS

const NinjaRMM = require('ninja-rmm-node')

ESM

import NinjaRMM from 'ninja-rmm-node'

Options

For headless (API/M2M), use client_credentials grantType. Defaults to client_credentials.

const options = {
  grantType: 'client_credentials',
  region: 'na',
  clientSecret,
  clientId,
  scope: 'monitoring management control',
}

const ninja = new NinjaRMM(options)

For interactive login, use authorization_code. The default browser will open to prompt for user authentication. Note: this will not work if trying to run this module in the browser.

const options = {
  grantType: 'authorization_code',
  region: 'na',
  clientSecret,
  clientId,
  scope: 'monitoring management control offline_access',
}

If you've previously requested a refresh_token with offline_access scope, use grantType refresh_token:

const options = {
  grantType: 'refresh_token',
  region: 'na',
  clientSecret,
  clientId,
  refreshToken: 'mytoken'
}

Usage

See documentation for a list of endpoints and parameters.

Using async/await:


/**
 * @param {string} path
 * @param {string} [method]
 * @param {object} [params]
 * @param {object} [data] if method is POST or PUT, this is put in the body
 * @returns {Promise<*>}
 */
const result = await ninja.request({path: '/api/v2/organizations'})

Or with promises:

ninja.request(options)
  .then(result => {
    // use result
  })

Generate a token for use elsewhere with these static methods:

const token = await NinjaRMM.generateTokenClientCredentials({clientSecret, clientId, scope, region})
const token = await NinjaRMM.generateTokenRefresh({clientSecret, clientId, region, refreshToken})
const token = await NinjaRMM.generateTokenAuthorizationCode({clientSecret, clientId, region, scope})