MillionSend.Segments (MillionSend v0.1.0)

Copy Markdown View Source

Dynamic segments — a saved filter over an audience's contacts. A MillionSend extension with no Resend equivalent; the wire path is /segments2. get/2 returns a live contact_count.

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

Summary

Functions

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

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

POST /segments2

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

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

GET /segments2/:id

list()

GET /segments2 — 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()}

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

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

DELETE /segments2/: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 /segments2/:id