View Source CozyLark.ServerSideAPI.Client behaviour (cozy_lark v0.4.1)

Specification for the HTTP client of CozyLark.ServerSideAPI.

It can be set to a client provided by CozyLark, such as:

config :cozy_lark, :server_side_api_client, CozyLark.ServerSideAPI.Client.Finch

Or, set it to your own client, such as:

config :cozy_lark, :server_side_api_client, MyClient

Link to this section Summary

Types

The response of a request.

Callbacks

Callback to initialize the given API client.

Callback to send a request.

Functions

Send a struct %CozyLark.ServerSideAPI.Request{} as an HTTP request by the given client.

Link to this section Types

@type body() :: map()
@type headers() :: [{binary(), binary()}]
@type response() :: {:ok, status(), headers(), body()} | {:error, term()}

The response of a request.

@type status() :: pos_integer()

Link to this section Callbacks

@callback init() :: :ok

Callback to initialize the given API client.

@callback request(CozyLark.ServerSideAPI.Request.t()) :: response()

Callback to send a request.

Link to this section Functions

Send a struct %CozyLark.ServerSideAPI.Request{} as an HTTP request by the given client.