grisp_updater_http behaviour (grisp_updater v2.3.0)

View Source

Summary

Callbacks

Given a URL, return {Host,Port,Opts}. Return not_supported to delegate to another backend.

Initialize optional HTTP HAL that customizes connections/requests (TLS, auth). Return opaque state.

Customize request path and headers before issuing the HTTP request.

Types

method()

-type method() :: get | head | options | patch | post | put | delete.

Callbacks

http_connection_options(State, Url)

(optional)
-callback http_connection_options(State :: term(), Url :: binary()) ->
                                     {ok,
                                      Host :: inet:hostname() | inet:ip_address(),
                                      Port :: inet:port_number(),
                                      Opts :: gun:opts(),
                                      State :: term()} |
                                     not_supported |
                                     {error, term()}.

Given a URL, return {Host,Port,Opts}. Return not_supported to delegate to another backend.

http_init(Options)

-callback http_init(Options :: map()) -> {ok, State :: term()} | {error, REason :: term()}.

Initialize optional HTTP HAL that customizes connections/requests (TLS, auth). Return opaque state.

http_request_options(State, Method, Url, Path)

(optional)
-callback http_request_options(State :: term(), Method :: method(), Url :: binary(), Path :: binary()) ->
                                  {ok, Path :: binary(), Headers :: [{binary(), binary()}], State :: term()} |
                                  {error, term()}.

Customize request path and headers before issuing the HTTP request.

Functions

join_http_path(Base, Path)

source_cancel(State, ConnPid, StreamRef)

source_close(State, ConnPid)

source_handle/2

source_init(Opts)

source_open(State, Url, Opts)

source_stream/4

source_terminate/2