Predictions
| Function | Returns |
|---|---|
getPredictions | Promise<PaginatedResult<Prediction>> |
getPredictionsByIds | Promise<Array<Prediction>> |
getPredictionById | Promise<Prediction | null> |
createPrediction | Promise<Prediction> |
lockPrediction | Promise<Prediction> |
resolvePrediction | Promise<Prediction> |
cancelPrediction | Promise<Prediction> |
Functions
getPredictions
twitch.prediction.getPredictions(pagination?: ForwardPagination): Promise<PaginatedResult<Prediction>>
getPredictionsByIds
twitch.prediction.getPredictionsByIds(predictionIds: Array<string>): Promise<Array<Prediction>>
getPredictionById
twitch.prediction.getPredictionById(predictionId: string): Promise<Prediction | null>
createPrediction
twitch.prediction.createPrediction(data: CreatePrediction): Promise<Prediction>
lockPrediction
twitch.prediction.lockPrediction(predictionId: string): Promise<Prediction>
resolvePrediction
twitch.prediction.resolvePrediction(predictionId: string, outcomeId: string): Promise<Prediction>
cancelPrediction
twitch.prediction.cancelPrediction(predictionId: string): Promise<Prediction>
Types
CreatePrediction
type CreatePrediction = {
title: string
outcomes: Array<string>
autoLockAfter: number
}
ForwardPagination
type ForwardPagination = {
limit?: number
after?: string
}
PaginatedResult
type PaginatedResult<T> = {
data: Array<T>
cursor?: string
}
Prediction
type Prediction = {
id: string
broadcasterId: string
broadcasterLogin: string
broadcasterName: string
title: string
winningOutcomeId: string | null
outcomes: Array<PredictionOutcome>
predictionWindow: number
status: PredictionStatus
createdAt: string
endedAt: string
lockedAt: string
}
PredictionOutcome
type PredictionOutcome = {
id: string
title: string
users: number
channelPoints: number
topPredictors: Array<Predictor> | null
color: PredictionOutcomeColor
}
PredictionOutcomeColor
type PredictionOutcomeColor = "BLUE" | "PINK"
PredictionStatus
type PredictionStatus = "CANCELED" | "ACTIVE" | "RESOLVED" | "LOCKED"
Predictor
type Predictor = {
userId: string
userName: string
userLogin: string
channelPointsUsed: number
channelPointsWon: number | null
}