-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | complete binding to the Telegram Database Library
--
-- Please see the README on GitHub at
-- https://github.com/poscat0x04/tdlib#readme
@package tdlib
@version 0.1.5
module Paths_tdlib
version :: Version
getBinDir :: IO FilePath
getLibDir :: IO FilePath
getDynLibDir :: IO FilePath
getDataDir :: IO FilePath
getLibexecDir :: IO FilePath
getDataFileName :: FilePath -> IO FilePath
getSysconfDir :: IO FilePath
module TDLib.Errors
data TDLibError
-- | Recieved an answer but the field "@extra" is not present or is not a
-- integer
ExtraFieldNotInt :: !Value -> TDLibError
-- | The json value cannot be parsed into the expected data type
UnableToParseJSON :: !ByteString -> TDLibError
-- | The bytestring failed to be parsed into a Value
UnableToParseValue :: !Value -> TDLibError
-- | Unknown Error
UnknownError :: TDLibError
instance GHC.Exception.Type.Exception TDLib.Errors.TDLibError
instance GHC.Classes.Eq TDLib.Errors.TDLibError
instance GHC.Show.Show TDLib.Errors.TDLibError
-- | Bindings to TDLib Json interface
module TDLib.TDJson
-- | TDLib client, will be automacially destroyed as soon as there are no
-- references pointing to it (backed by ForeignPtr)
data Client
-- | Creates a new instance of TDLib.
newClient :: IO Client
-- | Destroys the TDLib client instance. After this is called the client
-- instance shouldn't be used anymore.
destroyClient :: Client -> IO ()
-- | Receives incoming updates and request responses from the TDLib client.
-- May be called from any thread, but shouldn't be called simultaneously
-- from two different threads. Returned pointer will be deallocated by
-- TDLib during next call to clientReceive or clientExecute
-- in the same thread, so it can't be used after that.
clientReceive :: Client -> Double -> IO (Maybe ByteString)
-- | Sends request to the TDLib client. May be called from any thread.
clientSend :: Client -> ByteString -> IO ()
-- | Synchronously executes TDLib request. May be called from any thread.
-- Only a few requests can be executed synchronously. Returned pointer
-- will be deallocated by TDLib during next call to clientReceive
-- or clientExecute in the same thread, so it can't be used after
-- that.
clientExecute :: Client -> ByteString -> IO (Maybe ByteString)
-- | Sets the path to the file where the internal TDLib log will be
-- written. By default TDLib writes logs to stderr or an OS specific log.
-- Use this method to write the log to a file instead.
setLogFilePath :: ByteString -> IO Bool
-- | Sets the maximum size of the file to where the internal TDLib log is
-- written before the file will be auto-rotated. Unused if log is not
-- written to a file. Defaults to 10 MB.
setLogMaxFileSize :: Int64 -> IO ()
-- | Sets the verbosity level of the internal logging of TDLib. By default
-- the TDLib uses a log verbosity level of Verbose.
setLogVerbosityLevel :: Verbosity -> IO ()
-- | Sets the callback that will be called when a fatal error happens. None
-- of the TDLib methods can be called from the callback. The TDLib will
-- crash as soon as callback returns. By default the callback is not set.
setLogFatalErrorCallback :: (ByteString -> IO ()) -> IO ()
instance GHC.Show.Show TDLib.TDJson.Client
instance GHC.Classes.Ord TDLib.TDJson.Client
instance GHC.Classes.Eq TDLib.TDJson.Client
-- | A heavyweight TDLib effect intepreter written using event loop
module TDLib.EventLoop
-- | runs the TDLib effect
runTDLibEventLoop :: Members '[Embed IO] r => Double -> InChan Update -> Sem (TDLib : r) a -> Sem r a
-- | runs a command and waits for its answer
runCommand :: (ToJSON a, FromJSON b, FromJSON err) => Client -> Int -> Locks -> Ans -> a -> IO (err ∪ b)
-- | runs the event loop that receives updates from the client and
-- dispatches them
loop :: Client -> Double -> Locks -> Ans -> InChan Update -> IO a