ProductDetails
Ce contenu n’est pas encore disponible dans votre langue.
struct ProductDetailsThe purchase line-item fields a campaign’s productScope can target.
Mirrors the backend’s PRODUCT_SCOPE_FIELDS allowlist and sdk/core’s ProductDetails
exactly (sdk/core/src/types/product.ts) — a field outside this set cannot have been
published on a campaign, so adding one here without a matching backend change would be
dead weight.
Double, not Int, for every numeric: the wire type is a JSON number and the backend
compares numerically; an Int would silently truncate a fractional unitPrice.
Decoding lives on a private wire type in RewardsDecoder.swift: a synthesized Decodable
throws on a present-but-wrong-typed value even for an Optional property, which would let one
reshaped field inside matchedProducts take down the whole rewards response.
Conforms to Swift.Equatable, Swift.Hashable, Swift.Sendable
Defined in: Sources/FrakSDK/Core/ProductDetails.swift:16
Initializers
Section titled “Initializers”init(productId:sku:name:quantity:unitPrice:totalPrice:)
Section titled “init(productId:sku:name:quantity:unitPrice:totalPrice:)”init( productId: String? = nil, sku: String? = nil, name: String? = nil, quantity: Double? = nil, unitPrice: Double? = nil, totalPrice: Double? = nil)Properties
Section titled “Properties”let name: String?productId
Section titled “productId”let productId: String?quantity
Section titled “quantity”let quantity: Double?let sku: String?totalPrice
Section titled “totalPrice”let totalPrice: Double?unitPrice
Section titled “unitPrice”let unitPrice: Double?Operators
Section titled “Operators”!=(::)
static func != (lhs: Self, rhs: Self) -> BoolReturns a Boolean value indicating whether two values are not equal.
Inequality is the inverse of equality. For any values a and b, a != b
implies that a == b is false.
This is the default implementation of the not-equal-to operator (!=)
for any type that conforms to Equatable.
- Parameters:
- lhs: A value to compare.
- rhs: Another value to compare.