src/main/java/net/systran/platform/translation/client/api/TranslationApi.java
/**
   * Translate File
   * Translate a file from source language to target language\n\n\n* In asynchronous mode (async=true), the response will be a JSON containing a request identifier. This identifier can then be used to poll the request status and its result when completed.\n\n  ```\n  {\n     \&quot;requestId\&quot;: \&quot;54a3d860e62ea467b136eddb\&quot; Request identifier to use to get the status,\n                                                the result of the request and to cancel it \n     \&quot;error\&quot;: {\n       \&quot;message\&quot;: \&quot;\&quot; Error at request level \n       \&quot;info\&quot;: {}\n     }\n  }\n  ```\n\n* In synchronous mode, the response will be either:\n\n  * The **translated document**, directly, if `source` parameters was not `auto` and `withSource` was not true\n  * A `multipart/mixed` document with the following parts:\n\n    1. **Detected language**, if request was done with `auto` source language\n\n      * Header:\n\n        `part-name: detectedLanguage`\n\n      * Body: JSON document\n        ```\n        {\n          detectedLanguage: \&quot;string\&quot;\n          detectedLanguageConfidence : number\n        }\n        ```\n\n    2. **Source document**, if request was done with `withSource`:\n\n      * Header: `part-name: source`\n      * Body: Source document\n\n    3. **Translated document**\n\n      * Header: `part-name: output`\n\n      * Body: Translated document\n
   * @param input Input file\n
   * @param source Source language code ([details](#description_langage_code_values)) or `auto`.\n\nWhen the value is set to `auto`, the language will be automatically detected, used to enhance the translation, and returned in output.\n
   * @param target Target language code ([details](#description_langage_code_values))
   * @param format Format of the source text.\n\nValid values are `text` for plain text, `html` for HTML pages, and `auto` for automatic detection. The MIME type of file format supported by SYSTRAN can also be used (application/vnd.openxmlformats, application/vnd.oasis.opendocument, ...)\n
   * @param profile Profile id\n
   * @param withSource If `true`, the source will also be sent back in the response message. It can be useful when used with the withAnnotations option to align the source document with the translated document\n
   * @param withAnnotations If `true`, different annotations will be provided in the translated document. If the option &#39;withSource&#39; is used, the annotations will also be provided in the source document. It will provide segments, tokens, not found words,...\n
   * @param withDictionary User Dictionary or/and Normalization Dictionary ids to be applied to the translation result. Each dictionary &#39;id&#39; has to be separate by a comma.\n
   * @param withCorpus Corpus to be applied to the translation result. Each corpus &#39;id&#39; has to be separate by a comma.\n
   * @param options Additional options.\n\nAn option can be a JSON object containing a set of key/value generic options supported by the translator. It can also be a string with the syntax &#39;&lt;key&gt;:&lt;value&gt;&#39; to pass a key/value generic option to the translator.\n
   * @param encoding Encoding. `base64` can be useful to send binary documents in the JSON body. Please note that another alternative is to use translateFile\n
   * @param async If `true`, the translation is performed asynchronously.\n\nThe \&quot;/translate/status\&quot; service must be used to wait for the completion of the request and the \&quot;translate/result\&quot; service must be used to get the final result. The \&quot;/translate/cancel\&quot; can be used to cancel the request.\n
   * @param batchId Batch Identifier\n
   * @param callback Javascript callback function name for JSONP Support\n
   * @return TranslationFileResponse
   */
