Skip to content

Commit

Permalink
Merge pull request #130 from nicklaw5/v5-0-4
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandin authored Jun 15, 2021
2 parents 6a41391 + 0f95489 commit 0a49d6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
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
17 changes: 16 additions & 1 deletion src/NewTwitchApi/Resources/EventSubApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function subscribeToChannelSubscriptionEnd(string $bearer, string $secret
}

/**
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptiongift-beta
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelsubscriptiongift
*/
public function subscribeToChannelSubscriptionGift(string $bearer, string $secret, string $callback, string $twitchId): ResponseInterface
{
Expand All @@ -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 0a49d6e

Please sign in to comment.