class TranslationRequestsApi in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 vendor/smartling/api-sdk-php/src/TranslationRequests/TranslationRequestsApi.php \Smartling\TranslationRequests\TranslationRequestsApi
Class TranslationRequestsApi @package Smartling\TranslationRequests
Hierarchy
- class \Smartling\BaseApiAbstract
- class \Smartling\TranslationRequests\TranslationRequestsApi
Expanded class hierarchy of TranslationRequestsApi
4 files declare their use of TranslationRequestsApi
- SmartlingApiFactory.php in src/
Smartling/ SmartlingApiFactory.php - SmartlingApiFactory.php.
- TranslationRequestsApiFunctionalTest.php in vendor/
smartling/ api-sdk-php/ tests/ functional/ TranslationRequestsApiFunctionalTest.php - TranslationRequestsApiTest.php in vendor/
smartling/ api-sdk-php/ tests/ unit/ TranslationRequestsApiTest.php - TranslationRequestsApiV3.php in src/
Smartling/ Submission/ TranslationRequestsApiV3.php
File
- vendor/
smartling/ api-sdk-php/ src/ TranslationRequests/ TranslationRequestsApi.php, line 17
Namespace
Smartling\TranslationRequestsView source
class TranslationRequestsApi extends BaseApiAbstract {
const ENDPOINT_URL = 'https://api.smartling.com/submission-service-api/v2/projects';
/**
* @param AuthApiInterface $authProvider
* @param string $projectId
* @param LoggerInterface $logger
*
* @return TranslationRequestsApi
*/
public static function create(AuthApiInterface $authProvider, $projectId, $logger = null) {
$client = static::initializeHttpClient(static::ENDPOINT_URL);
$instance = new self($projectId, $client, $logger, static::ENDPOINT_URL);
$instance
->setAuth($authProvider);
return $instance;
}
/**
* @param string $bucketName
* @param CreateTranslationRequestParams $params
* @return mixed
* @throws SmartlingApiException
*/
public function createTranslationRequest($bucketName, CreateTranslationRequestParams $params) {
$requestData = $this
->getDefaultRequestData('json', $params
->exportToArray());
$requestUri = vsprintf('buckets/%s/translation-requests', [
$bucketName,
]);
return $this
->sendRequest($requestUri, $requestData, static::HTTP_METHOD_POST);
}
/**
* @param string $bucketName
* @param string $translationRequestUid
* @return array
* @throws SmartlingApiException
*/
public function getTranslationRequest($bucketName, $translationRequestUid) {
$requestData = $this
->getDefaultRequestData('query', []);
$requestUri = vsprintf('buckets/%s/translation-requests/%s', [
$bucketName,
$translationRequestUid,
]);
return $this
->sendRequest($requestUri, $requestData, static::HTTP_METHOD_GET);
}
/**
* @param string $bucketName
* @param string $translationRequestUid
* @param UpdateTranslationRequestParams $params
* @return mixed
* @throws SmartlingApiException
*/
public function updateTranslationRequest($bucketName, $translationRequestUid, UpdateTranslationRequestParams $params) {
$requestData = $this
->getDefaultRequestData('json', $params
->exportToArray());
$requestUri = vsprintf('buckets/%s/translation-requests/%s', [
$bucketName,
$translationRequestUid,
]);
return $this
->sendRequest($requestUri, $requestData, static::HTTP_METHOD_PUT);
}
/**
* @param string $bucketName
* @param SearchTranslationRequestParams $searchParams
* @return array
* @throws SmartlingApiException
*/
public function searchTranslationRequests($bucketName, SearchTranslationRequestParams $searchParams) {
$requestData = $this
->getDefaultRequestData('query', $searchParams
->exportToArray());
$requestUri = vsprintf('buckets/%s/translation-requests', [
$bucketName,
]);
return $this
->sendRequest($requestUri, $requestData, static::HTTP_METHOD_GET);
}
}