You are here

class TranslationRequestsApi in TMGMT Translator Smartling 8.4

Same name and namespace in other branches
  1. 8.3 vendor/smartling/api-sdk-php/src/TranslationRequests/TranslationRequestsApi.php \Smartling\TranslationRequests\TranslationRequestsApi

Class TranslationRequestsApi @package Smartling\TranslationRequests

Hierarchy

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\TranslationRequests
View 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);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseApiAbstract::$auth private property
BaseApiAbstract::$baseUrl private property Smartling API base url.
BaseApiAbstract::$currentClientId private static property
BaseApiAbstract::$currentClientUserAgentExtension private static property
BaseApiAbstract::$currentClientVersion private static property
BaseApiAbstract::$httpClient private property Http Client abstraction.
BaseApiAbstract::$logger private property Logger.
BaseApiAbstract::$projectId private property Project Id in Smartling dashboard
BaseApiAbstract::checkAuthenticationError private function
BaseApiAbstract::CLIENT_LIB_ID_SDK constant
BaseApiAbstract::CLIENT_LIB_ID_VERSION constant
BaseApiAbstract::CLIENT_USER_AGENT_EXTENSION constant
BaseApiAbstract::getAuth protected function
BaseApiAbstract::getBaseUrl protected function
BaseApiAbstract::getCurrentClientId public static function
BaseApiAbstract::getCurrentClientUserAgentExtension public static function
BaseApiAbstract::getCurrentClientVersion public static function
BaseApiAbstract::getDefaultRequestData protected function 1
BaseApiAbstract::getHttpClient protected function
BaseApiAbstract::getLogger protected function
BaseApiAbstract::getProjectId protected function
BaseApiAbstract::HTTP_METHOD_DELETE constant
BaseApiAbstract::HTTP_METHOD_GET constant
BaseApiAbstract::HTTP_METHOD_POST constant
BaseApiAbstract::HTTP_METHOD_PUT constant
BaseApiAbstract::initializeHttpClient protected static function
BaseApiAbstract::normalizeUri private function
BaseApiAbstract::PATTERN_DATE_TIME_ISO_8601 constant PHP equivalent to 'YYYY-MM-DDThh:mm:ssZ'
BaseApiAbstract::processBodyOptions protected function 3
BaseApiAbstract::processError private function
BaseApiAbstract::processErrors private function
BaseApiAbstract::readFile protected function OOP wrapper for fopen() function.
BaseApiAbstract::sendRequest protected function
BaseApiAbstract::setAuth protected function
BaseApiAbstract::setBaseUrl protected function
BaseApiAbstract::setCurrentClientId public static function
BaseApiAbstract::setCurrentClientUserAgentExtension public static function
BaseApiAbstract::setCurrentClientVersion public static function
BaseApiAbstract::setHttpClient protected function
BaseApiAbstract::setLogger protected function
BaseApiAbstract::setProjectId protected function
BaseApiAbstract::__construct public function BaseApiAbstract constructor. 3
TranslationRequestsApi::create public static function 1
TranslationRequestsApi::createTranslationRequest public function
TranslationRequestsApi::ENDPOINT_URL constant 1
TranslationRequestsApi::getTranslationRequest public function
TranslationRequestsApi::searchTranslationRequests public function 1
TranslationRequestsApi::updateTranslationRequest public function