package ozulip

  1. Overview
  2. Docs
OCaml bindings to Zulip API

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=4173fefee440773dd0f8d7db5a2e01e5
sha512=cb53870eb8d41f53cf6de636d060fe1eee6c39f7c812eacb803b33f9998242bfb12798d4922e7633aa3035cf2ab98018987b380fb3f380f80d7270e56359c5d8

Description

Tags

zulip bindings api

Published: 28 Jun 2023

README

ozulip

OCaml bindings to Zulip API.

Messages

Send message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        Messages.send_message conf dest "New message from `ozulip`" 

Upload a file

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let%lwt uri = Messages.upload_file conf "/path/to/your/file" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let msg = Format.sprintf "Check out the [this file](%s)!" uri in 
        Messages.send_message conf dest msg

Edit message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let%lwt mess_id =  Messages.send_message conf dest "New message from `ozulip`" in
        Messages.edit_message ~content:"New content of my message" mess_id

Delete message

    let _ =
        let open Ozulip in
        let conf = init "www.domain.com" "email@email.com" "key" in
        let dest = Messages.stream_name "general" "welcom topic" in
        let%lwt mess_id =  Messages.send_message conf dest "New message from `ozulip`" in
        Messages.delete_message mess_id

High-level user interaction

    let _ =
        let open Ozulip in
        let conf = init ~domain ~email ~key in
        Events.interact ~trusted_emails:["you@example.com"] conf (fun msg ->
            if String.lowercase_ascii msg = "ping"
            then Lwt.return_some "pong"
            else Lwt.return_none)

Dependencies (12)

  1. logs
  2. yojson
  3. cohttp-lwt-unix
  4. ez_file >= "0.3.0"
  5. lwt >= "5.4.0"
  6. logs
  7. json-data-encoding >= "1.0.0"
  8. base64
  9. re
  10. ez_api >= "2.0.0"
  11. dune >= "2.0"
  12. ocaml >= "4.10"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.