diff --git a/src/Crowdin.Api/SourceStrings/StringUploadResponseModel.cs b/src/Crowdin.Api/SourceStrings/StringUploadResponseModel.cs index c8e9ca8e..0e6111f4 100644 --- a/src/Crowdin.Api/SourceStrings/StringUploadResponseModel.cs +++ b/src/Crowdin.Api/SourceStrings/StringUploadResponseModel.cs @@ -59,6 +59,9 @@ public class AttributesData [JsonProperty("cleanupMode")] public bool CleanupMode { get; set; } + + [JsonProperty("updateOption")] + public UpdateOption UpdateOption { get; set; } } } } \ No newline at end of file diff --git a/src/Crowdin.Api/SourceStrings/UpdateOption.cs b/src/Crowdin.Api/SourceStrings/UpdateOption.cs new file mode 100644 index 00000000..9ab6e666 --- /dev/null +++ b/src/Crowdin.Api/SourceStrings/UpdateOption.cs @@ -0,0 +1,19 @@ + +using System.ComponentModel; +using JetBrains.Annotations; + +namespace Crowdin.Api.SourceStrings +{ + [PublicAPI] + public enum UpdateOption + { + [Description("clear_translations_and_approvals")] + ClearTranslationsAndApprovals, + + [Description("keep_translations")] + KeepTranslations, + + [Description("keep_translations_and_approvals")] + KeepTranslationsAndApprovals + } +} \ No newline at end of file diff --git a/src/Crowdin.Api/SourceStrings/UploadStringsRequest.cs b/src/Crowdin.Api/SourceStrings/UploadStringsRequest.cs index 6a045215..811f7470 100644 --- a/src/Crowdin.Api/SourceStrings/UploadStringsRequest.cs +++ b/src/Crowdin.Api/SourceStrings/UploadStringsRequest.cs @@ -36,5 +36,8 @@ public class UploadStringsRequest [JsonProperty("importOptions")] public SpreadsheetFileImportOptions? ImportOptions { get; set; } + + [JsonProperty("updateOption")] + public UpdateOption? UpdateOption { get; set; } } } \ No newline at end of file diff --git a/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.Designer.cs b/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.Designer.cs index 0618a243..1381d6e3 100644 --- a/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.Designer.cs +++ b/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.Designer.cs @@ -11,46 +11,32 @@ namespace Crowdin.Api.Tests.Core.Resources { using System; - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class SourceStrings { - private static global::System.Resources.ResourceManager resourceMan; + private static System.Resources.ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal SourceStrings() { } - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Resources.ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Crowdin.Api.Tests.Core.Resources.SourceStrings", typeof(SourceStrings).Assembly); + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("Crowdin.Api.Tests.Core.Resources.SourceStrings", typeof(SourceStrings).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + internal static System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -59,179 +45,36 @@ internal SourceStrings() { } } - /// - /// Looks up a localized string similar to { - /// "data": [ - /// { - /// "data": { - /// "id": 2814, - /// "projectId": 2, - /// "fileId": 48, - /// "branchId": 12, - /// "directoryId": 13, - /// "identifier": "name", - /// "text": "Not all videos are shown to users. See more", - /// "type": "text", - /// "context": "shown on main page", - /// "maxLength": 35, - /// "isHidden": false, - /// "isDuplicate": true, - /// "masterStringId": 1, - /// "revision": 1, - /// "hasPlurals": false, - /// "isIcu": fal [rest of string was truncated]";. - /// - internal static string CommonResponses_SingleStringInArray { - get { - return ResourceManager.GetString("CommonResponses_SingleStringInArray", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "data": { - /// "identifier": "50fb3506-4127-4ba8-8296-f97dc7e3e0c3", - /// "status": "finished", - /// "progress": 100, - /// "attributes": { - /// "branchId": 38, - /// "storageId": 38, - /// "fileType": "android", - /// "parserVersion": 8, - /// "labelIds": [ - /// 1, - /// 2 - /// ], - /// "importOptions": { - /// "firstLineContainsHeader": false, - /// "importTranslations": true, - /// "scheme": { - /// "identifier": 0, - /// "sourcePhrase": 1, - /// "en": 2, - /// [rest of string was truncated]";. - /// - internal static string CommonResponses_UploadStrings { + internal static string StringBatchOperations_Response { get { - return ResourceManager.GetString("CommonResponses_UploadStrings", resourceCulture); + return ResourceManager.GetString("StringBatchOperations_Response", resourceCulture); } } - /// - /// Looks up a localized string similar to [ - /// { - /// - /// "path": "/2814/isHidden", - /// "op": "replace", - /// "value": true - /// }, - /// { - /// - /// "path": "/2814/context", - /// "op": "replace", - /// "value": "some context" - /// }, - /// { - /// - /// "path": "/-", - /// "op": "add", - /// "value": { - /// "text": "new added string", - /// "identifier": "a.b.c", - /// - /// "fileId": 5, - /// "context": "context for new string", - /// "isHidden": false - /// } - /// }, - /// { - /// - /// "path": "/2815", - /// "op": "remove" - /// } - ///]. - /// internal static string StringBatchOperations_Request { get { return ResourceManager.GetString("StringBatchOperations_Request", resourceCulture); } } - /// - /// Looks up a localized string similar to { - /// "data": [ - /// { - /// "data": { - /// "id": 2814, - /// "projectId": 2, - /// "fileId": 48, - /// "branchId": 12, - /// "directoryId": 13, - /// "identifier": "name", - /// "text": "Not all videos are shown to users. See more", - /// "type": "text", - /// "context": "shown on main page", - /// "maxLength": 35, - /// "isHidden": false, - /// "isDuplicate": true, - /// "masterStringId": 1, - /// "revision": 1, - /// "hasPlurals": false, - /// "isIcu": fal [rest of string was truncated]";. - /// - internal static string StringBatchOperations_Response { + internal static string CommonResponses_SingleStringInArray { get { - return ResourceManager.GetString("StringBatchOperations_Response", resourceCulture); + return ResourceManager.GetString("CommonResponses_SingleStringInArray", resourceCulture); } } - /// - /// Looks up a localized string similar to { - /// "data": [ - /// { - /// "data": { - /// "id": 468549, - /// "projectId": 11, - /// "fileId": 1533, - /// "branchId": null, - /// "directoryId": 1535, - /// "identifier": "bulk_edit_6", - /// "text": "Batch operations with send patch request", - /// "type": "text", - /// "context": "edited context using patch request", - /// "maxLength": 0, - /// "isHidden": false, - /// [rest of string was truncated]";. - /// internal static string StringBatchOperations_Response_NoPagination { get { return ResourceManager.GetString("StringBatchOperations_Response_NoPagination", resourceCulture); } } - /// - /// Looks up a localized string similar to { - /// "storageId": 61, - /// "branchId": 34, - /// "type": "xliff", - /// "parserVersion": 1, - /// "labelIds": [ - /// 1, 2, 3 - /// ], - /// "updateStrings": true, - /// "cleanupMode": true, - /// "importOptions": { - /// "firstLineContainsHeader": false, - /// "importTranslations": true, - /// "scheme": { - /// "identifier": 0, - /// "sourcePhrase": 1, - /// "en": 2, - /// "de": 3 - /// } - /// } - ///}. - /// + internal static string CommonResponses_UploadStrings { + get { + return ResourceManager.GetString("CommonResponses_UploadStrings", resourceCulture); + } + } + internal static string UploadStrings_Request { get { return ResourceManager.GetString("UploadStrings_Request", resourceCulture); diff --git a/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.resx b/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.resx index 593b0880..1c632fd5 100644 --- a/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.resx +++ b/tests/Crowdin.Api.Tests/Core/Resources/SourceStrings.resx @@ -177,7 +177,8 @@ } }, "updateStrings": false, - "cleanupMode": false + "cleanupMode": false, + "updateOption": "keep_translations_and_approvals" }, "createdAt": "2019-09-23T11:26:54+00:00", "updatedAt": "2019-09-23T11:26:54+00:00", @@ -206,7 +207,8 @@ "en": 2, "de": 3 } - } + }, + "updateOption": "keep_translations_and_approvals" } \ No newline at end of file diff --git a/tests/Crowdin.Api.Tests/SourceStrings/SourceStringsApiTests.cs b/tests/Crowdin.Api.Tests/SourceStrings/SourceStringsApiTests.cs index f1edb307..2c953dbd 100644 --- a/tests/Crowdin.Api.Tests/SourceStrings/SourceStringsApiTests.cs +++ b/tests/Crowdin.Api.Tests/SourceStrings/SourceStringsApiTests.cs @@ -82,7 +82,8 @@ public async Task UploadStrings() ["en"] = 2, ["de"] = 3 } - } + }, + UpdateOption = UpdateOption.KeepTranslationsAndApprovals }; string actualRequestJson = JsonConvert.SerializeObject(request, DefaultSettings); @@ -132,6 +133,7 @@ private static void Assert_StringUploadResponseModel(StringUploadResponseModel? Assert.Equal(new[] { 1, 2 }, attributes.LabelIds); Assert.False(attributes.UpdateStrings); Assert.False(attributes.CleanupMode); + Assert.Equal(UpdateOption.KeepTranslationsAndApprovals, attributes.UpdateOption); SpreadsheetFileImportOptions? importOptions = attributes.ImportOptions; Assert.NotNull(importOptions);