Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: include channel raid beta eventsub type #261

Merged
merged 1 commit into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.github.twitch4j.eventsub.condition;

import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;

/**
* Generic condition when a broadcaster can be either on the receiving or giving end of the event type.
*/
@Data
@Setter(AccessLevel.PRIVATE)
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
@Jacksonized
public class ChannelFromToEventSubCondition extends EventSubCondition {

/**
* The broadcaster user ID that triggered the channel event you want to get notifications for.
*/
private String fromBroadcasterUserId;

/**
* The broadcaster user ID that received the channel event you want to get notifications for.
*/
private String toBroadcasterUserId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.github.twitch4j.eventsub.condition;

import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import lombok.extern.jackson.Jacksonized;

@SuperBuilder
@Jacksonized
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ChannelRaidCondition extends ChannelFromToEventSubCondition {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.github.twitch4j.eventsub.events;

import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Data
@Setter(AccessLevel.PRIVATE)
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class ChannelRaidEvent extends EventSubChannelFromToEvent {

/**
* The number of viewers in the raid.
*/
private Integer viewers;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.github.twitch4j.eventsub.events;

import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Data
@Setter(AccessLevel.PRIVATE)
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class EventSubChannelFromToEvent extends EventSubEvent {

/**
* The broadcaster ID that triggered the event.
*/
private String fromBroadcasterUserId;

/**
* The broadcaster login that triggered the event.
*/
private String fromBroadcasterUserLogin;

/**
* The broadcaster display name that triggered the event.
*/
private String fromBroadcasterUserName;

/**
* The broadcaster ID that received the event.
*/
private String toBroadcasterUserId;

/**
* The broadcaster login that received the event.
*/
private String toBroadcasterUserLogin;

/**
* The broadcaster display name that received the event.
*/
private String toBroadcasterUserName;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.github.twitch4j.eventsub.subscriptions;

import com.github.twitch4j.common.annotation.Unofficial;
import com.github.twitch4j.eventsub.condition.ChannelRaidCondition;
import com.github.twitch4j.eventsub.events.ChannelRaidEvent;

/**
* A broadcaster raids another broadcaster’s channel.
* <p>
* No authorization required.
* <p>
* This {@link SubscriptionType} is marked as {@link Unofficial} due to Twitch indicating that it is not intended for use in production environments.
*/
@Unofficial
public class BetaChannelRaidType implements SubscriptionType<ChannelRaidCondition, ChannelRaidCondition.ChannelRaidConditionBuilder<?, ?>, ChannelRaidEvent> {

@Override
public String getName() {
return "channel.raid";
}

@Override
public String getVersion() {
return "beta";
}

@Override
public ChannelRaidCondition.ChannelRaidConditionBuilder<?, ?> getConditionBuilder() {
return ChannelRaidCondition.builder();
}

@Override
public Class<ChannelRaidEvent> getEventClass() {
return ChannelRaidEvent.class;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.twitch4j.eventsub.subscriptions;

import com.github.twitch4j.common.annotation.Unofficial;
import lombok.experimental.UtilityClass;

import java.util.Collections;
Expand All @@ -11,6 +12,8 @@
@UtilityClass
public class SubscriptionTypes {
private final Map<String, SubscriptionType<?, ?, ?>> SUBSCRIPTION_TYPES;
@Unofficial
public final BetaChannelRaidType CHANNEL_RAID_BETA;
public final ChannelBanType CHANNEL_BAN;
public final ChannelCheerType CHANNEL_CHEER;
public final ChannelFollowType CHANNEL_FOLLOW;
Expand All @@ -37,6 +40,7 @@ public class SubscriptionTypes {
static {
SUBSCRIPTION_TYPES = Collections.unmodifiableMap(
Stream.of(
CHANNEL_RAID_BETA = new BetaChannelRaidType(),
CHANNEL_BAN = new ChannelBanType(),
CHANNEL_CHEER = new ChannelCheerType(),
CHANNEL_FOLLOW = new ChannelFollowType(),
Expand Down