Skip to content

Commit

Permalink
Add EventSub->subscribeToChannelSubscriptionMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandin committed Jun 14, 2021
1 parent 95d5999 commit 0f95489
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/NewTwitchApi/Resources/EventSubApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ function it_should_subscribe_to_channel_subscription_gift(RequestGenerator $requ
$this->subscribeToChannelSubscriptionGift($this->bearer, $this->secret, $this->callback, '12345')->shouldBe($response);
}

function it_should_subscribe_to_channel_subscription_message(RequestGenerator $requestGenerator, Request $request, Response $response)
{
$this->createEventSubSubscription('channel.subscription.message', 'beta', ['broadcaster_user_id' => '12345'], $requestGenerator)->willReturn($request);
$this->subscribeToChannelSubscriptionMessage($this->bearer, $this->secret, $this->callback, '12345')->shouldBe($response);
}

function it_should_subscribe_to_channel_cheer(RequestGenerator $requestGenerator, Request $request, Response $response)
{
$this->createEventSubSubscription('channel.cheer', '1', ['broadcaster_user_id' => '12345'], $requestGenerator)->willReturn($request);
Expand Down
15 changes: 15 additions & 0 deletions src/NewTwitchApi/Resources/EventSubApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,21 @@ public function subscribeToChannelSubscriptionGift(string $bearer, string $secre
);
}

/**
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelsubscriptionmessage-beta
*/
public function subscribeToChannelSubscriptionMessage(string $bearer, string $secret, string $callback, string $twitchId): ResponseInterface
{
return $this->createEventSubSubscription(
$bearer,
$secret,
$callback,
'channel.subscription.message',
'beta',
['broadcaster_user_id' => $twitchId],
);
}

/**
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelcheer
*/
Expand Down

0 comments on commit 0f95489

Please sign in to comment.