Current section
Files
Jump to
Current section
Files
src/glitch@api@api.erl
-module(glitch@api@api).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([send/1]).
-spec send(glitch@api@api_request:twitch_api_request()) -> {ok,
glitch@api@api_response:twitch_api_response(binary())} |
{error, glitch@error:twitch_error()}.
send(Request) ->
_pipe = Request,
_pipe@1 = glitch@api@api_request:to_http_request(_pipe),
_pipe@2 = gleam@httpc:send(_pipe@1),
_pipe@3 = gleam@result:map_error(
_pipe@2,
fun(Field@0) -> {request_error, Field@0} end
),
gleam@result:map(_pipe@3, fun glitch@api@api_response:of_http_response/1).