View Source LoggerTelegramBackend.HTTPClient behaviour (logger_telegram_backend v3.0.0-rc.1)

Specifies the API for using a custom HTTP Client.

By default, the first HTTP client in the list whose application is loaded is selected:

To configure a different HTTP client, implement the LoggerTelegramBackend.HTTPClient behaviour and change the :client configuration:

config :logger, LoggerTelegramBackend,
  client: MyHTTPClient

Summary

Types

HTTP request or response body.

HTTP request or response headers.

HTTP request method.

HTTP response status.

HTTP request URL.

Callbacks

Should return a child specification to start the HTTP client or nil.

Should make an HTTP request to url with the given method, headers and body.

Types

@type body() :: binary()

HTTP request or response body.

@type headers() :: [{String.t(), String.t()}]

HTTP request or response headers.

@type method() :: atom()

HTTP request method.

@type status() :: 100..599

HTTP response status.

@type url() :: String.t()

HTTP request URL.

Callbacks

@callback child_spec() :: Supervisor.child_spec() | nil

Should return a child specification to start the HTTP client or nil.

For example, this can start a pool of HTTP connections dedicated to LoggerTelegramBackend.

Link to this callback

request(method, url, headers, body)

View Source
@callback request(method(), url(), headers(), body()) ::
  {:ok, status(), headers(), body()} | {:error, term()}

Should make an HTTP request to url with the given method, headers and body.