blob: 368c8df01967e17592321b96a34e47208b2a410b (
plain) (
blame)
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
|
//
// Models.swift
// tst
//
// Created by Vitaly Takmazov on 10.12.2019.
// Copyright © 2019 com.juick. All rights reserved.
//
import Foundation
typealias Model = Decodable & Identifiable
typealias Root = Array<Message>
struct Attachment: Decodable {
var url: String
}
struct Entity: Decodable {
var type: String
var text: String
var link: String?
var start: Int?
var end: Int?
}
struct User: Model {
var id: Int
var name: String
var avatar: String?
private enum CodingKeys : String, CodingKey {
case id = "uid", name = "uname", avatar
}
}
struct Message : Model {
var id: Int
var user: User
var text : String?
var attachment: Attachment?
var entities: [Entity]?
var tags: [String]?
private enum CodingKeys : String, CodingKey {
case id = "mid", user, text = "body", attachment, entities, tags
}
}
struct Feed {
var title: String
var url: String
var imageName: String
}
|