Expand description
GrabMart: the mart API client, models, cart and quote parsing (see docs/mart.md).
Browsing uses the mart public API with reCAPTCHA tokens minted in the CDP
browser (recaptcha); results are cached under namespace "mart". The
cart is a value the caller keeps; quotes hit protected/cart with the
logged-in session; the order path is gated exactly like GrabFood’s
(order). Build a client::Mart from a grabcli_core::Context.
§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());This example makes no network calls. A cart price is only a display snapshot;
obtain a live quote through Mart before considering an order.
Re-exports§
pub use cart::Cart;pub use cart::CartItem;pub use client::Mart;pub use client::MemoryPacer;pub use client::Pacer;
Modules§
- api
- GrabMart endpoint URLs and the URL allowlist (see docs/mart.md).
- cart
- A GrabMart cart: one store at a time, separate from the GrabFood cart.
A value the caller keeps (the
grabCLI stores<state>/mart/cart.json). Never cached; it only records ids, quantities and a price snapshot for display. - client
- The GrabMart API client: a
Contextplus reCAPTCHA minting, call pacing and mart-specific error messages. - model
- Parsing of GrabMart responses into small, display-ready structs.
- order
- GrabMart order submission — gated exactly like GrabFood, and disabled by default.
- quote
- GrabMart price quotes via
POST mart.grab.com/martwebapi/v1/protected/cart. - recaptcha
- reCAPTCHA v3 tokens for the GrabMart
publicAPI.