-module(gleatter@utils). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([to_request/4]). -file("/home/runner/work/gleatter/gleatter/src/gleatter/utils.gleam", 11). -spec to_request(gleatter@route:route(JGR, JGS, JGT, any()), JGR, JGS, JGT) -> gleam@http@request:request(binary()). to_request(Route, Path, Query, Body) -> Req = begin _pipe = gleam@http@request:new(), _pipe@1 = gleam@http@request:set_method(_pipe, erlang:element(2, Route)), _pipe@4 = gleam@http@request:set_path( _pipe@1, begin _pipe@2 = erlang:element(3, Route), _pipe@3 = gleatter@path:encode(_pipe@2, Path), gleam@string:join(_pipe@3, <<"/"/utf8>>) end ), _pipe@6 = gleam@http@request:set_query( _pipe@4, begin _pipe@5 = erlang:element(4, Route), gleatter@query:encode(_pipe@5, Query) end ), gleam@http@request:set_body( _pipe@6, begin _pipe@7 = erlang:element(5, Route), _pipe@8 = gleatter@body:encode(_pipe@7, Body), unicode:characters_to_binary(_pipe@8) end ) end, Req@1 = case begin _pipe@9 = erlang:element(5, Route), gleatter@body:get_type(_pipe@9) end of json_body -> _pipe@10 = Req, gleam@http@request:set_header( _pipe@10, <<"Content-Type"/utf8>>, <<"application/json"/utf8>> ); _ -> Req end, Req@1.