apiCreateEvent :: ToJSON event => URI -> event -> IO (Either String ())
apiCreateEvent baseUrl event = do
  let endpoint = baseUrl { uriPath = uriPath baseUrl ++ "/create-event" }
      req :: Request BSL.ByteString
      req = buildRequest POST endpoint $ encode event
  eresp <- simpleHTTP req
  return $ case eresp of
    Left err   -> Left $ "Error from HTTP: " ++ show err
    Right resp -> case rspCode resp of
      (2, 0, 1) -> Right ()
      _         -> Left "Error code returned" -- FIXME (return a Maybe CreationError ?)
apiCreateEvent :: ToJSON event => URI -> event -> IO (Either String ())
apiCreateEvent baseUrl event = do
  let endpoint = baseUrl { uriPath = uriPath baseUrl ++ "/create-event" }
      req :: Request BSL.ByteString
      req = buildRequest POST endpoint $ encode event
  eresp <- simpleHTTP req
  return $ case eresp of
    Left err   -> Left $ "Error from HTTP: " ++ show err
    Right resp -> case rspCode resp of
      (2, 0, 1) -> Right ()
      _         -> Left "Error code returned" -- FIXME (return a Maybe CreationError ?)
apiCreateEvent baseUrl event = do
  let endpoint = baseUrl { uriPath = uriPath baseUrl ++ "/create-event" }
      req :: Request BSL.ByteString
      req = buildRequest POST endpoint $ encode event
  eresp <- simpleHTTP req
  return $ case eresp of
    Left err   -> Left $ "Error from HTTP: " ++ show err
    Right resp -> case rspCode resp of
      (2, 0, 1) -> Right ()
      _         -> Left "Error code returned" -- FIXME (return a Maybe CreationError ?)