View Source ExPipedrive.Search (ex_pipedrive v0.1.0)

Pipedrive item search (API v2).

Wraps GET /api/v2/itemSearch with cursor pagination. Nested data.items[].item entries are unwrapped into ExPipedrive.SearchResult.

Per-resource helpers (search_deals/3, search_persons/3, search_organizations/3) set item_types and return the same page shape.

Legacy v1 resource search (Deals.search_deals/3, etc.) remains available for compatibility. Upstream LineDrive PR #22 (pass-through search opts) is covered here via explicit v2 options rather than opaque keyword merging — see GitHub #24.

Summary

Functions

Maximum page size for itemSearch (Pipedrive caps at 100).

Searches deals only (item_types=deal).

Searches organizations only (item_types=organization).

Searches across item types via GET /api/v2/itemSearch.

Searches persons only (item_types=person).

Lazily streams search results across all v2 cursor pages until next_cursor is nil.

Functions

@spec max_limit() :: pos_integer()

Maximum page size for itemSearch (Pipedrive caps at 100).

Link to this function

search_deals(client, term, opts \\ [])

View Source
@spec search_deals(Tesla.Client.t(), String.t(), keyword()) ::
  {:ok, ExPipedrive.Page.t()} | {:error, ExPipedrive.Error.t()}

Searches deals only (item_types=deal).

Link to this function

search_organizations(client, term, opts \\ [])

View Source
@spec search_organizations(Tesla.Client.t(), String.t(), keyword()) ::
  {:ok, ExPipedrive.Page.t()} | {:error, ExPipedrive.Error.t()}

Searches organizations only (item_types=organization).

Link to this function

search_page(client, term, opts \\ [])

View Source
@spec search_page(Tesla.Client.t(), String.t(), keyword()) ::
  {:ok, ExPipedrive.Page.t()} | {:error, ExPipedrive.Error.t()}

Searches across item types via GET /api/v2/itemSearch.

Returns one cursor page of %ExPipedrive.SearchResult{}.

Options

  • :item_types — list or comma-separated string (deal, person, organization, product, lead, …)
  • :fields — list or comma-separated searchable fields
  • :exact_match — boolean
  • :include_fields — list or comma-separated optional fields
  • :search_for_related_items — boolean
  • :custom_fields — hash of searchable custom field keys
  • :cursor / :limit — cursor pagination (limit clamped to 1..100)

Example

{:ok, %ExPipedrive.Page{data: results}} =
  ExPipedrive.Search.search_page(client, "acme", item_types: ["organization", "person"])

Enum.map(results, & &1.item)
Link to this function

search_persons(client, term, opts \\ [])

View Source
@spec search_persons(Tesla.Client.t(), String.t(), keyword()) ::
  {:ok, ExPipedrive.Page.t()} | {:error, ExPipedrive.Error.t()}

Searches persons only (item_types=person).

Link to this function

stream(client, term, opts \\ [])

View Source
@spec stream(Tesla.Client.t(), String.t(), keyword()) :: Enumerable.t()

Lazily streams search results across all v2 cursor pages until next_cursor is nil.