Skip to content

Commit

Permalink
slack, example: add image block, fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
sewenthy committed May 17, 2024
1 parent b9a417d commit 067c31d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion examples/echo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ let slack_echo_event_handler ctx event =
let link_unfurl : unfurl =
match !alternate_unfurl with
| true ->
Blocks { blocks = [ Section { text = { text_type = Mrkdwn; text = "some other text in a section" } } ] }
Blocks
{
blocks =
[ Section { text = { text_type = Mrkdwn; text = "some other text in a section" }; accessory = None } ];
}
| false -> Message_attachment (make_message_attachment ~text:"i unfurled this link!" ())
in
alternate_unfurl := not !alternate_unfurl;
Expand Down
5 changes: 3 additions & 2 deletions lib/slack.atd
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ type message_attachment <ocaml attr="deriving make"> = {
?footer: string nullable;
}

type image_accessory_object <ocaml attr="deriving make"> = {
type image_object <ocaml attr="deriving make"> = {
image_url: string;
~alt_text <ocaml default="\"\"">: string;
}

type accessory_object = [
Image <json name="image"> of image_accessory_object
Image <json name="image"> of image_object
] <ocaml repr="classic"> <json adapter.ocaml="Atdgen_runtime.Json_adapter.Type_field">


Expand All @@ -65,6 +65,7 @@ type divider = {

type message_block = [
Section <json name="section"> of message_text_block
| Image <json name="image"> of image_object
| Divider <json name="divider"> of divider
] <ocaml repr="classic"> <json adapter.ocaml="Atdgen_runtime.Json_adapter.Type_field">

Expand Down

0 comments on commit 067c31d

Please sign in to comment.