Skip to content

Commit 8c7c6df

Browse files
author
cp6
committed
More features and options
Added pagination option for topClips. Added getAllStreamTags.
1 parent 180ddd9 commit 8c7c6df

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

twitch-class.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,15 +336,47 @@ public function getStreamTags($stream_id)
336336
return $this->apiCall('/helix/streams/tags?broadcaster_id=' . rawurlencode($stream_id));
337337
}
338338

339+
/**
340+
* Returns all tags for stream
341+
* @param string $tag_id
342+
* @return string
343+
*/
344+
public function getAllStreamTags($tag_id)
345+
{
346+
return $this->apiCall('/helix/tags/streams?tag_id=' . rawurlencode($tag_id));
347+
}
348+
339349
/**
340350
* Returns clips for game id
341351
* @param int $game_id
352+
* @param string $pagination
353+
* @param int $amount
354+
* @return string
355+
*/
356+
public function getGameClips($game_id, $pagination = null, $amount = 25)
357+
{
358+
if ($pagination == '') {
359+
return $this->apiCall('/helix/clips?game_id=' . rawurlencode($game_id) . '&first=' . rawurlencode($amount));
360+
} else {
361+
return $this->apiCall('/helix/clips?game_id=' . rawurlencode($game_id) . '&first=' . rawurlencode($amount) . '&after=' . rawurlencode($pagination) . '');
362+
}
363+
}
364+
365+
/**
366+
* Returns clips for user and game id
367+
* @param int $user_id
368+
* @param int $game_id
369+
* @param string $pagination
342370
* @param int $amount
343371
* @return string
344372
*/
345-
public function getGameClips($game_id, $amount = 25)
373+
public function getUserGameClips($user_id, $game_id, $pagination = null, $amount = 25)
346374
{
347-
return $this->apiCall('/helix/clips?game_id=' . rawurlencode($game_id) . '&first=' . rawurlencode($amount));
375+
if ($pagination == '') {
376+
return $this->apiCall('/helix/clips?broadcaster_id=' . rawurlencode($user_id) . '&game_id=' . rawurlencode($game_id) . '&first=' . rawurlencode($amount));
377+
} else {
378+
return $this->apiCall('/helix/clips?broadcaster_id=' . rawurlencode($user_id) . '&game_id=' . rawurlencode($game_id) . '&first=' . rawurlencode($amount) . '&after=' . rawurlencode($pagination) . '');
379+
}
348380
}
349381

350382

0 commit comments

Comments
 (0)