-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38c99ab
commit 83bde8c
Showing
21 changed files
with
1,552 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
Sources/code/application/Models/Cart/CartItemInfoCartAppModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
|
||
|
||
import Foundation | ||
public extension ApplicationClient.Cart { | ||
/* | ||
Model: CartItemInfo | ||
Used By: Cart | ||
*/ | ||
class CartItemInfo: Codable { | ||
|
||
public var itemId: Int? | ||
|
||
public var size: String? | ||
|
||
public var storeId: Int? | ||
|
||
public var success: Bool? | ||
|
||
public var message: String? | ||
|
||
|
||
public enum CodingKeys: String, CodingKey { | ||
|
||
case itemId = "item_id" | ||
|
||
case size = "size" | ||
|
||
case storeId = "store_id" | ||
|
||
case success = "success" | ||
|
||
case message = "message" | ||
|
||
} | ||
|
||
public init(itemId: Int? = nil, message: String? = nil, size: String? = nil, storeId: Int? = nil, success: Bool? = nil) { | ||
|
||
self.itemId = itemId | ||
|
||
self.size = size | ||
|
||
self.storeId = storeId | ||
|
||
self.success = success | ||
|
||
self.message = message | ||
|
||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
do { | ||
itemId = try container.decode(Int.self, forKey: .itemId) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
size = try container.decode(String.self, forKey: .size) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
storeId = try container.decode(Int.self, forKey: .storeId) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
success = try container.decode(Bool.self, forKey: .success) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
|
||
do { | ||
message = try container.decode(String.self, forKey: .message) | ||
|
||
} catch DecodingError.typeMismatch(let type, let context) { | ||
print("Type '\(type)' mismatch:", context.debugDescription) | ||
print("codingPath:", context.codingPath) | ||
} catch { | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
|
||
|
||
try? container.encodeIfPresent(itemId, forKey: .itemId) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(size, forKey: .size) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(storeId, forKey: .storeId) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(success, forKey: .success) | ||
|
||
|
||
|
||
try? container.encodeIfPresent(message, forKey: .message) | ||
|
||
|
||
} | ||
|
||
} | ||
} |
Oops, something went wrong.