function createProjectLevelLogRecordDemo in TMGMT Translator Smartling 8.3
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/examples/audit-log-example.php \createProjectLevelLogRecordDemo()
Parameters
\Smartling\AuthApi\AuthApiInterface $authProvider:
string $projectId:
Return value
bool
1 call to createProjectLevelLogRecordDemo()
- 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 125
Code
function createProjectLevelLogRecordDemo($authProvider, $projectId) {
$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
->createProjectLevelLogRecord($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;
}