Current section
Files
Jump to
Current section
Files
src/chilp.erl
-module(chilp).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/chilp.gleam").
-export([bluesky/2, mastodon/2, widget/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/chilp.gleam", 14).
?DOC(
" An anchor to the Bluesky post you want to \n"
" fetch comments from.\n"
" | Parameter | Description |\n"
" | --------- | ----------- |\n"
" | `did` | Your DID, for `@strawmelonjuice.com`, this looks like `\"did:plc:jgtfsmv25thfs4zmydtbccnn\"`.<br><br>Not sure how to find your DID? <https://bsky-did.neocities.org> is one of the many places where you can easily find it. |\n"
" | `post_id` | A post id to bind to, you'll find this in a post url `https://bsky.app/profile/<your-username-or-did>/post/[postid]` |\n"
"\n"
"\n"
" You can also construct this directly if you import `chilp/widget/anchors`.\n"
).
-spec bluesky(binary(), binary()) -> chilp@widget@anchors:bluesky().
bluesky(Did, Postid) ->
{bluesky, Did, Postid}.
-file("src/chilp.gleam", 28).
?DOC(
" \n"
" An anchor to the Fediverse post you want to \n"
" fetch comments from.\n"
" | Parameter | Description |\n"
" | ---------- | ----------- |\n"
" | `instance` | The instance name, e.g. `\"mastodon.social\"`, this is where your post is stored, and where chilp will attempt to fetch it from. |\n"
" | `post_id` | A post id to bind to, you'll find this in a post url `https://instance.social/@<username>/[postid]`. |\n"
" | | On Sharkey or Misskey this is a note id, found `https://instance.social/notes/[note-id]` |\n"
"\n"
" You can also construct this directly if you import `chilp/widget/anchors`.\n"
).
-spec mastodon(binary(), binary()) -> chilp@widget@anchors:mastodon().
mastodon(Instance, Postid) ->
{mastodon, Instance, Postid}.
-file("src/chilp.gleam", 46).
?DOC(
" Widget component!\n"
" Before adding this component make sure to call `widget.register()` to register it!\n"
"\n"
" Little example:\n"
" ```gleam\n"
" chilp.widget(\n"
" // We connect to Bluesky...\n"
" bluesky: option.Some(chilp.bluesky(\"did:plc:my-did\",\"myPostId\")),\n"
" // ...But not to Mastodon? Sure! Make it a None!\n"
" mastodon: option.None\n"
" )\n"
" ```\n"
"\n"
" You can also construct this directly if you import `chilp/widget`.\n"
).
-spec widget(
gleam@option:option(chilp@widget@anchors:bluesky()),
gleam@option:option(chilp@widget@anchors:mastodon())
) -> lustre@vdom@vnode:element(any()).
widget(Bsky, Masto) ->
chilp@widget:element(Masto, Bsky).