createRelease
    :: Session
    -> ByteString
    -> ByteString
    -> ByteString
    -> ByteString
    -> IO (Either CreateFailure (Response LB.ByteString))
createRelease session token owner repo tagName =
    resp >>= \ r -> return $ case r ^. responseStatus . statusCode of
        401 -> Left AuthFail
        _ -> Right r
  where
    resp = postWith (opts token) session uri content
    uri = B.unpack $ mconcat
        ["https://api.github.com/repos/", owner, "/", repo, "/releases"]
    content = mconcat
        [ "{\"tag_name\":\"", tagName, "\",\"name\":\"", tagName
        , "\",\"draft\":true,\"prerelease\":false,\
            \\"target_commitish\":\"master\"}"
        ]
createRelease
    :: Session
    -> ByteString
    -> ByteString
    -> ByteString
    -> ByteString
    -> IO (Either CreateFailure (Response LB.ByteString))
createRelease session token owner repo tagName =
    resp >>= \ r -> return $ case r ^. responseStatus . statusCode of
        401 -> Left AuthFail
        _ -> Right r
  where
    resp = postWith (opts token) session uri content
    uri = B.unpack $ mconcat
        ["https://api.github.com/repos/", owner, "/", repo, "/releases"]
    content = mconcat
        [ "{\"tag_name\":\"", tagName, "\",\"name\":\"", tagName
        , "\",\"draft\":true,\"prerelease\":false,\
            \\"target_commitish\":\"master\"}"
        ]
createRelease session token owner repo tagName =
    resp >>= \ r -> return $ case r ^. responseStatus . statusCode of
        401 -> Left AuthFail
        _ -> Right r
  where
    resp = postWith (opts token) session uri content
    uri = B.unpack $ mconcat
        ["https://api.github.com/repos/", owner, "/", repo, "/releases"]
    content = mconcat
        [ "{\"tag_name\":\"", tagName, "\",\"name\":\"", tagName
        , "\",\"draft\":true,\"prerelease\":false,\
            \\"target_commitish\":\"master\"}"
        ]