Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support of PageToken while requesting comments #188

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Youtube.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ public function getCategories($regionCode = 'US', $part = ['snippet'])
* @param string $order Specifies the order in which the API response should list comment threads. Valid values are: time, relevance.
* @param array $part Specifies a list of one or more commentThread resource properties that the API response will include.
* @param bool $pageInfo Add page info to returned array.
* @param string $pageToken The pageToken parameter identifies a specific page in the result set that should be returned.
* @return array
* @throws \Exception
*/
public function getCommentThreadsByVideoId($videoId = null, $maxResults = 20, $order = null, $part = ['id', 'replies', 'snippet'], $pageInfo = false) {
public function getCommentThreadsByVideoId($videoId = null, $maxResults = 20, $order = null, $part = ['id', 'replies', 'snippet'], $pageInfo = false, $pageToken = null) {

return $this->getCommentThreads(null, null, $videoId, $maxResults, $order, $part, $pageInfo);
return $this->getCommentThreads(null, null, $videoId, $maxResults, $order, $part, $pageInfo, $pageToken);
}

/**
Expand All @@ -148,10 +149,11 @@ public function getCommentThreadsByVideoId($videoId = null, $maxResults = 20, $o
* @param string $order Specifies the order in which the API response should list comment threads. Valid values are: time, relevance.
* @param array $part Specifies a list of one or more commentThread resource properties that the API response will include.
* @param bool $pageInfo Add page info to returned array.
* @param string $pageToken The pageToken parameter identifies a specific page in the result set that should be returned.
* @return array
* @throws \Exception
*/
public function getCommentThreads($channelId = null, $id = null, $videoId = null, $maxResults = 20, $order = null, $part = ['id', 'replies', 'snippet'], $pageInfo = false)
public function getCommentThreads($channelId = null, $id = null, $videoId = null, $maxResults = 20, $order = null, $part = ['id', 'replies', 'snippet'], $pageInfo = false, $pageToken = null)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just please update the tests accordingly

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@artin1982 I see this was fixed, can you also please update the tests accordingly in order to merge it for the next release ?

{
$API_URL = $this->getApi('commentThreads.list');

Expand All @@ -162,6 +164,7 @@ public function getCommentThreads($channelId = null, $id = null, $videoId = null
'maxResults' => $maxResults,
'part' => implode(',', $part),
'order' => $order,
'pageToken' => $pageToken,
]);

$apiData = $this->api_get($API_URL, $params);
Expand Down