Client & hooks
Every method is a GET, is safe to retry, and accepts an optional AbortSignal in JavaScript for cancellation.
Constructing
<ArmenusProvider
publishableKey="pk_live_..."
baseUrl="https://api.armenus.app/v1" // optional
timeoutMs={8000} // optional
retries={2} // optional
>Methods
What this key can see: its scope, its owner’s name, and every merchant it may read. Call it once at startup — it is the only way a revoked or mistyped key fails loudly instead of presenting as an empty catalogue for the lifetime of the app.
One dish, by Armenus id.
One dish, by your identifier — your SKU, your product id, a barcode. The route that makes an integration cheap: your app already has its own id on the screen it is about to render, so it never has to migrate a column of our uuids into its catalogue first.
Every dish on a merchant. Pass withModel: true for only those with a ready, published model — the filter runs in the database, so limit and offset paginate against the filtered set and a page of 20 really is 20.
Up to 50 dishes in one request, returned in the order you asked so a grid does not reshuffle itself. Twenty round trips from a phone on restaurant wifi is the difference between a grid that pops in and one that trickles.
Batching
A product grid needs many models at once. Ask for them together rather than a request per card.
// One request for the whole grid, rather than one per card.
const { data } = useArmenusItems(merchantId, { withModel: true, limit: 20 });Hooks
React and React Native expose the same four hooks, each returning { data, loading, error }.
| Hook | Data |
|---|---|
useArmenusItem(itemId) | EmbedItem |
useArmenusItemByRef(merchantId, ref) | EmbedItem |
useArmenusItems(merchantId, opts?) | EmbedItem[] |
useArmenusConfig() | EmbedConfig |
Failures come back as ArmenusError — what each one means, and what to do.