require('vendor/autoload.php');
use Emis\Http\Client;
use Emis\Document\Api\Proxy\Search;
use Emis\Document\Api\Proxy\Usage;
$client = new Client();
$client->setApi(Client::DOCUMENTS_API);
$client->setToken("YOUR_TOKEN");
$search = new Search($client);
$result = $search->query('HU');
$documents = $result->getDocuments();
$usage = new Usage($client);
$usage->report($documents[0]->getId(), new \DateTime());
require('vendor/autoload.php');
use Emis\Http\Client;
use Emis\Document\Api\Proxy\Search;
use Emis\Document\Api\Proxy\Usage;
use Emis\Entity\Api\UsageReport\Document as ReportDocument;
use Emis\Entity\Api\UsageReport\Request as UsageRequest;
$client = new Client();
$client->setApi(Client::DOCUMENTS_API);
$client->setToken("YOUR_TOKEN");
$search = new Search($client);
$result = $search->query('HU');
$usage = new Usage($client);
$request = new UsageRequest();
foreach ($result->getDocuments() as $document) {
$reportDocument = new ReportDocument();
$reportDocument->setDocumentId($document->getId());
$reportDocument->setAccessTime(new \DateTime());
$request->addDocument($reportDocument);
}
$usage->reportMultiple($request);