Expand description
Serde shapes for the basket API.
Every field here was observed on a live response, not read
from documentation – there isn’t any. Structs are therefore deliberately
permissive: unknown fields are ignored and almost everything is defaulted,
so a K-Ruoka deploy that adds or drops a field degrades the output rather
than failing the call.
Structs§
- Amount
Info - Basket
- The raw basket, as returned by
/kr-api/basket/activeand by every successfulPATCH /kr-api/basket/by-id/{id}. - Basket
Item - Brand
- Cart
Item View - Cart
View - Localized
Name - Mobile
Scan - Mobile
Scan Pricing - NewItem
- Normal
Price - Offer
Product - Offer
Unit - Personal
Offer - Personal
Offer Normal Pricing - Personal
Offer Pricing - Personal
Offer Product - Personal
Offer Product View - Personal
Offer View - Personal
Offers Response POST /kr-api/tos-offers– OmaPlussa-edut, the account’s personalised offers. “tos” is K-Ruoka’s own term, seen throughout the frontend (tosOffers,isTargetingOffersAllowed); not modelled here since nothing surfaces it.- Personal
Offers View - Price
Summary - Pricing
- Product
Details - Only the one key we need. The full blob is several KB of nutrition data, images and category trees.
- Product
Hit - Product
Search Response POST /kr-api/v2/product-search/{term}. Only the fields the tool surfaces are modelled; the response also carries aggregations, brands and suggestions.- Product
Search View - Product
View - Search
Product - Store
- Store
Hit - Store
Search Response POST /kr-api/stores/search, which takes its query in a JSON body rather than the path or query string like product search does.- Store
Search View - Store
View - Unit
Price - User
Info - Empty strings throughout on an anonymous session; populated once logged in. This is the only reliable signal of whether the basket belongs to an account, because an anonymous caller gets a perfectly valid basket rather than a 401.
Enums§
- Basket
Event - A cart mutation.
PATCH /kr-api/basket/by-id/{id}always takes an array of these, even for a single change.
Constants§
- DEFAULT_
UNIT - K-Ruoka amounts always carry a unit.
kpl(“pieces”) is overwhelmingly the common one, including for goods that are priced by weight.