Skip to content

Commit

Permalink
added version to event types (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katzen48 authored Jul 17, 2022
1 parent 304c8ce commit 5e99387
Show file tree
Hide file tree
Showing 38 changed files with 118 additions and 37 deletions.
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelBanEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class ChannelBanEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_BAN;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_MODERATE,
];
Expand Down Expand Up @@ -65,7 +67,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelCheerEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ChannelCheerEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHEER;

protected static string $version = '1';

protected static array $scopes = [
Scope::BITS_READ,
];
Expand Down Expand Up @@ -52,7 +54,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelFollowEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ChannelFollowEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_FOLLOW;

protected static string $version = '1';

public string $followerId;

public string $followerLogin;
Expand Down Expand Up @@ -42,7 +44,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelModeratorAddEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ChannelModeratorAddEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_MODERATOR_ADD;

protected static string $version = '1';

protected static array $scopes = [
Scope::MODERATION_READ,
];
Expand Down Expand Up @@ -43,7 +45,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelModeratorRemoveEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ChannelModeratorRemoveEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_MODERATOR_REMOVE;

protected static string $version = '1';

protected static array $scopes = [
Scope::MODERATION_READ,
];
Expand Down Expand Up @@ -43,7 +45,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPointsCustomRewardAddEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHANNEL_POINTS_CUSTOM_REWARDS_ADD;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_REDEMPTIONS, Scope::CHANNEL_MANAGE_REDEMPTIONS,
];
Expand Down Expand Up @@ -107,7 +109,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ChannelPointsCustomRewardRedemptionAddEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_REDEMPTIONS, Scope::CHANNEL_MANAGE_REDEMPTIONS,
];
Expand Down Expand Up @@ -74,7 +76,7 @@ public static function subscribe(string $broadcasterId, string $rewardId = null,
$condition['reward_id'] = $rewardId;
}

return parent::subscribeTo('1',
return parent::subscribeTo(self::getVersion(),
$condition, false, $callbackUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class ChannelPointsCustomRewardRedemptionUpdateEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_UPDATE;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_REDEMPTIONS, Scope::CHANNEL_MANAGE_REDEMPTIONS,
];
Expand Down Expand Up @@ -74,7 +76,7 @@ public static function subscribe(string $broadcasterId, string $rewardId = null,
$condition['reward_id'] = $rewardId;
}

return parent::subscribeTo('1',
return parent::subscribeTo(self::getVersion(),
$condition, false, $callbackUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPointsCustomRewardRemoveEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHANNEL_POINTS_CUSTOM_REWARDS_REMOVE;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_REDEMPTIONS, Scope::CHANNEL_MANAGE_REDEMPTIONS,
];
Expand Down Expand Up @@ -115,7 +117,7 @@ public static function subscribe(string $broadcasterId, string $rewardId = null,
$condition['reward_id'] = $rewardId;
}

return parent::subscribeTo('1',
return parent::subscribeTo(self::getVersion(),
$condition, false, $callbackUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPointsCustomRewardUpdateEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_CHANNEL_POINTS_CUSTOM_REWARDS_UPDATE;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_REDEMPTIONS, Scope::CHANNEL_MANAGE_REDEMPTIONS,
];
Expand Down Expand Up @@ -115,7 +117,7 @@ public static function subscribe(string $broadcasterId, string $rewardId = null,
$condition['reward_id'] = $rewardId;
}

return parent::subscribeTo('1',
return parent::subscribeTo(self::getVersion(),
$condition, false, $callbackUrl);
}
}
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelRaidEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ChannelRaidEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_RAID;

protected static string $version = '1';

public string $fromBroadcasterId;

public string $fromBroadcasterLogin;
Expand Down Expand Up @@ -41,7 +43,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, bool $to = false, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
sprintf('%s_broadcaster_user_id', $to ? 'to' : 'from') => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelUnbanEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class ChannelUnbanEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_UNBAN;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_MODERATE,
];
Expand Down Expand Up @@ -52,7 +54,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/ChannelUpdateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ChannelUpdateEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_UPDATE;

protected static string $version = '1';

public string $userId;

public string $login;
Expand Down Expand Up @@ -44,7 +46,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Goal/ChannelGoalBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class ChannelGoalBeginEvent extends BaseEvent
{
protected static string $type = 'channel.goal.begin'; // TODO change to EventSubType::CHANNEL_GOAL_BEGIN

protected static string $version = '1';

protected static array $scopes = [
'channel:read:goals', // TODO change to Scope::CHANNEL_READ_GOALS
];
Expand Down Expand Up @@ -71,7 +73,7 @@ public function isNewSubscription(): bool

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Goal/ChannelGoalEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ChannelGoalEndEvent extends BaseEvent
{
protected static string $type = 'channel.goal.end'; // TODO change to EventSubType::CHANNEL_GOAL_END

protected static string $version = '1';

protected static array $scopes = [
'channel:read:goals', // TODO change to Scope::CHANNEL_READ_GOALS
];
Expand Down Expand Up @@ -72,7 +74,7 @@ public function isNewSubscription(): bool

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Goal/ChannelGoalProgressEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class ChannelGoalProgressEvent extends BaseEvent
{
protected static string $type = 'channel.goal.progress'; // TODO change to EventSubType::CHANNEL_GOAL_PROGRESS

protected static string $version = '1';

protected static array $scopes = [
'channel:read:goals', // TODO change to Scope::CHANNEL_READ_GOALS
];
Expand Down Expand Up @@ -69,7 +71,7 @@ public function isNewSubscription(): bool

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/HypeTrain/ChannelHypeTrainBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ChannelHypeTrainBeginEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_HYPE_TRAIN_BEGIN;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_HYPE_TRAIN,
];
Expand Down Expand Up @@ -83,7 +85,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/HypeTrain/ChannelHypeTrainEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ChannelHypeTrainEndEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_HYPE_TRAIN_END;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_HYPE_TRAIN,
];
Expand Down Expand Up @@ -69,7 +71,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ChannelHypeTrainProgressEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_HYPE_TRAIN_PROGRESS;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_HYPE_TRAIN,
];
Expand Down Expand Up @@ -83,7 +85,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Poll/ChannelPollBeginEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPollBeginEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_POLL_BEGIN;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_POLLS, Scope::CHANNEL_MANAGE_POLLS,
];
Expand Down Expand Up @@ -77,7 +79,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Poll/ChannelPollEndEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPollEndEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_POLL_END;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_POLLS, Scope::CHANNEL_MANAGE_POLLS,
];
Expand Down Expand Up @@ -83,7 +85,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
4 changes: 3 additions & 1 deletion src/Events/Channel/Poll/ChannelPollProgressEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ChannelPollProgressEvent extends BaseEvent
{
protected static string $type = EventSubType::CHANNEL_POLL_PROGRESS;

protected static string $version = '1';

protected static array $scopes = [
Scope::CHANNEL_READ_POLLS, Scope::CHANNEL_MANAGE_POLLS,
];
Expand Down Expand Up @@ -80,7 +82,7 @@ public function parseEvent($event): void

public static function subscribe(string $broadcasterId, string $callbackUrl = null): ?string
{
return parent::subscribeTo('1', [
return parent::subscribeTo(self::getVersion(), [
'broadcaster_user_id' => $broadcasterId,
], false, $callbackUrl);
}
Expand Down
Loading

0 comments on commit 5e99387

Please sign in to comment.