You are here

function listJobsDemo 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 \listJobsDemo()

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

Return value

bool

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

File

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

Code

function listJobsDemo($authProvider, $projectId) {
  echo "--- List jobs ---\n";
  $response = [];
  $jobs = \Smartling\Jobs\JobsApi::create($authProvider, $projectId);
  $st = microtime(true);
  try {
    $params = new \Smartling\Jobs\Params\ListJobsParameters();
    $params
      ->setStatuses([
      \Smartling\Jobs\JobStatus::AWAITING_AUTHORIZATION,
      \Smartling\Jobs\JobStatus::IN_PROGRESS,
    ]);
    $response = $jobs
      ->listJobs($params);
  } 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;
}