Translate File
Translate a file from source language to target language\n\n\n* In asynchronous mode (async=true), the response will be a JSON containing a request identifier.
Translate File Translate a file from source language to target language \ n \ n \ n * In asynchronous mode ( async = true ) the response will be a JSON containing a request identifier .
public TranslationFileResponse translationFileTranslateGet (File input, String source, String target, String format, Integer profile, Boolean withSource, Boolean withAnnotations, String withDictionary, String withCorpus, List<String> options, String encoding, Boolean async, String batchId, String callback) throws ApiException {
    Object postBody = null;
    if (input == null) {
       throw new ApiException(400, "Missing the required parameter 'input' when calling translationFileTranslateGet");
    }
    if (target == null) {
       throw new ApiException(400, "Missing the required parameter 'target' when calling translationFileTranslateGet");
    }
    String path = "/translation/file/translate".replaceAll("\\{format\\}","json");
    Map<String, Object> queryParams = new HashMap<String, Object>();
    Map<String, String> headerParams = new HashMap<String, String>();
    Map<String, String> formParams = new HashMap<String, String>();
    if (source != null)
      queryParams.put("source", apiClient.parameterToString(source));
    if (target != null)
      queryParams.put("target", apiClient.parameterToString(target));
    if (format != null)
      queryParams.put("format", apiClient.parameterToString(format));
    if (profile != null)
      queryParams.put("profile", apiClient.parameterToString(profile));
    if (withSource != null)
      queryParams.put("withSource", apiClient.parameterToString(withSource));
    if (withAnnotations != null)
      queryParams.put("withAnnotations", apiClient.parameterToString(withAnnotations));
    if (withDictionary != null)
      queryParams.put("withDictionary", apiClient.parameterToString(withDictionary));
    if (withCorpus != null)
      queryParams.put("withCorpus", apiClient.parameterToString(withCorpus));
    if (options != null)
      queryParams.put("options", apiClient.parameterToString(options));
    if (encoding != null)
      queryParams.put("encoding", apiClient.parameterToString(encoding));
    if (async != null)
      queryParams.put("async", apiClient.parameterToString(async));
    if (batchId != null)
      queryParams.put("batchId", apiClient.parameterToString(batchId));
    if (callback != null)
      queryParams.put("callback", apiClient.parameterToString(callback));
    final String[] accepts = {
      "application/json", "multipart/mixed", "*/*"
    };
    final String accept = apiClient.selectHeaderAccept(accepts);
    final String[] contentTypes = {
      "multipart/form-data", "application/x-www-form-urlencoded", "*/*"
    };
    final String contentType = apiClient.selectHeaderContentType(contentTypes);
    if(contentType.startsWith("multipart/form-data")) {
      boolean hasFields = false;
      FormDataMultiPart mp = new FormDataMultiPart();
      if (input != null) {
        hasFields = true;
        mp.field("input", input.getName());
        mp.bodyPart(new FileDataBodyPart("input", input, MediaType.MULTIPART_FORM_DATA_TYPE));
      }
      if(hasFields)
        postBody = mp;
    }
    else {
    }
    try {
      String[] authNames = new String[] { "accessToken", "apiKey" };
      ClientResponse response = apiClient.invokeAPI(path, "GET", queryParams, postBody, headerParams, formParams, accept, contentType, authNames);
      if(response != null){ 
        Object res = apiClient.deserialize(response, "", TranslationFileResponse.class);
        if(res instanceof TranslationFileResponse) {
          return (TranslationFileResponse) res;
        }
        TranslationFileResponse obj = new TranslationFileResponse();
        if(res instanceof InputStream) {
          obj.setOutput((InputStream)res);
        } else if(res instanceof MultipartResponse) {
          MultipartResponse multipart = (MultipartResponse) res;
          obj.setDetectedLanguage(multipart.getDetectedLanguage());
          obj.setDetectedLanguageConfidence(multipart.getDetectedLanguageConfidence());
          obj.setSource(multipart.getSource());
          obj.setOutput(multipart.getOutput());
        }
        return obj;
      }
      else {
        return null;
      }
    } catch (ApiException ex) {
      throw ex;
    }
  }
