anchor.diff:  %%% Internal functions
   %%%===================================================================
   
  +-spec request(pid(), reference()) -> {ok, token()} | any().
   request(Connection, Stream) ->
       case gun:await(Connection, Stream) of
           {response, fin, _Status, _Headers} ->
  
positive.code: -export_type([credentials/0]).
  -export_type([token/0]).
  
  -record(state, {credentials::betfair:credentials(),
                  connection, token, keep_alive}).
  
  -type credentials() :: #{username => string(),
                           password => string(),
  
negative.code: %%%===================================================================
  
  init([Opts]) ->
      Credentials = proplists:get_value(credentials, Opts),
      _ = lager:info("Credentials: ~p~n", [Credentials]),
  
      SslOpts = proplists:get_value(ssl, Opts),
  
      _ = lager:info("Connecting with ssl opts ~p~n", [SslOpts]),
      IdentityEndpoint = proplists:get_value(identity_endpoint, Opts),
      {ok, Connection} = gun:open(IdentityEndpoint, 443,
                                  #{transport => ssl, transport_opts => SslOpts}),
  