← Receivers

products:generate

products family

Draft a product listing from what the seller has so far — description, tags, a collection (an existing one or a new name) and variant titles. Returns a PATCH for the editor and writes nothing; the pressed `focus` field is rewritten and every other field only filled when empty

Effect
ask
Awaits an outcome — the call returns the response below.
Caller
member
The class of authority the caller must already hold, decided from the attested context with no round trip.
Cost
variable
What one call costs, so you can budget before acting.
Reversible
yes
The effect can be undone by a later call.
Idempotent
no
Not safe to blind-retry — dedupe on the envelope idempotencyKey.

Send it with your agent

One click hands your coding agent a prompt that registers the substrate, reads this contract, and makes the call. Launch opens the app; the others copy the prompt.

Claude Code
Codex
Cursor
Gemini CLI
Claude Desktop
ChatGPT
curl -X POST https://one.ie/api/ask/products:generate \
  -H "Authorization: Bearer $ONE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data": { "slug": <string>, "name": <string> }}'

The key is never in a link. npx -y @oneie/cli login writes it to ~/.config/oneie/key on your machine.

Request

Validated before dispatch — an invalid payload is refused with the fix, never half-applied.

  • slug string required The workspace whose shop this is — its collections are read and its credits pay for the one model turn
  • name string required The product name — required, every other field is optional context
  • focus description | tags | collection | … optional Which Generate button was pressed; that field is rewritten, the others are only filled when empty. Default all
  • description string optional What the seller has written so far; improved, never contradicted
  • tags string[] optional
  • collection string optional
  • price number optional Major units (dollars). Used to price generated variants
  • ships boolean optional True for a physical parcel; false for a download, course or service
  • variants object[] optional

Response

What comes back from the call.

  • patch object
  • collections string[] The shop's existing collections, for the editor's drop-down
  • error string
  • balance number
  • needed number
  • topupUrl string

Traffic

Every call to products:generate, counted where it is dispatched — over HTTP or in-process alike. Aggregate only — no actor, no payload, no workspace.

Counting…

Wiring

Every place in the open source that names products:generate, and the file that answers it. Read from the tree at build time — a receiver is reached by NAME through one door, so there is no import edge to follow and a grep is the honest shape of the question. Structure, not volume — the count is in Traffic above.

Called from

UI 1
  • one.ie/web/src/components/products/ProductEditor.tsx:212
API route 2
  • one.ie/web/src/lib/receiver-index.generated.ts:293
  • one.ie/web/src/lib/resolvers/storefront/product-generate.ts:51
→

Answered by

products:generate one.ie/web/src/lib/resolvers/commerce.ts:948 Dispatched through POST /api/ask/products:generate, after the envelope validates the payload.
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "slug": {
      "type": "string",
      "description": "The workspace whose shop this is — its collections are read and its credits pay for the one model turn"
    },
    "name": {
      "type": "string",
      "description": "The product name — required, every other field is optional context"
    },
    "focus": {
      "description": "Which Generate button was pressed; that field is rewritten, the others are only filled when empty. Default all",
      "type": "string",
      "enum": [
        "description",
        "tags",
        "collection",
        "variants",
        "all"
      ]
    },
    "description": {
      "description": "What the seller has written so far; improved, never contradicted",
      "type": "string"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "collection": {
      "type": "string"
    },
    "price": {
      "description": "Major units (dollars). Used to price generated variants",
      "type": "number"
    },
    "ships": {
      "description": "True for a physical parcel; false for a download, course or service",
      "type": "boolean"
    },
    "variants": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "sku": {
            "type": "string"
          },
          "price": {
            "type": "string"
          },
          "stock": {
            "type": "string"
          }
        },
        "required": [
          "title"
        ]
      }
    }
  },
  "required": [
    "slug",
    "name"
  ]
}
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "patch": {
      "type": "object",
      "properties": {
        "description": {
          "type": "string"
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "collection": {
          "type": "string"
        },
        "variants": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "sku": {
                "type": "string"
              },
              "price": {
                "type": "string"
              },
              "stock": {
                "type": "string"
              }
            },
            "required": [
              "title",
              "sku",
              "price",
              "stock"
            ]
          }
        }
      }
    },
    "collections": {
      "description": "The shop's existing collections, for the editor's drop-down",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "error": {
      "type": "string"
    },
    "balance": {
      "type": "number"
    },
    "needed": {
      "type": "number"
    },
    "topupUrl": {
      "type": "string"
    }
  }
}