1.0.3 • Published 3 years ago

strawpoll-lib v1.0.3

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

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

1.0.3

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago