mirror of
https://github.com/hanzoai/swift-sdk.git
synced 2026-10-30 18:20:19 +00:00
The projection these were generated from predated the compute migration, so they described /v1/visor — which the API serves at zero paths now. No /v1/visor path survives here.
64 lines
2.5 KiB
Swift
64 lines
2.5 KiB
Swift
//
|
|
// CartItem.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct CartItem: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** Free reports a line that costs nothing because a coupon or a promotion made it so, rather than because its price is zero. */
|
|
public var free: Bool?
|
|
/** ID is the line's identity — the variant id when the line is a variant, otherwise the product id. It is what a subsequent set call addresses. */
|
|
public var id: String?
|
|
/** Kind is \"variant\" when this line is a specific sellable variant and \"product\" when it is the product itself. */
|
|
public var kind: String?
|
|
/** Name is the item's display name, cached onto the line when it was added so a cart renders without a second read. */
|
|
public var name: String?
|
|
/** PriceCents is the unit price in whole cents, cached at the moment the line was added. The line's contribution to the cart is this times Quantity. */
|
|
public var priceCents: Int64?
|
|
/** Quantity is how many units of this item the cart holds. */
|
|
public var quantity: Int64?
|
|
/** SKU is the line's stock-keeping unit — the variant's when it has one, otherwise the product's. Empty when neither carries one. */
|
|
public var sku: String?
|
|
|
|
public init(free: Bool? = nil, id: String? = nil, kind: String? = nil, name: String? = nil, priceCents: Int64? = nil, quantity: Int64? = nil, sku: String? = nil) {
|
|
self.free = free
|
|
self.id = id
|
|
self.kind = kind
|
|
self.name = name
|
|
self.priceCents = priceCents
|
|
self.quantity = quantity
|
|
self.sku = sku
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case free
|
|
case id
|
|
case kind
|
|
case name
|
|
case priceCents
|
|
case quantity
|
|
case sku
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(free, forKey: .free)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(kind, forKey: .kind)
|
|
try container.encodeIfPresent(name, forKey: .name)
|
|
try container.encodeIfPresent(priceCents, forKey: .priceCents)
|
|
try container.encodeIfPresent(quantity, forKey: .quantity)
|
|
try container.encodeIfPresent(sku, forKey: .sku)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension CartItem: Identifiable {}
|