2626public class TranslateDocumentOptions extends GenericModel {
2727
2828 private InputStream file ;
29+ private String filename ;
2930 private String fileContentType ;
3031 private String modelId ;
3132 private String source ;
@@ -37,6 +38,7 @@ public class TranslateDocumentOptions extends GenericModel {
3738 */
3839 public static class Builder {
3940 private InputStream file ;
41+ private String filename ;
4042 private String fileContentType ;
4143 private String modelId ;
4244 private String source ;
@@ -45,6 +47,7 @@ public static class Builder {
4547
4648 private Builder (TranslateDocumentOptions translateDocumentOptions ) {
4749 this .file = translateDocumentOptions .file ;
50+ this .filename = translateDocumentOptions .filename ;
4851 this .fileContentType = translateDocumentOptions .fileContentType ;
4952 this .modelId = translateDocumentOptions .modelId ;
5053 this .source = translateDocumentOptions .source ;
@@ -62,9 +65,11 @@ public Builder() {
6265 * Instantiates a new builder with required properties.
6366 *
6467 * @param file the file
68+ * @param filename the filename
6569 */
66- public Builder (InputStream file ) {
70+ public Builder (InputStream file , String filename ) {
6771 this .file = file ;
72+ this .filename = filename ;
6873 }
6974
7075 /**
@@ -87,6 +92,17 @@ public Builder file(InputStream file) {
8792 return this ;
8893 }
8994
95+ /**
96+ * Set the filename.
97+ *
98+ * @param filename the filename
99+ * @return the TranslateDocumentOptions builder
100+ */
101+ public Builder filename (String filename ) {
102+ this .filename = filename ;
103+ return this ;
104+ }
105+
90106 /**
91107 * Set the fileContentType.
92108 *
@@ -152,13 +168,16 @@ public Builder documentId(String documentId) {
152168 */
153169 public Builder file (File file ) throws FileNotFoundException {
154170 this .file = new FileInputStream (file );
171+ this .filename = file .getName ();
155172 return this ;
156173 }
157174 }
158175
159176 private TranslateDocumentOptions (Builder builder ) {
160177 Validator .notNull (builder .file , "file cannot be null" );
178+ Validator .notNull (builder .filename , "filename cannot be null" );
161179 file = builder .file ;
180+ filename = builder .filename ;
162181 fileContentType = builder .fileContentType ;
163182 modelId = builder .modelId ;
164183 source = builder .source ;
@@ -181,9 +200,7 @@ public Builder newBuilder() {
181200 * The source file to translate.
182201 *
183202 * [Supported file
184- * types]
185- * (https://cloud.ibm.com/docs/services/language-translator
186- * ?topic=language-translator-document-translator-tutorial#supported-file-formats)
203+ * types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
187204 *
188205 * Maximum file size: **20 MB**.
189206 *
@@ -193,6 +210,17 @@ public InputStream file() {
193210 return file ;
194211 }
195212
213+ /**
214+ * Gets the filename.
215+ *
216+ * The filename for file.
217+ *
218+ * @return the filename
219+ */
220+ public String filename () {
221+ return filename ;
222+ }
223+
196224 /**
197225 * Gets the fileContentType.
198226 *
0 commit comments