You are here

public function SmartlingApiWrapper::searchTranslationRequest in TMGMT Translator Smartling 8.4

Returns translation request by search params.

Parameters

$bucketName:

\Smartling\TranslationRequests\Params\SearchTranslationRequestParams $params:

Return value

mixed

File

src/Smartling/SmartlingApiWrapper.php, line 405
SmartlingApiWrapper.php.

Class

SmartlingApiWrapper
Class SmartlingApiWrapper @package Drupal\tmgmt_smartling\Smartling

Namespace

Drupal\tmgmt_smartling\Smartling

Code

public function searchTranslationRequest($bucketName, SearchTranslationRequestParams $params) {
  $result = [];
  try {
    $response = $this
      ->getApi('translation_request')
      ->searchTranslationRequests($bucketName, $params);
    $result = $response['items'];
  } catch (SmartlingApiException $e) {
    $this->logger
      ->error('Smartling failed to search translation request:<br/>
      Bucket name: @bucket
      Params: @params
      Error: @error', [
      '@bucket' => $bucketName,
      '@params' => json_encode($params
        ->exportToArray()),
      '@error' => $e
        ->getMessage(),
    ]);
  }
  return $result;
}