Skip to content

Commit

Permalink
refactor!: add missing required params (#571)
Browse files Browse the repository at this point in the history
* Add missing required params

* Add project_id as required param for creating distribution

* Bump major phrase-go version

* Auto bump major go packages
  • Loading branch information
theSoenke committed Apr 23, 2024
1 parent bad41cc commit d810e9e
Show file tree
Hide file tree
Showing 44 changed files with 196 additions and 73 deletions.
9 changes: 4 additions & 5 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 @@ -114,6 +114,7 @@ public void localeDeleteTest() throws ApiException {
String id = null;
String xPhraseAppOTP = null;
String branch = null;

api.localeDelete(projectId, id, xPhraseAppOTP, branch);

// TODO: test validations
Expand Down
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, xPhraseAppOTP, branch, file, 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, null, null, $file);
$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/locales_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
# @option opts [Boolean] :skip_unverified_translations Indicates whether the locale file should skip all unverified translations. This parameter is deprecated and should be replaced with <code>include_unverified_translations</code>.
# @option opts [Boolean] :include_unverified_translations if set to false unverified translations are excluded
# @option opts [Boolean] :use_last_reviewed_version If set to true the last reviewed version of a translation is used. This is only available if the review workflow is enabled for the project.
# @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the public ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to <code>true</code>.
# @option opts [String] :fallback_locale_id If a key has no translation in the locale being downloaded the translation in the fallback locale will be used. Provide the ID of the locale that should be used as the fallback. Requires include_empty_translations to be set to <code>true</code>.
# @option opts [String] :source_locale_id Provides the source language of a corresponding job as the source language of the generated locale file. This parameter will be ignored unless used in combination with a <code>tag</code> parameter indicating a specific job.
# @return [File]
describe 'locale_download test' do
Expand Down
4 changes: 2 additions & 2 deletions clients/ruby/spec/api/uploads_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# @option opts [String] :branch specify the branch to use
# @option opts [File] :file File to be imported
# @option opts [String] :file_format File format. Auto-detected when possible and not specified.
# @option opts [String] :locale_id Locale of the file's content. Can be the name or public id of the locale. Preferred is the public id.
# @option opts [String] :locale_id Locale of the file's content. Can be the name or id of the locale. Preferred is id.
# @option opts [String] :tags List of tags separated by comma to be associated with the new keys contained in the upload.
# @option opts [Boolean] :update_translations Indicates whether existing translations should be updated with the file content.
# @option opts [Boolean] :update_descriptions Existing key descriptions will be updated with the file content. Empty descriptions overwrite existing descriptions.
Expand All @@ -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
Loading

0 comments on commit d810e9e

Please sign in to comment.