Skip to content

Commit

Permalink
chore: add new pubsub hype fields (#577)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed May 27, 2022
1 parent f573191 commit bfbe70e
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
Expand Up @@ -371,7 +371,7 @@ protected void onConnected() {
// 3) allow other threads to update subscribedTopics again
// 4) send unlisten requests for the old elements of subscribedTopics (optional?)
// 5) call listenOnTopic for each new PubSubRequest
subscribedTopics.forEach(topic -> queueRequest(topic));
subscribedTopics.forEach(this::queueRequest);
}

protected void onTextMessage(String text) {
Expand Down Expand Up @@ -594,6 +594,9 @@ protected void onTextMessage(String text) {
case "hype-train-cooldown-expiration":
eventManager.publish(new HypeTrainCooldownExpirationEvent(lastTopicIdentifier));
break;
case "last-x-experiment-event":
// ignore for now (experiment is not publicly deployed)
break;
default:
log.warn("Unparsable Message: " + message.getType() + "|" + message.getData());
break;
Expand Down
@@ -1,8 +1,10 @@
package com.github.twitch4j.pubsub.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.twitch4j.common.util.MilliInstantDeserializer;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.Instant;

Expand All @@ -11,4 +13,7 @@ public class HypeLevelUp {
@JsonDeserialize(using = MilliInstantDeserializer.class)
private Instant timeToExpire;
private HypeTrainProgress progress;
@Accessors(fluent = true)
@JsonProperty("is_boost_train")
private Boolean isBoostTrain;
}
@@ -1,6 +1,8 @@
package com.github.twitch4j.pubsub.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
public class HypeProgression {
Expand All @@ -10,4 +12,7 @@ public class HypeProgression {
private String source;
private Integer quantity;
private HypeTrainProgress progress;
@Accessors(fluent = true)
@JsonProperty("is_boost_train")
private Boolean isBoostTrain;
}
@@ -1,8 +1,10 @@
package com.github.twitch4j.pubsub.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.twitch4j.common.util.MilliInstantDeserializer;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.Instant;

Expand All @@ -11,4 +13,7 @@ public class HypeTrainEnd {
@JsonDeserialize(using = MilliInstantDeserializer.class)
private Instant endedAt;
private String endingReason;
@Accessors(fluent = true)
@JsonProperty("is_boost_train")
private Boolean isBoostTrain;
}
Expand Up @@ -9,4 +9,5 @@ public class HypeTrainLevel {
private Integer value;
private Integer goal;
private List<HypeTrainReward> rewards;
private Integer impressions;
}
@@ -1,8 +1,10 @@
package com.github.twitch4j.pubsub.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.twitch4j.common.util.MilliInstantDeserializer;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.Instant;

Expand All @@ -19,4 +21,7 @@ public class HypeTrainStart {
private Instant expiresAt;
@JsonDeserialize(using = MilliInstantDeserializer.class)
private Instant updatedAt;
@Accessors(fluent = true)
@JsonProperty("is_boost_train")
private Boolean isBoostTrain;
}

0 comments on commit bfbe70e

Please sign in to comment.