|
| 1 | +-module(nova_request_old_plugin). |
| 2 | +-behaviour(nova_plugin). |
| 3 | + |
| 4 | +-export([ |
| 5 | + pre_request/2, |
| 6 | + post_request/2, |
| 7 | + plugin_info/0 |
| 8 | + ]). |
| 9 | + |
| 10 | +%%-------------------------------------------------------------------- |
| 11 | +%% @doc |
| 12 | +%% Pre-request callback |
| 13 | +%% @end |
| 14 | +%%-------------------------------------------------------------------- |
| 15 | +-spec pre_request(Req :: cowboy_req:req(), Options :: map()) -> |
| 16 | + {ok, Req0 :: cowboy_req:req()} | |
| 17 | + {stop, Req0 :: cowboy_req:req()} | |
| 18 | + {error, Reason :: term()}. |
| 19 | +pre_request(Req, _Options) -> |
| 20 | + {ok, Req}. |
| 21 | + |
| 22 | + |
| 23 | +%%-------------------------------------------------------------------- |
| 24 | +%% @doc |
| 25 | +%% Post-request callback |
| 26 | +%% @end |
| 27 | +%%-------------------------------------------------------------------- |
| 28 | +-spec post_request(Req :: cowboy_req:req(), Options :: map()) -> |
| 29 | + {ok, Req0 :: cowboy_req:req()} | |
| 30 | + {stop, Req0 :: cowboy_req:req()} | |
| 31 | + {error, Reason :: term()}. |
| 32 | +post_request(Req, _Options) -> |
| 33 | + {ok, Req}. |
| 34 | + |
| 35 | + |
| 36 | +%%-------------------------------------------------------------------- |
| 37 | +%% @doc |
| 38 | +%% nova_plugin callback. Returns information about the plugin. |
| 39 | +%% @end |
| 40 | +%%-------------------------------------------------------------------- |
| 41 | +-spec plugin_info() -> {Title :: binary(), Version :: binary(), Author :: binary(), Description :: binary(), |
| 42 | + [{Key :: atom(), OptionDescription :: atom()}]}. |
| 43 | +plugin_info() -> |
| 44 | + {<<" plugin">>, |
| 45 | + <<"0.0.1">>, |
| 46 | + <<"User <user@email.com">>, |
| 47 | + <<"Descriptive text">>, |
| 48 | + []}. %% Options is specified as {Key, Description} |
0 commit comments