You are here

function searchJobDemo in TMGMT Translator Smartling 8.3

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

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

string $fileUri:

Return value

bool

1 call to searchJobDemo()
jobs-example.php in vendor/smartling/api-sdk-php/examples/jobs-example.php

File

vendor/smartling/api-sdk-php/examples/jobs-example.php, line 223

Code

function searchJobDemo($authProvider, $projectId, $fileUri) {
  echo "--- Search jobs ---\n";
  $jobs = \Smartling\Jobs\JobsApi::create($authProvider, $projectId);
  $info = FALSE;
  $searchParameters = new \Smartling\Jobs\Params\SearchJobsParameters();
  $searchParameters
    ->setFileUris([
    $fileUri,
  ]);
  $st = microtime(true);
  try {
    $info = $jobs
      ->searchJobs($searchParameters);
  } 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($info)) {
    var_dump($info['items']);
  }
  return $info;
}