twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks
Welcome

Classes

ApiClientBadgesApiBitsApiChannelChannelApiChannelFollowChannelPlaceholderChannelSubscriptionChatApiChatBadgeListChatBadgeSetChatBadgeVersionChatEmoteChatEmoteListChattersListCheermoteListConfigErrorCreatedVideoEmoteSetListHelixApiGroupHelixBanHelixBanEventHelixBitsApiHelixBitsLeaderboardHelixBitsLeaderboardEntryHelixChannelHelixChannelApiHelixChannelEditorHelixChannelEmoteHelixChannelPointsApiHelixChannelSearchResultHelixChatApiHelixChatBadgeSetHelixChatBadgeVersionHelixCheermoteListHelixClipHelixClipApiHelixCustomRewardHelixCustomRewardRedemptionHelixEmoteHelixEmoteFromSetHelixEventSubApiHelixEventSubSubscriptionHelixExtensionsApiHelixExtensionTransactionHelixFollowHelixGameHelixGameApiHelixHypeTrainApiHelixHypeTrainContributionHelixHypeTrainEventHelixInstalledExtensionHelixInstalledExtensionListHelixModerationApiHelixModeratorHelixModeratorEventHelixPaginatedRequestHelixPaginatedRequestWithTotalHelixPaginatedScheduleSegmentRequestHelixPollHelixPollApiHelixPollChoiceHelixPredictionHelixPredictionApiHelixPredictionOutcomeHelixPredictorHelixPrivilegedUserHelixScheduleHelixScheduleApiHelixScheduleSegmentHelixSearchApiHelixStreamHelixStreamApiHelixStreamMarkerHelixStreamMarkerWithVideoHelixSubscriptionHelixSubscriptionApiHelixSubscriptionEventHelixTagHelixTagApiHelixTeamHelixTeamApiHelixTeamWithUsersHelixUserHelixUserApiHelixUserBlockHelixUserExtensionHelixUserRelationHelixUserSubscriptionHelixVideoHelixVideoApiHelixWebHooksApiHelixWebHookSubscriptionKrakenApiGroupNoSubscriptionProgramErrorPrivilegedChannelPrivilegedUserSearchApiStreamStreamApiStreamNotLiveErrorSubscriptionTeamTeamApiTeamWithUsersUnsupportedApiUserUserApiUserBlockUserChatInfoUserFollowUserSubscriptionVideoVideoApi

HelixPollApi

The Helix API methods that deal with polls.

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)

async

Creates a new poll.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to create the poll for.

dataHelixCreatePollDatanone
data.bitsPerVotenumbernone

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

data.channelPointsPerVotenumbernone

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

data.choicesArray<string>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
broadcasterUserIdResolvablenone

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

Retrieves a poll by ID.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve the poll for.

idstringnone

The ID of the poll.

Return type: HelixPoll | null

getPolls(broadcaster, pagination)

async

Retrieves a list of polls for the given broadcaster.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve polls for.

paginationHelixForwardPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitstringnone

The number of results per page.

getPollsByIds(broadcaster, ids)

async

Retrieves polls by IDs.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve the polls for.

idsArray<string>none

The IDs of the polls.

Return type: Array<HelixPoll>

getPollsPaginated(broadcaster)

Creates a paginator for polls for the given broadcaster.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve polls for.

Return type: HelixPaginatedRequest<HelixPollData, HelixPoll>