Skip to content

Commit 01a2739

Browse files
committed
chore(Language Translator V3): Regnerate using updated api-definition
1 parent 76c3f93 commit 01a2739

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/IBM.Watson.LanguageTranslator.v3/ILanguageTranslatorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public partial interface ILanguageTranslatorService
3131
DetailedResponse<DeleteModelResult> DeleteModel(string modelId);
3232
DetailedResponse<TranslationModel> GetModel(string modelId);
3333
DetailedResponse<DocumentList> ListDocuments();
34-
DetailedResponse<DocumentStatus> TranslateDocument(System.IO.MemoryStream file, string fileContentType = null, string modelId = null, string source = null, string target = null, string documentId = null);
34+
DetailedResponse<DocumentStatus> TranslateDocument(System.IO.MemoryStream file, string filename, string fileContentType = null, string modelId = null, string source = null, string target = null, string documentId = null);
3535
DetailedResponse<DocumentStatus> GetDocumentStatus(string documentId);
3636
DetailedResponse<object> DeleteDocument(string documentId);
3737
DetailedResponse<System.IO.MemoryStream> GetTranslatedDocument(string documentId, string accept = null);

src/IBM.Watson.LanguageTranslator.v3/LanguageTranslatorService.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ public DetailedResponse<DocumentList> ListDocuments()
628628
/// types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
629629
///
630630
/// Maximum file size: **20 MB**.</param>
631+
/// <param name="filename">The filename for file.</param>
631632
/// <param name="fileContentType">The content type of file. (optional)</param>
632633
/// <param name="modelId">The model to use for translation. `model_id` or both `source` and `target` are
633634
/// required. (optional)</param>
@@ -636,12 +637,16 @@ public DetailedResponse<DocumentList> ListDocuments()
636637
/// <param name="documentId">To use a previously submitted document as the source for a new translation, enter
637638
/// the `document_id` of the document. (optional)</param>
638639
/// <returns><see cref="DocumentStatus" />DocumentStatus</returns>
639-
public DetailedResponse<DocumentStatus> TranslateDocument(System.IO.MemoryStream file, string fileContentType = null, string modelId = null, string source = null, string target = null, string documentId = null)
640+
public DetailedResponse<DocumentStatus> TranslateDocument(System.IO.MemoryStream file, string filename, string fileContentType = null, string modelId = null, string source = null, string target = null, string documentId = null)
640641
{
641642
if (file == null)
642643
{
643644
throw new ArgumentNullException("`file` is required for `TranslateDocument`");
644645
}
646+
if (string.IsNullOrEmpty(filename))
647+
{
648+
throw new ArgumentNullException("`filename` is required for `TranslateDocument`");
649+
}
645650

646651
if (string.IsNullOrEmpty(VersionDate))
647652
{
@@ -660,7 +665,7 @@ public DetailedResponse<DocumentStatus> TranslateDocument(System.IO.MemoryStream
660665
System.Net.Http.Headers.MediaTypeHeaderValue contentType;
661666
System.Net.Http.Headers.MediaTypeHeaderValue.TryParse(fileContentType, out contentType);
662667
fileContent.Headers.ContentType = contentType;
663-
formData.Add(fileContent, "file", "filename");
668+
formData.Add(fileContent, "file", filename);
664669
}
665670

666671
if (modelId != null)

test/LanguageTranslator.v3.IntegrationTests/LanguageTranslatorServiceIntegrationTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ public void Documents_Success()
163163
service.WithHeader("X-Watson-Test", "1");
164164
translateDocumentResult = service.TranslateDocument(
165165
file: ms,
166+
filename: Path.GetFileName(documentToTranslatePath),
166167
fileContentType: "text/plain",
167168
modelId: "en-es"
168169
);

0 commit comments

Comments
 (0)