1515 */
1616
1717/**
18- * IBM OpenAPI SDK Code Generator Version: 3.38 .0-07189efd-20210827-205025
18+ * IBM OpenAPI SDK Code Generator Version: 3.53 .0-9710cac3-20220713-193508
1919 */
2020
2121import * as extend from 'extend' ;
@@ -24,7 +24,7 @@ import {
2424 Authenticator ,
2525 BaseService ,
2626 getAuthenticatorFromEnvironment ,
27- getMissingParams ,
27+ validateParams ,
2828 UserOptions ,
2929} from 'ibm-cloud-sdk-core' ;
3030import { getSdkHeaders } from '../lib/common' ;
@@ -65,10 +65,10 @@ class LanguageTranslatorV3 extends BaseService {
6565 constructor ( options : UserOptions ) {
6666 options = options || { } ;
6767
68- const requiredParams = [ 'version' ] ;
69- const missingParams = getMissingParams ( options , requiredParams ) ;
70- if ( missingParams ) {
71- throw missingParams ;
68+ const _requiredParams = [ 'version' ] ;
69+ const _validationErrors = validateParams ( options , _requiredParams , null ) ;
70+ if ( _validationErrors ) {
71+ throw _validationErrors ;
7272 }
7373 if ( ! options . serviceName ) {
7474 options . serviceName = LanguageTranslatorV3 . DEFAULT_SERVICE_NAME ;
@@ -106,6 +106,12 @@ class LanguageTranslatorV3 extends BaseService {
106106 params ?: LanguageTranslatorV3 . ListLanguagesParams
107107 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . Languages > > {
108108 const _params = { ...params } ;
109+ const _requiredParams = [ ] ;
110+ const _validParams = [ 'headers' ] ;
111+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
112+ if ( _validationErrors ) {
113+ return Promise . reject ( _validationErrors ) ;
114+ }
109115
110116 const query = {
111117 'version' : this . version ,
@@ -170,11 +176,11 @@ class LanguageTranslatorV3 extends BaseService {
170176 params : LanguageTranslatorV3 . TranslateParams
171177 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . TranslationResult > > {
172178 const _params = { ...params } ;
173- const requiredParams = [ 'text' ] ;
174-
175- const missingParams = getMissingParams ( _params , requiredParams ) ;
176- if ( missingParams ) {
177- return Promise . reject ( missingParams ) ;
179+ const _requiredParams = [ 'text' ] ;
180+ const _validParams = [ 'text' , 'modelId' , 'source' , 'target' , 'headers' ] ;
181+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
182+ if ( _validationErrors ) {
183+ return Promise . reject ( _validationErrors ) ;
178184 }
179185
180186 const body = {
@@ -234,6 +240,12 @@ class LanguageTranslatorV3 extends BaseService {
234240 params ?: LanguageTranslatorV3 . ListIdentifiableLanguagesParams
235241 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . IdentifiableLanguages > > {
236242 const _params = { ...params } ;
243+ const _requiredParams = [ ] ;
244+ const _validParams = [ 'headers' ] ;
245+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
246+ if ( _validationErrors ) {
247+ return Promise . reject ( _validationErrors ) ;
248+ }
237249
238250 const query = {
239251 'version' : this . version ,
@@ -280,11 +292,11 @@ class LanguageTranslatorV3 extends BaseService {
280292 params : LanguageTranslatorV3 . IdentifyParams
281293 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . IdentifiedLanguages > > {
282294 const _params = { ...params } ;
283- const requiredParams = [ 'text' ] ;
284-
285- const missingParams = getMissingParams ( _params , requiredParams ) ;
286- if ( missingParams ) {
287- return Promise . reject ( missingParams ) ;
295+ const _requiredParams = [ 'text' ] ;
296+ const _validParams = [ 'text' , 'headers' ] ;
297+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
298+ if ( _validationErrors ) {
299+ return Promise . reject ( _validationErrors ) ;
288300 }
289301
290302 const body = _params . text ;
@@ -343,6 +355,12 @@ class LanguageTranslatorV3 extends BaseService {
343355 params ?: LanguageTranslatorV3 . ListModelsParams
344356 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . TranslationModels > > {
345357 const _params = { ...params } ;
358+ const _requiredParams = [ ] ;
359+ const _validParams = [ 'source' , 'target' , '_default' , 'headers' ] ;
360+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
361+ if ( _validationErrors ) {
362+ return Promise . reject ( _validationErrors ) ;
363+ }
346364
347365 const query = {
348366 'version' : this . version ,
@@ -455,6 +473,7 @@ class LanguageTranslatorV3 extends BaseService {
455473 * the method description.
456474 *
457475 * *With `curl`, use `--form forced_glossary=@{filename}`.*.
476+ * @param {string } [params.forcedGlossaryContentType] - The content type of forcedGlossary.
458477 * @param {NodeJS.ReadableStream | Buffer } [params.parallelCorpus] - A file with parallel sentences for the source and
459478 * target languages. You can upload multiple parallel corpus files in one request by repeating the parameter. All
460479 * uploaded parallel corpus files combined must contain at least 5000 parallel sentences to train successfully. You
@@ -464,6 +483,7 @@ class LanguageTranslatorV3 extends BaseService {
464483 * cumulative maximum size of 250 MB. For more information, see **Supported file formats** in the method description.
465484 *
466485 * *With `curl`, use `--form parallel_corpus=@{filename}`.*.
486+ * @param {string } [params.parallelCorpusContentType] - The content type of parallelCorpus.
467487 * @param {string } [params.name] - An optional model name that you can use to identify the model. Valid characters are
468488 * letters, numbers, dashes, underscores, spaces, and apostrophes. The maximum length of the name is 32 characters.
469489 * @param {OutgoingHttpHeaders } [params.headers] - Custom request headers
@@ -473,21 +493,21 @@ class LanguageTranslatorV3 extends BaseService {
473493 params : LanguageTranslatorV3 . CreateModelParams
474494 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . TranslationModel > > {
475495 const _params = { ...params } ;
476- const requiredParams = [ 'baseModelId' ] ;
477-
478- const missingParams = getMissingParams ( _params , requiredParams ) ;
479- if ( missingParams ) {
480- return Promise . reject ( missingParams ) ;
496+ const _requiredParams = [ 'baseModelId' ] ;
497+ const _validParams = [ 'baseModelId' , 'forcedGlossary' , 'forcedGlossaryContentType' , 'parallelCorpus' , 'parallelCorpusContentType' , 'name' , 'headers' ] ;
498+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
499+ if ( _validationErrors ) {
500+ return Promise . reject ( _validationErrors ) ;
481501 }
482502
483503 const formData = {
484504 'forced_glossary' : {
485505 data : _params . forcedGlossary ,
486- contentType : 'application/octet-stream' ,
506+ contentType : _params . forcedGlossaryContentType ,
487507 } ,
488508 'parallel_corpus' : {
489509 data : _params . parallelCorpus ,
490- contentType : 'application/octet-stream' ,
510+ contentType : _params . parallelCorpusContentType ,
491511 } ,
492512 } ;
493513
@@ -540,11 +560,11 @@ class LanguageTranslatorV3 extends BaseService {
540560 params : LanguageTranslatorV3 . DeleteModelParams
541561 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . DeleteModelResult > > {
542562 const _params = { ...params } ;
543- const requiredParams = [ 'modelId' ] ;
544-
545- const missingParams = getMissingParams ( _params , requiredParams ) ;
546- if ( missingParams ) {
547- return Promise . reject ( missingParams ) ;
563+ const _requiredParams = [ 'modelId' ] ;
564+ const _validParams = [ 'modelId' , 'headers' ] ;
565+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
566+ if ( _validationErrors ) {
567+ return Promise . reject ( _validationErrors ) ;
548568 }
549569
550570 const query = {
@@ -598,11 +618,11 @@ class LanguageTranslatorV3 extends BaseService {
598618 params : LanguageTranslatorV3 . GetModelParams
599619 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . TranslationModel > > {
600620 const _params = { ...params } ;
601- const requiredParams = [ 'modelId' ] ;
602-
603- const missingParams = getMissingParams ( _params , requiredParams ) ;
604- if ( missingParams ) {
605- return Promise . reject ( missingParams ) ;
621+ const _requiredParams = [ 'modelId' ] ;
622+ const _validParams = [ 'modelId' , 'headers' ] ;
623+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
624+ if ( _validationErrors ) {
625+ return Promise . reject ( _validationErrors ) ;
606626 }
607627
608628 const query = {
@@ -657,6 +677,12 @@ class LanguageTranslatorV3 extends BaseService {
657677 params ?: LanguageTranslatorV3 . ListDocumentsParams
658678 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . DocumentList > > {
659679 const _params = { ...params } ;
680+ const _requiredParams = [ ] ;
681+ const _validParams = [ 'headers' ] ;
682+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
683+ if ( _validationErrors ) {
684+ return Promise . reject ( _validationErrors ) ;
685+ }
660686
661687 const query = {
662688 'version' : this . version ,
@@ -695,13 +721,16 @@ class LanguageTranslatorV3 extends BaseService {
695721 * Submit a document for translation. You can submit the document contents in the `file` parameter, or you can
696722 * reference a previously submitted document by document ID. The maximum file size for document translation is
697723 * * 20 MB for service instances on the Standard, Advanced, and Premium plans
698- * * 2 MB for service instances on the Lite plan.
724+ * * 2 MB for service instances on the Lite plan
725+ *
726+ * **Note:** When translating a previously submitted document, the target language must be different from the target
727+ * language of the original request when the document was initially submitted.
699728 *
700729 * @param {Object } params - The parameters to send to the service.
701730 * @param {NodeJS.ReadableStream | Buffer } params.file - The contents of the source file to translate. The maximum
702731 * file size for document translation is 20 MB for service instances on the Standard, Advanced, and Premium plans, and
703- * 2 MB for service instances on the Lite plan. For more information, see [Supported file formats
704- * (Beta) ](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
732+ * 2 MB for service instances on the Lite plan. For more information, see [Supported file
733+ * formats ](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
705734 * @param {string } params.filename - The filename for file.
706735 * @param {string } [params.fileContentType] - The content type of file.
707736 * @param {string } [params.modelId] - The model to use for translation. For example, `en-de` selects the IBM-provided
@@ -721,11 +750,11 @@ class LanguageTranslatorV3 extends BaseService {
721750 params : LanguageTranslatorV3 . TranslateDocumentParams
722751 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . DocumentStatus > > {
723752 const _params = { ...params } ;
724- const requiredParams = [ 'file' , 'filename' ] ;
725-
726- const missingParams = getMissingParams ( _params , requiredParams ) ;
727- if ( missingParams ) {
728- return Promise . reject ( missingParams ) ;
753+ const _requiredParams = [ 'file' , 'filename' ] ;
754+ const _validParams = [ 'file' , 'filename' , 'fileContentType' , 'modelId' , 'source' , 'target' , 'documentId' , 'headers' ] ;
755+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
756+ if ( _validationErrors ) {
757+ return Promise . reject ( _validationErrors ) ;
729758 }
730759
731760 const formData = {
@@ -787,11 +816,11 @@ class LanguageTranslatorV3 extends BaseService {
787816 params : LanguageTranslatorV3 . GetDocumentStatusParams
788817 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . DocumentStatus > > {
789818 const _params = { ...params } ;
790- const requiredParams = [ 'documentId' ] ;
791-
792- const missingParams = getMissingParams ( _params , requiredParams ) ;
793- if ( missingParams ) {
794- return Promise . reject ( missingParams ) ;
819+ const _requiredParams = [ 'documentId' ] ;
820+ const _validParams = [ 'documentId' , 'headers' ] ;
821+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
822+ if ( _validationErrors ) {
823+ return Promise . reject ( _validationErrors ) ;
795824 }
796825
797826 const query = {
@@ -844,11 +873,11 @@ class LanguageTranslatorV3 extends BaseService {
844873 params : LanguageTranslatorV3 . DeleteDocumentParams
845874 ) : Promise < LanguageTranslatorV3 . Response < LanguageTranslatorV3 . Empty > > {
846875 const _params = { ...params } ;
847- const requiredParams = [ 'documentId' ] ;
848-
849- const missingParams = getMissingParams ( _params , requiredParams ) ;
850- if ( missingParams ) {
851- return Promise . reject ( missingParams ) ;
876+ const _requiredParams = [ 'documentId' ] ;
877+ const _validParams = [ 'documentId' , 'headers' ] ;
878+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
879+ if ( _validationErrors ) {
880+ return Promise . reject ( _validationErrors ) ;
852881 }
853882
854883 const query = {
@@ -909,11 +938,11 @@ class LanguageTranslatorV3 extends BaseService {
909938 params : LanguageTranslatorV3 . GetTranslatedDocumentParams
910939 ) : Promise < LanguageTranslatorV3 . Response < NodeJS . ReadableStream > > {
911940 const _params = { ...params } ;
912- const requiredParams = [ 'documentId' ] ;
913-
914- const missingParams = getMissingParams ( _params , requiredParams ) ;
915- if ( missingParams ) {
916- return Promise . reject ( missingParams ) ;
941+ const _requiredParams = [ 'documentId' ] ;
942+ const _validParams = [ 'documentId' , 'accept' , 'headers' ] ;
943+ const _validationErrors = validateParams ( _params , _requiredParams , _validParams ) ;
944+ if ( _validationErrors ) {
945+ return Promise . reject ( _validationErrors ) ;
917946 }
918947
919948 const query = {
@@ -1061,6 +1090,8 @@ namespace LanguageTranslatorV3 {
10611090 * *With `curl`, use `--form forced_glossary=@{filename}`.*.
10621091 */
10631092 forcedGlossary ?: NodeJS . ReadableStream | Buffer ;
1093+ /** The content type of forcedGlossary. */
1094+ forcedGlossaryContentType ?: CreateModelConstants . ForcedGlossaryContentType | string ;
10641095 /** A file with parallel sentences for the source and target languages. You can upload multiple parallel corpus
10651096 * files in one request by repeating the parameter. All uploaded parallel corpus files combined must contain at
10661097 * least 5000 parallel sentences to train successfully. You can provide a maximum of 500,000 parallel sentences
@@ -1073,13 +1104,37 @@ namespace LanguageTranslatorV3 {
10731104 * *With `curl`, use `--form parallel_corpus=@{filename}`.*.
10741105 */
10751106 parallelCorpus ?: NodeJS . ReadableStream | Buffer ;
1107+ /** The content type of parallelCorpus. */
1108+ parallelCorpusContentType ?: CreateModelConstants . ParallelCorpusContentType | string ;
10761109 /** An optional model name that you can use to identify the model. Valid characters are letters, numbers,
10771110 * dashes, underscores, spaces, and apostrophes. The maximum length of the name is 32 characters.
10781111 */
10791112 name ?: string ;
10801113 headers ?: OutgoingHttpHeaders ;
10811114 }
10821115
1116+ /** Constants for the `createModel` operation. */
1117+ export namespace CreateModelConstants {
1118+ /** The content type of forcedGlossary. */
1119+ export enum ForcedGlossaryContentType {
1120+ APPLICATION_X_TMX_XML = 'application/x-tmx+xml' ,
1121+ APPLICATION_XLIFF_XML = 'application/xliff+xml' ,
1122+ TEXT_CSV = 'text/csv' ,
1123+ TEXT_TAB_SEPARATED_VALUES = 'text/tab-separated-values' ,
1124+ APPLICATION_JSON = 'application/json' ,
1125+ APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ,
1126+ }
1127+ /** The content type of parallelCorpus. */
1128+ export enum ParallelCorpusContentType {
1129+ APPLICATION_X_TMX_XML = 'application/x-tmx+xml' ,
1130+ APPLICATION_XLIFF_XML = 'application/xliff+xml' ,
1131+ TEXT_CSV = 'text/csv' ,
1132+ TEXT_TAB_SEPARATED_VALUES = 'text/tab-separated-values' ,
1133+ APPLICATION_JSON = 'application/json' ,
1134+ APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ,
1135+ }
1136+ }
1137+
10831138 /** Parameters for the `deleteModel` operation. */
10841139 export interface DeleteModelParams {
10851140 /** Model ID of the model to delete. */
@@ -1103,8 +1158,8 @@ namespace LanguageTranslatorV3 {
11031158 export interface TranslateDocumentParams {
11041159 /** The contents of the source file to translate. The maximum file size for document translation is 20 MB for
11051160 * service instances on the Standard, Advanced, and Premium plans, and 2 MB for service instances on the Lite plan.
1106- * For more information, see [Supported file formats
1107- * (Beta) ](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
1161+ * For more information, see [Supported file
1162+ * formats ](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
11081163 */
11091164 file : NodeJS . ReadableStream | Buffer ;
11101165 /** The filename for file. */
0 commit comments