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

plague-api

v1.0.92

Published

Plague Social Platform NodeJS API

Downloads

17

Readme

plague-api

npm package

Build Status Gitter

Plague Social Platform NodeJS API Changelog

v1.09 - include badges v1.08 - include tests v1.07 - new methods - resetPassword and confirmEmail v1.06 - option to change locality using set function v1.05 - fix encoding problem v1.04 - register method

set(options)

Set Plague Api Options

Parameters:

options: Use this to set your location.

Sample Code:

var plague = require('plague-api').set({
  latitude: -99.999999999999,
  longitude: -99.999999999999,
  administrativeArea: 'Quebec',
  country: 'Canada',
  locality: 'Montreal'
});

register(email, password, name, callback)

Register to get UserId and Token

Parameters:

email: Your user email. password: Your user password. name: Your name. callback: callback function.

Sample Code:

plague.register('[email protected]', 'mypassword', 'My Name', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  console.log(user);
});

login(email, password, callback)

Login to get UserId and Token

Parameters:

email: Your plague user email. password: Your plague user password. callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  console.log(user);
});

confirmEmail(email, code, callback)

Confirm user e-mail

Parameters:

email: Your plague user email. code: Your plague confirmation code. callback: callback function.

Sample Code:

plague.confirmEmail('[email protected]', '1234', function(res){
  console.log(res);
});

resetPassword(email, code, callback)

Reset user password using e-mail

Parameters:

email: Your plague user email. code: Your plague confirmation code. callback: callback function.

Sample Code:

plague.resetPassword('[email protected]', '1234', function(res){
  console.log(res);
});

getPosts(callback)

Return all user posts

Parameters:

callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  //List all user posts
  plague.getPosts(function(res){
    var posts = res.posts;
    posts.forEach(function(post) {
      console.log(post);
    })
  });
});

getInfectionsNearby(callback)

Return Nearby Plagues

Parameters:

callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.getInfectionsNearby(function(res){
    console.log(res);
  });
});

postText(text, callback)

Send a text only post to Plague API

Parameters:

text: Text of the post. callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.postText('Hello Plague', function(res){
    console.log(res);
  });
});

postLink(mediaLink, mediaLinkPreview, text, callback)

Send a post with a Media Link

Parameters:

mediaLink: Url of the image should be around 600x600 pixels. mediaLinkPreview: Url of the image should be around 300x300 pixels. callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.postLink(
    'http://domain.com/imageFull.png',
    'http://domain.com/imageSmall.png',
    'Hello! =)',function(res){
      console.log(res);
    });
});

deletePost(postId, callback)

Delete a post using postId

Parameters:

postId: This is the id returned from getPosts. callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.deletePost(123456,function(res){
    console.log(res);
  });
});

deleteAllPosts(postId, callback)

Delete all user posts

Parameters:

callback: callback function.

Sample Code:

plague.login('[email protected]', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.deleteAllPosts(function(res){
    console.log(res);
  });
});