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

@apigrate/sortly

v2.2.1

Published

Sortly API connectors for NodeJS

Downloads

17

Readme

sortly

Sortly API Connector

Usage

Visit: https://pro.sortly.com/public-api to obtain an API access key pair for your account. Then...

Example:

const {Sortly} = require('@apigrate/sortly');
let sortly = new Sortly({apiToken: 'api secret key'})
//sortly.listItems etc...

Methods supported

See Sortly API Docs for response details.

Items

cloneItem(id, payload)

  1. payload.quantity {number} optional
  2. payload.folder_id {number} optional, defaults to root folder
  3. payload.include_subtree {boolean} optional, default false

createItem(item)

deleteItem(id)

getItem(id, opts)

  1. id {number} id of the item
  2. opts {object} parameters to pass with the query

Example

let resp = await sortly.getItem(478391, {include: "custom_attributes"});

let item = resp.data; // an object

listItems(opts)

  1. id {number} id of the item
  2. opts {object} parameters to pass with the query

Example

let resp = await sortly.listItems({page: 1, per_page 50, include: "custom_attributes"});

let items = resp.data; // an array

listRecentItems(opts)

moveItem(id, payload)

  1. payload.quantity {number} required
  2. payload.folder_id {number} optional defaults to root folder

updateItem(id, item)

Note: nothing returned on success

Custom Fields

listCustomFields(opts)

getCustomField(id)

More Examples

const {Sortly}  = require('@apigrate/sortly');
const debug     = require('debug')('gr8:sortly');
const moment    = require('moment');

let sortly = new Sortly({apiToken: process.env.SORTLY_PRIVATE_KEY });

(async function(){
  try{

    let result = null;

    result = await sortly.listCustomFields({page: 1, per_page: 2});

    result = await sortly.listRecentItems({updated_since: moment('2019-07-30T17:49:30.876Z').unix()});

    result = await sortly.getItem(23758);

    let item = await sortly.createItem({
      name: 'Test',
      price: null,
      quanity: null,
      parent_id: null,
      notes: "This is a test folder.",
      type: "folder",
    });
    console.log(`Created item ${item.data.id}`);

    item.data.name = "Testing";
    item.data.notes = "After updating, the item looks like this.";
    result = await sortly.updateItem(item.data.id, item.data);

    result = await sortly.deleteItem(item.data.id);
    console.log(`Deleted item ${item.data.id}`);


    console.log(`Last Result is:\n${JSON.stringify(result,null,2)}` );
    debug(`\nRate limits:\nlimit: ${sortly.rate_limit}\nremaining: ${sortly.rate_limit_remaining}\nreset: ${sortly.rate_limit_reset}`)
  }catch(ex){
    console.error(`Error. ${ex.message}`);
    debug(`\nRate limits:\nlimit: ${sortly.rate_limit}\nremaining: ${sortly.rate_limit_remaining}\nreset: ${sortly.rate_limit_reset}`)
  }
})()