Docspring.Connection (docspring v3.0.0)

Handle Tesla connections for Docspring.

Additional middleware can be set in the compile-time or runtime configuration:

config :tesla, Docspring.Connection,
  base_url: "https://sync.api.docspring.com/api/v1",
  adapter: Tesla.Adapter.Hackney

The default base URL can also be set as:

config :docspring,
  :base_url, "https://sync.api.docspring.com/api/v1"

Summary

Types

The list of options that can be passed to new/1.

Functions

Returns the default adapter for this API.

Returns fully configured middleware for passing to Tesla.client/2.

Configure a Docspring client.

Forward requests to Tesla.

Types

options()

@type options() :: [
  base_url: String.t(),
  user_agent: String.t(),
  username: String.t() | nil,
  password: String.t() | nil,
  host: String.t(),
  region: String.t()
]

The list of options that can be passed to new/1.

  • base_url: Overrides the base URL on a per-client basis.
  • user_agent: Overrides the User-Agent header.
  • username: A username for basic authentication.
  • password: A password for basic authentication.
  • host: Convenience option for providing a Docspring host (scheme optional).
  • region: Region code (e.g. "US", "EU") that selects the Docspring host.

Functions

adapter()

Returns the default adapter for this API.

middleware(options \\ [])

@spec middleware(options()) :: [Tesla.Client.middleware()]

Returns fully configured middleware for passing to Tesla.client/2.

new(options \\ [])

@spec new(options()) :: Tesla.Env.client()

Configure a Docspring client.

Supports credentials supplied directly or via environment variables:

  • DOCSPRING_TOKEN_ID
  • DOCSPRING_TOKEN_SECRET

Host resolution precedence:

  1. options[:base_url]
  2. options[:host]
  3. DOCSPRING_HOST
  4. options[:region]
  5. DOCSPRING_REGION

Region values must be "US" or "EU" when provided.

Parameters

  • options: an optional keyword list of Docspring.Connection.options.

Returns

Tesla.Env.client

request(client, options)

@spec request(Tesla.Client.t(), [Tesla.option()]) :: Tesla.Env.result()

Forward requests to Tesla.