VKAPI: Friends.getRequests added some parameters that i forgot about and fix count requests in the response (#724)

* VKAPI: Friends.getRequests method did not give more than 6 elements

* VKAPI: Friends.getRequests i'm forget add some parameters LOL
This commit is contained in:
Vladimir Lapskiy 2022-09-17 02:05:25 +05:00 committed by GitHub
parent 1aed452a12
commit ed7faa4a16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,15 +133,18 @@ final class Friends extends VKAPIRequestHandler
return $response;
}
function getRequests(string $fields = "", int $offset = 0, int $count = 100): object
function getRequests(string $fields = "", int $offset = 0, int $count = 100, int $extended = 0): object
{
if ($count >= 1000)
$this->fail(100, "One of the required parameters was not passed or is invalid.");
$this->requireUser();
$i = 0;
$offset++;
$followers = [];
foreach($this->getUser()->getFollowers() as $follower) {
foreach($this->getUser()->getFollowers($offset, $count) as $follower) {
$followers[$i] = $follower->getId();
$i++;
}
@ -149,8 +152,10 @@ final class Friends extends VKAPIRequestHandler
$response = $followers;
$usersApi = new Users($this->getUser());
if(!is_null($fields))
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME
if($extended == 1)
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count);
else
$response = $usersApi->get(implode(',', $followers), "", 0, $count);
foreach($response as $user)
$user->user_id = $user->id;