Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/figbus/elm-urbit-api
Elm wrapper for the Urbit HTTP API
https://github.com/figbus/elm-urbit-api
Last synced: 7 days ago
JSON representation
Elm wrapper for the Urbit HTTP API
- Host: GitHub
- URL: https://github.com/figbus/elm-urbit-api
- Owner: figbus
- License: mit
- Created: 2021-06-05T18:46:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-03T04:21:22.000Z (about 3 years ago)
- Last Synced: 2024-08-03T01:15:24.998Z (4 months ago)
- Language: Elm
- Homepage: https://package.elm-lang.org/packages/figbus/elm-urbit-api/latest/
- Size: 188 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-urbit - Elm
README
# Elm Urbit HTTP API
[![](https://img.shields.io/badge/~-awesome%20urbit-lightgrey)](https://github.com/urbit/awesome-urbit)
This is an Elm wrapper for the [Urbit](https://urbit.org/) HTTP API, making it
easy to interact with Urbit from any Elm application.## Examples
```elm
import Random
import Time
import Json.Encode
import Urbitconnect : Int -> Time.Posix -> Cmd Msg
connect entropy time =
Urbit.connect
{ ship = zod
, url = "http://localhost:8080"
, channelId =
Random.initialSeed entropy
|> Random.step (Urbit.channelId time)
|> Tuple.first
, code = "lidlut-tabwed-pillex-ridrup"
}
GotConnectionpoke : Urbit.Session -> ( Urbit.Session, Cmd Msg )
poke session =
Urbit.poke
{ ship = zod
, app = "hood"
, mark = "helm-hi"
, json = Json.Encode.string "opening airlock"
}
|> Urbit.send session PokedHood
```See the `example/` folder for a more complete example.
## Ports Disclaimer
Because Elm does not support the [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource)
API, some additional work is required to create the ports necessary for most
functionality. See the `Urbit.setupEventSource` documentation for details.