public ServiceCall < Void > addCorpus ( AddCorpusOptions addCorpusOptions ) { Validator . notNull ( addCorpusOptions , "addCorpusOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" , "corpora" } ; String [ ] pathParameters = { addCorpusOptions . customizationId ( ) , addCorpusOptions . corpusName ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "speech_to_text" , "v1" , "addCorpus" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( addCorpusOptions . allowOverwrite ( ) != null ) { builder . query ( "allow_overwrite" , String . valueOf ( addCorpusOptions . allowOverwrite ( ) ) ) ; } builder . body ( RequestUtils . inputStreamBody ( addCorpusOptions . corpusFile ( ) , "text/plain" ) ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getVoid ( ) ) ; }
Add a corpus .