Methods
(inner) createPoll() → {Promise}
Create a poll placeholder or a complete poll.
Example
const { meta, data } = pnut.createPoll({
type: "com.example.site",
prompt: "Do you like Pnut?",
options: [
{
text: "Yes"
},
{
text: "Of course"
}
],
duration: "60",
is_anonymous: "false"
});
Parameters:
Type | Description |
---|---|
object | A valid poll object |
Returns:
- Type
- Promise
(inner) deletePoll(pollId) → {Promise}
Delete a poll
Example
const { meta, data } = await pnut.deletePoll(72);
Parameters:
Name | Type | Description |
---|---|---|
pollId |
string | Number | A poll id |
Returns:
- Type
- Promise
(inner) myPolls() → {Promise}
Retrieve a list of polls created by the authenticated user.
Example
const { meta, data } = await pnut.myPolls();
Returns:
- Type
- Promise
(inner) poll(pollId) → {Promise}
Retrieve a poll objec
Example
const { meta, data } = await pnut.poll(1);
Parameters:
Name | Type | Description |
---|---|---|
pollId |
string | Number | A poll id |
Returns:
- Type
- Promise
(inner) respondToPoll(poll, position) → {Promise}
Respond to a poll object
Example
const { meta, data } = await pnut.respondToPoll(1, 2);
Parameters:
Name | Type | Description |
---|---|---|
poll |
string | Number | A poll id |
position |
string | number | A position |
Returns:
- Type
- Promise