public ServiceCall < TrainingQuery > addTrainingData ( AddTrainingDataOptions addTrainingDataOptions ) { Validator . notNull ( addTrainingDataOptions , "addTrainingDataOptions cannot be null" ) ; String [ ] pathSegments = { "v1/environments" , "collections" , "training_data" } ; String [ ] pathParameters = { addTrainingDataOptions . environmentId ( ) , addTrainingDataOptions . collectionId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "discovery" , "v1" , "addTrainingData" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( addTrainingDataOptions . naturalLanguageQuery ( ) != null ) { contentJson . addProperty ( "natural_language_query" , addTrainingDataOptions . naturalLanguageQuery ( ) ) ; } if ( addTrainingDataOptions . filter ( ) != null ) { contentJson . addProperty ( "filter" , addTrainingDataOptions . filter ( ) ) ; } if ( addTrainingDataOptions . examples ( ) != null ) { contentJson . add ( "examples" , GsonSingleton . getGson ( ) . toJsonTree ( addTrainingDataOptions . examples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( TrainingQuery . class ) ) ; }
Add query to training data .