public TranslationFileResponse translationFileTranslateGet ( File input , String source , String target , String format , Integer profile , Boolean withSource , Boolean withAnnotations , String withDictionary , String withCorpus , List < String > options , String encoding , Boolean async , String batchId , String callback ) throws ApiException { Object postBody = null ; if ( input == null ) { throw new ApiException ( 400 , "Missing the required parameter 'input' when calling translationFileTranslateGet" ) ; } if ( target == null ) { throw new ApiException ( 400 , "Missing the required parameter 'target' when calling translationFileTranslateGet" ) ; } String path = "/translation/file/translate" . replaceAll ( "\\{format\\}" , "json" ) ; Map < String , Object > queryParams = new HashMap < String , Object > ( ) ; Map < String , String > headerParams = new HashMap < String , String > ( ) ; Map < String , String > formParams = new HashMap < String , String > ( ) ; if ( source != null ) queryParams . put ( "source" , apiClient . parameterToString ( source ) ) ; if ( target != null ) queryParams . put ( "target" , apiClient . parameterToString ( target ) ) ; if ( format != null ) queryParams . put ( "format" , apiClient . parameterToString ( format ) ) ; if ( profile != null ) queryParams . put ( "profile" , apiClient . parameterToString ( profile ) ) ; if ( withSource != null ) queryParams . put ( "withSource" , apiClient . parameterToString ( withSource ) ) ; if ( withAnnotations != null ) queryParams . put ( "withAnnotations" , apiClient . parameterToString ( withAnnotations ) ) ; if ( withDictionary != null ) queryParams . put ( "withDictionary" , apiClient . parameterToString ( withDictionary ) ) ; if ( withCorpus != null ) queryParams . put ( "withCorpus" , apiClient . parameterToString ( withCorpus ) ) ; if ( options != null ) queryParams . put ( "options" , apiClient . parameterToString ( options ) ) ; if ( encoding != null ) queryParams . put ( "encoding" , apiClient . parameterToString ( encoding ) ) ; if ( async != null ) queryParams . put ( "async" , apiClient . parameterToString ( async ) ) ; if ( batchId != null ) queryParams . put ( "batchId" , apiClient . parameterToString ( batchId ) ) ; if ( callback != null ) queryParams . put ( "callback" , apiClient . parameterToString ( callback ) ) ; final String [ ] accepts = { "application/json" , "multipart/mixed" , "*/*" } ; final String accept = apiClient . selectHeaderAccept ( accepts ) ; final String [ ] contentTypes = { "multipart/form-data" , "application/x-www-form-urlencoded" , "*/*" } ; final String contentType = apiClient . selectHeaderContentType ( contentTypes ) ; if ( contentType . startsWith ( "multipart/form-data" ) ) { boolean hasFields = false ; FormDataMultiPart mp = new FormDataMultiPart ( ) ; if ( input != null ) { hasFields = true ; mp . field ( "input" , input . getName ( ) ) ; mp . bodyPart ( new FileDataBodyPart ( "input" , input , MediaType . MULTIPART_FORM_DATA_TYPE ) ) ; } if ( hasFields ) postBody = mp ; } else { } try { String [ ] authNames = new String [ ] { "accessToken" , "apiKey" } ; ClientResponse response = apiClient . invokeAPI ( path , "GET" , queryParams , postBody , headerParams , formParams , accept , contentType , authNames ) ; if ( response != null ) { Object res = apiClient . deserialize ( response , "" , TranslationFileResponse . class ) ; if ( res instanceof TranslationFileResponse ) { return ( TranslationFileResponse ) res ; } TranslationFileResponse obj = new TranslationFileResponse ( ) ; if ( res instanceof InputStream ) { obj . setOutput ( ( InputStream ) res ) ; } else if ( res instanceof MultipartResponse ) { MultipartResponse multipart = ( MultipartResponse ) res ; obj . setDetectedLanguage ( multipart . getDetectedLanguage ( ) ) ; obj . setDetectedLanguageConfidence ( multipart . getDetectedLanguageConfidence ( ) ) ; obj . setSource ( multipart . getSource ( ) ) ; obj . setOutput ( multipart . getOutput ( ) ) ; } return obj ; } else { return null ; } } catch ( ApiException ex ) { throw ex ; } }
Translate File
 Translate a file from source language to target language\n\n\n* In asynchronous mode (async=true), the response will be a JSON containing a request identifier.
Translate File Translate a file from source language to target language \ n \ n \ n * In asynchronous mode ( async = true ) the response will be a JSON containing a request identifier .
// verify the required parameter 'input' is set // verify the required parameter 'target' is set // create path and map variables // query params