37 lines
858 B
PHP
37 lines
858 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Library\VK\Resources;
|
|
|
|
use App\Library\VK\VkApiClient;
|
|
|
|
class WallResource
|
|
{
|
|
public function __construct(private VkApiClient $api) {}
|
|
|
|
public function get(string $domain, int $count = 50, int $offset = 0): array
|
|
{
|
|
$result = $this->api->call('wall.get', [
|
|
'domain' => $domain,
|
|
'offset' => $offset,
|
|
'count' => $count,
|
|
'copy_history_depth' => 10
|
|
]);
|
|
|
|
return $result['response'] ?? [ 'count' => 0, 'items' => [] ];
|
|
}
|
|
|
|
// id = '-93243530_2113'
|
|
public function getById(string $id): array
|
|
{
|
|
$result = $this->api->call('wall.getById',
|
|
[
|
|
'posts' => [ $id ],
|
|
'copy_history_depth' => 10
|
|
]);
|
|
|
|
return $result['response'] ?? [ 'items' => [] ];
|
|
}
|
|
}
|