-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewnetwrking2
63 lines (48 loc) · 1.95 KB
/
newnetwrking2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Foundation
struct ResponseBase<T:Codable> : Codable {
let code : String?
let data : [T]?
let message : String?
enum CodingKeys: String, CodingKey {
case code = "Code"
case data = "Data"
case message = "Message"
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
code = try values.decodeIfPresent(String.self, forKey: .code)
data = try values.decodeIfPresent([T].self, forKey: .data)
message = try values.decodeIfPresent(String.self, forKey: .message)
}
}
struct SocialWarmer : Codable {
let createdDate : String?
let lookUpId : String?
let lookupKey : String?
let lookupValue : String?
let parentId : String?
let statusFlag : String?
let type : String?
let updatedDate : String?
enum CodingKeys: String, CodingKey {
case createdDate = "CreatedDate"
case lookUpId = "LookUpId"
case lookupKey = "LookupKey"
case lookupValue = "LookupValue"
case parentId = "ParentId"
case statusFlag = "StatusFlag"
case type = "Type"
case updatedDate = "UpdatedDate"
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
createdDate = try values.decodeIfPresent(String.self, forKey: .createdDate)
lookUpId = try values.decodeIfPresent(String.self, forKey: .lookUpId)
lookupKey = try values.decodeIfPresent(String.self, forKey: .lookupKey)
lookupValue = try values.decodeIfPresent(String.self, forKey: .lookupValue)
parentId = try values.decodeIfPresent(String.self, forKey: .parentId)
statusFlag = try values.decodeIfPresent(String.self, forKey: .statusFlag)
type = try values.decodeIfPresent(String.self, forKey: .type)
updatedDate = try values.decodeIfPresent(String.self, forKey: .updatedDate)
}
}