-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Talk to Urbit from Haskell
--
-- urbit-api is a Haskell library that helps you connect to the
-- Urbit API.
--
-- Built on req, conduit, and aeson for stability and simplicity.
@package urbit-api
@version 0.2.0.0
-- |
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 pokes) 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
-- wires.
--
-- 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.
module Urbit.API
-- | Some information about your ship needed to establish connection.
data Ship
Ship :: Text -> Text -> Int -> Text -> Text -> Ship
-- | A random string for your channel
[uid] :: Ship -> Text
-- | The @p of your ship
[name] :: Ship -> Text
-- | Track the latest event we saw (needed for poking)
[lastEventId] :: Ship -> Int
-- | Network access point, with port if necessary, like
-- https://sampel-palnet.arvo.network, or
-- http://localhost:8080
[url] :: Ship -> Text
-- | Login code, +code in the dojo. Don't share this publically
[code] :: Ship -> Text
-- | A wrapper type for the session cookies.
type Session = CookieJar
-- | Connect and login to the ship.
connect :: Ship -> IO Session
-- | Poke a ship.
poke :: ToJSON a => Session -> Ship -> Text -> Text -> Text -> a -> IO BsResponse
-- | Acknowledge receipt of a message. (This clears it from the ship's
-- queue.)
ack :: Session -> Ship -> Int -> IO BsResponse
-- | Subscribe to ship events on some path.
subscribe :: Session -> Ship -> Text -> ConduitM ByteString Void (ResourceT IO) a -> IO a
instance GHC.Show.Show Urbit.API.Ship
instance Network.HTTP.Req.MonadHttp (Data.Conduit.Internal.Conduit.ConduitM i o (Control.Monad.Trans.Resource.Internal.ResourceT GHC.Types.IO))