Overview
Can be accessed using client.polls
on an ApiClient instance.
Example
const api = new ApiClient({ authProvider });
const { data: polls } = await api.helix.polls.getPolls('61369223');
Methods
createPoll(broadcaster, data)
asyncCreates a new poll.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to create the poll for. | |
data | HelixCreatePollData | none | see below | |
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 | 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 A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | 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)
asyncGets a poll by ID.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get the poll for. | |
id | string | none | The ID of the poll. |
getPolls(broadcaster, pagination)
asyncGets a list of polls for the given broadcaster.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get polls for. | |
pagination | HelixForwardPagination | none | see below | |
pagination.after | string | none | A cursor to get the following page of. | |
pagination.limit | number | none | The number of results per page. |
getPollsByIds(broadcaster, ids)
asyncGets polls by IDs.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
broadcaster | UserIdResolvable A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get the polls for. | |
ids | 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 A user ID or a user or channel object. This is not a user name. Please use HelixUserApi#getUserByName to fetch a user object by name. Aliased type: string | number | UserIdResolvableType | none | The broadcaster to get polls for. |