strawpoll-lib
v1.0.3
Published
npm package for Strawpoll.me API
Downloads
6
Readme
Strawpoll-lib
npm package for the strawpoll API
Installation
Use npm to install strawpoll-lib.
npm i strawpoll-lib --save
Usage
Get Poll Information
const strawpoll = require('strawpoll-lib')
let pollID = 1
strawpoll.getPoll(pollID).then(res => {
console.log(res)
})
Create Poll
const strawpoll = require('strawpoll-lib')
strawpoll.createPoll("Question?", ["Yes", "No"]).then(res => {
console.log(res)
console.log(strawpoll.getURL(res.id))
})
Functions
Getting Poll Information
getPoll(pollID) // returns a Promise that will attempt to get a JSON Object based on schema at https://github.com/strawpoll/strawpoll/wiki/API.
getTitle(pollID) // returns a Promise that will attempt to get the poll's title question.
getOptions(pollID) // returns a Promise that will attempt to get the poll's options.
getResults(pollID) // returns a Promise that will attempt to get a JSON Object that associates poll options with number of votes.
getURL(pollID) // returns the URL of the poll.
Creating A Poll
createPoll(title, options, multi=false, dupcheck="normal", captcha=false) // returns a Promise that will attempt to get a JSON Object based on schema at https://github.com/strawpoll/strawpoll/wiki/API.