Class Prediction

java.lang.Object
com.github.twitch4j.helix.domain.Prediction

public class Prediction extends Object
  • Constructor Details

    • Prediction

      public Prediction()
    • Prediction

      public Prediction(String id, String broadcasterId, String broadcasterName, String broadcasterLogin, String title, @Nullable @Nullable String winningOutcomeId, List<PredictionOutcome> outcomes, Integer predictionWindowSeconds, PredictionStatus status, Instant createdAt, @Nullable @Nullable Instant endedAt, @Nullable @Nullable Instant lockedAt)
      Creates a new Prediction instance.
      Parameters:
      id - ID of the Prediction.
      broadcasterId - ID of the broadcaster.
      broadcasterName - Display name of the broadcaster.
      broadcasterLogin - Login name of the broadcaster.
      title - Title for the Prediction. Maximum: 45 characters.
      winningOutcomeId - ID of the winning outcome. If the status is ACTIVE, this is set to null.
      outcomes - The possible outcomes for the Prediction. Size must be 2.
      predictionWindowSeconds - Total duration for the Prediction (in seconds). Minimum: 1. Maximum: 1800.
      status - Status of the Prediction.
      createdAt - UTC timestamp for the Prediction’s start time.
      endedAt - UTC timestamp for when the Prediction ended. If the status is ACTIVE, this is set to null.
      lockedAt - UTC timestamp for when the Prediction was locked. If the status is not LOCKED, this is set to null.
  • Method Details

    • getPredictionWindow

      @Nullable public @Nullable Duration getPredictionWindow()
      Returns:
      the total duration for the Prediction.
    • getWinningOutcome

      public Optional<PredictionOutcome> getWinningOutcome()
      Returns:
      the winning PredictionOutcome, in an optional wrapper
    • builder

      public static Prediction.PredictionBuilder builder()
    • toBuilder

      public Prediction.PredictionBuilder toBuilder()
    • withId

      public Prediction withId(String id)
      ID of the Prediction.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withBroadcasterId

      public Prediction withBroadcasterId(String broadcasterId)
      ID of the broadcaster.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withBroadcasterName

      public Prediction withBroadcasterName(String broadcasterName)
      Display name of the broadcaster.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withBroadcasterLogin

      public Prediction withBroadcasterLogin(String broadcasterLogin)
      Login name of the broadcaster.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withTitle

      public Prediction withTitle(String title)
      Title for the Prediction. Maximum: 45 characters.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withWinningOutcomeId

      public Prediction withWinningOutcomeId(@Nullable @Nullable String winningOutcomeId)
      ID of the winning outcome. If the status is ACTIVE, this is set to null.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withOutcomes

      public Prediction withOutcomes(List<PredictionOutcome> outcomes)
      The possible outcomes for the Prediction. Size must be 2.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withPredictionWindowSeconds

      public Prediction withPredictionWindowSeconds(Integer predictionWindowSeconds)
      Total duration for the Prediction (in seconds). Minimum: 1. Maximum: 1800.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withStatus

      public Prediction withStatus(PredictionStatus status)
      Status of the Prediction.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withCreatedAt

      public Prediction withCreatedAt(Instant createdAt)
      UTC timestamp for the Prediction’s start time.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withEndedAt

      public Prediction withEndedAt(@Nullable @Nullable Instant endedAt)
      UTC timestamp for when the Prediction ended. If the status is ACTIVE, this is set to null.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withLockedAt

      public Prediction withLockedAt(@Nullable @Nullable Instant lockedAt)
      UTC timestamp for when the Prediction was locked. If the status is not LOCKED, this is set to null.
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • getId

      public String getId()
      ID of the Prediction.
    • getBroadcasterId

      public String getBroadcasterId()
      ID of the broadcaster.
    • getBroadcasterName

      public String getBroadcasterName()
      Display name of the broadcaster.
    • getBroadcasterLogin

      public String getBroadcasterLogin()
      Login name of the broadcaster.
    • getTitle

      public String getTitle()
      Title for the Prediction. Maximum: 45 characters.
    • getWinningOutcomeId

      @Nullable public @Nullable String getWinningOutcomeId()
      ID of the winning outcome. If the status is ACTIVE, this is set to null.
    • getOutcomes

      public List<PredictionOutcome> getOutcomes()
      The possible outcomes for the Prediction. Size must be 2.
    • getPredictionWindowSeconds

      public Integer getPredictionWindowSeconds()
      Total duration for the Prediction (in seconds). Minimum: 1. Maximum: 1800.
    • getStatus

      public PredictionStatus getStatus()
      Status of the Prediction.
    • getCreatedAt

      public Instant getCreatedAt()
      UTC timestamp for the Prediction’s start time.
    • getEndedAt

      @Nullable public @Nullable Instant getEndedAt()
      UTC timestamp for when the Prediction ended. If the status is ACTIVE, this is set to null.
    • getLockedAt

      @Nullable public @Nullable Instant getLockedAt()
      UTC timestamp for when the Prediction was locked. If the status is not LOCKED, this is set to null.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object