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


-- | Transfer files with FTP and FTPS
--   
--   ftp-client is a library for communicating with an FTP server. It works
--   over both a clear channel or TLS.
@package ftp-client
@version 0.5.1.1


module Network.FTP.Client

-- | Takes a host name and port. A handle for interacting with the server
--   will be returned in a callback.
--   
--   <pre>
--   withFTP "ftp.server.com" 21 $ h welcome -&gt; do
--       print welcome
--       login h "username" "password"
--       print =&lt;&lt; nlst h []
--   </pre>
withFTP :: (MonadIO m, MonadMask m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m a

-- | Takes a host name and port. A handle for interacting with the server
--   will be returned in a callback. The commands will be protected with
--   TLS.
--   
--   <pre>
--   withFTPS "ftps.server.com" 21 $ h welcome -&gt; do
--       print welcome
--       login h "username" "password"
--       print =&lt;&lt; nlst h []
--   </pre>
withFTPS :: (MonadMask m, MonadIO m) => String -> Int -> (Handle -> FTPResponse -> m a) -> m a
login :: MonadIO m => Handle -> String -> String -> m FTPResponse
pasv :: MonadIO m => Handle -> m (String, Int)
rename :: MonadIO m => Handle -> String -> String -> m FTPResponse
dele :: MonadIO m => Handle -> String -> m FTPResponse
cwd :: MonadIO m => Handle -> String -> m FTPResponse
size :: MonadIO m => Handle -> String -> m Int
mkd :: MonadIO m => Handle -> String -> m String
rmd :: MonadIO m => Handle -> String -> m FTPResponse
pwd :: MonadIO m => Handle -> m String
quit :: MonadIO m => Handle -> m FTPResponse
nlst :: (MonadIO m, MonadMask m) => Handle -> [String] -> m ByteString
retr :: (MonadIO m, MonadMask m) => Handle -> String -> m ByteString
list :: (MonadIO m, MonadMask m) => Handle -> [String] -> m ByteString
stor :: (MonadIO m, MonadMask m) => Handle -> String -> ByteString -> RTypeCode -> m ()
mlsd :: (MonadIO m, MonadMask m) => Handle -> String -> m [MlsxResponse]
mlst :: (MonadIO m, MonadMask m) => Handle -> String -> m MlsxResponse

-- | Commands according to the FTP specification
data FTPCommand
User :: String -> FTPCommand
Pass :: String -> FTPCommand
Acct :: String -> FTPCommand
RType :: RTypeCode -> FTPCommand
Retr :: String -> FTPCommand
Nlst :: [String] -> FTPCommand
Port :: HostAddress -> PortNumber -> FTPCommand
Stor :: String -> FTPCommand
List :: [String] -> FTPCommand
Rnfr :: String -> FTPCommand
Rnto :: String -> FTPCommand
Dele :: String -> FTPCommand
Size :: String -> FTPCommand
Mkd :: String -> FTPCommand
Rmd :: String -> FTPCommand
Pbsz :: Int -> FTPCommand
Prot :: ProtType -> FTPCommand
Mlsd :: String -> FTPCommand
Mlst :: String -> FTPCommand
Cwd :: String -> FTPCommand
Cdup :: FTPCommand
Ccc :: FTPCommand
Auth :: FTPCommand
Pwd :: FTPCommand
Abor :: FTPCommand
Pasv :: FTPCommand
Quit :: FTPCommand

-- | Response from an FTP command. ex "200 Welcome!"
data FTPResponse
FTPResponse :: ResponseStatus -> Int -> FTPMessage -> FTPResponse

-- | Interpretation of the first digit of an FTP response code
[frStatus] :: FTPResponse -> ResponseStatus

-- | The three digit response code
[frCode] :: FTPResponse -> Int

-- | Text of the response
[frMessage] :: FTPResponse -> FTPMessage

-- | First digit of an FTP response
data ResponseStatus

-- | 1
Wait :: ResponseStatus

-- | 2
Success :: ResponseStatus

-- | 3
Continue :: ResponseStatus

-- | 4
FailureRetry :: ResponseStatus

-- | 5
Failure :: ResponseStatus
data MlsxResponse
MlsxResponse :: String -> Map String String -> MlsxResponse
[mrFilename] :: MlsxResponse -> String
[mrFacts] :: MlsxResponse -> Map String String
data RTypeCode
TA :: RTypeCode
TI :: RTypeCode
data PortActivity
Active :: PortActivity
Passive :: PortActivity
data ProtType
P :: ProtType
C :: ProtType
data Security
Clear :: Security
TLS :: Security

-- | Can send and recieve a <a>ByteString</a>.
data Handle
Handle :: (ByteString -> IO ()) -> (ByteString -> IO ()) -> (Int -> IO ByteString) -> IO ByteString -> Security -> Handle
[send] :: Handle -> ByteString -> IO ()
[sendLine] :: Handle -> ByteString -> IO ()
[recv] :: Handle -> Int -> IO ByteString
[recvLine] :: Handle -> IO ByteString
[security] :: Handle -> Security
data FTPException
FailureRetryException :: FTPResponse -> FTPException
FailureException :: FTPResponse -> FTPException
UnsuccessfulException :: FTPResponse -> FTPException
BogusResponseFormatException :: FTPResponse -> FTPException
BadProtocolResponseException :: ByteString -> FTPException
sIOHandleImpl :: Handle -> Handle
tlsHandleImpl :: Connection -> Handle

-- | Send a command to the server and get a response back. Some commands
--   use a data <a>Handle</a>, and their data is not returned here.
sendCommand :: MonadIO m => Handle -> FTPCommand -> m FTPResponse
sendCommandS :: MonadIO m => Handle -> FTPCommand -> m FTPResponse

-- | Equvalent to
--   
--   <pre>
--   mapM . sendCommand
--   </pre>
sendAll :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse]

-- | Equvalent to
--   
--   <pre>
--   mapM . sendCommandS
--   </pre>
sendAllS :: MonadIO m => Handle -> [FTPCommand] -> m [FTPResponse]

-- | Get a line from the server
getLineResp :: Handle -> IO ByteString

-- | Get a full response from the server Used in <a>sendCommand</a>
getResponse :: MonadIO m => Handle -> m FTPResponse
getResponseS :: MonadIO m => Handle -> m FTPResponse
sendCommandLine :: MonadIO m => Handle -> ByteString -> m ()

-- | Send setup commands to the server and create a data <a>Handle</a>
createSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> FTPCommand -> m Handle

-- | Send setup commands to the server and create a data TLS connection
createTLSSendDataCommand :: (MonadIO m, MonadMask m) => Handle -> PortActivity -> FTPCommand -> m Connection
parseMlsxLine :: ByteString -> MlsxResponse
instance GHC.Show.Show Network.FTP.Client.MlsxResponse
instance GHC.Show.Show Network.FTP.Client.FTPException
instance GHC.Classes.Eq Network.FTP.Client.ResponseStatus
instance GHC.Show.Show Network.FTP.Client.ResponseStatus
instance GHC.Show.Show Network.FTP.Client.FTPCommand
instance GHC.Exception.Type.Exception Network.FTP.Client.FTPException
instance GHC.Show.Show Network.FTP.Client.FTPResponse
instance GHC.Show.Show Network.FTP.Client.FTPMessage
