<commit_before><?php

namespace Smartling\TranslationRequests;

use Psr\Log\LoggerInterface;
use Smartling\AuthApi\AuthApiInterface;
use Smartling\BaseApiAbstract;
use Smartling\Exceptions\SmartlingApiException;
use Smartling\TranslationRequests\Params\CreateSubmissionParams;
use Smartling\TranslationRequests\Params\SearchSubmissionsParams;
use Smartling\TranslationRequests\Params\UpdateSubmissionParams;

/**
 * Class SubmissionsApi
 * @package Smartling\TranslationRequests
 */
class SubmissionsApi extends BaseApiAbstract
{
    const ENDPOINT_URL = 'https://api.smartling.com/submission-service-api/v2/projects';

    /**
     * @param AuthApiInterface $authProvider
     * @param string $projectId
     * @param LoggerInterface $logger
     *
     * @return SubmissionsApi
     */
    public static function create(AuthApiInterface $authProvider, $projectId, $logger = null)
    {
        $client = self::initializeHttpClient(self::ENDPOINT_URL);

        $instance = new self($projectId, $client, $logger, self::ENDPOINT_URL);
        $instance->setAuth($authProvider);

        return $instance;
    }

    /**
     * @param string $bucketName
     * @param CreateSubmissionParams $params
     * @return mixed
     * @throws SmartlingApiException
     */
    public function createSubmission($bucketName, CreateSubmissionParams $params)
    {
        $requestData = $this->getDefaultRequestData('json', $params->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions', [$bucketName]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_POST);
    }


    /**
     * @param string $bucketName
     * @param string $submissionUid
     * @return array
     * @throws SmartlingApiException
     */
    public function getSubmission($bucketName, $submissionUid)
    {
        $requestData = $this->getDefaultRequestData('query', []);
        $requestUri = vsprintf('buckets/%s/submissions/%s', [$bucketName, $submissionUid]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_GET);
    }

    /**
     * @param string $bucketName
     * @param string $submissionUid
     * @param UpdateSubmissionParams $params
     * @return mixed
     * @throws SmartlingApiException
     */
    public function updateSubmission($bucketName, $submissionUid, UpdateSubmissionParams $params)
    {
        $requestData = $this->getDefaultRequestData('json', $params->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions/%s', [$bucketName, $submissionUid]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_PUT);
    }

    /**
     * @param string $bucketName
     * @param SearchSubmissionsParams $searchParams
     * @return array
     * @throws SmartlingApiException
     */
    public function searchSubmissions($bucketName, SearchSubmissionsParams $searchParams)
    {
        $requestData = $this->getDefaultRequestData('query', $searchParams->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions', [$bucketName]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_GET);
    }
}
<commit_msg>Renamed api class<commit_after><?php

namespace Smartling\TranslationRequests;

use Psr\Log\LoggerInterface;
use Smartling\AuthApi\AuthApiInterface;
use Smartling\BaseApiAbstract;
use Smartling\Exceptions\SmartlingApiException;
use Smartling\TranslationRequests\Params\CreateSubmissionParams;
use Smartling\TranslationRequests\Params\SearchSubmissionsParams;
use Smartling\TranslationRequests\Params\UpdateSubmissionParams;

/**
 * Class TranslationRequestsApi
 * @package Smartling\TranslationRequests
 */
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 = self::initializeHttpClient(self::ENDPOINT_URL);

        $instance = new self($projectId, $client, $logger, self::ENDPOINT_URL);
        $instance->setAuth($authProvider);

        return $instance;
    }

    /**
     * @param string $bucketName
     * @param CreateSubmissionParams $params
     * @return mixed
     * @throws SmartlingApiException
     */
    public function createSubmission($bucketName, CreateSubmissionParams $params)
    {
        $requestData = $this->getDefaultRequestData('json', $params->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions', [$bucketName]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_POST);
    }


    /**
     * @param string $bucketName
     * @param string $submissionUid
     * @return array
     * @throws SmartlingApiException
     */
    public function getSubmission($bucketName, $submissionUid)
    {
        $requestData = $this->getDefaultRequestData('query', []);
        $requestUri = vsprintf('buckets/%s/submissions/%s', [$bucketName, $submissionUid]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_GET);
    }

    /**
     * @param string $bucketName
     * @param string $submissionUid
     * @param UpdateSubmissionParams $params
     * @return mixed
     * @throws SmartlingApiException
     */
    public function updateSubmission($bucketName, $submissionUid, UpdateSubmissionParams $params)
    {
        $requestData = $this->getDefaultRequestData('json', $params->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions/%s', [$bucketName, $submissionUid]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_PUT);
    }

    /**
     * @param string $bucketName
     * @param SearchSubmissionsParams $searchParams
     * @return array
     * @throws SmartlingApiException
     */
    public function searchSubmissions($bucketName, SearchSubmissionsParams $searchParams)
    {
        $requestData = $this->getDefaultRequestData('query', $searchParams->exportToArray());
        $requestUri = vsprintf('buckets/%s/submissions', [$bucketName]);
        return $this->sendRequest($requestUri, $requestData, self::HTTP_METHOD_GET);
    }
}

{'fraction_non_alphanumeric': 0.11948297604035309, 'fraction_numerical': 0.00031525851197982345, 'mean_word_length': 3.9071925754060324, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4933666', 'n_tokens_mistral': 1789, 'n_tokens_neox': 1762, 'n_words': 326}