You are here

function createAccountLevelLogRecordDemo in TMGMT Translator Smartling 8.4

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

Parameters

\Smartling\AuthApi\AuthApiInterface $authProvider:

string $projectId:

string $accountUid:

Return value

bool

1 call to createAccountLevelLogRecordDemo()
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 174

Code

function createAccountLevelLogRecordDemo($authProvider, $projectId, $accountUid) {
  $response = false;
  $auditLog = \Smartling\AuditLog\AuditLogApi::create($authProvider, $projectId);
  $st = microtime(true);
  try {
    $createParams = (new \Smartling\AuditLog\Params\CreateRecordParameters())
      ->setActionTime(time())
      ->setActionType(\Smartling\AuditLog\Params\CreateRecordParameters::ACTION_TYPE_UPLOAD)
      ->setFileUri("file_uri")
      ->setFileUid("file_uid")
      ->setSourceLocaleId('en')
      ->setTargetLocaleIds([
      'de',
    ])
      ->setTranslationJobUid("smartling_job_uid")
      ->setTranslationJobName("smartling_job_name")
      ->setTranslationJobDueDate("smartling_job_due_date")
      ->setTranslationJobAuthorize(true)
      ->setBatchUid("batch_uid")
      ->setDescription("description")
      ->setClientUserId("user_id")
      ->setClientUserEmail("user_email")
      ->setClientUserName("user_name")
      ->setEnvId("env_id")
      ->setClientData("foo", "bar");
    $response = $auditLog
      ->createAccountLevelLogRecord($accountUid, $createParams);
  } 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;
}