grabmart
GrabMart API client for grabcli.
This is an internal building block of the grab CLI, not a general-purpose
library. Its API is not stable.
Modules
api: public and protected endpoint URLs and the URL allowlist; the order-submission URL is only registered when ordering is enabled.client:Mart::new(ctx); requests paced by an injectablePacer(at least 2 s apart, one retry on429).recaptcha: the reCAPTCHA v3 token, minted in the browser over CDP and never printed or cached.model: stores, departments and products.cart,quote: the mart cart (a value, separate from food's) and price quotes.order: gated order submission, sharing GrabFood's confirmation gate (docs/mart.md).
How it fits
Built on grabcli-core for session, auth (including
GrabMart's own GrabID web login), HTTP and the read-only browse cache, and reuses grabfood's order gate. The
grabcli binary implements grab mart on top of it.
See the root README's disclaimer.
Example
keep a cart in memory
use grabmart::{Cart, CartItem};
let mut cart = Cart::default();
cart.add("store-id", "Example store", CartItem {
item_id: "item-id".into(),
quantity: 2,
name: "Example item".into(),
unit_price_minor: 5_000,
campaign_id: None,
comment: String::new(),
})?;
assert!(!cart.is_empty());
# Ok::<(), grabcli_core::Error>(())
This example makes no network calls. A cart price is only a display snapshot;
obtain a live quote through Mart before considering an order.