Urbit.API

Description

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.

Types

data Ship Source #

Some information about your ship needed to establish connection.

Constructors

Ship 

Fields

  • uid :: Text

    A random string for your channel

  • name :: Text

    The @p of your ship

  • lastEventId :: Int

    Track the latest event we saw (needed for poking)

  • url :: Text
  • code :: Text

    Login code, +code in the dojo. Don't share this publically

Instances

Instances details

Functions

poke Source #

Arguments

:: ToJSON a 
=> Session

Session cookie from connect

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

ack Source #

Acknowledge receipt of a message. (This clears it from the ship's queue.)

Orphan instances