-module(discord_gleam@http@request). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([new/2, new_auth/3, new_auth_post/4]). -spec new(gleam@http:method(), binary()) -> gleam@http@request:request(binary()). new(Method, Path) -> _pipe = gleam@http@request:new(), _pipe@1 = gleam@http@request:set_method(_pipe, Method), _pipe@2 = gleam@http@request:set_host(_pipe@1, <<"discord.com"/utf8>>), _pipe@3 = gleam@http@request:set_path( _pipe@2, <<"/api/v10"/utf8, Path/binary>> ), _pipe@4 = gleam@http@request:prepend_header( _pipe@3, <<"accept"/utf8>>, <<"application/json"/utf8>> ), gleam@http@request:prepend_header( _pipe@4, <<"User-Agent"/utf8>>, <<"DiscordBot (https://github.com/cyteon/discord_gleam, 0.0.1)"/utf8>> ). -spec new_auth(gleam@http:method(), binary(), binary()) -> gleam@http@request:request(binary()). new_auth(Method, Path, Token) -> _pipe = new(Method, Path), gleam@http@request:prepend_header( _pipe, <<"Authorization"/utf8>>, <<"Bot "/utf8, Token/binary>> ). -spec new_auth_post(gleam@http:method(), binary(), binary(), binary()) -> gleam@http@request:request(binary()). new_auth_post(Method, Path, Token, Data) -> _pipe = new(Method, Path), _pipe@1 = gleam@http@request:prepend_header( _pipe, <<"Authorization"/utf8>>, <<"Bot "/utf8, Token/binary>> ), _pipe@2 = gleam@http@request:set_body(_pipe@1, Data), gleam@http@request:prepend_header( _pipe@2, <<"Content-Type"/utf8>>, <<"application/json"/utf8>> ).