<?php
use GrapheneNodeClient\Commands\CommandQueryData;
use GrapheneNodeClient\Commands\DataBase\GetDiscussionsByCreatedCommand;
use GrapheneNodeClient\Connectors\WebSocket\GolosWSConnector;
use GrapheneNodeClient\Connectors\WebSocket\SteemitWSConnector;
//Set params for query
$commandQuery = new CommandQueryData();
$data = [
[
'limit' => $limit,
'select_tags' => ['golos'], // for GOLOS
'tag' => 'steemit', // for STEEMIT
]
];
$commandQuery->setParams($data);
//OR
$commandQuery = new CommandQueryData();
$commandQuery->setParamByKey('0:limit', $limit);
$commandQuery->setParamByKey('0:select_tags', [$tag]);
$commandQuery->setParamByKey('0:tag', $tag);
$command = new GetDiscussionsByCreatedCommand(new GolosWSConnector());
$golosPosts = $command->execute(
$commandQuery
);
// will return
// [
// "id" => 1,
// "result" => [
// [
// "id": 466628,
// "author": "piranya",
// "permlink": "devyatyi-krug",
// ...
// ],
// ...
// ]
// ]
$command = new GetDiscussionsByCreatedCommand(new SteemitWSConnector());
$steemitPosts = $command->execute(
$commandQuery,
'result',
SteemitWSConnector::ANSWER_FORMAT_ARRAY // or SteemitWSConnector::ANSWER_FORMAT_OBJECT
);
// will return
// [
// [
// "id": 466628,
// "author": "piranya",
// "permlink": "devyatyi-krug",
// ...
// ],
// ...
// ]