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.
109 lines
4.8 KiB
Swift
109 lines
4.8 KiB
Swift
//
|
|
// Cart.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct Cart: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** CreatedAt is when the cart was opened, RFC3339. */
|
|
public var createdAt: String?
|
|
/** Currency is the ISO 4217 code every amount below is denominated in. */
|
|
public var currency: String?
|
|
/** DiscountCents is what coupons and promotions took off, in whole cents. */
|
|
public var discountCents: Int64?
|
|
/** Email is the shopper's address, when the cart carries one. */
|
|
public var email: String?
|
|
/** ID is the cart's id — what every other cart op addresses it by, and what a storefront persists against the browser session. */
|
|
public var id: String?
|
|
/** Items are the cart's lines, in the order they were added. */
|
|
public var items: [CartItem]?
|
|
/** LineTotalCents is the sum of the lines before any discount, in whole cents. */
|
|
public var lineTotalCents: Int64?
|
|
/** Order is the order this cart became, once checkout completed it. Empty until then, and its presence is what makes a cart final. */
|
|
public var order: String?
|
|
/** ShippingCents is the shipping charge, in whole cents. It stays zero until a shipping option is priced at checkout. */
|
|
public var shippingCents: Int64?
|
|
/** Status is \"active\" for a cart still being filled, \"ordered\" once checkout turned it into an order, and \"discarded\" when the shopper abandoned it. */
|
|
public var status: String?
|
|
/** Store is the storefront the cart is being filled on. */
|
|
public var store: String?
|
|
/** SubtotalCents is LineTotalCents less DiscountCents, in whole cents. */
|
|
public var subtotalCents: Int64?
|
|
/** TaxCents is the sales tax, in whole cents. It stays zero until checkout resolves the shopper's tax region. */
|
|
public var taxCents: Int64?
|
|
/** TotalCents is what the shopper pays: subtotal plus shipping plus tax, in whole cents. */
|
|
public var totalCents: Int64?
|
|
/** UpdatedAt is when the cart was last amended, RFC3339. */
|
|
public var updatedAt: String?
|
|
/** User is the signed-in shopper this cart belongs to, empty for a guest cart. */
|
|
public var user: String?
|
|
|
|
public init(createdAt: String? = nil, currency: String? = nil, discountCents: Int64? = nil, email: String? = nil, id: String? = nil, items: [CartItem]? = nil, lineTotalCents: Int64? = nil, order: String? = nil, shippingCents: Int64? = nil, status: String? = nil, store: String? = nil, subtotalCents: Int64? = nil, taxCents: Int64? = nil, totalCents: Int64? = nil, updatedAt: String? = nil, user: String? = nil) {
|
|
self.createdAt = createdAt
|
|
self.currency = currency
|
|
self.discountCents = discountCents
|
|
self.email = email
|
|
self.id = id
|
|
self.items = items
|
|
self.lineTotalCents = lineTotalCents
|
|
self.order = order
|
|
self.shippingCents = shippingCents
|
|
self.status = status
|
|
self.store = store
|
|
self.subtotalCents = subtotalCents
|
|
self.taxCents = taxCents
|
|
self.totalCents = totalCents
|
|
self.updatedAt = updatedAt
|
|
self.user = user
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case createdAt
|
|
case currency
|
|
case discountCents
|
|
case email
|
|
case id
|
|
case items
|
|
case lineTotalCents
|
|
case order
|
|
case shippingCents
|
|
case status
|
|
case store
|
|
case subtotalCents
|
|
case taxCents
|
|
case totalCents
|
|
case updatedAt
|
|
case user
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(createdAt, forKey: .createdAt)
|
|
try container.encodeIfPresent(currency, forKey: .currency)
|
|
try container.encodeIfPresent(discountCents, forKey: .discountCents)
|
|
try container.encodeIfPresent(email, forKey: .email)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(items, forKey: .items)
|
|
try container.encodeIfPresent(lineTotalCents, forKey: .lineTotalCents)
|
|
try container.encodeIfPresent(order, forKey: .order)
|
|
try container.encodeIfPresent(shippingCents, forKey: .shippingCents)
|
|
try container.encodeIfPresent(status, forKey: .status)
|
|
try container.encodeIfPresent(store, forKey: .store)
|
|
try container.encodeIfPresent(subtotalCents, forKey: .subtotalCents)
|
|
try container.encodeIfPresent(taxCents, forKey: .taxCents)
|
|
try container.encodeIfPresent(totalCents, forKey: .totalCents)
|
|
try container.encodeIfPresent(updatedAt, forKey: .updatedAt)
|
|
try container.encodeIfPresent(user, forKey: .user)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension Cart: Identifiable {}
|