Open
Description
Describe the bug
The new version of the API https://www.deepl.com/cs/docs-api/documents/translate-document includes support for the optional output_format parameter, but there is no implementation in deepl-dotnet.
To Reproduce
var options = new DocumentTranslateOptions();
options.OutputFormat = "docx";
Expected behavior
DocumentTranslateOptions have an OutputFormat parameter, I can set it to "docx" to change PDF to Word during translation.
Screenshots or sample code
Expected final code:
var translator = new Translator(ServiceApiKey);
var options = new DocumentTranslateOptions();
options.OutputFormat = "docx";
var handle = await translator.TranslateDocumentUploadAsync(filepath, sourceLanguage, targetLanguage, options);
Files to change:
DeepL/DocumentTranslateOptions.cs
/// <summary>File extension of desired format of translated file, for example: docx.</summary>
/// If unspecified, by default the translated file will be in the same format as the input file.
public string? OutputFormat { get; set; }
DeepL/Translator.cs
/// <inheritdoc />
public async Task<DocumentHandle> TranslateDocumentUploadAsync(
Stream inputFile,
string inputFileName,
string? sourceLanguageCode,
string targetLanguageCode,
DocumentTranslateOptions? options = null,
CancellationToken cancellationToken = default) {
var bodyParams = CreateCommonHttpParams(
sourceLanguageCode,
targetLanguageCode,
options?.Formality,
options?.GlossaryId);
if (options?.OutputFormat != null) {
bodyParams.Add(("output_format", options.OutputFormat));
}
using var responseMessage =
(...)