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 🙏

© 2025 – Pkg Stats / Ryan Hefner

quander-node-sdk

v1.0.13

Published

SDK for Quander REST APIs

Readme

QUANDER NODE SDK

Installation

npm install quander-node-sdk

Usage

To write an app using the SDK

  • Register for a developer account and get your client_id and secret.
  • Add dependency 'quander-node-sdk' in your package.json file.
  • Require 'quander-node-sdk' in your file
var Quander = require('quander-node-sdk').Quander;
  • Create config options, with parameters (mode, client_id, secret).
var quander = new Quander({
  baseUrl: 'http://dev.quander.io/api',
  tokenUrl: 'http://dev.quander.io',
  clientId: '1a1t2u7b9540ggkk8s0gc4wcwcwwow40k4osw40cwo44swcoo0',
  clientSecret: '1a1t2u7b9540ggkk8s0gc4wcwcwwow40k4osw40cwo44swcoo0'
});
  • Login with username/password
quander.login(req.body.username, req.body.password).then((accessToken) => {
});
  • If you already have your access token
quander.setAccessToken(user);

How to use the resources

  • Accessing your resources
var accountManager = quander.createResource('accounts');
var projectManager = quander.createResource('projects', {account: account});
  • getList operation
accountManager.getList().then(function (accounts) {
  res.send(accounts instanceof ResourceCollection); // true
  res.send(accounts);
});

// Using Pagination
accountManager.getList({limit: 2, page: 1}).then(function (accounts) {
  res.send(accounts instanceof ResourceCollection); // true  
  res.send(accounts);
});

// Example of return for getList operation (ResourceCollection object):
//{
//  "data": [
//    {
//      "id": 115,
//      ...
//    },
//    {
//      "id": 34,
//      ...
//    }
//  ],
//  "page": 1,
//  "limit": 100,
//  "pages": 1,
//  "total": 2
//}
  • get operation ".get(uuid)"
accountManager.get('ccfb1d41-7c0b-4cb1-8836-606f0d8d5511').then(function (account) {
  res.send(account);
});
  • post operation ".post(payload, data)"
mediaManager.post({
  posterurl: 'https://www.google.com/logos/doodles/2015/new-years-eve-2015-5985438795825152-hp2x.gif',
  url: 'https://www.google.com/logos/doodles/2015/new-years-eve-2015-5985438795825152-hp2x.gif',
  type: 'image',
  referenceId: 'REFEREFEFEFEF',
  metadata: ''
}).then((media) =>{
  res.send(media);
});

// Post multipart/form-data with the payload and files
mediaManager.post({
  type: 'image',
  referenceId: 'REFEREFEFEFEF',
  metadata: ''
}, {
  media: fs.createReadStream('/..../test.gif'),
  poster: fs.createReadStream('/....p/test.gif')
}).then((media) =>{
  res.send(media);
});

Available Resources and Operations

  • Account => getList, get, post
  • Project(account) => getList
  • Experience(project) => getList
  • Media(project) => getList
  • Media(attendee) => getList
  • Media(experience) => post
  • Attendee(project) => post

Handling Error

There are 2 types of error, one coming from the sdk (QuanderSdkError), and the other one from the api responses (QuanderApiError).

accountManager.getList().then(function (accounts) {
  res.send(accounts);
}).catch((error) => {
  res.send(error instanceof Error);
  // return true
  
  res.send(error instanceof QuanderApiError);
  // return true
});
  • Example: Handling expired token
try {
  quander.setAccessToken(token);
} catch (e) {
  if (e instanceof QuanderSdkError && QuanderSdkError.TOKEN_EXPIRED === e.errorCode) {
    // Call the api to request the new access token
    return quander.getRefreshedToken(token).then((token) => {
      quander.setAccessToken(token);
    }).catch((e) => {
      // Refresh token also expired or not valid
      if (e instanceof QuanderApiError && QuanderApiError.REFRESH_TOKEN_INVALID === e.errorCode) {
        res.redirect('/login');
      }
    });
  }
}

Available Errors

  • QuanderSdkError

| Key | Description | |---------------|:-------------:| | BAD_RESOURCE | Resource not supported by the sdk | | BAD_OPERATION | Operation not supported by the sdk | | TOKEN_EXPIRED | Token is expired, you should request a new one through the api |

  • QuanderApiError

| Key | Description | |---------------|:-------------:| | INVALID_GRANT | You can't authenticate with that method | | REFRESH_TOKEN_INVALID | Your refresh token is invalid, you have to authenticate again | | BAD_REQUEST | General error. The server cannot or will not process the request. | | FORBIDDEN | The request was a valid request, but the server is refusing to respond to it. | | NOT_FOUND | Resource could not be found but may be available in the future. | | CONFLICT | Indicates that the request could not be processed because of conflict in the request. |

Debugging

  • Enable debug
Quander.enableDebug();