public ServiceCall < Intent > createIntent ( CreateIntentOptions createIntentOptions ) { Validator . notNull ( createIntentOptions , "createIntentOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "intents" } ; String [ ] pathParameters = { createIntentOptions . workspaceId ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createIntent" ) ; 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 ( "intent" , createIntentOptions . intent ( ) ) ; if ( createIntentOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createIntentOptions . description ( ) ) ; } if ( createIntentOptions . examples ( ) != null ) { contentJson . add ( "examples" , GsonSingleton . getGson ( ) . toJsonTree ( createIntentOptions . examples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Intent . class ) ) ; }
Create intent .