-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
VideoPlaybackData.java
64 lines (52 loc) · 1.39 KB
/
VideoPlaybackData.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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;
}
}
}