Smartling / api-sdk-php

SDK for integrating with the Smartling API. The Smartling API allows developers to upload language specific resource files and download the translations of those files for easy integration within their application. http://docs.smartling.com
Apache License 2.0
6 stars 15 forks source link

Added localeWorkflows param to BatchApi::execute #127

Closed baikho closed 3 years ago

baikho commented 3 years ago

Added localeWorkflows parameter to startJobBatchV1 call as per: Smartling API Specification - Execute batch

PavelLoparev commented 3 years ago

Hi @baikho, thanks for the patch.

In general, looks good but since $localeWorkflows is an array of { targetLocaleId: "...", workflowUid: "..." } defined structure I would like to introduce ExecuteBatchParameters class with addLocaleWorkflowPair(targetLocaleId, workflowUid) method (or something like this) and pass instance of parameters class to executeBatch method (just to avoid invalid request payload). I expect client code to be like:

$executeBatchParameters = new ExecuteBatchParameters();
$executeBatchParameters
    ->addLocaleWorkflowPair("fr-FR", "test_wf_uid_1")
    ->addLocaleWorkflowPair("de-DE", "test_wf_uid_2");

$response = $batchApi->executeBatch($batchUid, $executeBatchParameters);

Also, we would need to add a unit test once the signature of executeBatch is changed.

baikho commented 3 years ago

Thanks @PavelLoparev, see updates as per your feedback.

PavelLoparev commented 3 years ago

Thanks @baikho. Merged and released