update_item_title = "Updated Item."
                  }
      liftIO $ print updatedS

runDeleteItem :: IO ()
runDeleteItem = do
  putStrLn "ユーザ名を入力してEnter、次にパスワードを入力してEnter、最後に削除したい投稿のUUIDを入力してEnterを押すこと！"
  input <- getContents
  lines <- return $ lines input

  let user = C8.pack $ lines !! 0
  let pass = C8.pack $ lines !! 1
  let uuid = C8.pack $ lines !! 2

  withAuthentication user pass
        (\err limit -> print err >> print limit) -- 認証エラー時の処理
       (\ctx -> evalStateT (runDeleteItemCore uuid) ctx) -- 認証OK後の処理

runDeleteItemCore :: B.ByteString -> StateT QiitaContext IO ()
runDeleteItemCore uuid = do
  deleteItem uuid
  return ()

runStockItem :: IO ()
runStockItem = do
  putStrLn "ユーザ名を入力してEnter、次にパスワードを入力してEnter、最後にストックしたい投稿のUUID
runUpdateItemCore :: StateT QiitaContext IO ()
runUpdateItemCore = do
  let newItem = PostItem { post_item_title = "Qiita API on Haskell"
                         , post_item_body = "Qiita API on Haskell"
                         , post_item_tags = [ PostTag "Haskell" [] ]
                         , post_item_private = True
                         , post_item_gist = False
                         , post_item_tweet = False
                         }
  postedS <- postItem newItem

  case postedS of
    Left     err -> liftIO $ print err
    Right posted -> do
      let updated = itemToUpdateItem posted
      updatedS <- updateItem updated {
                    update_item_title = "Updated Item."
                  }
      liftIO $ print updatedS
runUpdateItemCore = do
  let newItem = PostItem { post_item_title = "Qiita API on Haskell"
                         , post_item_body = "Qiita API on Haskell"
                         , post_item_tags = [ PostTag "Haskell" [] ]
                         , post_item_private = True
                         , post_item_gist = False
                         , post_item_tweet = False
                         }
  postedS <- postItem newItem

  case postedS of
    Left     err -> liftIO $ print err
    Right posted -> do
      let updated = itemToUpdateItem posted
      updatedS <- updateItem updated {
                    update_item_title = "Updated Item."
                  }
      liftIO $ print updatedS