mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
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:
parent
1aed452a12
commit
ed7faa4a16
1 changed files with 9 additions and 4 deletions
|
@ -133,15 +133,18 @@ final class Friends extends VKAPIRequestHandler
|
||||||
return $response;
|
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();
|
$this->requireUser();
|
||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$offset++;
|
$offset++;
|
||||||
$followers = [];
|
$followers = [];
|
||||||
|
|
||||||
foreach($this->getUser()->getFollowers() as $follower) {
|
foreach($this->getUser()->getFollowers($offset, $count) as $follower) {
|
||||||
$followers[$i] = $follower->getId();
|
$followers[$i] = $follower->getId();
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
@ -149,8 +152,10 @@ final class Friends extends VKAPIRequestHandler
|
||||||
$response = $followers;
|
$response = $followers;
|
||||||
$usersApi = new Users($this->getUser());
|
$usersApi = new Users($this->getUser());
|
||||||
|
|
||||||
if(!is_null($fields))
|
if($extended == 1)
|
||||||
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count); # FIXME
|
$response = $usersApi->get(implode(',', $followers), $fields, 0, $count);
|
||||||
|
else
|
||||||
|
$response = $usersApi->get(implode(',', $followers), "", 0, $count);
|
||||||
|
|
||||||
foreach($response as $user)
|
foreach($response as $user)
|
||||||
$user->user_id = $user->id;
|
$user->user_id = $user->id;
|
||||||
|
|
Loading…
Reference in a new issue