View Source ExPipedrive.LeadLabels (ex_pipedrive v0.2.0)

API v1 shim for Pipedrive lead labels.

Unlike Deal/Person/Organization labels (option values on a label_ids field), Leads have a dedicated /api/v1/leadLabels endpoint with full CRUD except a single-item getGET /leadLabels always returns every label (no pagination, no filtering).

Assigning or clearing labels on a lead is done through ExPipedrive.Leads.update/3 with a label_ids attribute (a list of label ids) — there is no separate assign/clear endpoint.

Summary

Functions

Creates a lead label via POST /api/v1/leadLabels.

Deletes a lead label via DELETE /api/v1/leadLabels/:id.

Lists all lead labels via GET /api/v1/leadLabels.

Updates a lead label via PATCH /api/v1/leadLabels/:id.

Functions

@spec create(Tesla.Client.t(), term()) ::
  {:ok, ExPipedrive.Label.t()} | {:error, ExPipedrive.Error.t()}

Creates a lead label via POST /api/v1/leadLabels.

Accepts a map (preferred) or %Label{} with :name and :color. color must be one of green, blue, red, yellow, purple, or gray.

@spec delete(Tesla.Client.t(), term()) ::
  {:ok, term()} | {:error, ExPipedrive.Error.t()}

Deletes a lead label via DELETE /api/v1/leadLabels/:id.

@spec list(Tesla.Client.t()) ::
  {:ok, [ExPipedrive.Label.t()]} | {:error, ExPipedrive.Error.t()}

Lists all lead labels via GET /api/v1/leadLabels.

This endpoint does not support pagination — all labels are always returned.

Link to this function

update(client, id, attrs)

View Source
@spec update(Tesla.Client.t(), term(), term()) ::
  {:ok, ExPipedrive.Label.t()} | {:error, ExPipedrive.Error.t()}

Updates a lead label via PATCH /api/v1/leadLabels/:id.

Only properties included in attrs are updated.