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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue