Commit d18f4770 authored by Loparev's avatar Loparev
Browse files

Switched from get to post v3 search TR

parent 8415dac1
......@@ -3,6 +3,8 @@
namespace Drupal\tmgmt_smartling\Smartling\Submission;
use Smartling\TranslationRequests\TranslationRequestsApi;
use Smartling\AuthApi\AuthApiInterface;
use Smartling\TranslationRequests\Params\SearchTranslationRequestParams;
/**
* Class TranslationRequestsApiV3
......@@ -11,4 +13,21 @@ use Smartling\TranslationRequests\TranslationRequestsApi;
class TranslationRequestsApiV3 extends TranslationRequestsApi
{
const ENDPOINT_URL = 'https://api.smartling.com/submission-service-api/v3/projects';
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;
}
public function searchTranslationRequests($bucketName, SearchTranslationRequestParams $searchParams)
{
$requestData = $this->getDefaultRequestData('json', $searchParams->exportToArray());
$requestUri = vsprintf('buckets/%s/search/translation-requests', [$bucketName]);
return $this->sendRequest($requestUri, $requestData, static::HTTP_METHOD_POST);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment