Packages

A Gleam library for building Discord webhook payloads safely.

Current section

Files

Jump to
kitazith src kitazith@component.erl
Raw

src/kitazith@component.erl

-module(kitazith@component).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/kitazith/component.gleam").
-export([raw/1, text_display/1, section/1, media_gallery/1, file/1, separator/1, container/1, to_json/1]).
-export_type([component/0]).
-type component() :: {component, gleam@json:json()} |
{text_display_component, kitazith@component@text_display:text_display()} |
{section_component, kitazith@component@section:section()} |
{media_gallery_component, kitazith@component@media_gallery:media_gallery()} |
{file_component, kitazith@component@file:file()} |
{separator_component, kitazith@component@separator:separator()} |
{container_component, kitazith@component@container:container()}.
-file("src/kitazith/component.gleam", 23).
-spec raw(gleam@json:json()) -> component().
raw(Data) ->
{component, Data}.
-file("src/kitazith/component.gleam", 27).
-spec text_display(kitazith@component@text_display:text_display()) -> component().
text_display(Text_display) ->
{text_display_component, Text_display}.
-file("src/kitazith/component.gleam", 33).
-spec section(kitazith@component@section:section()) -> component().
section(Section) ->
{section_component, Section}.
-file("src/kitazith/component.gleam", 37).
-spec media_gallery(kitazith@component@media_gallery:media_gallery()) -> component().
media_gallery(Media_gallery) ->
{media_gallery_component, Media_gallery}.
-file("src/kitazith/component.gleam", 43).
-spec file(kitazith@component@file:file()) -> component().
file(File) ->
{file_component, File}.
-file("src/kitazith/component.gleam", 47).
-spec separator(kitazith@component@separator:separator()) -> component().
separator(Separator) ->
{separator_component, Separator}.
-file("src/kitazith/component.gleam", 51).
-spec container(kitazith@component@container:container()) -> component().
container(Container) ->
{container_component, Container}.
-file("src/kitazith/component.gleam", 55).
-spec to_json(component()) -> gleam@json:json().
to_json(Component) ->
case Component of
{component, Raw} ->
Raw;
{text_display_component, Text_display} ->
kitazith@component@text_display:to_json(Text_display);
{section_component, Section} ->
kitazith@component@section:to_json(Section);
{media_gallery_component, Media_gallery} ->
kitazith@component@media_gallery:to_json(Media_gallery);
{file_component, File} ->
kitazith@component@file:to_json(File);
{separator_component, Separator} ->
kitazith@component@separator:to_json(Separator);
{container_component, Container} ->
kitazith@component@container:to_json(Container)
end.