51 lines
1.1 KiB
Swift
51 lines
1.1 KiB
Swift
|
//
|
||
|
// Card.swift
|
||
|
// Pachyderm
|
||
|
//
|
||
|
// Created by Shadowfacts on 9/9/18.
|
||
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||
|
//
|
||
|
|
||
|
import Foundation
|
||
|
|
||
|
public class Card: Decodable, ClientModel {
|
||
|
var client: Client!
|
||
|
|
||
|
public let url: URL
|
||
|
public let title: String
|
||
|
public let description: String
|
||
|
public let image: URL?
|
||
|
public let kind: Kind
|
||
|
public let authorName: String?
|
||
|
public let authorURL: URL?
|
||
|
public let providerName: String?
|
||
|
public let providerURL: URL?
|
||
|
public let html: String?
|
||
|
public let width: Int?
|
||
|
public let height: Int?
|
||
|
|
||
|
private enum CodingKeys: String, CodingKey {
|
||
|
case url
|
||
|
case title
|
||
|
case description
|
||
|
case image
|
||
|
case kind = "type"
|
||
|
case authorName = "author_name"
|
||
|
case authorURL = "author_url"
|
||
|
case providerName = "provider_name"
|
||
|
case providerURL = "provider_url"
|
||
|
case html
|
||
|
case width
|
||
|
case height
|
||
|
}
|
||
|
}
|
||
|
|
||
|
extension Card {
|
||
|
public enum Kind: String, Decodable {
|
||
|
case link
|
||
|
case photo
|
||
|
case video
|
||
|
case rich
|
||
|
}
|
||
|
}
|