diff --git a/Sources/ScryfallKit/Extensions/Card+helpers.swift b/Sources/ScryfallKit/Extensions/Card+helpers.swift index 4023c2a..1fe6035 100644 --- a/Sources/ScryfallKit/Extensions/Card+helpers.swift +++ b/Sources/ScryfallKit/Extensions/Card+helpers.swift @@ -34,6 +34,28 @@ extension Card { return legalities.penny ?? .notLegal case .commander: return legalities.commander ?? .notLegal + case .future: + return legalities.future ?? .notLegal + case .timeless: + return legalities.timeless ?? .notLegal + case .gladiator: + return legalities.gladiator ?? .notLegal + case .oathbreaker: + return legalities.oathbreaker ?? .notLegal + case .standardbrawl: + return legalities.standardbrawl ?? .notLegal + case .alchemy: + return legalities.alchemy ?? .notLegal + case .paupercommander: + return legalities.paupercommander ?? .notLegal + case .duel: + return legalities.duel ?? .notLegal + case .oldschool: + return legalities.oldschool ?? .notLegal + case .premodern: + return legalities.premodern ?? .notLegal + case .predh: + return legalities.predh ?? .notLegal } } diff --git a/Sources/ScryfallKit/Models/Card/Card+Face.swift b/Sources/ScryfallKit/Models/Card/Card+Face.swift index b0f0f61..bc080a2 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Face.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Face.swift @@ -23,6 +23,8 @@ extension Card { public var colorIndicator: [Card.Color]? /// An array of the colors in this card's mana cost public var colors: [Card.Color]? + /// This face's defense, if any + public var defense: String? /// This card's flavor text if any public var flavorText: String? /// An ID for this card face's art that remains consistent across reprints @@ -61,6 +63,7 @@ extension Card { artist: String? = nil, colorIndicator: [Card.Color]? = nil, colors: [Card.Color]? = nil, + defense: String? = nil, flavorText: String? = nil, illustrationId: UUID? = nil, imageUris: ImageUris? = nil, @@ -79,6 +82,7 @@ extension Card { self.artist = artist self.colorIndicator = colorIndicator self.colors = colors + self.defense = defense self.flavorText = flavorText self.illustrationId = illustrationId self.imageUris = imageUris diff --git a/Sources/ScryfallKit/Models/Card/Card+Legalities.swift b/Sources/ScryfallKit/Models/Card/Card+Legalities.swift index 94247d5..14ae015 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Legalities.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Legalities.swift @@ -17,6 +17,17 @@ extension Card { public let penny: Legality? public let commander: Legality? public let brawl: Legality? + public let future: Legality? + public let timeless: Legality? + public let gladiator: Legality? + public let oathbreaker: Legality? + public let standardbrawl: Legality? + public let alchemy: Legality? + public let paupercommander: Legality? + public let duel: Legality? + public let oldschool: Legality? + public let premodern: Legality? + public let predh: Legality? public init( standard: Legality?, @@ -28,7 +39,18 @@ extension Card { vintage: Legality?, penny: Legality?, commander: Legality?, - brawl: Legality? + brawl: Legality?, + future: Legality?, + timeless: Legality?, + gladiator: Legality?, + oathbreaker: Legality?, + standardbrawl: Legality?, + alchemy: Legality?, + paupercommander: Legality?, + duel: Legality?, + oldschool: Legality?, + premodern: Legality?, + predh: Legality?, ) { self.standard = standard self.historic = historic @@ -40,6 +62,17 @@ extension Card { self.penny = penny self.commander = commander self.brawl = brawl + self.future = future + self.timeless = timeless + self.gladiator = gladiator + self.oathbreaker = oathbreaker + self.standardbrawl = standardbrawl + self.alchemy = alchemy + self.paupercommander = paupercommander + self.duel = duel + self.oldschool = oldschool + self.premodern = premodern + self.predh = predh } } } diff --git a/Sources/ScryfallKit/Models/Card/Card+Symbol.swift b/Sources/ScryfallKit/Models/Card/Card+Symbol.swift index 2ea0332..eca120f 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Symbol.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Symbol.swift @@ -29,10 +29,15 @@ extension Card { public var funny: Bool /// The colors that make up this symbol public var colors: [Color] + /// True if the symbol is a hybrid mana symbol. Note that monocolor Phyrexian symbols aren’t considered hybrid. + public var hybrid: Bool + /// True if the symbol is a Phyrexian mana symbol, i.e. it can be paid with 2 life. + public var phyrexian: Bool /// Alternate notations for this symbol that used on Wizards of the Coast's [Gatherer](https://gatherer.wizards.com/Pages/Default.aspx) public var gathererAlternates: [String]? /// A link to an SVG of this symbol public var svgUri: String? + /// A computed ID for this symbol which is just the `symbol` property public var id: String { symbol } @@ -47,6 +52,8 @@ extension Card { appearsInManaCosts: Bool, funny: Bool, colors: [Color], + hybrid: Bool, + phyrexian: Bool, gathererAlternates: [String]? = nil, svgUri: String? = nil ) { @@ -59,6 +66,8 @@ extension Card { self.appearsInManaCosts = appearsInManaCosts self.funny = funny self.colors = colors + self.hybrid = hybrid + self.phyrexian = phyrexian self.gathererAlternates = gathererAlternates self.svgUri = svgUri } diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index c7d2ccb..7fd440b 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -59,8 +59,12 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { public var colorIndicator: [Color]? /// An array of the colors in this card's mana cost public var colors: [Color]? + /// This card's defense, if any + public var defense: String? /// This card’s overall rank/popularity on EDHREC. Not all cards are ranked. public var edhrecRank: Int? + /// True if this card is on the [Commander Game Changer list](https://mtg.wiki/page/Game_Changers). + public var gameChanger: Bool? /// This card’s hand modifier, if it is Vanguard card. This value will contain a delta, such as -1. public var handModifier: String? /// An array of the keywords on this card (deathouch, first strike, etc) @@ -206,7 +210,9 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { colorIdentity: [Color], colorIndicator: [Color]? = nil, colors: [Color]? = nil, + defense: String? = nil, edhrecRank: Int? = nil, + gameChanger: Bool? = nil, handModifier: String? = nil, keywords: [String], layout: Layout, @@ -284,7 +290,9 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { self.colorIdentity = colorIdentity self.colorIndicator = colorIndicator self.colors = colors + self.defense = defense self.edhrecRank = edhrecRank + self.gameChanger = gameChanger self.handModifier = handModifier self.keywords = keywords self.layout = layout diff --git a/Sources/ScryfallKit/Models/Catalog.swift b/Sources/ScryfallKit/Models/Catalog.swift index 8083c87..dafc828 100644 --- a/Sources/ScryfallKit/Models/Catalog.swift +++ b/Sources/ScryfallKit/Models/Catalog.swift @@ -9,20 +9,25 @@ import Foundation /// [Scryfall documentation](https://scryfall.com/docs/api/catalogs) public struct Catalog: Codable, Sendable { /// The catalog type. Each of these types represents a different `/catalogs` endpoint - public enum `Type`: String, Codable, CaseIterable { - case powers, toughnesses, loyalties, watermarks + public enum `Type`: String, Codable, CaseIterable, Sendable { case cardNames = "card-names" case artistNames = "artist-names" case wordBank = "word-bank" - case creatureTypes = "creature-types" - case planeswalkerTypes = "planeswalker-types" - case landTypes = "land-types" + case supertypes + case cardTypes = "card-types" case artifactTypes = "artifact-types" + case battleTypes = "battle-types" + case creatureTypes = "creature-types" case enchantmentTypes = "enchantment-types" + case landTypes = "land-types" + case planeswalkerTypes = "planeswalker-types" case spellTypes = "spell-types" + case powers, toughnesses, loyalties case keywordAbilities = "keyword-abilities" case keywordActions = "keyword-actions" case abilityWords = "ability-words" + case flavorWords = "flavor-words" + case watermarks } /// The number of items in the `data` array diff --git a/Sources/ScryfallKit/Models/Enums.swift b/Sources/ScryfallKit/Models/Enums.swift index b2b09c1..dd2ad27 100644 --- a/Sources/ScryfallKit/Models/Enums.swift +++ b/Sources/ScryfallKit/Models/Enums.swift @@ -6,7 +6,7 @@ import Foundation /// Environments to play Magic: The Gathering in public enum Game: String, Codable, CaseIterable, Sendable { - case paper, mtgo, arena + case paper, mtgo, arena, astral, sega } /// Comparison strategies for determining what makes a card "unique" @@ -20,7 +20,7 @@ public enum UniqueMode: String, Codable, CaseIterable, Sendable { /// /// [Scryfall documentation](https://scryfall.com/docs/api/cards/search#sorting-cards) public enum SortMode: String, Codable, CaseIterable, Sendable { - case name, set, released, rarity, color, usd, tix, eur, cmc, power, toughness, edhrec, artist + case name, set, released, rarity, color, usd, tix, eur, cmc, power, toughness, edhrec, artist, spoiled } /// Directions that Scryfall can order cards in @@ -32,7 +32,9 @@ public enum SortDirection: String, Codable, CaseIterable, Sendable { /// Formats for playing Magic: the Gathering public enum Format: String, CaseIterable, Sendable { - case standard, historic, pioneer, modern, legacy, pauper, vintage, penny, commander, brawl + case standard, future, historic, timeless, gladiator, pioneer, modern, legacy, pauper, vintage, + penny, commander, oathbreaker, standardbrawl, brawl, alchemy, paupercommander, duel, oldschool, + premodern, predh } /// Currency types that Scryfall provides prices for diff --git a/Sources/ScryfallKit/Models/MTGSet.swift b/Sources/ScryfallKit/Models/MTGSet.swift index 105c387..dbfddfb 100644 --- a/Sources/ScryfallKit/Models/MTGSet.swift +++ b/Sources/ScryfallKit/Models/MTGSet.swift @@ -34,13 +34,15 @@ public struct MTGSet: Codable, Identifiable, Hashable, Sendable { // While "masters" is in fact not inclusive, it's also a name that we can't control // swiftlint:disable:next inclusive_language case core, expansion, masters, masterpiece, spellbook, commander, planechase, archenemy, - vanguard, funny, starter, box, promo, token, memorabilia, arsenal, alchemy, minigame, fromTheVault, premiumDeck, duelDeck, draftInnovation, treasureChest + vanguard, funny, starter, box, promo, token, memorabilia, arsenal, alchemy, minigame, + eternal, fromTheVault, premiumDeck, duelDeck, draftInnovation, treasureChest /// A layout that hasn't been added to ScryfallKit yet case unknown(String) public static let allCases: [Kind] = [ .core, .expansion, .masters, .masterpiece, .spellbook, .commander, .planechase, .archenemy, - .vanguard, .funny, .starter, .box, .promo, .token, .memorabilia, .arsenal, .alchemy, .minigame, .fromTheVault, .premiumDeck, .duelDeck, .draftInnovation, .treasureChest + .vanguard, .funny, .starter, .box, .promo, .token, .memorabilia, .arsenal, .alchemy, .minigame, + .eternal, .fromTheVault, .premiumDeck, .duelDeck, .draftInnovation, .treasureChest ] public var rawValue: String { diff --git a/Tests/ScryfallKitTests/CaseIterableTests.swift b/Tests/ScryfallKitTests/CaseIterableTests.swift index e0b564b..cbe7422 100644 --- a/Tests/ScryfallKitTests/CaseIterableTests.swift +++ b/Tests/ScryfallKitTests/CaseIterableTests.swift @@ -131,6 +131,7 @@ final class CaseIterableTests: XCTestCase { case .arsenal: MTGSet.Kind.allCases.contains(.arsenal) case .alchemy: MTGSet.Kind.allCases.contains(.alchemy) case .minigame: MTGSet.Kind.allCases.contains(.minigame) + case .eternal: MTGSet.Kind.allCases.contains(.eternal) case .fromTheVault: MTGSet.Kind.allCases.contains(.fromTheVault) case .premiumDeck: MTGSet.Kind.allCases.contains(.premiumDeck) case .duelDeck: MTGSet.Kind.allCases.contains(.duelDeck)