public ServiceCall < CreateEventResponse > createEvent ( CreateEventOptions createEventOptions ) { Validator . notNull ( createEventOptions , "createEventOptions cannot be null" ) ; String [ ] pathSegments = { "v1/events" } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "discovery" , "v1" , "createEvent" ) ; 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 ( "type" , createEventOptions . type ( ) ) ; contentJson . add ( "data" , GsonSingleton . getGson ( ) . toJsonTree ( createEventOptions . data ( ) ) ) ; builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( CreateEventResponse . class ) ) ; }
Create event .