Skip to content

Commit

Permalink
Promote EventSubApi->subscribeToChannelFollow to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandin committed Jun 10, 2023
1 parent cfa9b33 commit 511caa0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions spec/TwitchApi/Resources/EventSubApiSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function it_should_subscribe_to_channel_update(RequestGenerator $requestGenerato

function it_should_subscribe_to_channel_follow(RequestGenerator $requestGenerator, Request $request, Response $response)
{
$this->createEventSubSubscription('channel.follow', '1', ['broadcaster_user_id' => '12345'], $requestGenerator)->willReturn($request);
$this->subscribeToChannelFollow($this->bearer, $this->secret, $this->callback, '12345')->shouldBe($response);
$this->createEventSubSubscription('channel.follow', '2', ['broadcaster_user_id' => '12345', 'moderator_user_id' => '543231'], $requestGenerator)->willReturn($request);
$this->subscribeToChannelFollow($this->bearer, $this->secret, $this->callback, '12345', '54321')->shouldBe($response);
}

function it_should_subscribe_to_channel_subscribe(RequestGenerator $requestGenerator, Request $request, Response $response)
Expand Down
11 changes: 7 additions & 4 deletions src/Resources/EventSubApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,20 @@ public function subscribeToChannelUpdate(string $bearer, string $secret, string
}

/**
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelfollow
* @link https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#channelfollow
*/
public function subscribeToChannelFollow(string $bearer, string $secret, string $callback, string $twitchId): ResponseInterface
public function subscribeToChannelFollow(string $bearer, string $secret, string $callback, string $twitchId, string $moderatorId): ResponseInterface
{
return $this->createEventSubSubscription(
$bearer,
$secret,
$callback,
'channel.follow',
'1',
['broadcaster_user_id' => $twitchId],
'2',
[
'broadcaster_user_id' => $twitchId,
'moderator_user_id' => $moderatorId,
],
);
}

Expand Down

0 comments on commit 511caa0

Please sign in to comment.