1414# See the License for the specific language governing permissions and
1515# limitations under the License.
1616
17- # IBM OpenAPI SDK Code Generator Version: 3.46 .0-a4e29da0-20220224-210428
17+ # IBM OpenAPI SDK Code Generator Version: 3.53 .0-9710cac3-20220713-193508
1818"""
1919IBM Watson™ Language Translator translates text from one language to another. The
2020service offers multiple IBM-provided translation models that you can customize based on
@@ -107,6 +107,7 @@ def list_languages(self, **kwargs) -> DetailedResponse:
107107
108108 if 'headers' in kwargs :
109109 headers .update (kwargs .get ('headers' ))
110+ del kwargs ['headers' ]
110111 headers ['Accept' ] = 'application/json'
111112
112113 url = '/v3/languages'
@@ -182,6 +183,7 @@ def translate(self,
182183
183184 if 'headers' in kwargs :
184185 headers .update (kwargs .get ('headers' ))
186+ del kwargs ['headers' ]
185187 headers ['Accept' ] = 'application/json'
186188
187189 url = '/v3/translate'
@@ -221,6 +223,7 @@ def list_identifiable_languages(self, **kwargs) -> DetailedResponse:
221223
222224 if 'headers' in kwargs :
223225 headers .update (kwargs .get ('headers' ))
226+ del kwargs ['headers' ]
224227 headers ['Accept' ] = 'application/json'
225228
226229 url = '/v3/identifiable_languages'
@@ -259,6 +262,7 @@ def identify(self, text: Union[str, TextIO], **kwargs) -> DetailedResponse:
259262
260263 if 'headers' in kwargs :
261264 headers .update (kwargs .get ('headers' ))
265+ del kwargs ['headers' ]
262266 headers ['Accept' ] = 'application/json'
263267
264268 url = '/v3/identify'
@@ -315,6 +319,7 @@ def list_models(self,
315319
316320 if 'headers' in kwargs :
317321 headers .update (kwargs .get ('headers' ))
322+ del kwargs ['headers' ]
318323 headers ['Accept' ] = 'application/json'
319324
320325 url = '/v3/models'
@@ -330,7 +335,9 @@ def create_model(self,
330335 base_model_id : str ,
331336 * ,
332337 forced_glossary : BinaryIO = None ,
338+ forced_glossary_content_type : str = None ,
333339 parallel_corpus : BinaryIO = None ,
340+ parallel_corpus_content_type : str = None ,
334341 name : str = None ,
335342 ** kwargs ) -> DetailedResponse :
336343 """
@@ -409,6 +416,8 @@ def create_model(self,
409416 words or short phrases. For more information, see **Supported file
410417 formats** in the method description.
411418 *With `curl`, use `--form forced_glossary=@{filename}`.*.
419+ :param str forced_glossary_content_type: (optional) The content type of
420+ forced_glossary.
412421 :param BinaryIO parallel_corpus: (optional) A file with parallel sentences
413422 for the source and target languages. You can upload multiple parallel
414423 corpus files in one request by repeating the parameter. All uploaded
@@ -420,6 +429,8 @@ def create_model(self,
420429 MB. For more information, see **Supported file formats** in the method
421430 description.
422431 *With `curl`, use `--form parallel_corpus=@{filename}`.*.
432+ :param str parallel_corpus_content_type: (optional) The content type of
433+ parallel_corpus.
423434 :param str name: (optional) An optional model name that you can use to
424435 identify the model. Valid characters are letters, numbers, dashes,
425436 underscores, spaces, and apostrophes. The maximum length of the name is 32
@@ -445,14 +456,19 @@ def create_model(self,
445456
446457 form_data = []
447458 if forced_glossary :
448- form_data .append (('forced_glossary' , (None , forced_glossary ,
449- 'application/octet-stream' )))
459+ form_data .append (
460+ ('forced_glossary' ,
461+ (None , forced_glossary , forced_glossary_content_type or
462+ 'application/octet-stream' )))
450463 if parallel_corpus :
451- form_data .append (('parallel_corpus' , (None , parallel_corpus ,
452- 'application/octet-stream' )))
464+ form_data .append (
465+ ('parallel_corpus' ,
466+ (None , parallel_corpus , parallel_corpus_content_type or
467+ 'application/octet-stream' )))
453468
454469 if 'headers' in kwargs :
455470 headers .update (kwargs .get ('headers' ))
471+ del kwargs ['headers' ]
456472 headers ['Accept' ] = 'application/json'
457473
458474 url = '/v3/models'
@@ -489,6 +505,7 @@ def delete_model(self, model_id: str, **kwargs) -> DetailedResponse:
489505
490506 if 'headers' in kwargs :
491507 headers .update (kwargs .get ('headers' ))
508+ del kwargs ['headers' ]
492509 headers ['Accept' ] = 'application/json'
493510
494511 path_param_keys = ['model_id' ]
@@ -529,6 +546,7 @@ def get_model(self, model_id: str, **kwargs) -> DetailedResponse:
529546
530547 if 'headers' in kwargs :
531548 headers .update (kwargs .get ('headers' ))
549+ del kwargs ['headers' ]
532550 headers ['Accept' ] = 'application/json'
533551
534552 path_param_keys = ['model_id' ]
@@ -568,6 +586,7 @@ def list_documents(self, **kwargs) -> DetailedResponse:
568586
569587 if 'headers' in kwargs :
570588 headers .update (kwargs .get ('headers' ))
589+ del kwargs ['headers' ]
571590 headers ['Accept' ] = 'application/json'
572591
573592 url = '/v3/documents'
@@ -596,14 +615,16 @@ def translate_document(self,
596615 `file` parameter, or you can reference a previously submitted document by document
597616 ID. The maximum file size for document translation is
598617 * 20 MB for service instances on the Standard, Advanced, and Premium plans
599- * 2 MB for service instances on the Lite plan.
618+ * 2 MB for service instances on the Lite plan
619+ **Note:** When translating a previously submitted document, the target language
620+ must be different from the target language of the original request when the
621+ document was initially submitted.
600622
601623 :param BinaryIO file: The contents of the source file to translate. The
602624 maximum file size for document translation is 20 MB for service instances
603625 on the Standard, Advanced, and Premium plans, and 2 MB for service
604626 instances on the Lite plan. For more information, see [Supported file
605- formats
606- (Beta)](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
627+ formats](https://cloud.ibm.com/docs/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats).
607628 :param str filename: (optional) The filename for file.
608629 :param str file_content_type: (optional) The content type of file.
609630 :param str model_id: (optional) The model to use for translation. For
@@ -653,6 +674,7 @@ def translate_document(self,
653674
654675 if 'headers' in kwargs :
655676 headers .update (kwargs .get ('headers' ))
677+ del kwargs ['headers' ]
656678 headers ['Accept' ] = 'application/json'
657679
658680 url = '/v3/documents'
@@ -690,6 +712,7 @@ def get_document_status(self, document_id: str,
690712
691713 if 'headers' in kwargs :
692714 headers .update (kwargs .get ('headers' ))
715+ del kwargs ['headers' ]
693716 headers ['Accept' ] = 'application/json'
694717
695718 path_param_keys = ['document_id' ]
@@ -728,6 +751,7 @@ def delete_document(self, document_id: str, **kwargs) -> DetailedResponse:
728751
729752 if 'headers' in kwargs :
730753 headers .update (kwargs .get ('headers' ))
754+ del kwargs ['headers' ]
731755
732756 path_param_keys = ['document_id' ]
733757 path_param_values = self .encode_path_vars (document_id )
@@ -784,6 +808,7 @@ def get_translated_document(self,
784808
785809 if 'headers' in kwargs :
786810 headers .update (kwargs .get ('headers' ))
811+ del kwargs ['headers' ]
787812
788813 path_param_keys = ['document_id' ]
789814 path_param_values = self .encode_path_vars (document_id )
@@ -799,6 +824,34 @@ def get_translated_document(self,
799824 return response
800825
801826
827+ class CreateModelEnums :
828+ """
829+ Enums for create_model parameters.
830+ """
831+
832+ class ForcedGlossaryContentType (str , Enum ):
833+ """
834+ The content type of forced_glossary.
835+ """
836+ APPLICATION_X_TMX_XML = 'application/x-tmx+xml'
837+ APPLICATION_XLIFF_XML = 'application/xliff+xml'
838+ TEXT_CSV = 'text/csv'
839+ TEXT_TAB_SEPARATED_VALUES = 'text/tab-separated-values'
840+ APPLICATION_JSON = 'application/json'
841+ APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
842+
843+ class ParallelCorpusContentType (str , Enum ):
844+ """
845+ The content type of parallel_corpus.
846+ """
847+ APPLICATION_X_TMX_XML = 'application/x-tmx+xml'
848+ APPLICATION_XLIFF_XML = 'application/xliff+xml'
849+ TEXT_CSV = 'text/csv'
850+ TEXT_TAB_SEPARATED_VALUES = 'text/tab-separated-values'
851+ APPLICATION_JSON = 'application/json'
852+ APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
853+
854+
802855class TranslateDocumentEnums :
803856 """
804857 Enums for translate_document parameters.
0 commit comments