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

com.github.twitch4j.pubsub.handlers.ShoutoutHandler Maven / Gradle / Ivy

The newest version!
package com.github.twitch4j.pubsub.handlers;

import com.github.twitch4j.common.events.TwitchEvent;
import com.github.twitch4j.common.util.TypeConvert;
import com.github.twitch4j.pubsub.domain.CreateShoutoutData;
import com.github.twitch4j.pubsub.events.ShoutoutCreatedEvent;

class ShoutoutHandler implements TopicHandler {
    @Override
    public String topicName() {
        return "shoutout";
    }

    @Override
    public TwitchEvent apply(Args args) {
        if ("create".equalsIgnoreCase(args.getType())) {
            CreateShoutoutData shoutoutInfo = TypeConvert.convertValue(args.getData(), CreateShoutoutData.class);
            return new ShoutoutCreatedEvent(args.getLastTopicPart(), shoutoutInfo);
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy