Code Monkey home page Code Monkey logo

plague-api's Introduction

Warning: looks like Plague Social Platform was discontinued, plague.io no longer exists.

๐ŸŒ plague-api

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);
  });
});

plague-api's People

Contributors

kaue avatar kauegimenes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

rpoveda

plague-api's Issues

Comments?

Is there any way to pull comments?
I would love to see methods about comments - where we can simply read/flag/delete comments. If possible, push enabled.

:)

Not possible to change location

I've been trying to set location for cards using .set({lat,long}). The created cards, for some reason, always have Montreal, Canada as the location attached to them; but interestingly the map location being displayed changes (to the actual lat/long I set).

I'm wondering if this is a bug of the api - or if this is something else that can be solved?

Also, I was unable to find any information about the actual api on plague website; how/where did you obtain the information to create the api for the app?

Thank you very much!

Still working?

Can't seem to make this work.
Unexpected tokens, or undefined's.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.