View Source ExPipedrive.Request (ex_pipedrive v0.1.0)

Versioned Pipedrive API request helpers.

Owns path construction so resource modules do not hard-code /api/v1 or /api/v2. Defaults to v2; pass api_version: :v1 for controlled fallback without duplicating HTTP logic.

Summary

Functions

Performs a DELETE against a versioned resource path.

Performs a GET against a versioned resource path.

Performs a PATCH against a versioned resource path.

Builds a versioned API path for a resource segment.

Performs a POST against a versioned resource path.

Performs a PUT against a versioned resource path.

Types

@type api_version() :: :v1 | :v2
@type resource() :: String.t() | atom()
@type result() :: {:ok, Tesla.Env.t()} | {:error, any()}

Functions

Link to this function

delete(client, resource, opts \\ [])

View Source
@spec delete(Tesla.Client.t(), resource(), keyword()) :: result()

Performs a DELETE against a versioned resource path.

Link to this function

get(client, resource, opts \\ [])

View Source
@spec get(Tesla.Client.t(), resource(), keyword()) :: result()

Performs a GET against a versioned resource path.

Options:

  • :api_version:v2 (default) or :v1
  • remaining options are passed through to Tesla.get/3 (:query, :opts, …)
Link to this function

patch(client, resource, body, opts \\ [])

View Source
@spec patch(Tesla.Client.t(), resource(), term(), keyword()) :: result()

Performs a PATCH against a versioned resource path.

Link to this function

path(resource, opts \\ [])

View Source
@spec path(
  resource(),
  keyword()
) :: String.t()

Builds a versioned API path for a resource segment.

Examples

iex> ExPipedrive.Request.path("deals")
"/api/v2/deals"

iex> ExPipedrive.Request.path("deals/:id", api_version: :v1)
"/api/v1/deals/:id"

iex> ExPipedrive.Request.path("dealFields", api_version: :v1)
"/api/v1/dealFields"
Link to this function

post(client, resource, body, opts \\ [])

View Source
@spec post(Tesla.Client.t(), resource(), term(), keyword()) :: result()

Performs a POST against a versioned resource path.

Link to this function

put(client, resource, body, opts \\ [])

View Source
@spec put(Tesla.Client.t(), resource(), term(), keyword()) :: result()

Performs a PUT against a versioned resource path.