hzulip-0.2.0.2: A haskell wrapper for the Zulip API.

Safe HaskellNone
LanguageHaskell2010

HZulip

Synopsis

Documentation

data Event Source

Represents zulip events

Constructors

Event 

Instances

data Queue Source

Represents some event queue

Constructors

Queue 

Fields

queueId :: String
 
lastEventId :: Int
 

data User Source

Represents a zulip user account - for both display_recipient and message_sender representations

Instances

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 [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 String 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.