Class Prediction

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

public class Prediction
extends java.lang.Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  Prediction.PredictionBuilder  
  • Constructor Summary

    Constructors
    Constructor Description
    Prediction()  
    Prediction​(java.lang.String id, java.lang.String broadcasterId, java.lang.String broadcasterName, java.lang.String broadcasterLogin, java.lang.String title, @Nullable java.lang.String winningOutcomeId, java.util.List<com.github.twitch4j.eventsub.domain.PredictionOutcome> outcomes, java.lang.Integer predictionWindowSeconds, com.github.twitch4j.eventsub.domain.PredictionStatus status, java.time.Instant createdAt, @Nullable java.time.Instant endedAt, @Nullable java.time.Instant lockedAt)  
  • Method Summary

    Modifier and Type Method Description
    static Prediction.PredictionBuilder builder()  
    protected boolean canEqual​(java.lang.Object other)  
    boolean equals​(java.lang.Object o)  
    java.lang.String getBroadcasterId()
    ID of the broadcaster.
    java.lang.String getBroadcasterLogin()
    Login name of the broadcaster.
    java.lang.String getBroadcasterName()
    Display name of the broadcaster.
    java.time.Instant getCreatedAt()
    UTC timestamp for the Prediction’s start time.
    @Nullable java.time.Instant getEndedAt()
    UTC timestamp for when the Prediction ended.
    java.lang.String getId()
    ID of the Prediction.
    @Nullable java.time.Instant getLockedAt()
    UTC timestamp for when the Prediction was locked.
    java.util.List<com.github.twitch4j.eventsub.domain.PredictionOutcome> getOutcomes()
    The possible outcomes for the Prediction.
    @Nullable java.time.Duration getPredictionWindow()  
    java.lang.Integer getPredictionWindowSeconds()
    Total duration for the Prediction (in seconds).
    com.github.twitch4j.eventsub.domain.PredictionStatus getStatus()
    Status of the Prediction.
    java.lang.String getTitle()
    Title for the Prediction.
    java.util.Optional<com.github.twitch4j.eventsub.domain.PredictionOutcome> getWinningOutcome()  
    @Nullable java.lang.String getWinningOutcomeId()
    ID of the winning outcome.
    int hashCode()  
    Prediction.PredictionBuilder toBuilder()  
    java.lang.String toString()  
    Prediction withBroadcasterId​(java.lang.String broadcasterId)
    ID of the broadcaster.
    Prediction withBroadcasterLogin​(java.lang.String broadcasterLogin)
    Login name of the broadcaster.
    Prediction withBroadcasterName​(java.lang.String broadcasterName)
    Display name of the broadcaster.
    Prediction withCreatedAt​(java.time.Instant createdAt)
    UTC timestamp for the Prediction’s start time.
    Prediction withEndedAt​(@Nullable java.time.Instant endedAt)
    UTC timestamp for when the Prediction ended.
    Prediction withId​(java.lang.String id)
    ID of the Prediction.
    Prediction withLockedAt​(@Nullable java.time.Instant lockedAt)
    UTC timestamp for when the Prediction was locked.
    Prediction withOutcomes​(java.util.List<com.github.twitch4j.eventsub.domain.PredictionOutcome> outcomes)
    The possible outcomes for the Prediction.
    Prediction withPredictionWindowSeconds​(java.lang.Integer predictionWindowSeconds)
    Total duration for the Prediction (in seconds).
    Prediction withStatus​(com.github.twitch4j.eventsub.domain.PredictionStatus status)
    Status of the Prediction.
    Prediction withTitle​(java.lang.String title)
    Title for the Prediction.
    Prediction withWinningOutcomeId​(@Nullable java.lang.String winningOutcomeId)
    ID of the winning outcome.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Prediction

      public Prediction()
    • Prediction

      public Prediction​(java.lang.String id, java.lang.String broadcasterId, java.lang.String broadcasterName, java.lang.String broadcasterLogin, java.lang.String title, @Nullable @Nullable java.lang.String winningOutcomeId, java.util.List<com.github.twitch4j.eventsub.domain.PredictionOutcome> outcomes, java.lang.Integer predictionWindowSeconds, com.github.twitch4j.eventsub.domain.PredictionStatus status, java.time.Instant createdAt, @Nullable @Nullable java.time.Instant endedAt, @Nullable @Nullable java.time.Instant lockedAt)
  • Method Details

    • getPredictionWindow

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

      public java.util.Optional<com.github.twitch4j.eventsub.domain.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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 java.lang.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​(java.util.List<com.github.twitch4j.eventsub.domain.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​(java.lang.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​(com.github.twitch4j.eventsub.domain.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​(java.time.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 java.time.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 java.time.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 java.lang.String getId()
      ID of the Prediction.
    • getBroadcasterId

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

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

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

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

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

      public java.util.List<com.github.twitch4j.eventsub.domain.PredictionOutcome> getOutcomes()
      The possible outcomes for the Prediction. Size must be 2.
    • getPredictionWindowSeconds

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

      public com.github.twitch4j.eventsub.domain.PredictionStatus getStatus()
      Status of the Prediction.
    • getCreatedAt

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

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

      @Nullable public @Nullable java.time.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​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • canEqual

      protected boolean canEqual​(java.lang.Object other)
    • hashCode

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

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object