TwurpleAuthenticationGetting dataExamplesFAQMigration

Main classes

HelixPollApi

The Helix API methods that deal with polls.

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)

async

Creates a new poll.

ParameterTypeRequiredDefaultDescription
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.

dataHelixCreatePollDatanonesee below
data.channelPointsPerVotenumbernone

The number of channel points that a vote should cost. If not given, voting with channel points will be disabled.

data.choicesstring[]none

The available choices for the poll.

data.durationnumbernone

The duration of the poll, in seconds.

data.titlestringnone

The title of the poll.

Return type: HelixPoll

endPoll(broadcaster, id, showResult)

async

Ends a poll.

ParameterTypeRequiredDefaultDescription
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.

idstringnone

The ID of the poll to end.

showResultbooleantrue

Whether to allow the result to be viewed publicly.

Return type: HelixPoll

getPollById(broadcaster, id)

async

Gets a poll by ID.

ParameterTypeRequiredDefaultDescription
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.

idstringnone

The ID of the poll.

Return type: HelixPoll | null

getPolls(broadcaster, pagination)

async

Gets a list of polls for the given broadcaster.

ParameterTypeRequiredDefaultDescription
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.

paginationHelixForwardPaginationnonesee below
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitnumbernone

The number of results per page.

getPollsByIds(broadcaster, ids)

async

Gets polls by IDs.

ParameterTypeRequiredDefaultDescription
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.

idsstring[]none

The IDs of the polls.

Return type: HelixPoll[]

getPollsPaginated(broadcaster)

Creates a paginator for polls for the given broadcaster.

ParameterTypeRequiredDefaultDescription
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.

Return type: HelixPaginatedRequest<HelixPollData, HelixPoll>