AlmondTill/G3N API

On this page

refreshSegment

mutation · in the family Pricing

What it does

Recompute a rule-based segment’s membership from its rule — shoppers who now match join, shoppers who no longer match leave.

Re-materialize a DYNAMIC segment's membership: a bounded probe sizes YOUR consumer universe first — at most 10,000 evaluates IN-REQUEST (the stored predicate, diffed against the member rows, adds/removes in bounded transactions, evaluatedAt stamped, refreshProblem cleared; answers queued: false + the arithmetic); past that the refresh is QUEUED (answers queued: true, arithmetic absent — the worker re-materializes up to 1,000,000 consumers; evaluatedAt moves on completion, refreshProblem words an over-cap outcome; a scheduled sweep also re-refreshes stale ACTIVE dynamics ~daily). Synchronous matches beyond the 100,000 membership cap refuse BEFORE any write; a static segment refuses (its membership moves via the member ops); legal on active AND inactive segments, never doomed. Not one atomic transaction — re-run heals an interrupted refresh. Requires the unrestricted capability. Template class (v89).

What happens

Rewrites the membership list and stamps when it was last computed; hand-picked membership is the static kind’s job.

Who may call it

Capability area: Pricing — Prices, price schedules, promotions, coupons and the money rules of selling.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.

Returns

RefreshSegmentResult RefreshSegmentResult! — The refreshSegment result — sync (queued: false): the re-stamped segment + the honest arithmetic; queued (queued: true): the CURRENT segment, the arithmetic honestly ABSENT (the worker re-materializes shortly — evaluatedAt moves on completion; refreshProblem words a refresh that could not complete).

Example request

mutation ExampleRefreshSegment($id: ID!) {
  refreshSegment(id: $id) {
    queued
    matched
    added
    removed
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000"
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "refreshSegment": {
      "queued": true,
      "matched": 1,
      "added": 1,
      "removed": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Used in