Tesla.Builder (tex v0.1.0)

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)

(macro)
Link to this macro

adapter(name, opts)

(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)

Link to this macro

plug(middleware)

(macro)
Link to this macro

plug(middleware, opts)

(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