public ServiceCall < VoiceModel > createVoiceModel ( CreateVoiceModelOptions createVoiceModelOptions ) { Validator . notNull ( createVoiceModelOptions , "createVoiceModelOptions cannot be null" ) ; String [ ] pathSegments = { "v1/customizations" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "text_to_speech" , "v1" , "createVoiceModel" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; contentJson . addProperty ( "name" , createVoiceModelOptions . name ( ) ) ; if ( createVoiceModelOptions . language ( ) != null ) { contentJson . addProperty ( "language" , createVoiceModelOptions . language ( ) ) ; } if ( createVoiceModelOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createVoiceModelOptions . description ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( VoiceModel . class ) ) ; }
Create a custom model .