Overview
Can be accessed using client.helix.polls
on an ApiClient instance.
Example
const api = new ApiClient(new StaticAuthProvider(clientId, accessToken));
const { data: polls } = await api.helix.polls.getPolls('61369223');
Methods
createPoll(broadcaster, data)
asyncCreates a new poll.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to create the poll for. | |
data | HelixCreatePollData | none | ||
data.bitsPerVote | number | none | The number of bits that a vote should cost. If not given, voting with bits will be disabled. | |
data.channelPointsPerVote | number | none | The number of channel points that a vote should cost. If not given, voting with channel points will be disabled. | |
data.choices | Array<string> | none | The available choices for the poll. | |
data.duration | number | none | The duration of the poll, in seconds. | |
data.title | string | none | The title of the poll. |
endPoll(broadcaster, id, showResult)
asyncEnds a poll.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to end the poll for. | |
id | string | none | The ID of the poll to end. | |
showResult | boolean | true | Whether to allow the result to be viewed publicly. |
getPollById(broadcaster, id)
asyncRetrieves a poll by ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to retrieve the poll for. | |
id | string | none | The ID of the poll. |
getPolls(broadcaster, pagination)
asyncRetrieves a list of polls for the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to retrieve polls for. | |
pagination | HelixForwardPagination | none | ||
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | string | none | The number of results per page. |
getPollsByIds(broadcaster, ids)
asyncRetrieves polls by IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to retrieve the polls for. | |
ids | Array<string> | none | The IDs of the polls. |
getPollsPaginated(broadcaster)
Creates a paginator for polls for the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable | none | The broadcaster to retrieve polls for. |