public ServiceCall < MessageResponse > message ( MessageOptions messageOptions ) { Validator . notNull ( messageOptions , "messageOptions cannot be null" ) ; String [ ] pathSegments = { "v2/assistants" , "sessions" , "message" } ; String [ ] pathParameters = { messageOptions . assistantId ( ) , messageOptions . sessionId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v2" , "message" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( messageOptions . input ( ) != null ) { contentJson . add ( "input" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . input ( ) ) ) ; } if ( messageOptions . context ( ) != null ) { contentJson . add ( "context" , GsonSingleton . getGson ( ) . toJsonTree ( messageOptions . context ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( MessageResponse . class ) ) ; }
Send user input to assistant .