erlang-server.default_logic_handler.mustache Maven / Gradle / Ivy
-module({{packageName}}_default_logic_handler).
-behaviour({{packageName}}_logic_handler).
-export([handle_request/3]).
{{#authMethods}}
{{#isApiKey}}
-export([authorize_api_key/2]).
{{/isApiKey}}
{{/authMethods}}
{{#authMethods}}
{{#isApiKey}}
-spec authorize_api_key(OperationID :: {{packageName}}_api:operation_id(), ApiKey :: binary()) -> {true, #{}}.
authorize_api_key(_, _) -> {true, #{}}.
{{/isApiKey}}
{{/authMethods}}
-spec handle_request(
OperationID :: {{packageName}}_api:operation_id(),
Req :: cowboy_req:req(),
Context :: #{}
) ->
{Status :: cowboy:http_status(), Headers :: cowboy:http_headers(), Body :: jsx:json_term()}.
handle_request(OperationID, Req, Context) ->
error_logger:error_msg(
"Got not implemented request to process: ~p~n",
[{OperationID, Req, Context}]
),
{501, #{}, #{}}.