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

com.github.twitch4j.helix.domain.ExtensionActiveList Maven / Gradle / Ivy

There is a newer version: 1.23.0
Show newest version
package com.github.twitch4j.helix.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * Extension Active List
 */
@Data
@Setter(AccessLevel.PRIVATE)
@NoArgsConstructor
@AllArgsConstructor
public class ExtensionActiveList {

    @JsonProperty("data")
    private ActiveExtensions data;

    @Deprecated
    private HelixPagination pagination;

    @Data
    @Setter(AccessLevel.PRIVATE)
    @Builder(toBuilder = true)
    @NoArgsConstructor
    @AllArgsConstructor
    public static class ActiveExtensions {

        /**
         * Contains data for panel Extensions.
         */
        @JsonProperty("panel")
        private Map activePanels;

        /**
         * Contains data for video-overlay Extensions.
         */
        @JsonProperty("overlay")
        private Map activeOverlays;

        /**
         * Contains data for video-component Extensions.
         */
        @JsonProperty("component")
        private Map activeComponents;

        @JsonIgnore
        @Deprecated
        public Map getPanels() {
            return computeFallback(activePanels);
        }

        @JsonIgnore
        @Deprecated
        public Map getOverlays() {
            return computeFallback(activeOverlays);
        }

        @JsonIgnore
        @Deprecated
        public Map getComponents() {
            return computeFallback(activeComponents);
        }

        private static Map computeFallback(Map map) {
            return map.keySet().stream().collect(Collectors.toMap(k -> k, k -> map.get(k).asExtension()));
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy