CMSAttachmentInfoResponse.swift 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // CMSAttachmentInfoResponse.swift
  3. // O2Platform
  4. //
  5. // Created by FancyLou on 2019/7/10.
  6. // Copyright © 2019 zoneland. All rights reserved.
  7. //
  8. import Foundation
  9. import ObjectMapper
  10. class CMSAttachmentInfoResponse : NSObject, NSCoding, Mappable{
  11. var count : Int?
  12. var data : CMSPublishInfoData?
  13. var date : String?
  14. var message : String?
  15. var position : Int?
  16. var size : Int?
  17. var spent : Int?
  18. var type : String?
  19. class func newInstance(map: Map) -> Mappable?{
  20. return CMSAttachmentInfoResponse()
  21. }
  22. required init?(map: Map){}
  23. private override init(){}
  24. func mapping(map: Map)
  25. {
  26. count <- map["count"]
  27. data <- map["data"]
  28. date <- map["date"]
  29. message <- map["message"]
  30. position <- map["position"]
  31. size <- map["size"]
  32. spent <- map["spent"]
  33. type <- map["type"]
  34. }
  35. /**
  36. * NSCoding required initializer.
  37. * Fills the data from the passed decoder
  38. */
  39. @objc required init(coder aDecoder: NSCoder)
  40. {
  41. count = aDecoder.decodeObject(forKey: "count") as? Int
  42. data = aDecoder.decodeObject(forKey: "data") as? CMSPublishInfoData
  43. date = aDecoder.decodeObject(forKey: "date") as? String
  44. message = aDecoder.decodeObject(forKey: "message") as? String
  45. position = aDecoder.decodeObject(forKey: "position") as? Int
  46. size = aDecoder.decodeObject(forKey: "size") as? Int
  47. spent = aDecoder.decodeObject(forKey: "spent") as? Int
  48. type = aDecoder.decodeObject(forKey: "type") as? String
  49. }
  50. /**
  51. * NSCoding required method.
  52. * Encodes mode properties into the decoder
  53. */
  54. @objc func encode(with aCoder: NSCoder)
  55. {
  56. if count != nil{
  57. aCoder.encode(count, forKey: "count")
  58. }
  59. if data != nil{
  60. aCoder.encode(data, forKey: "data")
  61. }
  62. if date != nil{
  63. aCoder.encode(date, forKey: "date")
  64. }
  65. if message != nil{
  66. aCoder.encode(message, forKey: "message")
  67. }
  68. if position != nil{
  69. aCoder.encode(position, forKey: "position")
  70. }
  71. if size != nil{
  72. aCoder.encode(size, forKey: "size")
  73. }
  74. if spent != nil{
  75. aCoder.encode(spent, forKey: "spent")
  76. }
  77. if type != nil{
  78. aCoder.encode(type, forKey: "type")
  79. }
  80. }
  81. }