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

shaarli-client

v0.0.6

Published

client for shaarli API

Downloads

2

Readme

Shaarli-client

a client in node.js for a shaarli api.

Installing

To utilize shaarli-client, install the the npm module:

npm install shaarli-client

After installing the npm package you can now start request shaarli instance like so:

var shaarliClient = require('shaarli-client');

var client = new shaarliClient(url,secret);

Get Info

Get information about this instance.

client.getInfo(function(err,info){
	console.log(info);
})

Get Links

Get a collection of links ordered by creation date.

params is a collection wich can have the following keys:

  • offset (int) - Offset from which to start listing links
  • limit (int | "all") - Number of links to retrieve or 'all'
  • searchtags (Array) - List of tags
  • searchterm (Array) - Search terms across all links fields
  • visibility ("all" | "private" | "public") - Filter links by visibility
var params = {
	"offset": 0,
	"limit": 10,
	"searchtags": ["gif","cat"],
	"searchterm": ["looks","at"],
	"visibility": "all"
};

client.getLinks(params,function(err,links){
	console.log(links);
})

Get Link

Get a link with its id.


client.getLink(id,function(err,link){
	console.log(link);
})

Post Link

Create a new link or note.

params is a collection wich can have the following keys:

  • description (string) - Link description
  • private (boolean) - Link visibility
  • tags (Array) - List of tags associated with the link
  • title (string) - Link title
  • url (string) - Link URL
var params = {
	"description": "blabla",
	"private": false,
	"tags": ["cat","image"],
	"title": "jumping cats",
	"url": "http://jumpin.cat/"
};

client.postLink(params,function(err,newLink){
	console.log(newLink);
});

Put Link

Update an existing link with provided request data. Keep in mind that all link’s fields will be updated.

params is a collection wich can have the following keys:

  • description (string) - Link description
  • private (boolean) - Link visibility
  • tags (Array) - List of tags associated with the link
  • title (string) - Link title
  • url (string) - Link URL
var params = {
	"description": "bloblo",
	"private": false,
	"tags": ["image","truc"],
	"title": "jumping cats calendar",
	"url": "http://jumpin.cat/post"
};

client.putLink(id,params,function(err,updateLink){
	console.log(updateLink);
});

Delete Link

Delete a link.

client.deleteLink(id,function(err){
});

Get Tags

Get a collection of tags

params is a collection wich can have the following keys:

  • offset (int) - Offset from which to start listing tags
  • limit (int | "all") - Number of tags to retrieve or 'all'
  • visibility ("all" | "private" | "public") - Filter tags by visibility
var params = {
	"offset": 0,
	"limit": 10,
	"visibility": "private"
};

client.getTags(params,function(err,tags){
	console.log(tags);
})

Get Tag

Get a tag with its tagName.


client.getTag(tagName,function(err,tag){
	console.log(tag);
})

Put Tag

Rename an existing tag.

params is a collection wich can have the following keys:

  • name (string) - new tag name
var params = {
	"name": "kitty"
};

client.putTag(tagName, params, function(err, updateTag){
	console.log(updateTag);
});

Delete Tag

Delete a tag.

client.deleteTag(tagName,function(err){
});

Get History

Retrieve the last actions made by the user, even in the web version, including:

  • CREATED: A new link has been created.
  • UPDATED: An existing link has been updated.
  • DELETED: A link has been deleted.
  • SETTINGS: Shaarli settings have been updated.

params is a collection wich can have the following keys:

  • since (string) - Get all event since this datetime (format ISO ISO8601). Note: the + should be encoded to %2B.
  • offset (int) - Offset from which to start listing events
  • limit (int | "all") - Number of event to retrieve or 'all'
var params = {
    "since": "2015-05-05T12:30:00%2B03:00",
	"offset": 0,
	"limit": 10,
};

client.getHistory(params, function(err, history){
	console.log(history);
});