Overview
Can be accessed using client.predictions
on an ApiClient instance.
Example
const api = new ApiClient({ authProvider });
const { data: predictions } = await api.helix.predictions.getPredictions('61369223');
Methods
cancelPrediction(broadcaster, id)
asyncCancels a prediction.
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 cancel the prediction for. | |
id | string | none | The ID of the prediction to cancel. |
createPrediction(broadcaster, data)
asyncCreates a new prediction.
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 prediction for. | |
data | HelixCreatePredictionData | none | see below | |
data.autoLockAfter | number | none | The time after which the prediction will be automatically locked, in seconds from creation. | |
data.outcomes | string[] | none | The possible outcomes for the prediction. | |
data.title | string | none | The title of the prediction. |
getPredictionById(broadcaster, id)
asyncGets a prediction 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 prediction for. | |
id | string | none | The ID of the prediction. |
getPredictions(broadcaster, pagination)
asyncGets a list of predictions 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 predictions 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. |
getPredictionsByIds(broadcaster, ids)
asyncGets predictions 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 predictions for. | |
ids | string[] | none | The IDs of the predictions. |
getPredictionsPaginated(broadcaster)
Creates a paginator for predictions 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 predictions for. |
lockPrediction(broadcaster, id)
asyncLocks a prediction.
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 lock the prediction for. | |
id | string | none | The ID of the prediction to lock. |
resolvePrediction(broadcaster, id, outcomeId)
asyncResolves a prediction.
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 resolve the prediction for. | |
id | string | none | The ID of the prediction to resolve. | |
outcomeId | string | none | The ID of the winning outcome. |