Showing
1 changed file
with
8 additions
and
0 deletions
... | @@ -395,6 +395,8 @@ public class swiftApi { | ... | @@ -395,6 +395,8 @@ public class swiftApi { |
395 | public let subcategory: String? | 395 | public let subcategory: String? |
396 | public let is_new: Bool? | 396 | public let is_new: Bool? |
397 | public let message: String? | 397 | public let message: String? |
398 | + public let loyaltyCampaignId: String? | ||
399 | + public let hasExtraFields: Bool? | ||
398 | 400 | ||
399 | init(dictionary: [String: Any]) { | 401 | init(dictionary: [String: Any]) { |
400 | self.index_url = dictionary["index_url"] as? String? ?? "" | 402 | self.index_url = dictionary["index_url"] as? String? ?? "" |
... | @@ -416,12 +418,18 @@ public class swiftApi { | ... | @@ -416,12 +418,18 @@ public class swiftApi { |
416 | { | 418 | { |
417 | extra_fields_parsed = jsonArray; | 419 | extra_fields_parsed = jsonArray; |
418 | self.subcategory = extra_fields_parsed["subcategory"] as? String? ?? "" | 420 | self.subcategory = extra_fields_parsed["subcategory"] as? String? ?? "" |
421 | + self.loyaltyCampaignId = extra_fields_parsed["loyaltyCampaignId"] as? String? ?? "" | ||
422 | + self.hasExtraFields = true | ||
419 | } else { | 423 | } else { |
420 | self.subcategory = "" | 424 | self.subcategory = "" |
425 | + self.loyaltyCampaignId = "" | ||
426 | + self.hasExtraFields = false | ||
421 | print("bad json") | 427 | print("bad json") |
422 | } | 428 | } |
423 | } catch let error as NSError { | 429 | } catch let error as NSError { |
424 | self.subcategory = "" | 430 | self.subcategory = "" |
431 | + self.loyaltyCampaignId = "" | ||
432 | + self.hasExtraFields = false | ||
425 | print(error) | 433 | print(error) |
426 | } | 434 | } |
427 | 435 | ... | ... |
-
Please register or login to post a comment