anchor.diff:          value -> #{<<"data">> => undefined_to_null(Result)};
           resource -> Result
       end;
  -encode_response_graph(2, #gs_resp_graph{data_format = Format, data = Result}) ->
  +% Covers all versions since 2
  +encode_response_graph(_, #gs_resp_graph{data_format = Format, data = Result}) ->
       FormatStr = data_format_to_str(Format),
       #{
           <<"format">> => FormatStr,
  
positive.code: encode_push_error(?BASIC_PROTOCOL, Message) ->
      % Error push message may be sent before negotiating handshake, so it must
      % support the basic protocol (currently the same as 1. protocol version).
      encode_push_error(2, Message);
  encode_push_error(ProtocolVersion, #gs_push_error{} = Message) ->
      #gs_push_error{
          error = Error
  
negative.code: string_to_subtype(<<"error">>) -> error.
  
  
  -spec json_to_client_auth(null | json_map() | binary()) -> client_auth().
  json_to_client_auth(null) ->
      undefined;
  json_to_client_auth(<<"nobody">>) ->
      nobody;
  json_to_client_auth(#{<<"macaroon">> := Macaroon} = Json) ->
      {macaroon, Macaroon, maps:get(<<"discharge-macaroons">>, Json, [])}.
  
  
  -spec client_auth_to_json(client_auth()) -> null | json_map() | binary().
  client_auth_to_json(undefined) ->
      null;
  client_auth_to_json(nobody) ->
      <<"nobody">>;
  client_auth_to_json({macaroon, Macaroon, DischargeMacaroons}) -> #{
      <<"macaroon">> => Macaroon,
      <<"discharge-macaroons">> => DischargeMacaroons
  