Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

plague-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

plague-api

Plague Social Platform NodeJS API

  • 1.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
Maintainers
1
Weekly downloads
 
Created
Source

plague-api

Plague Social Platform NodeJS API Changelog

v1.05 - fix encoding problem
v1.04 - register method

set(options)

Set Plague Api Options

Parameters:

options: Use this to set your latitude & longitude.

Sample Code:
var plague = require('plague-api').set({
  latitude: -99.999999999999,
  longitude: -99.999999999999
});

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('sample@domain.com', '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('sample@domain.com', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  console.log(user);
});

getPosts(callback)

Return all user posts

Parameters:

callback: callback function.

Sample Code:
plague.login('sample@domain.com', '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('sample@domain.com', '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('sample@domain.com', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.postText('Hello Plague', function(res){
    console.log(res);
  });
});

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('sample@domain.com', '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('sample@domain.com', '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('sample@domain.com', 'mypassword', function(user){
  if(user.error){
    console.log(user.error);
    return;
  }
  plague.deleteAllPosts(function(res){
    console.log(res);
  });
});

Keywords

FAQs

Package last updated on 19 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc