-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpecies.swift
57 lines (39 loc) · 1.48 KB
/
Species.swift
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
import Foundation
/// A species resource type from SWAPI.
public struct Species: DecodableResource {
public static let endpoint: Endpoint = .species
public let id: UUID = UUID()
public let name: String
public let url: URL
public let created: Date
public let updated: Date
/// The classification of this species.
public let classification: String
/// The desigation of this species.
public let designation: String
/// The average height of this species.
public let averageHeight: String
/// The average lifespan of this species.
public let averageLifespan: String
/// The eye colors of this species.
public let eyeColors: String
/// The hair colors of this species.
public let hairColors: String
/// The skin colors of this species.
public let skinColors: String
/// The language of this species.
public let language: String
public let homeworld: URL?
/// The list of `URL` for people of this species.
public let people: [URL]
public let films: [URL]
enum CodingKeys: String, CodingKey {
case name, url, created, classification, designation, averageHeight, averageLifespan, eyeColors, hairColors, skinColors, language, homeworld, people, films
case updated = "edited"
}
}
extension Species: CharactersProvider, FilmsProvider, HomeworldProvider {
public var characters: [URL] {
return people
}
}