Packages
caldav_gleam
1.0.0
A lightweight Gleam CalDAV client library for discovery, calendars, and events.
Current section
Files
Jump to
Current section
Files
src/caldav@internal@xml_request.erl
-module(caldav@internal@xml_request).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src\\caldav\\internal\\xml_request.gleam").
-export([propfind_current_user_principal/0, propfind_calendar_home_set/0, propfind_list_calendars/0, report_calendar_query_all/0, report_calendar_query_range/1]).
-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\\caldav\\internal\\xml_request.gleam", 5).
?DOC(" Builds a PROPFIND body that asks for the current user principal.\n").
-spec propfind_current_user_principal() -> binary().
propfind_current_user_principal() ->
<<<<<<<<"<d:propfind xmlns:d=\"DAV:\">"/utf8, "<d:prop>"/utf8>>/binary,
"<d:current-user-principal />"/utf8>>/binary,
"</d:prop>"/utf8>>/binary,
"</d:propfind>"/utf8>>.
-file("src\\caldav\\internal\\xml_request.gleam", 14).
?DOC(" Builds a PROPFIND body that asks for the calendar home set of a principal.\n").
-spec propfind_calendar_home_set() -> binary().
propfind_calendar_home_set() ->
<<<<<<<<"<d:propfind xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\">"/utf8,
"<d:prop>"/utf8>>/binary,
"<c:calendar-home-set />"/utf8>>/binary,
"</d:prop>"/utf8>>/binary,
"</d:propfind>"/utf8>>.
-file("src\\caldav\\internal\\xml_request.gleam", 23).
?DOC(" Builds a PROPFIND body that asks for the core properties of calendar collections.\n").
-spec propfind_list_calendars() -> binary().
propfind_list_calendars() ->
<<<<<<<<<<<<<<<<<<<<"<d:propfind"/utf8, " xmlns:d=\"DAV:\""/utf8>>/binary,
" xmlns:c=\"urn:ietf:params:xml:ns:caldav\""/utf8>>/binary,
" xmlns:cs=\"http://calendarserver.org/ns/\">"/utf8>>/binary,
"<d:prop>"/utf8>>/binary,
"<d:displayname />"/utf8>>/binary,
"<c:calendar-description />"/utf8>>/binary,
"<cs:getctag />"/utf8>>/binary,
"<d:resourcetype />"/utf8>>/binary,
"</d:prop>"/utf8>>/binary,
"</d:propfind>"/utf8>>.
-file("src\\caldav\\internal\\xml_request.gleam", 38).
?DOC(" Builds a REPORT body that asks for all VEVENT resources in a calendar.\n").
-spec report_calendar_query_all() -> binary().
report_calendar_query_all() ->
<<<<<<<<<<<<<<<<<<<<<<"<c:calendar-query xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\">"/utf8,
"<d:prop>"/utf8>>/binary,
"<d:getetag />"/utf8>>/binary,
"<d:getcontenttype />"/utf8>>/binary,
"<c:calendar-data />"/utf8>>/binary,
"</d:prop>"/utf8>>/binary,
"<c:filter>"/utf8>>/binary,
"<c:comp-filter name=\"VCALENDAR\">"/utf8>>/binary,
"<c:comp-filter name=\"VEVENT\" />"/utf8>>/binary,
"</c:comp-filter>"/utf8>>/binary,
"</c:filter>"/utf8>>/binary,
"</c:calendar-query>"/utf8>>.
-file("src\\caldav\\internal\\xml_request.gleam", 81).
?DOC(" Converts the temporary integer-based time range value into XML text.\n").
-spec format_time_range_value(integer()) -> binary().
format_time_range_value(Value) ->
erlang:integer_to_binary(Value).
-file("src\\caldav\\internal\\xml_request.gleam", 57).
?DOC(
" Builds a REPORT body that asks for VEVENT resources inside a time range.\n"
"\n"
" The current `TimeRange` type is still a placeholder, so its integer values\n"
" are serialized directly into the CalDAV `start` and `end` attributes.\n"
).
-spec report_calendar_query_range(caldav@types:time_range()) -> binary().
report_calendar_query_range(Range) ->
{time_range, Start, End} = Range,
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"<c:calendar-query xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\">"/utf8,
"<d:prop>"/utf8>>/binary,
"<d:getetag />"/utf8>>/binary,
"<d:getcontenttype />"/utf8>>/binary,
"<c:calendar-data />"/utf8>>/binary,
"</d:prop>"/utf8>>/binary,
"<c:filter>"/utf8>>/binary,
"<c:comp-filter name=\"VCALENDAR\">"/utf8>>/binary,
"<c:comp-filter name=\"VEVENT\">"/utf8>>/binary,
"<c:time-range start=\""/utf8>>/binary,
(format_time_range_value(Start))/binary>>/binary,
"\" end=\""/utf8>>/binary,
(format_time_range_value(End))/binary>>/binary,
"\" />"/utf8>>/binary,
"</c:comp-filter>"/utf8>>/binary,
"</c:comp-filter>"/utf8>>/binary,
"</c:filter>"/utf8>>/binary,
"</c:calendar-query>"/utf8>>.