-- 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 url redirects.
@package http-directory
@version 0.1.12


-- | A library for listing "files" in an http "directory".
--   
--   <pre>
--   import Network.HTTP.Directory
--   import qualified Data.Text as T
--   import qualified Data.Text.IO as T
--   
--   main = do
--     let url = "https://example.com/some/dir/"
--     files &lt;- httpDirectory' url
--     mapM_ T.putStrLn files
--     let file = url <a>+/+</a> T.unpack (head files)
--     httpFileSize' file &gt;&gt;= print
--     httpLastModified' file &gt;&gt;= print
--   </pre>
--   
--   The main methods use http-client and most of the primed ones
--   http-conduit.
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 this was the same as httpRawDirectory)
httpDirectory :: Manager -> String -> IO [Text]

-- | Like httpDirectory but uses the global 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]

-- | List all the hrefs in an http directory html file.
--   
--   Raises an error if the http request fails.
--   
--   Like httpRawDirectory but uses Network.HTTP.Simple (http-conduit)
httpRawDirectory' :: String -> IO [Text]

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

-- | Test if an file (url) exists
httpExists' :: 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 filesize (Content-Length field) of an http file
--   
--   Raises an error if the http request fails.
httpFileSize' :: 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)

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

-- | Try to get the filesize and modification time of an http file
--   
--   Raises an error if the http request fails.
httpFileSizeTime :: Manager -> String -> IO (Maybe Integer, Maybe UTCTime)

-- | Try to get the filesize and modification time of an http file
--   
--   Global Manager version.
--   
--   Raises an error if the http request fails.
httpFileSizeTime' :: String -> IO (Maybe Integer, Maybe UTCTime)

-- | Try to get the filesize and modification time together of an http file
--   Unlike httpFileSizeTime', it combines the results into one Maybe.
--   
--   Uses global Manager.
--   
--   Raises an error if the http request fails.
httpFileSizeAndTime' :: String -> IO (Maybe (Integer, UTCTime))

-- | Return the HTTP headers for a file
--   
--   Raises an error if the http request fails.
httpFileHeaders :: Manager -> String -> IO ResponseHeaders

-- | Return the HTTP headers of an http file.
--   
--   Global Manager version.
--   
--   Raises an error if the http request fails.
httpFileHeaders' :: String -> IO ResponseHeaders

-- | 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 global 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/" == "url/"
--   </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

-- | This +/+ eats extra slashes.
--   
--   <pre>
--   "dir//" +/+ "/subdir/" = "dir/subdir/"
--   </pre>
(+/+) :: String -> String -> String
infixr 5 +/+
