MillionSend.Segments (MillionSend v0.6.0)

Copy Markdown View Source

Segments — a saved filter over the team's contacts (dynamic, a MillionSend extension over Resend's static segments); a segment without a filter is a plain list contacts are added to explicitly. get/2 returns a live contact_count.

MillionSend.Segments.create(%{
  name: "Pro plan",
  filter: %{match: :all, conditions: [%{field: "property:plan", op: "equals", value: "pro"}]}
})

Summary

Functions

POST /segmentsname: plus an optional filter:.

GET /segments — accepts limit:, after:, before:.

GET /segments/:id/contacts — the segment's members; accepts limit:, after:, before:.

Functions

create(client \\ MillionSend.client(), params)

@spec create(MillionSend.Client.t(), map()) ::
  {:ok, MillionSend.Segments.Segment.t()} | {:error, MillionSend.Error.t()}

POST /segmentsname: plus an optional filter:.

get(client \\ MillionSend.client(), id)

GET /segments/:id

list()

GET /segments — accepts limit:, after:, before:.

list(client)

@spec list(MillionSend.Client.t() | keyword()) ::
  {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

list(client, opts)

@spec list(
  MillionSend.Client.t(),
  keyword()
) :: {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

list_contacts(id)

@spec list_contacts(String.t()) ::
  {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

GET /segments/:id/contacts — the segment's members; accepts limit:, after:, before:.

list_contacts(client, id)

@spec list_contacts(MillionSend.Client.t() | String.t(), String.t() | keyword()) ::
  {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

list_contacts(client, id, opts)

@spec list_contacts(MillionSend.Client.t(), String.t(), keyword()) ::
  {:ok, MillionSend.List.t()} | {:error, MillionSend.Error.t()}

remove(client \\ MillionSend.client(), id)

DELETE /segments/:id

update(client \\ MillionSend.client(), id, params)

@spec update(MillionSend.Client.t(), String.t(), map()) ::
  {:ok, MillionSend.Segments.Segment.t()} | {:error, MillionSend.Error.t()}

PATCH /segments/:id