-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | http directory listing library
--   
--   Library for listing the files (href's) in an http directory. It can
--   also check the size, existence, modtime of files, and for url
--   redirects.
@package http-directory
@version 0.1.8


-- | A library for listing "files" in an http "directory".
--   
--   <pre>
--   import Network.HTTP.Directory
--   import qualified Data.Text as T
--   
--   main = do
--     mgr &lt;- httpManager
--     let url = "<a>https://example.com/some/dir/"</a>
--     files &lt;- httpDirectory mgr url
--     mapM_ T.putStrLn files
--     let file = url <a>/</a> T.unpack (head files)
--     httpFileSize mgr file &gt;&gt;= print
--     httpLastModified mgr file &gt;&gt;= print
--   </pre>
module Network.HTTP.Directory

-- | List the files (hrefs) in an http directory
--   
--   It filters out absolute urls &amp; paths, queries, '..', and
--   <tt>#</tt> links.
--   
--   Raises an error if the http request fails.
--   
--   Note if the directory (webpage) url is redirected to a different path
--   you may need to use <a>httpRedirect</a> to determine the actual final
--   url prefix for relative links (files).
--   
--   (before 0.1.4 it was just httpRawDirectory)
httpDirectory :: Manager -> String -> IO [Text]

-- | Like httpDirectory but uses own Manager
httpDirectory' :: String -> IO [Text]

-- | List all the hrefs in an http directory html file.
--   
--   Raises an error if the http request fails.
--   
--   Note if the directory (webpage) url is redirected to a different path
--   you may need to use <a>httpRedirect</a> to determine the actual final
--   url prefix for relative links (files).
httpRawDirectory :: Manager -> String -> IO [Text]

-- | Test if an file (url) exists
httpExists :: Manager -> String -> IO Bool

-- | Try to get the filesize (Content-Length field) of an http file
--   
--   Raises an error if the http request fails.
httpFileSize :: Manager -> String -> IO (Maybe Integer)

-- | Try to get the modification time (Last-Modified field) of an http file
--   
--   Raises an error if the http request fails.
httpLastModified :: Manager -> String -> IO (Maybe UTCTime)

-- | alias for 'newManager tlsManagerSettings' so one does not need to
--   import http-client etc
httpManager :: IO Manager

-- | Return final redirect for an url
httpRedirect :: Manager -> String -> IO (Maybe ByteString)

-- | Like httpRedirect but uses own Manager.
httpRedirect' :: String -> IO (Maybe ByteString)

-- | Returns the list of http redirects for an url in reverse order (ie
--   last redirect is listed first)
httpRedirects :: Manager -> String -> IO [ByteString]

-- | Test if string starts with http[s]:
isHttpUrl :: String -> Bool

-- | Make sure an url ends with "/"
--   
--   <pre>
--   trailingSlash "url" == "url/"
--   trailingSlash "url<i>" == "url</i>"
--   </pre>
trailingSlash :: String -> String

-- | Remove all trailing slashes from filename or url
--   
--   <pre>
--   noTrailingSlash "dir/" == "dir"
--   noTrailingSlash "dir//" == "dir"
--   </pre>
noTrailingSlash :: Text -> Text
data Manager
