Skip to content

Pdbz199/strawpoll-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

License

MIT

About

A Node.js interface for the strawpoll.me API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published