Packages

The Bloodbath Erlang library provides convenient access to the Bloodbath API from applications written in the Erlang language.

Current section

Files

Jump to
bloodbath src bloodbath_configuration.erl
Raw

src/bloodbath_configuration.erl

-module(bloodbath_configuration).
-export([new/0, get_api_key/1, set_api_key/2, get_api_base/1, set_api_base/2, get_verbose/1, set_verbose/2]).
-export_type([state_record/0]).
-record(state, {api_key, api_base, verbose}).
-type state_record() :: #state{}.
new() ->
#state{api_key = undefined, api_base = "https://api.bloodbath.io/rest", verbose = false}.
get_api_key(#state{api_key = ApiKey}) ->
ApiKey.
set_api_key(Config, ApiKey) ->
Config#state{api_key = ApiKey}.
get_api_base(#state{api_base = ApiBase}) ->
ApiBase.
set_api_base(Config, ApiBase) ->
Config#state{api_base = ApiBase}.
get_verbose(#state{verbose = Verbose}) ->
Verbose.
set_verbose(Config, Verbose) ->
Config#state{verbose = Verbose}.