-module(starfeeds). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([json_feed_to_string/1, rss_item_to_xml_string/1, rss_channel_to_xml_string/1, to_xml_string/1, json_item/3, add_json_item_external_url/2, add_json_item_content_html/2, add_json_item_content_text/2, add_json_item_summary/2, add_json_item_image/2, add_json_item_banner_image/2, add_json_item_date_published/2, add_json_item_date_modified/2, add_json_item_author/2, add_json_item_authors/2, add_json_item_tags/2, add_json_item_language/2, add_json_item_attachment/2, add_json_item_attachments/2, json_feed/2, rss_channel/3, add_channel_language/2, add_channel_copyright/2, add_channel_managing_editor/2, add_channel_web_master/2, add_channel_pub_date/2, add_channel_last_build_date/2, add_channel_category/2, add_channel_categories/2, add_channel_generator/2, add_channel_docs/1, add_channel_cloud/2, add_channel_ttl/2, add_channel_image/2, add_channel_text_input/2, add_channel_skip_hours/2, add_channel_skip_days/2, add_channel_item/2, add_channel_items/2, rss_item/2, add_item_link/2, add_item_author/2, add_item_source/2, add_item_comments/2, add_item_pub_date/2, add_item_categories/2, add_item_enclosure/2, add_item_guid/2]). -export_type([json_author/0, json_attachment/0, json_item/0, json_feed/0, link/0, image/0, cloud/0, text_input/0, enclosure/0, rss_item/0, rss_channel/0]). -type json_author() :: {json_author, binary(), binary(), gleam@option:option(binary())}. -type json_attachment() :: {json_attachment, binary(), binary(), binary(), gleam@option:option(integer()), gleam@option:option(integer())}. -type json_item() :: {json_item, binary(), binary(), gleam@option:option(binary()), binary(), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(birl:time()), gleam@option:option(birl:time()), list(json_author()), list(binary()), gleam@option:option(binary()), list(json_attachment())}. -type json_feed() :: {json_feed, binary(), binary(), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), list(json_author()), gleam@option:option(binary()), gleam@option:option(boolean()), list(json_item())}. -type link() :: {link, binary(), binary(), binary(), binary()}. -type image() :: {image, binary(), binary(), binary(), gleam@option:option(binary()), gleam@option:option(integer()), gleam@option:option(integer())}. -type cloud() :: {cloud, binary(), integer(), binary(), binary(), binary()}. -type text_input() :: {text_input, binary(), binary(), binary(), binary()}. -type enclosure() :: {enclosure, binary(), integer(), binary()}. -type rss_item() :: {rss_item, binary(), binary(), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(birl:time()), list(binary()), gleam@option:option(enclosure()), gleam@option:option({binary(), gleam@option:option(boolean())})}. -type rss_channel() :: {rss_channel, binary(), binary(), binary(), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(birl:time()), gleam@option:option(birl:time()), list(binary()), gleam@option:option(binary()), gleam@option:option(binary()), gleam@option:option(cloud()), gleam@option:option(integer()), gleam@option:option(image()), gleam@option:option(text_input()), list(integer()), list(birl:weekday()), list(rss_item())}. -spec json_item_to_string(json_item()) -> gleam@json:json(). json_item_to_string(Item) -> _pipe = [{<<"id"/utf8>>, gleam@json:string(erlang:element(2, Item))}, {<<"url"/utf8>>, gleam@json:string(erlang:element(3, Item))}, case erlang:element(4, Item) of {some, External_url} when External_url =/= <<""/utf8>> -> {<<"external_url"/utf8>>, gleam@json:string(External_url)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, {<<"title"/utf8>>, gleam@json:string(erlang:element(5, Item))}, case erlang:element(6, Item) of {some, Content_html} when Content_html =/= <<""/utf8>> -> {<<"content_html"/utf8>>, gleam@json:string(Content_html)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(7, Item) of {some, Content_text} when Content_text =/= <<""/utf8>> -> {<<"content_text"/utf8>>, gleam@json:string(Content_text)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(8, Item) of {some, Summary} when Summary =/= <<""/utf8>> -> {<<"summary"/utf8>>, gleam@json:string(Summary)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(9, Item) of {some, Image} when Image =/= <<""/utf8>> -> {<<"image"/utf8>>, gleam@json:string(Image)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(10, Item) of {some, Banner_image} when Banner_image =/= <<""/utf8>> -> {<<"banner_image"/utf8>>, gleam@json:string(Banner_image)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(11, Item) of {some, Date_published} -> {<<"date_published"/utf8>>, gleam@json:string(birl:to_date_string(Date_published))}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(12, Item) of {some, Date_modified} -> {<<"date_modified"/utf8>>, gleam@json:string(birl:to_date_string(Date_modified))}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(13, Item) of [] -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)}; Authors -> {<<"authors"/utf8>>, gleam@json:array( Authors, fun(A) -> gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(erlang:element(2, A))}, {<<"url"/utf8>>, gleam@json:string(erlang:element(3, A))}, {<<"avatar"/utf8>>, gleam@json:string( case erlang:element(4, A) of {some, Avatar} when Avatar =/= <<""/utf8>> -> Avatar; _ -> <<""/utf8>> end )}] ) end )} end, case erlang:element(14, Item) of [] -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)}; Tags -> {<<"tags"/utf8>>, gleam@json:array(Tags, fun gleam@json:string/1)} end, case erlang:element(15, Item) of {some, Language} when Language =/= <<""/utf8>> -> {<<"language"/utf8>>, gleam@json:string(Language)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(16, Item) of [] -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)}; Attachments -> {<<"attachments"/utf8>>, gleam@json:array( Attachments, fun(Attach) -> gleam@json:object( [{<<"url"/utf8>>, gleam@json:string( erlang:element(2, Attach) )}, {<<"mime_type"/utf8>>, gleam@json:string( erlang:element(3, Attach) )}, {<<"title"/utf8>>, gleam@json:string( erlang:element(4, Attach) )}, {<<"size_in_bytes"/utf8>>, gleam@json:int( case erlang:element(5, Attach) of {some, Size_in_bytes} when Size_in_bytes >= 0 -> Size_in_bytes; _ -> 0 end )}, {<<"duration_in_seconds"/utf8>>, gleam@json:int( case erlang:element(6, Attach) of {some, Duration_in_seconds} when Duration_in_seconds >= 0 -> Duration_in_seconds; _ -> 0 end )}] ) end )} end], _pipe@1 = gleam@list:filter( _pipe, fun(Pair) -> erlang:element(1, Pair) /= <<""/utf8>> end ), gleam@json:object(_pipe@1). -spec json_feed_to_string(json_feed()) -> binary(). json_feed_to_string(Feed) -> _pipe = [{<<"version"/utf8>>, gleam@json:string(erlang:element(2, Feed))}, {<<"title"/utf8>>, gleam@json:string(erlang:element(3, Feed))}, case erlang:element(4, Feed) of {some, Url} -> {<<"home_page_url"/utf8>>, gleam@json:string(Url)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(5, Feed) of {some, Url@1} -> {<<"feed_url"/utf8>>, gleam@json:string(Url@1)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(6, Feed) of {some, Desc} -> {<<"description"/utf8>>, gleam@json:string(Desc)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(7, Feed) of {some, Comment} -> {<<"user_comment"/utf8>>, gleam@json:string(Comment)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(8, Feed) of {some, Url@2} -> {<<"next_url"/utf8>>, gleam@json:string(Url@2)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(9, Feed) of {some, Icon} -> {<<"icon"/utf8>>, gleam@json:string(Icon)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(10, Feed) of {some, Favicon} -> {<<"favicon"/utf8>>, gleam@json:string(Favicon)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(11, Feed) of [] -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)}; Authors -> {<<"authors"/utf8>>, gleam@json:array( Authors, fun(A) -> gleam@json:object( [{<<"name"/utf8>>, gleam@json:string(erlang:element(2, A))}, {<<"url"/utf8>>, gleam@json:string(erlang:element(3, A))}, {<<"avatar"/utf8>>, gleam@json:string( case erlang:element(4, A) of {some, Avatar} when Avatar =/= <<""/utf8>> -> Avatar; _ -> <<""/utf8>> end )}] ) end )} end, case erlang:element(12, Feed) of {some, Lang} -> {<<"language"/utf8>>, gleam@json:string(Lang)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, case erlang:element(13, Feed) of {some, Expired} -> {<<"expired"/utf8>>, gleam@json:bool(Expired)}; _ -> {<<""/utf8>>, gleam@json:string(<<""/utf8>>)} end, {<<"items"/utf8>>, gleam@json:array( erlang:element(14, Feed), fun(Item) -> json_item_to_string(Item) end )}], _pipe@1 = gleam@list:filter( _pipe, fun(Pair) -> erlang:element(1, Pair) /= <<""/utf8>> end ), _pipe@2 = gleam@json:object(_pipe@1), gleam@json:to_string(_pipe@2). -spec rss_item_to_xml_string(rss_item()) -> binary(). rss_item_to_xml_string(Item) -> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"\n"/utf8, ""/utf8>>/binary, (erlang:element( 2, Item ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element(3, Item))/binary>>/binary, "\n"/utf8>>/binary, (case erlang:element(4, Item) of {some, Link} -> <<<<""/utf8, Link/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(5, Item) of {some, Author} -> <<<<""/utf8, Author/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(6, Item) of {some, Source} -> <<<<""/utf8, Source/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(7, Item) of {some, Comment} -> <<<<""/utf8, Comment/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(8, Item) of {some, Pub_date} -> <<<<""/utf8, (begin _pipe = Pub_date, birl:to_iso8601(_pipe) end)/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (begin _pipe@1 = erlang:element(9, Item), _pipe@2 = gleam@list:map( _pipe@1, fun(Category) -> <<<<""/utf8, Category/binary>>/binary, "\n"/utf8>> end ), _pipe@3 = gleam@list:reduce( _pipe@2, fun(Acc, Category@1) -> <> end ), gleam@result:unwrap(_pipe@3, <<""/utf8>>) end)/binary>>/binary, (case erlang:element(10, Item) of {some, Enclosure} -> <<<<<<<<<<<<">/binary, "\" length=\""/utf8>>/binary, (gleam@int:to_string( erlang:element(3, Enclosure) ))/binary>>/binary, "\" type=\""/utf8>>/binary, (erlang:element(4, Enclosure))/binary>>/binary, "\"/>\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(11, Item) of {some, Guid} -> case Guid of {Guid@1, {some, Is_permalink}} -> <<<<<<<<" <<"true"/utf8>>; false -> <<"false"/utf8>> end)/binary>>/binary, "\">"/utf8>>/binary, Guid@1/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end; _ -> <<""/utf8>> end)/binary>>/binary, ""/utf8>>. -spec rss_channel_to_xml_string(rss_channel()) -> binary(). rss_channel_to_xml_string(Channel) -> Channel_items = begin _pipe = erlang:element(20, Channel), _pipe@2 = gleam@list:map(_pipe, fun(Rss_item) -> _pipe@1 = Rss_item, rss_item_to_xml_string(_pipe@1) end), _pipe@3 = gleam@list:reduce( _pipe@2, fun(Acc, Rss_item_to_xml_string) -> <<<>/binary, Rss_item_to_xml_string/binary>> end ), gleam@result:unwrap(_pipe@3, <<""/utf8>>) end, <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"\n\n"/utf8, ""/utf8>>/binary, (erlang:element( 2, Channel ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 3, Channel ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 4, Channel ))/binary>>/binary, "\n"/utf8>>/binary, (case erlang:element( 5, Channel ) of {some, Language} -> <<<<""/utf8, Language/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element( 6, Channel ) of {some, Copyright} -> <<<<""/utf8, Copyright/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element( 7, Channel ) of {some, Managing_editor} -> <<<<""/utf8, Managing_editor/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element( 8, Channel ) of {some, Web_master} -> <<<<""/utf8, Web_master/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element( 9, Channel ) of {some, Pub_date} -> <<<<""/utf8, (begin _pipe@4 = Pub_date, birl:to_iso8601( _pipe@4 ) end)/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element( 10, Channel ) of {some, Last_build_date} -> <<<<""/utf8, (begin _pipe@5 = Last_build_date, birl:to_iso8601( _pipe@5 ) end)/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (begin _pipe@6 = erlang:element( 11, Channel ), _pipe@7 = gleam@list:map( _pipe@6, fun(Category) -> <<<<""/utf8, Category/binary>>/binary, "\n"/utf8>> end ), _pipe@8 = gleam@list:reduce( _pipe@7, fun(Acc@1, Category@1) -> <> end ), gleam@result:unwrap( _pipe@8, <<""/utf8>> ) end)/binary>>/binary, (case erlang:element(12, Channel) of {some, Generator} -> <<<<""/utf8, Generator/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(13, Channel) of {some, Docs} -> <<<<""/utf8, Docs/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(14, Channel) of {some, Cloud} -> <<<<<<<<<<<<<<<<<<<<">/binary, "\" port=\""/utf8>>/binary, (gleam@int:to_string( erlang:element( 3, Cloud ) ))/binary>>/binary, "\" path=\""/utf8>>/binary, (erlang:element( 4, Cloud ))/binary>>/binary, "\" registerProcedure=\""/utf8>>/binary, (erlang:element( 5, Cloud ))/binary>>/binary, "\" protocol=\""/utf8>>/binary, (erlang:element(6, Cloud))/binary>>/binary, "\" />\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(15, Channel) of {some, Ttl} -> <<<<""/utf8, (gleam@int:to_string(Ttl))/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(16, Channel) of {some, Image} -> <<<<<<<<<<<<<<<<<<<<<<<<<<""/utf8, ""/utf8>>/binary, (erlang:element( 2, Image ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 3, Image ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 4, Image ))/binary>>/binary, "\n"/utf8>>/binary, (case erlang:element( 5, Image ) of {some, Description} -> <<<<""/utf8, Description/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(6, Image) of {some, Width} -> <<<<""/utf8, (gleam@int:to_string( Width ))/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(7, Image) of {some, Height} -> <<<<""/utf8, (gleam@int:to_string( Height ))/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case erlang:element(17, Channel) of {some, Text_input} -> <<<<<<<<<<<<<<<<<<<<<<<<<<""/utf8, ""/utf8>>/binary, (erlang:element( 2, Text_input ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 3, Text_input ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element( 4, Text_input ))/binary>>/binary, "\n"/utf8>>/binary, ""/utf8>>/binary, (erlang:element(5, Text_input))/binary>>/binary, "\n"/utf8>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, (case begin _pipe@9 = erlang:element(18, Channel), erlang:length(_pipe@9) end > 0 of true -> <<""/utf8, (begin _pipe@10 = gleam@list:map( erlang:element(18, Channel), fun(Hour) -> <<<<""/utf8, (gleam@int:to_string(Hour))/binary>>/binary, ""/utf8>> end ), _pipe@11 = gleam@list:reduce( _pipe@10, fun(Acc@2, Hour@1) -> <<<>/binary, Hour@1/binary>> end ), gleam@result:unwrap(_pipe@11, <<""/utf8>>) end)/binary>>; _ -> <<""/utf8>> end)/binary>>/binary, (case begin _pipe@12 = erlang:element(19, Channel), erlang:length(_pipe@12) end > 0 of true -> <<<<""/utf8, (begin _pipe@14 = gleam@list:map( erlang:element(19, Channel), fun(Day) -> <<<<""/utf8, (begin _pipe@13 = Day, birl:weekday_to_string( _pipe@13 ) end)/binary>>/binary, ""/utf8>> end ), _pipe@15 = gleam@list:reduce( _pipe@14, fun(Acc@3, Day@1) -> <<<>/binary, Day@1/binary>> end ), gleam@result:unwrap(_pipe@15, <<""/utf8>>) end)/binary>>/binary, "\n"/utf8>>; _ -> <<""/utf8>> end)/binary>>/binary, Channel_items/binary>>/binary, ""/utf8>>. -spec to_xml_string(list(rss_channel())) -> binary(). to_xml_string(Channels) -> Channel_ctx = begin _pipe = Channels, _pipe@2 = gleam@list:map(_pipe, fun(Channel) -> _pipe@1 = Channel, rss_channel_to_xml_string(_pipe@1) end), _pipe@3 = gleam@list:reduce( _pipe@2, fun(Acc, Channel_str) -> <<<>/binary, Channel_str/binary>> end ), gleam@result:unwrap(_pipe@3, <<""/utf8>>) end, <<<<"\n"/utf8, Channel_ctx/binary>>/binary, "\n"/utf8>>. -spec json_item(binary(), binary(), binary()) -> json_item(). json_item(Id, Url, Title) -> {json_item, Id, Url, none, Title, none, none, none, none, none, none, none, [], [], none, []}. -spec add_json_item_external_url(json_item(), binary()) -> json_item(). add_json_item_external_url(Item, External_url) -> erlang:setelement(4, Item, {some, External_url}). -spec add_json_item_content_html(json_item(), binary()) -> json_item(). add_json_item_content_html(Item, Content_html) -> erlang:setelement(6, Item, {some, Content_html}). -spec add_json_item_content_text(json_item(), binary()) -> json_item(). add_json_item_content_text(Item, Content_text) -> erlang:setelement(7, Item, {some, Content_text}). -spec add_json_item_summary(json_item(), binary()) -> json_item(). add_json_item_summary(Item, Summary) -> erlang:setelement(8, Item, {some, Summary}). -spec add_json_item_image(json_item(), binary()) -> json_item(). add_json_item_image(Item, Image) -> erlang:setelement(9, Item, {some, Image}). -spec add_json_item_banner_image(json_item(), binary()) -> json_item(). add_json_item_banner_image(Item, Banner_image) -> erlang:setelement(10, Item, {some, Banner_image}). -spec add_json_item_date_published(json_item(), birl:time()) -> json_item(). add_json_item_date_published(Item, Date_published) -> erlang:setelement(11, Item, {some, Date_published}). -spec add_json_item_date_modified(json_item(), birl:time()) -> json_item(). add_json_item_date_modified(Item, Date_modified) -> erlang:setelement(12, Item, {some, Date_modified}). -spec add_json_item_author(json_item(), json_author()) -> json_item(). add_json_item_author(Item, Author) -> erlang:setelement(13, Item, [Author | erlang:element(13, Item)]). -spec add_json_item_authors(json_item(), list(json_author())) -> json_item(). add_json_item_authors(Item, Authors) -> erlang:setelement( 13, Item, gleam@list:concat([erlang:element(13, Item), Authors]) ). -spec add_json_item_tags(json_item(), list(binary())) -> json_item(). add_json_item_tags(Item, Tags) -> erlang:setelement(14, Item, Tags). -spec add_json_item_language(json_item(), binary()) -> json_item(). add_json_item_language(Item, Language) -> erlang:setelement(15, Item, {some, Language}). -spec add_json_item_attachment(json_item(), json_attachment()) -> json_item(). add_json_item_attachment(Item, Attachment) -> erlang:setelement(16, Item, [Attachment | erlang:element(16, Item)]). -spec add_json_item_attachments(json_item(), list(json_attachment())) -> json_item(). add_json_item_attachments(Item, Attachments) -> erlang:setelement( 16, Item, gleam@list:concat([erlang:element(16, Item), Attachments]) ). -spec json_feed(binary(), binary()) -> json_feed(). json_feed(Version, Title) -> {json_feed, Version, Title, none, none, none, none, none, none, none, [], none, none, []}. -spec rss_channel(binary(), binary(), binary()) -> rss_channel(). rss_channel(Title, Description, Link) -> {rss_channel, Title, Link, Description, none, none, none, none, none, none, [], none, none, none, none, none, none, [], [], []}. -spec add_channel_language(rss_channel(), binary()) -> rss_channel(). add_channel_language(Channel, Language) -> erlang:setelement(5, Channel, {some, Language}). -spec add_channel_copyright(rss_channel(), binary()) -> rss_channel(). add_channel_copyright(Channel, Copyright) -> erlang:setelement(6, Channel, {some, Copyright}). -spec add_channel_managing_editor(rss_channel(), binary()) -> rss_channel(). add_channel_managing_editor(Channel, Managing_editor) -> erlang:setelement(7, Channel, {some, Managing_editor}). -spec add_channel_web_master(rss_channel(), binary()) -> rss_channel(). add_channel_web_master(Channel, Web_master) -> erlang:setelement(8, Channel, {some, Web_master}). -spec add_channel_pub_date(rss_channel(), birl:time()) -> rss_channel(). add_channel_pub_date(Channel, Pub_date) -> erlang:setelement(9, Channel, {some, Pub_date}). -spec add_channel_last_build_date(rss_channel(), birl:time()) -> rss_channel(). add_channel_last_build_date(Channel, Last_build_date) -> erlang:setelement(10, Channel, {some, Last_build_date}). -spec add_channel_category(rss_channel(), binary()) -> rss_channel(). add_channel_category(Channel, Category) -> erlang:setelement(11, Channel, [Category | erlang:element(11, Channel)]). -spec add_channel_categories(rss_channel(), list(binary())) -> rss_channel(). add_channel_categories(Channel, Categories) -> erlang:setelement( 11, Channel, gleam@list:concat([erlang:element(11, Channel), Categories]) ). -spec add_channel_generator(rss_channel(), binary()) -> rss_channel(). add_channel_generator(Channel, Generator) -> erlang:setelement(12, Channel, {some, Generator}). -spec add_channel_docs(rss_channel()) -> rss_channel(). add_channel_docs(Channel) -> erlang:setelement( 13, Channel, {some, <<"https://www.rssboard.org/rss-specification"/utf8>>} ). -spec add_channel_cloud(rss_channel(), cloud()) -> rss_channel(). add_channel_cloud(Channel, Cloud) -> erlang:setelement(14, Channel, {some, Cloud}). -spec add_channel_ttl(rss_channel(), integer()) -> rss_channel(). add_channel_ttl(Channel, Ttl) -> erlang:setelement(15, Channel, {some, Ttl}). -spec add_channel_image(rss_channel(), image()) -> rss_channel(). add_channel_image(Channel, Image) -> erlang:setelement(16, Channel, {some, Image}). -spec add_channel_text_input(rss_channel(), text_input()) -> rss_channel(). add_channel_text_input(Channel, Text_input) -> erlang:setelement(17, Channel, {some, Text_input}). -spec add_channel_skip_hours(rss_channel(), list(integer())) -> rss_channel(). add_channel_skip_hours(Channel, Skip_hours) -> erlang:setelement(18, Channel, Skip_hours). -spec add_channel_skip_days(rss_channel(), list(birl:weekday())) -> rss_channel(). add_channel_skip_days(Channel, Skip_days) -> erlang:setelement(19, Channel, Skip_days). -spec add_channel_item(rss_channel(), rss_item()) -> rss_channel(). add_channel_item(Channel, Item) -> erlang:setelement(20, Channel, [Item | erlang:element(20, Channel)]). -spec add_channel_items(rss_channel(), list(rss_item())) -> rss_channel(). add_channel_items(Channel, Items) -> erlang:setelement( 20, Channel, gleam@list:concat([erlang:element(20, Channel), Items]) ). -spec rss_item(binary(), binary()) -> rss_item(). rss_item(Title, Description) -> {rss_item, Title, Description, none, none, none, none, none, [], none, none}. -spec add_item_link(rss_item(), binary()) -> rss_item(). add_item_link(Item, Link) -> erlang:setelement(4, Item, {some, Link}). -spec add_item_author(rss_item(), binary()) -> rss_item(). add_item_author(Item, Author) -> erlang:setelement(5, Item, {some, Author}). -spec add_item_source(rss_item(), binary()) -> rss_item(). add_item_source(Item, Source) -> erlang:setelement(6, Item, {some, Source}). -spec add_item_comments(rss_item(), binary()) -> rss_item(). add_item_comments(Item, Comments) -> erlang:setelement(7, Item, {some, Comments}). -spec add_item_pub_date(rss_item(), birl:time()) -> rss_item(). add_item_pub_date(Item, Pub_date) -> erlang:setelement(8, Item, {some, Pub_date}). -spec add_item_categories(rss_item(), list(binary())) -> rss_item(). add_item_categories(Item, Categories) -> erlang:setelement(9, Item, Categories). -spec add_item_enclosure(rss_item(), enclosure()) -> rss_item(). add_item_enclosure(Item, Enclosure) -> erlang:setelement(10, Item, {some, Enclosure}). -spec add_item_guid(rss_item(), {binary(), gleam@option:option(boolean())}) -> rss_item(). add_item_guid(Item, Guid) -> erlang:setelement(11, Item, {some, Guid}).