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

Classes

ApiClientBadgesApiBitsApiChannelChannelApiChannelFollowChannelPlaceholderChannelSubscriptionChatApiChatBadgeListChatBadgeSetChatBadgeVersionChatEmoteChatEmoteListChattersListCheermoteListConfigErrorCreatedVideoEmoteSetListHelixApiGroupHelixBanHelixBanEventHelixBitsApiHelixBitsLeaderboardHelixBitsLeaderboardEntryHelixChannelHelixChannelApiHelixChannelEditorHelixChannelEmoteHelixChannelPointsApiHelixChannelSearchResultHelixChatApiHelixChatBadgeSetHelixChatBadgeVersionHelixCheermoteListHelixClipHelixClipApiHelixCustomRewardHelixCustomRewardRedemptionHelixEmoteHelixEmoteFromSetHelixEventSubApiHelixEventSubSubscriptionHelixExtensionsApiHelixExtensionTransactionHelixFollowHelixGameHelixGameApiHelixHypeTrainApiHelixHypeTrainContributionHelixHypeTrainEventHelixInstalledExtensionHelixInstalledExtensionListHelixModerationApiHelixModeratorHelixModeratorEventHelixPaginatedRequestHelixPaginatedRequestWithTotalHelixPaginatedScheduleSegmentRequestHelixPollHelixPollApiHelixPollChoiceHelixPredictionHelixPredictionApiHelixPredictionOutcomeHelixPredictorHelixPrivilegedUserHelixScheduleHelixScheduleApiHelixScheduleSegmentHelixSearchApiHelixStreamHelixStreamApiHelixStreamMarkerHelixStreamMarkerWithVideoHelixSubscriptionHelixSubscriptionApiHelixSubscriptionEventHelixTagHelixTagApiHelixTeamHelixTeamApiHelixTeamWithUsersHelixUserHelixUserApiHelixUserBlockHelixUserExtensionHelixUserRelationHelixUserSubscriptionHelixVideoHelixVideoApiHelixWebHooksApiHelixWebHookSubscriptionKrakenApiGroupNoSubscriptionProgramErrorPrivilegedChannelPrivilegedUserSearchApiStreamStreamApiStreamNotLiveErrorSubscriptionTeamTeamApiTeamWithUsersUnsupportedApiUserUserApiUserBlockUserChatInfoUserFollowUserSubscriptionVideoVideoApi

HelixPredictionApi

The Helix API methods that deal with predictions.

Overview

Can be accessed using client.helix.predictions on an ApiClient instance.

Example

const api = new ApiClient(new StaticAuthProvider(clientId, accessToken));
const { data: predictions } = await api.helix.predictions.getPredictions('61369223');

Methods

cancelPrediction(broadcaster, id)

async

Cancels a prediction.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to cancel the prediction for.

idstringnone

The ID of the prediction to cancel.

Return type: HelixPrediction

createPrediction(broadcaster, data)

async

Creates a new prediction.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to create the prediction for.

dataHelixCreatePredictionDatanone
data.autoLockAfternumbernone

The time after which the prediction will be automatically locked, in seconds from creation.

data.outcomesArray<string>none

The possible outcomes for the prediction.

data.titlestringnone

The title of the prediction.

Return type: HelixPrediction

getPredictionById(broadcaster, id)

async

Retrieves a prediction by ID.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve the prediction for.

idstringnone

The ID of the prediction.

Return type: HelixPrediction | null

getPredictions(broadcaster, pagination)

async

Retrieves a list of predictions for the given broadcaster.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve predictions for.

paginationHelixForwardPaginationnone
pagination.afterstringnone

A cursor to get the following page of.

pagination.limitstringnone

The number of results per page.

getPredictionsByIds(broadcaster, ids)

async

Retrieves predictions by IDs.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve the predictions for.

idsArray<string>none

The IDs of the predictions.

Return type: Array<HelixPrediction>

getPredictionsPaginated(broadcaster)

Creates a paginator for predictions for the given broadcaster.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to retrieve predictions for.

Return type: HelixPaginatedRequest<HelixPredictionData, HelixPrediction>

lockPrediction(broadcaster, id)

async

Locks a prediction.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to lock the prediction for.

idstringnone

The ID of the prediction to lock.

Return type: HelixPrediction

resolvePrediction(broadcaster, id, outcomeId)

async

Resolves a prediction.

ParameterTypeRequiredDefaultDescription
broadcasterUserIdResolvablenone

The broadcaster to resolve the prediction for.

idstringnone

The ID of the prediction to resolve.

outcomeIdstringnone

The ID of the winning outcome.

Return type: HelixPrediction