Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yamadapc/hzulip
A haskell wrapper for the Zulip API.
https://github.com/yamadapc/hzulip
Last synced: 2 months ago
JSON representation
A haskell wrapper for the Zulip API.
- Host: GitHub
- URL: https://github.com/yamadapc/hzulip
- Owner: yamadapc
- License: gpl-2.0
- Created: 2014-10-08T20:21:26.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-19T16:38:22.000Z (almost 5 years ago)
- Last Synced: 2024-10-11T22:53:47.098Z (3 months ago)
- Language: Haskell
- Homepage: https://yamadapc.github.io/hzulip
- Size: 177 KB
- Stars: 6
- Watchers: 5
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hzulip
======
[![Build Status](https://travis-ci.org/yamadapc/hzulip.svg?branch=master)](https://travis-ci.org/yamadapc/hzulip)
[![Hackage](https://img.shields.io/hackage/v/hzulip.svg)](https://hackage.haskell.org/package/hzulip)
[![Dependencies Status](http://img.shields.io/hackage-deps/v/hzulip.svg)](http://packdeps.haskellers.com/feed?needle=hzulip)
[![Gitter chat](https://badges.gitter.im/yamadapc/hzulip.png)](https://gitter.im/yamadapc/hzulip)
- - -
A haskell wrapper for the zulip API.## Installing
Simply installing through cabal with `cabal install hzulip` should do it.## Usage
### Getting started
```haskell
import Web.HZulipmain :: IO ()
main = withZulipCreds "zulip-api-user" "zulip-api-key" $ do
-- Since we are inside the ZulipM ReaderT monad transformer, we
-- don't need to pass options around. The above function already
-- created an HTTP manager, for connection pooling and wrapped the
-- default configuration options with the Monad:
print =<< getSubscriptions
-- >> ["haskell"]-- Sending messages is as easy as:
void $ sendStreamMessage "haskell" -- message stream
"hzulip" -- message topic
"Message from Haskell" -- message content-- Before receiving messages, our client needs to be subscribed to streams
addAllSubscriptions-- Listening for events works with a callback based API:
onNewMessage $ \msg -> do
lift $ putStrLn "Got a new message!"
let usr = messageSender msg
fn = userFullName usr
e = userEmail usrsendPrivateMessage [e] $ "Thanks for the message " ++ fn ++ "!!"
```## Documentation
The best resource on this is naturally its haddock documentation, available at
[yamadapc.github.io/hzulip](https://yamadapc.github.io/hzulip). You might also
be interested in the [zulip API documentation](https://zulip.com/api/) as well.## Examples
There are a couple of example bots and applications on the
[`examples`](https://github.com/yamadapc/hzulip/tree/master/examples) directory. If you're getting started with Haskell, I'd
suggest looking at the [`ZulipLogger`](https://github.com/yamadapc/hzulip/blob/master/examples/src/ZulipLogger.hs) and
[`ZulipEchoBot`](https://github.com/yamadapc/hzulip/blob/master/examples/src/ZulipEchoBot.hs) which show of basic API usage
with minimal noise from anything else.## A higher-level API
A [`Conduit`](https://www.fpcomplete.com/user/snoyberg/library-documentation/conduit-overview)
API is provided as well and an "echo" example is available for it in the
examples directory; [here](https://github.com/yamadapc/hzulip/blob/master/examples/src/ZulipConduitBot.hs). You can compare the evented implementation and see which you
like best. Right now using streams to handle output is a bit unhandy, but it
provides a nice composable high-level interface for the events.- - -
Other than the echo and logger examples; there's also a pretty logger at [`ZulipCli`](https://github.com/yamadapc/hzulip/blob/master/examples/src/ZulipCli.hs).## A remote evaluation bot
Though slightly outdated, there's a remote evaluation Zulip bot using this
library at [zulip-eval-bot](https://github.com/yamadapc/zulip-eval-bot), which
might be worth taking a look at as well.## License
This code is licensed under the GPLv2 license for Pedro Tacla Yamada. Plese
refer to [LICENSE](/LICENSE) for more information.## Donations
Would you like to buy me a beer? Send bitcoin to 3JjxJydvoJjTrhLL86LGMc8cNB16pTAF3y