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

Allow to use custom API URL #5

Closed dimitrystd closed 10 years ago

dimitrystd commented 10 years ago

Current sdk doesn't allow to specify custom API URL for tests purposes. Also we should keep interface of php sdk consistent with other sdk. DoD:

public function __construct($baseUrl, $apiKey, $projectId) {}
curl -k -F "file=@test.xml;type=text/plain" "https://api.smartling.com/v1/file/upload?apiKey=********&projectId=5bf7d71e4&fileUri=test.xml&fileType=XML&localesToApprove[0]=ru-RU&localesToApprove[1]=da-DK"
public function uploadFile($path, $fileType, $fileUri, $params = array());
public function uploadContent($content, $fileType, $fileUri, $params = array());

But will be much easy to use some parameters builder, like

$paramBuilder = new FileUploadParameterBuilder();
paramBuilder.fileType($fileType)
  .fileUri($fileUri)
  .callbackUrl($callback)
  .localesToApprove(array('ru', 'es-ES'));
  .overwriteApprovedLocales(false);

uploadFile($path, $paramBuilder);

You can find example of implementation there

cr0ss commented 10 years ago

I believe this functionality is implemented and works well.