All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.twitch4j.pubsub.domain.VideoPlaybackData Maven / Gradle / Ivy

There is a newer version: 1.22.0
Show newest version
package com.github.twitch4j.pubsub.domain;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Data;
import lombok.RequiredArgsConstructor;

@Data
public class VideoPlaybackData {
    /**
     * The type of the video playback event.
     */
    private Type type;

    /**
     * Always sent. May have a fractional part.
     */
    private String serverTime;

    /**
     * Sent when {@link #getType()} is {@link Type#STREAM_UP}.
     */
    private Integer playDelay;

    /**
     * Sent when {@link #getType()} is {@link Type#VIEW_COUNT}.
     */
    private Integer viewers;

    /**
     * Sent when {@link #getType()} is {@link Type#COMMERCIAL}.
     */
    private Integer length;

    /**
     * Sent when {@link #getType()} is {@link Type#COMMERCIAL}.
     */
    private Boolean scheduled;

    @RequiredArgsConstructor
    public enum Type {
        COMMERCIAL("commercial"),
        STREAM_DOWN("stream-down"),
        STREAM_UP("stream-up"),
        VIEW_COUNT("viewcount"),
        TOS_STRIKE("tos-strike");

        private final String type;

        @Override
        public String toString() {
            return this.type;
        }

        @JsonCreator
        public static Type fromString(String type) {
            for (Type t : Type.values()) {
                if (t.type.equalsIgnoreCase(type))
                    return t;
            }

            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy