Tesla.Builder (tesla v1.5.1) View Source

Link to this section Summary

Functions

Choose adapter for your API client.

Attach middleware to your API client.

Link to this section Functions

Link to this macro

adapter(name, opts)

View Source (macro)

Choose adapter for your API client.

defmodule ExampleApi do
  use Tesla

  # set adapter as module
  adapter Tesla.Adapter.Hackney

  # set adapter as anonymous function
  adapter fn env ->
    ...
    env
  end
end
Link to this function

client(pre, post, adapter \\ nil)

View Source
Link to this macro

plug(middleware)

View Source (macro)
Link to this macro

plug(middleware, opts)

View Source (macro)

Attach middleware to your API client.

defmodule ExampleApi do
  use Tesla

  # plug middleware module with options
  plug Tesla.Middleware.BaseUrl, "http://api.example.com"

  # or without options
  plug Tesla.Middleware.JSON

  # or a custom middleware
  plug MyProject.CustomMiddleware
end