diff --git a/Sources/Filters/AmiiboFilter.swift b/Sources/Filters/AmiiboFilter.swift index 4bce627..1e9d1f8 100644 --- a/Sources/Filters/AmiiboFilter.swift +++ b/Sources/Filters/AmiiboFilter.swift @@ -107,14 +107,16 @@ extension AmiiboFilter: Filter { // MARK: - Enumerations -/// This enumeration indicates if extra information for amiibos need to be retrieved. -public enum ShowExtras { - /// No extra information needs to be retrieved. - case none - /// Amiibo games information needs to be retrieved. - case games - /// Amiibo games and its usage information needs to be retrieved. - case usage +extension AmiiboFilter { + /// This enumeration indicates if extra information for amiibos need to be retrieved. + public enum ShowExtras { + /// No extra information needs to be retrieved. + case none + /// Amiibo games information needs to be retrieved. + case games + /// Amiibo games and its usage information needs to be retrieved. + case usage + } } // MARK: - String+Key diff --git a/Sources/Models/AmiiboGame.swift b/Sources/Models/AmiiboGame.swift new file mode 100644 index 0000000..377a0df --- /dev/null +++ b/Sources/Models/AmiiboGame.swift @@ -0,0 +1,27 @@ +extension Amiibo { + /// This model structs represents a game that is related to an amiibo, when requested to the respective [remote API endpoint](https://www.amiiboapi.com/docs/#showGames). + public struct Game { + + // MARK: Properties + + /// The list of identifiers associated to the game. + public let ids: [String] + + /// The name of the game. + public let name: String + + /// The list of usages that explains how the amiibo is being used in the game. + public let usage: [Usage]? + + } +} + +// MARK: - Decodable + +extension Amiibo.Game: Decodable { + enum CodingKeys: String, CodingKey { + case ids = "gameID" + case name = "gameName" + case usage = "amiiboUsage" + } +} diff --git a/Sources/Models/AmiiboGameUsage.swift b/Sources/Models/AmiiboGameUsage.swift new file mode 100644 index 0000000..05ca396 --- /dev/null +++ b/Sources/Models/AmiiboGameUsage.swift @@ -0,0 +1,23 @@ +extension Amiibo.Game { + /// This model struct represents how an amiibo is used with a particular game, when requested to the respective [remote API endpoint](https://www.amiiboapi.com/docs/#showUsage). + public struct Usage { + + // MARK: Properties + + /// The explanation on how an amiibo is being used with a particular game. + public let explanation: String + + /// A flag that indicates whether an amiibo is only read-only or the game can also write information to the amiibo. + public let isWritable: Bool + + } +} + +// MARK: - Decodable + +extension Amiibo.Game.Usage: Decodable { + enum CodingKeys: String, CodingKey { + case explanation = "Usage" + case isWritable = "write" + } +} diff --git a/Sources/Models/AmiiboRelease.swift b/Sources/Models/AmiiboRelease.swift new file mode 100644 index 0000000..fc78b2e --- /dev/null +++ b/Sources/Models/AmiiboRelease.swift @@ -0,0 +1,33 @@ +import Foundation + +extension Amiibo { + /// This model struct represents a collection of official release dates (if released) of an amiibo in different markets around the world. + public struct Release { + + // MARK: Properties + + /// The official release date (if released) of an amiibo in Australia. + public let australia: Date? + + /// The official release date (if released) of an amiibo in Europe. + public let europe: Date? + + /// The official release date (if released) of an amiibo in Japan. + public let japan: Date? + + /// The official release date (if released) of an amiibo in North America. + public let america: Date? + + } +} + +// MARK: - Decodable + +extension Amiibo.Release: Decodable { + enum CodingKeys: String, CodingKey { + case australia = "au" + case europe = "eu" + case japan = "jp" + case america = "na" + } +} diff --git a/Sources/Models/Game.swift b/Sources/Models/Game.swift deleted file mode 100644 index 9457bb6..0000000 --- a/Sources/Models/Game.swift +++ /dev/null @@ -1,25 +0,0 @@ -/// This model structs represents a game that is related to an amiibo, when requested to the respective [remote API endpoint](https://www.amiiboapi.com/docs/#showGames). -public struct Game { - - // MARK: Properties - - /// The list of identifiers associated to the game. - public let ids: [String] - - /// The name of the game. - public let name: String - - /// The list of usages that explains how the amiibo is being used in the game. - public let usage: [Usage]? - -} - -// MARK: - Decodable - -extension Game: Decodable { - enum CodingKeys: String, CodingKey { - case ids = "gameID" - case name = "gameName" - case usage = "amiiboUsage" - } -} diff --git a/Sources/Models/Release.swift b/Sources/Models/Release.swift deleted file mode 100644 index 6f155cb..0000000 --- a/Sources/Models/Release.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation - -/// This model struct represents a collection of official release dates (if released) of an amiibo in different markets around the world. -public struct Release { - - // MARK: Properties - - /// The official release date (if released) of an amiibo in Australia. - public let australia: Date? - - /// The official release date (if released) of an amiibo in Europe. - public let europe: Date? - - /// The official release date (if released) of an amiibo in Japan. - public let japan: Date? - - /// The official release date (if released) of an amiibo in North America. - public let america: Date? - -} - -// MARK: - Decodable - -extension Release: Decodable { - enum CodingKeys: String, CodingKey { - case australia = "au" - case europe = "eu" - case japan = "jp" - case america = "na" - } -} diff --git a/Sources/Models/Usage.swift b/Sources/Models/Usage.swift deleted file mode 100644 index 5b55dab..0000000 --- a/Sources/Models/Usage.swift +++ /dev/null @@ -1,21 +0,0 @@ -/// This model struct represents how an amiibo is used with a particular game, when requested to the respective [remote API endpoint](https://www.amiiboapi.com/docs/#showUsage). -public struct Usage { - - // MARK: Properties - - /// The explanation on how an amiibo is being used with a particular game. - public let explanation: String - - /// A flag that indicates whether an amiibo is only read-only or the game can also write information to the amiibo. - public let isWritable: Bool - -} - -// MARK: - Decodable - -extension Usage: Decodable { - enum CodingKeys: String, CodingKey { - case explanation = "Usage" - case isWritable = "write" - } -}