public ServiceCall < Workspace > createWorkspace ( CreateWorkspaceOptions createWorkspaceOptions ) { String [ ] pathSegments = { "v1/workspaces" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "createWorkspace" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; if ( createWorkspaceOptions != null ) { final JsonObject contentJson = new JsonObject ( ) ; if ( createWorkspaceOptions . name ( ) != null ) { contentJson . addProperty ( "name" , createWorkspaceOptions . name ( ) ) ; } if ( createWorkspaceOptions . description ( ) != null ) { contentJson . addProperty ( "description" , createWorkspaceOptions . description ( ) ) ; } if ( createWorkspaceOptions . language ( ) != null ) { contentJson . addProperty ( "language" , createWorkspaceOptions . language ( ) ) ; } if ( createWorkspaceOptions . metadata ( ) != null ) { contentJson . add ( "metadata" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . metadata ( ) ) ) ; } if ( createWorkspaceOptions . learningOptOut ( ) != null ) { contentJson . addProperty ( "learning_opt_out" , createWorkspaceOptions . learningOptOut ( ) ) ; } if ( createWorkspaceOptions . systemSettings ( ) != null ) { contentJson . add ( "system_settings" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . systemSettings ( ) ) ) ; } if ( createWorkspaceOptions . intents ( ) != null ) { contentJson . add ( "intents" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . intents ( ) ) ) ; } if ( createWorkspaceOptions . entities ( ) != null ) { contentJson . add ( "entities" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . entities ( ) ) ) ; } if ( createWorkspaceOptions . dialogNodes ( ) != null ) { contentJson . add ( "dialog_nodes" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . dialogNodes ( ) ) ) ; } if ( createWorkspaceOptions . counterexamples ( ) != null ) { contentJson . add ( "counterexamples" , GsonSingleton . getGson ( ) . toJsonTree ( createWorkspaceOptions . counterexamples ( ) ) ) ; } builder . bodyJson ( contentJson ) ; } return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Workspace . class ) ) ; }
Create workspace .