Skip to content

Commit

Permalink
Make file_format and locale_id required params
Browse files Browse the repository at this point in the history
  • Loading branch information
theSoenke committed Apr 19, 2024
1 parent 23f639d commit cdb0251
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
8 changes: 4 additions & 4 deletions clients/go/test/api_uploads_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public void uploadCreateTest() throws ApiException, IOException, InterruptedExce
String branch = "branch_example";
File file = File.createTempFile("test", "test");
file.deleteOnExit();
String fileFormat = null;
String localeId = null;
String fileFormat = "simple_json";
String localeId = "en";
String tags = null;
Boolean updateTranslations = null;
Boolean updateDescriptions = null;
Expand All @@ -106,7 +106,7 @@ public void uploadCreateTest() throws ApiException, IOException, InterruptedExce
Boolean autotranslate = null;
Boolean markReviewed = null;
Boolean tagOnlyAffectedKeys = null;
Upload response = api.uploadCreate(projectId, file, xPhraseAppOTP, branch, fileFormat, localeId, tags, updateTranslations, updateDescriptions, convertEmoji, skipUploadTags, skipUnverification, fileEncoding, localeMapping, formatOptions, autotranslate, markReviewed, tagOnlyAffectedKeys);
Upload response = api.uploadCreate(projectId, file, fileFormat, localeId, xPhraseAppOTP, branch, tags, updateTranslations, updateDescriptions, convertEmoji, skipUploadTags, skipUnverification, fileEncoding, localeMapping, formatOptions, autotranslate, markReviewed, tagOnlyAffectedKeys);

Assert.assertEquals("valid id returned", "id_example", response.getId());
Assert.assertEquals("valid creation date returned", OffsetDateTime.parse("2015-01-28T09:52:53Z"), response.getCreatedAt());
Expand Down
2 changes: 1 addition & 1 deletion clients/php/test/Api/UploadsApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function testUploadCreate()
$file = new \SplFileObject($fileName, 'w+');
$file->fwrite('test');

$result = $this->apiInstance->uploadCreate($projectId, $file, null, null);
$result = $this->apiInstance->uploadCreate($projectId, $file, "yml", "en", null, null);
$file = null;
unlink($fileName);

Expand Down
3 changes: 2 additions & 1 deletion clients/python/test/test_uploads_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def test_upload_create(self, mock_post):
api_response = api_instance.upload_create(
project_id,
file="./test/fixtures/en.json",
file_format="simple_json"
file_format="simple_json",
locale_id="en"
)

self.assertEqual("https://api.phrase.com/v2/projects/project_id_example/uploads", mock_post.call_args_list[0].args[1])
Expand Down
2 changes: 1 addition & 1 deletion clients/ruby/spec/api/uploads_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
end

it 'should work' do
@api_instance.upload_create('project_id', file: File.new('Gemfile'))
@api_instance.upload_create('project_id', File.new('Gemfile'), "yml", "en")

expect(a_request(:post, 'https://api.phrase.com/v2/projects/project_id/uploads')
.with { |req|
Expand Down
4 changes: 3 additions & 1 deletion clients/typescript/__tests__/BasicApiTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ describe('UploadsApi', () => {
test('uploads a file', async () => {
const projectId = 'my-project-id';
const file = fs.createReadStream('package.json');
const fileFormat = 'json';
const localeId = 'en';

await api.uploadCreate({projectId, file}).then((response) => {
await api.uploadCreate({projectId, file, fileFormat, localeId}).then((response) => {
expect(response.id).toBe('upload_id');
});

Expand Down
2 changes: 2 additions & 0 deletions paths/uploads/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ requestBody:
title: upload/create/parameters
required:
- file
- file_format
- locale_id
properties:
file:
description: File to be imported
Expand Down

0 comments on commit cdb0251

Please sign in to comment.