From f7b6700679d9f6d4e135da1d494d5b5e0546e0ea Mon Sep 17 00:00:00 2001 From: Sidd Date: Tue, 10 Jan 2023 21:37:52 -0800 Subject: [PATCH 1/2] feat: add custom tags to helix responses --- .../helix/domain/ChannelInformation.java | 16 ++++++++++++++++ .../helix/domain/ChannelSearchResult.java | 11 +++++++++++ .../com/github/twitch4j/helix/domain/Stream.java | 13 ++++++++++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java index a327f7600..7a12addae 100644 --- a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java +++ b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java @@ -8,6 +8,8 @@ import lombok.With; import org.jetbrains.annotations.Nullable; +import java.util.List; + @Data @With @Setter(AccessLevel.PRIVATE) @@ -56,8 +58,22 @@ public class ChannelInformation { * Stream delay in seconds. *

* Stream delay is a Twitch Partner feature; trying to set this value for other account types will return a 400 error. + *

+ * Note: this can only be returned if using the broadcaster's user access toke */ @Nullable private Integer delay; + /** + * A list of channel-defined tags to apply to the channel. + *

+ * A channel may specify a maximum of 10 tags. + * Each tag is limited to a maximum of 25 characters and may not be an empty string or contain spaces or special characters. + * Tags are case-insensitive. For readability, consider using camelCasing or PascalCasing. + *

+ * For {@link com.github.twitch4j.helix.TwitchHelix#updateChannelInformation(String, String, ChannelInformation)}, + * setting this to an empty list will result in all tags being removed from the channel. + */ + private List tags; + } diff --git a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelSearchResult.java b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelSearchResult.java index 92a05b249..45f108875 100644 --- a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelSearchResult.java +++ b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelSearchResult.java @@ -6,6 +6,7 @@ import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.Setter; +import org.jetbrains.annotations.Nullable; import java.time.Instant; import java.util.List; @@ -57,10 +58,20 @@ public class ChannelSearchResult { * Note: Category Tags are not returned * * @see Tag types + * @deprecated Twitch is deprecating this field and will stop providing IDs in 2023 (Twitch will communicate the specific date in early 2023) in favor of {@link #getTags()} */ + @Nullable + @Deprecated @JsonProperty("tag_ids") private List tagsIds; + /** + * The tags applied to the channel. + *

+ * Note: Unlike {@link #getTagsIds()}, these tags are returned for offline channels + */ + private List tags; + /** * Thumbnail URL of the stream */ diff --git a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/Stream.java b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/Stream.java index 9cc3181af..0e39552ec 100644 --- a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/Stream.java +++ b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/Stream.java @@ -9,6 +9,7 @@ import lombok.NonNull; import lombok.Setter; import lombok.experimental.Accessors; +import org.jetbrains.annotations.Nullable; import java.time.Duration; import java.time.Instant; @@ -49,6 +50,7 @@ public class Stream { private String gameName; /** Array of community IDs. */ + @Nullable @Deprecated private List communityIds; @@ -60,6 +62,9 @@ public class Stream { @NonNull private String title; + /** The tags applied to the stream. */ + private List tags; + /** Number of viewers watching the stream at the time of the query. */ @NonNull private Integer viewerCount; @@ -69,7 +74,13 @@ public class Stream { @JsonProperty("started_at") private Instant startedAtInstant; - /** Ids of active tags on the stream */ + /** + * Ids of active tags on the stream + * + * @deprecated Twitch is deprecating this field and will stop providing IDs in 2023 (Twitch will communicate the specific date in early 2023) in favor of {@link #getTags()} + */ + @Nullable + @Deprecated private List tagIds = new ArrayList<>(); /** Indicates if the broadcaster has specified their channel contains mature content that may be inappropriate for younger audiences. */ From 4e82ac95213cff0e4e666c10354646c023c60d5b Mon Sep 17 00:00:00 2001 From: iProdigy Date: Wed, 11 Jan 2023 13:43:38 -0800 Subject: [PATCH 2/2] chore: reference updateChannelInformation issue --- .../com/github/twitch4j/helix/domain/ChannelInformation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java index 7a12addae..37d8aec84 100644 --- a/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java +++ b/rest-helix/src/main/java/com/github/twitch4j/helix/domain/ChannelInformation.java @@ -72,7 +72,7 @@ public class ChannelInformation { * Tags are case-insensitive. For readability, consider using camelCasing or PascalCasing. *

* For {@link com.github.twitch4j.helix.TwitchHelix#updateChannelInformation(String, String, ChannelInformation)}, - * setting this to an empty list will result in all tags being removed from the channel. + * setting this to an empty list should result in all tags being removed from the channel. */ private List tags;