function createRecordDemo in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 vendor/smartling/api-sdk-php/examples/progress-tracker-example.php \createRecordDemo()
Parameters
\Smartling\AuthApi\AuthApiInterface $authProvider:
string $projectId:
$spaceId:
$objectId:
Return value
bool
1 call to createRecordDemo()
- progress-tracker-example.php in vendor/
smartling/ api-sdk-php/ examples/ progress-tracker-example.php
File
- vendor/
smartling/ api-sdk-php/ examples/ progress-tracker-example.php, line 86
Code
function createRecordDemo($authProvider, $projectId, $spaceId, $objectId) {
$response = false;
$progressTracker = \Smartling\ProgressTracker\ProgressTrackerApi::create($authProvider, $projectId);
$st = microtime(true);
$params = new \Smartling\ProgressTracker\Params\RecordParameters();
$params
->setTtl(15);
$params
->setData([
"foo" => "bar",
]);
try {
$response = $progressTracker
->createRecord($spaceId, $objectId, $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;
}