diff options
author | 2024-05-15 09:38:05 +0300 | |
---|---|---|
committer | 2024-05-15 09:38:05 +0300 | |
commit | f2bf132d6df251ea7d5224d0d86c2ca5b0c02320 (patch) | |
tree | 0e3206404d934c8bff590ba1f3c757ab05192def /JuickNext/Models.swift | |
parent | 1b058af687bac9dfe8c78209fe7ba510b2d78257 (diff) |
Integrate feeds from good old `tst` 2019 project
Diffstat (limited to 'JuickNext/Models.swift')
-rw-r--r-- | JuickNext/Models.swift | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/JuickNext/Models.swift b/JuickNext/Models.swift new file mode 100644 index 0000000..77a12f5 --- /dev/null +++ b/JuickNext/Models.swift @@ -0,0 +1,47 @@ +// +// 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 + } +} |