Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ncitron/oframl
A framework for building Farcaster Frames in OCaml
https://github.com/ncitron/oframl
Last synced: 22 days ago
JSON representation
A framework for building Farcaster Frames in OCaml
- Host: GitHub
- URL: https://github.com/ncitron/oframl
- Owner: ncitron
- License: mit
- Created: 2024-02-02T03:53:31.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-02-04T02:36:50.000Z (10 months ago)
- Last Synced: 2024-11-17T03:30:33.535Z (25 days ago)
- Language: OCaml
- Size: 15.6 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-frames - Oframl framework for building frames in OCaml
- awesome-farcaster - ncitron.eth's oframl
README
## Oframl
Oframl is a simple framework for building Farcaster Frames in OCaml.## Usage
```OCaml
open Oframllet image_handler (data : string) =
let str = if String.equal data "initial" then
"Click to fetch FID"
else
[%string "FID: %{data}"]
in
[%string
{|
%{str}
|}]
;;let frame_handler (): frame =
{ title = "FID Check"
; image_extra_data = "initial"
; post_extra_data = ""
; buttons = [ { content = "Check FID" } ]
}
;;let post_handler (act : action) (_data : string) : frame =
{ title = "FID Check"
; image_extra_data = string_of_int act.fid
; post_extra_data = ""
; buttons = []
}
;;let base_url = "https://df78-72-69-118-50.ngrok-free.app" in
let start = Server.start base_url frame_handler post_handler image_handler in
Lwt_main.run start
```## Examples
To view more examples see [examples](./examples)