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.
49 lines
1.8 KiB
Swift
49 lines
1.8 KiB
Swift
//
|
|
// CartItemSet.swift
|
|
//
|
|
// Generated by openapi-generator
|
|
// https://openapi-generator.tech
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public struct CartItemSet: Sendable, Codable, ParameterConvertible, Hashable {
|
|
|
|
/** ID is the cart to amend, from the path. */
|
|
public var id: String?
|
|
/** Product names the catalog product to set, by its id or its URL slug. Give this or Variant, never both; a request naming neither is refused. */
|
|
public var product: String?
|
|
/** Quantity is how many of that item the cart should hold AFTER this call — it is the resulting count, not a delta, so sending 3 twice leaves 3 and not 6. ZERO REMOVES the line, which is the only way to take an item out. */
|
|
public var quantity: Int64?
|
|
/** Variant names the specific sellable variant to set, by its id or its SKU. Prefer it over Product for anything sold in sizes, colours or tiers — the price and the stock are the variant's, not the product's. */
|
|
public var variant: String?
|
|
|
|
public init(id: String? = nil, product: String? = nil, quantity: Int64? = nil, variant: String? = nil) {
|
|
self.id = id
|
|
self.product = product
|
|
self.quantity = quantity
|
|
self.variant = variant
|
|
}
|
|
|
|
public enum CodingKeys: String, CodingKey, CaseIterable {
|
|
case id
|
|
case product
|
|
case quantity
|
|
case variant
|
|
}
|
|
|
|
// Encodable protocol methods
|
|
|
|
public func encode(to encoder: Encoder) throws {
|
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
try container.encodeIfPresent(id, forKey: .id)
|
|
try container.encodeIfPresent(product, forKey: .product)
|
|
try container.encodeIfPresent(quantity, forKey: .quantity)
|
|
try container.encodeIfPresent(variant, forKey: .variant)
|
|
}
|
|
}
|
|
|
|
|
|
@available(iOS 13, tvOS 13, watchOS 6, macOS 10.15, *)
|
|
extension CartItemSet: Identifiable {}
|