Skip to content

Commit

Permalink
Merge pull request #46 from crowdin/fix_tm_download
Browse files Browse the repository at this point in the history
Fix TM export
  • Loading branch information
andrii-bodnar authored May 21, 2020
2 parents 0e48d42 + a2f09bc commit da68a3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "crowdin/crowdin-api-client",
"description": "PHP client library for Crowdin API v2",
"version": "1.3.4",
"version": "1.3.5",
"keywords": [
"crowdin",
"sdk",
Expand Down
8 changes: 4 additions & 4 deletions src/CrowdinApiClient/Api/TranslationMemoryApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ public function delete(int $translationMemoryId)
* @link https://support.crowdin.com/enterprise/api/#operation/api.tms.exports.getMany API Documentation Enterprise
*
* @param int $translationMemoryId
* @param array $params
* @param string $exportId
* @return DownloadFile|null
*/
public function download(int $translationMemoryId, $params = []): ?DownloadFile
public function download(int $translationMemoryId, string $exportId): ?DownloadFile
{
$path = sprintf('tms/%d/exports', $translationMemoryId);
return $this->_get($path, DownloadFile::class, $params);
$path = sprintf('tms/%d/exports/%s/download', $translationMemoryId, $exportId);
return $this->_get($path, DownloadFile::class);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/CrowdinApiClient/Api/TranslationMemoryApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ public function testDelete()

public function testDownload()
{
$this->mockRequestGet('/tms/4/exports', '{
$this->mockRequestGet('/tms/4/exports/1/download', '{
"data": {
"url": "https://production-enterprise-importer.downloads.crowdin.com/992000002/2/14.xliff?response-content-disposition=attachment%3B%20filename%3D%22APP.xliff%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIGJKLQV66ZXPMMEA%2F20190920%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190920T093121Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=439ebd69a1b7e4c23e6d17891a491c94f832e0c82e4692dedb35a6cd1e624b62",
"expireIn": "2019-09-20T10:31:21+00:00"
}
}');

$downloadFile = $this->crowdin->translationMemory->download(4);
$downloadFile = $this->crowdin->translationMemory->download(4, 1);
$this->assertInstanceOf(DownloadFile::class, $downloadFile);
$this->assertEquals('https://production-enterprise-importer.downloads.crowdin.com/992000002/2/14.xliff?response-content-disposition=attachment%3B%20filename%3D%22APP.xliff%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIGJKLQV66ZXPMMEA%2F20190920%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190920T093121Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3600&X-Amz-Signature=439ebd69a1b7e4c23e6d17891a491c94f832e0c82e4692dedb35a6cd1e624b62', $downloadFile->getUrl());
}
Expand Down

0 comments on commit da68a3c

Please sign in to comment.