You are here

function searchProjectLevelLogRecordDemo in TMGMT Translator Smartling 8.3

Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/examples/audit-log-example.php \searchProjectLevelLogRecordDemo()

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

Return value

bool

1 call to searchProjectLevelLogRecordDemo()
audit-log-example.php in vendor/smartling/api-sdk-php/examples/audit-log-example.php

File

vendor/smartling/api-sdk-php/examples/audit-log-example.php, line 54

Code

function searchProjectLevelLogRecordDemo($authProvider, $projectId) {
  $response = false;
  $auditLog = \Smartling\AuditLog\AuditLogApi::create($authProvider, $projectId);
  $st = microtime(true);
  try {
    $searchParams = (new \Smartling\AuditLog\Params\SearchRecordParameters())
      ->setSearchQuery('clientData.foo:bar')
      ->setOffset(0)
      ->setLimit(100)
      ->setSort('actionTime', \Smartling\AuditLog\Params\SearchRecordParameters::ORDER_DESC);
    $response = $auditLog
      ->searchProjectLevelLogRecord($searchParams);
  } catch (\Smartling\Exceptions\SmartlingApiException $e) {
    var_dump($e
      ->getErrors());
  }
  $et = microtime(true);
  $time = $et - $st;
  echo vsprintf('Request took %s seconds.%s', [
    round($time, 3),
    "\n\r",
  ]);
  if (!empty($response)) {
    var_dump($response);
  }
  return $response;
}