Cartesiandocs

Android · cartesian-core

Models

Product, Cart, Wishlist, Comparison, ShopperProfile and User.

Models wrap the backend's JSON. The typed getters cover common fields, and toJson() returns the full object so that fields specific to your backend aren't lost.

Product

PropertyTypeNotes
idStringproduct_id, falling back to id
nameString
brandString?manufacturer
priceDouble?The current price. Apparel sale_price wins when it is lower.
regularPriceDouble?Set only when the product is on sale
isOnSaleBoolean
currencyStringDefault USD
imageUrl, productUrl, sku, size, category, department, aisle, shelf, color, description, promoLabelString?
featuresList<String>
ratingDouble?
reviewCountInt?
isUsualBooleanThe shopper buys it regularly
isSnapEligibleBoolean?Grocery
attributesSet<String>All JSON keys present
val json = product.toJson()
val again = Product.fromJson(json)
kotlin

Cart and Wishlist

Cart
linesList<CartLine>, each with product and quantity
itemCount / distinctItemCountInt
total / currencyDouble? / String?
allPricesAvailableBoolean
quantityOf(productId)Int

Wishlist.products: List<Product>, Wishlist.contains(productId). Both have an EMPTY constant.

Comparison

products, rows (feature, values), summary, nextStep, recommendations: Map<String, String>, and prosCons (product, pros, cons, whyBuy, whyNotBuy).

ShopperProfile

name, facts: Map<String, String>, and members (household members with id, name, relationship and facts), for example dietary needs and allergies the assistant remembers.

User and AuthState

sealed interface AuthState {
    data object Restoring : AuthState
    data object SignedOut : AuthState
    class SignedIn(val user: User) : AuthState     // user.id, user.email, user.displayName
}
kotlin