Packages

A small, focused OAuth 2.0 library for Gleam, built on top of Gleams HTTP requests and responses.

Current section

Files

Jump to
flwr_oauth2 src flwr_oauth2@helpers.erl
Raw

src/flwr_oauth2@helpers.erl

-module(flwr_oauth2@helpers).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/flwr_oauth2/helpers.gleam").
-export([add_if_present/2, unwrap_both/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.
?MODULEDOC(" Helper functions\n").
-file("src/flwr_oauth2/helpers.gleam", 7).
?DOC(" Appends the value if present a given list\n").
-spec add_if_present(list(HCU), gleam@option:option(HCU)) -> list(HCU).
add_if_present(D, Value) ->
_pipe = [Value],
_pipe@1 = gleam@option:values(_pipe),
lists:append(_pipe@1, D).
-file("src/flwr_oauth2/helpers.gleam", 13).
-spec unwrap_both({ok, HCY} | {error, HCY}) -> HCY.
unwrap_both(Res) ->
case Res of
{ok, Res@1} ->
Res@1;
{error, Res@2} ->
Res@2
end.