Copyright | © 2020–present Ben Sima |
---|---|
License | MIT |
Maintainer | Ben Sima <ben@bsima.me> |
Stability | experimental |
Portability | non-portableo |
Safe Haskell | None |
Language | Haskell2010 |
About the Urbit API
The Urbit API is a command-query API that lets you hook into apps running on your Urbit. You can submit commands and subscribe to responses.
The Urbit vane eyre
is responsible for defining the API interface. The HTTP
path to the API is /~/channel/...
, where we send messages to the global
log (called poke
s) which are then dispatched to the appropriate apps. To
receive responses, we stream messages from a path associated with the app,
such as /mailbox/~/~zod/mc
. Internally, I believe Urbit calls these
wire
s.
About this library
This library helps you talk to your Urbit from Haskell, via HTTP. It handles
most of the path, session, and HTTP request stuff automatically. You'll need
to know what app and mark (data type) to send to, which path/wire listen to,
and the shape of the message. The latter can be found in the Hoon source
code, called the vase
on the poke arm.
This library is built on req, conduit, and aeson, all of which are very stable and usable libraries for working with HTTP requests and web data. Released under the MIT License, same as Urbit.
Types
Some information about your ship needed to establish connection.
Ship | |
|
Functions
:: ToJSON a | |
=> Session | Session cookie from |
-> Ship | Your ship |
-> Text | Name of the ship to poke |
-> Text | Name of the gall application you want to poke |
-> Text | The mark of the message you are sending |
-> a | The actual JSON message, serialized via aeson |
-> IO BsResponse |
Poke a ship.
Acknowledge receipt of a message. (This clears it from the ship's queue.)
:: Session | Session cookie from |
-> Ship | Your ship |
-> Text | The path to subscribe to. |
-> ConduitM ByteString Void (ResourceT IO) a | A handler conduit to receive the response from the server, e.g.
|
-> IO a |
Subscribe to ship events on some path.
Orphan instances
MonadHttp (ConduitM i o (ResourceT IO)) Source # | |
handleHttpException :: HttpException -> ConduitM i o (ResourceT IO) a # getHttpConfig :: ConduitM i o (ResourceT IO) HttpConfig # |