diff --git a/src/nova_plugin.erl b/src/nova_plugin.erl index 042ab4b..fd02148 100644 --- a/src/nova_plugin.erl +++ b/src/nova_plugin.erl @@ -34,26 +34,20 @@ {reply, Status :: integer(), Body :: binary()} | {reply, Status :: integer(), Headers :: [{binary(), binary()}], Body :: binary()}. -%% @doc %% Start function for the plugin. This function is called when the plugin is started %% and will return a state that will be passed to the other functions during %% the life cycle of the plugin. The state can be any term. -%% @end -callback init() -> State :: nova:state(). -optional_callbacks([init/0]). -%% @doc %% Stop function for the plugin. This function is called when the application is stopped. %% It takes a state as argument and should return ok. -%% @end -callback stop(State :: nova:state()) -> ok. -optional_callbacks([stop/1]). -%% @doc %% This function is called before the request is processed. It can modify the request %% and the nova-state. It takes a state and a map of options as arguments and should return %% either {ok, NewState}, {break, NewState}, {stop, NewState} or {error, Reason}. -%% @end -callback pre_request(Req :: cowboy_req:req(), Env :: any(), Options :: map(), PluginState :: any()) -> {ok, Req0 :: cowboy_req:req(), NewState :: any()} | @@ -65,12 +59,10 @@ {error, Reason :: term()}. -optional_callbacks([pre_request/4]). -%% @doc %% This function is called after the request is processed. It can modify the request. %% It takes a state and a map of options as arguments and should return %% either {ok, NewState}, {break, NewState}, {stop, NewState} or {error, Reason}. %% The state is only used if there's another plugin invoked after this one. -%% @end -callback post_request(Req :: cowboy_req:req(), Env :: any(), Options :: map(), PluginState :: any()) -> {ok, Req0 :: cowboy_req:req(), NewState :: any()} | @@ -82,10 +74,8 @@ {error, Reason :: term()}. -optional_callbacks([post_request/4]). -%% @doc %% This function should return information about the plugin. The information is used %% in the documentation and in the plugin-listing. -%% @end -callback plugin_info() -> #{title := binary(), version := binary(), url := binary(),