Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Event = Event {}
- data Message = Message {}
- data Queue = Queue {
- queueId :: String
- lastEventId :: Int
- data User = User {
- userId :: Int
- userFullName :: String
- userEmail :: String
- userDomain :: String
- userShortName :: String
- data ZulipClient = ZulipClient {}
- type EventCallback = Event -> IO ()
- defaultBaseUrl :: String
- getEvents :: ZulipClient -> Queue -> Bool -> IO (Queue, [Event])
- newZulip :: String -> String -> ZulipClient
- onNewEvent :: ZulipClient -> Bool -> EventCallback -> IO ()
- registerQueue :: ZulipClient -> [String] -> Bool -> IO Queue
- sendMessage :: ZulipClient -> String -> [String] -> String -> String -> IO Int
Documentation
Represents zulip events
Represents a Zulip Message
Message | |
|
Represents a zulip user account - for both display_recipient
and
message_sender
representations
User | |
|
data ZulipClient Source
Represents a Zulip API client
type EventCallback = Event -> IO () Source
The root type for Event callbacks
defaultBaseUrl :: String Source
The default zulip API URL
getEvents :: ZulipClient -> Queue -> Bool -> IO (Queue, [Event]) Source
Fetches new set of events from a Queue
.
newZulip :: String -> String -> ZulipClient Source
Helper for creating a ZulipClient
with the baseUrl
set to
defaultBaseUrl
onNewEvent :: ZulipClient -> Bool -> EventCallback -> IO () Source
Registers an event callback for all events and keeps executing it over events as they come in. Will loop forever
registerQueue :: ZulipClient -> [String] -> Bool -> IO Queue Source
This registers a new event queue with the zulip API. It's a lower level
function, which shouldn't be used unless you know what you're doing. It
takes a ZulipClient
, a list of names of the events you want to listen
for and whether you'd like for the content to be rendered in HTML format
(if you set the last parameter to False
it will be kept as typed, in
markdown format)
sendMessage :: ZulipClient -> String -> [String] -> String -> String -> IO Int Source
This wraps `POST https://api.zulip.com/v1/messages` with a nicer root API. Simpler helpers for each specific case of this somewhat overloaded endpoint will also be provided in the future.
It takes the message mtype
, mrecipients
, msubject
and mcontent
and returns the created message's id
in the IO
monad.