From 855446c49fc5645a0870ccef2bc53a4219fec3ef Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Thu, 6 Feb 2025 23:38:42 -0500 Subject: [PATCH 01/12] watchos --- Package.swift | 2 +- Sources/ScryfallKit/Logger.swift | 2 ++ Sources/ScryfallKit/Networking/NetworkService.swift | 4 ++-- Sources/ScryfallKit/ScryfallClient+Async.swift | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Package.swift b/Package.swift index 97fe625..a1b7694 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "ScryfallKit", - platforms: [.macOS(.v10_13), .iOS(.v12)], + platforms: [.macOS(.v10_13), .iOS(.v12), .watchOS(.v11)], products: [ .library( name: "ScryfallKit", diff --git a/Sources/ScryfallKit/Logger.swift b/Sources/ScryfallKit/Logger.swift index d070490..f065328 100644 --- a/Sources/ScryfallKit/Logger.swift +++ b/Sources/ScryfallKit/Logger.swift @@ -7,6 +7,8 @@ import OSLog @available(macOS 11.0, *) @available(iOS 14.0, *) +@available(watchOS 11.0, *) + extension Logger { static let subsystem = "dev.hearst.scryfallkit" static let main = Logger(subsystem: subsystem, category: "ScryfallKit") diff --git a/Sources/ScryfallKit/Networking/NetworkService.swift b/Sources/ScryfallKit/Networking/NetworkService.swift index 892fec0..3639eaf 100644 --- a/Sources/ScryfallKit/Networking/NetworkService.swift +++ b/Sources/ScryfallKit/Networking/NetworkService.swift @@ -19,7 +19,7 @@ protocol NetworkServiceProtocol: Sendable { as type: T.Type, completion: @Sendable @escaping (Result) -> Void ) - @available(macOS 10.15.0, *, iOS 13.0.0, *) + @available(macOS 10.15.0, *, iOS 13.0.0, *, watchOS 11.0, *) func request(_ request: EndpointRequest, as type: T.Type) async throws -> T } @@ -104,7 +104,7 @@ struct NetworkService: NetworkServiceProtocol, Sendable { } } - @available(macOS 10.15.0, *, iOS 13.0.0, *) + @available(macOS 10.15.0, *, iOS 13.0.0, *, watchOS 11.0, *) func request(_ request: EndpointRequest, as type: T.Type) async throws -> T where T: Sendable { try await withCheckedThrowingContinuation { continuation in diff --git a/Sources/ScryfallKit/ScryfallClient+Async.swift b/Sources/ScryfallKit/ScryfallClient+Async.swift index 6b69232..8e50fce 100644 --- a/Sources/ScryfallKit/ScryfallClient+Async.swift +++ b/Sources/ScryfallKit/ScryfallClient+Async.swift @@ -4,7 +4,7 @@ import Foundation -@available(macOS 10.15.0, *, iOS 13.0.0, *) +@available(macOS 10.15.0, *, iOS 13.0.0, *, watchOS 11.0, *) extension ScryfallClient { /// Equivalent to ``searchCards(filters:unique:order:sortDirection:includeExtras:includeMultilingual:includeVariations:page:completion:)`` but with async/await syntax public func searchCards( From 2460cb7128175d31812112e0043fdf0624c5ecfc Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Fri, 7 Feb 2025 10:06:14 -0500 Subject: [PATCH 02/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 306c1e1..0916661 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -33,7 +33,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// The language that this specific printing was printed in public var lang: String /// A link to where you can begin paginating all re/prints for this card on Scryfall’s API. - public var printsSearchUri: String + public var printsSearchUri: String? /// A link to this card’s rulings list on Scryfall’s API. public var rulingsUri: String /// A link to this card’s permapage on Scryfall’s website. @@ -196,7 +196,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { id: UUID, oracleId: String, lang: String, - printsSearchUri: String, + printsSearchUri: String?, rulingsUri: String, scryfallUri: String, uri: String, From a3d3cdb10af5c24e173f9cb3e22d7c46b888b4fa Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Fri, 7 Feb 2025 10:07:38 -0500 Subject: [PATCH 03/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 0916661..48e5a57 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -35,7 +35,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A link to where you can begin paginating all re/prints for this card on Scryfall’s API. public var printsSearchUri: String? /// A link to this card’s rulings list on Scryfall’s API. - public var rulingsUri: String + public var rulingsUri: String? /// A link to this card’s permapage on Scryfall’s website. public var scryfallUri: String /// A link to this card object on Scryfall’s API. @@ -197,7 +197,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { oracleId: String, lang: String, printsSearchUri: String?, - rulingsUri: String, + rulingsUri: String?, scryfallUri: String, uri: String, allParts: [RelatedCard]? = nil, From b3fdc89de81d2719f94cb16394ce40bb43453111 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Fri, 7 Feb 2025 10:08:55 -0500 Subject: [PATCH 04/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 48e5a57..32a5029 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -37,7 +37,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A link to this card’s rulings list on Scryfall’s API. public var rulingsUri: String? /// A link to this card’s permapage on Scryfall’s website. - public var scryfallUri: String + public var scryfallUri: String? /// A link to this card object on Scryfall’s API. public var uri: String @@ -198,7 +198,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { lang: String, printsSearchUri: String?, rulingsUri: String?, - scryfallUri: String, + scryfallUri: String?, uri: String, allParts: [RelatedCard]? = nil, cardFaces: [Face]? = nil, From 328b86cd4798ea517a6c0f95942685c31f22acd8 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Fri, 7 Feb 2025 10:11:17 -0500 Subject: [PATCH 05/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 32a5029..b333000 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -52,7 +52,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// An array of colors representing this card's color identity. /// /// Color identity is used to determine what cards are legal in a Commander deck. See the [comprehensive rules](https://magic.wizards.com/en/rules) for more information - public var colorIdentity: [Color] + public var colorIdentity: [Color]? /// An array of the colors in this card’s color indicator or nil if it doesn't have one /// /// Color indicators are used to specify the color of a card that has no mana symbols @@ -196,14 +196,14 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { id: UUID, oracleId: String, lang: String, - printsSearchUri: String?, - rulingsUri: String?, - scryfallUri: String?, + printsSearchUri: String? = nil, + rulingsUri: String? = nil, + scryfallUri: String? = nil, uri: String, allParts: [RelatedCard]? = nil, cardFaces: [Face]? = nil, cmc: Double, - colorIdentity: [Color], + colorIdentity: [Color]? = nil, colorIndicator: [Color]? = nil, colors: [Color]? = nil, edhrecRank: Int? = nil, From b1be6880036e42ec31e2ab2a9ef233bcaa000aca Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Fri, 7 Feb 2025 14:07:32 -0500 Subject: [PATCH 06/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 77 +++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index b333000..4b3fca6 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -100,6 +100,8 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { // MARK: Print fields /// The name of the artist who illustrated this card public var artist: String? + /// An array of IDs that map to the artists who illustrated the card + public var artistIds: [String]? /// True if this card was printed in booster packs public var booster: Bool /// The color of this card's border @@ -127,6 +129,8 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { public var frame: Frame /// True if this card's art is larger than normal public var fullArt: Bool + /// A description of what security stamp the card has - for Unfinity cards, will be "acorn", for normal rares, "oval" + public var securityStamp: String? /// An array of the games this card has been released in public var games: [Game] /// True if Scryfall has a high-res image of this card @@ -169,6 +173,8 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { public var setType: MTGSet.`Type` /// A link to this card's set object on the Scryfall API public var setUri: String + /// A unique ID that identifies what set the card came from. + public var setId: String? /// This card's set code public var set: String /// True if this was a story spotlight card @@ -184,6 +190,71 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// An object with information on when this card was previewed and by whom public var preview: Preview? + enum CodingKeys: String, CodingKey { + case id + case oracleId = "oracle_id" + case multiverseIds = "multiverse_ids" + case mtgoId = "mtgo_id" + case arenaId = "arena_id" + case tcgplayerId = "tcgplayer_id" + case cardMarketId = "cardmarket_id" + case name + case lang + case releasedAt = "released_at" + case uri + case scryfallUri = "scryfall_uri" + case layout + case highresImage = "highres_image" + case imageStatus = "image_status" + case imageUris = "image_uris" + case manaCost = "mana_cost" + case cmc + case typeLine = "type_line" + case oracleText = "oracle_text" + case power + case toughness + case colors + case colorIdentity = "color_identity" + case keywords + case legalities + case games + case reserved + case finishes + case oversized + case promo + case promoTypes = "promo_types" + case reprint + case variation + case setId = "set_id" + case set + case setName = "set_name" + case setType = "set_type" + case setUri = "set_uri" + case setSearchUri = "set_search_uri" + case scryfallSetUri = "scryfall_set_uri" + case rulingsUri = "rulings_uri" + case printsSearchUri = "prints_search_uri" + case collectorNumber = "collector_number" + case digital + case rarity + case cardBackId = "card_back_id" + case artist + case artistIds = "artist_ids" + case illustrationId = "illustration_id" + case borderColor = "border_color" + case frame + case frameEffects = "frame_effects" + case securityStamp = "security_stamp" + case fullArt = "full_art" + case textless + case booster + case storySpotlight = "story_spotlight" + case edhrecRank = "edhrec_rank" + case prices + case relatedUris = "related_uris" + case purchaseUris = "purchase_uris" + } + // swiftlint:disable function_body_length public init( arenaId: Int? = nil, @@ -196,7 +267,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { id: UUID, oracleId: String, lang: String, - printsSearchUri: String? = nil, + printsSearchUri: String? = nil, rulingsUri: String? = nil, scryfallUri: String? = nil, uri: String, @@ -223,6 +294,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { toughness: String? = nil, typeLine: String? = nil, artist: String? = nil, + artistIds: [String]? = nil, booster: Bool, borderColor: BorderColor, cardBackId: UUID? = nil, @@ -235,6 +307,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { frameEffects: [FrameEffect]? = nil, frame: Frame, fullArt: Bool, + securityStamp: String? = nil, games: [Game], highresImage: Bool, illustrationId: UUID? = nil, @@ -301,6 +374,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { self.toughness = toughness self.typeLine = typeLine self.artist = artist + self.artistIds = artistIds self.booster = booster self.borderColor = borderColor self.cardBackId = cardBackId @@ -313,6 +387,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { self.frameEffects = frameEffects self.frame = frame self.fullArt = fullArt + self.securityStamp = securityStamp self.games = games self.highresImage = highresImage self.illustrationId = illustrationId From 4d0c612de397e9556a260579f5e7010809a4526c Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Sat, 8 Feb 2025 22:40:14 -0500 Subject: [PATCH 07/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 4b3fca6..13d01e2 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -208,6 +208,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { case imageStatus = "image_status" case imageUris = "image_uris" case manaCost = "mana_cost" + case cardFaces = "card_faces" case cmc case typeLine = "type_line" case oracleText = "oracle_text" From b606e22547f241866a1a1b1b20a6d004d0b0fe72 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Sat, 8 Feb 2025 22:44:09 -0500 Subject: [PATCH 08/12] Update Card+Face.swift --- .../ScryfallKit/Models/Card/Card+Face.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/ScryfallKit/Models/Card/Card+Face.swift b/Sources/ScryfallKit/Models/Card/Card+Face.swift index b0f0f61..8fdb56a 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Face.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Face.swift @@ -57,6 +57,26 @@ extension Card { /// This card's watermark, if any public var watermark: String? + enum CodingKeys: String, CodingKey { + case artist + case colorIndicator = "color_indicator" + case colors + case flavorText = "flavor_text" + case illustrationId = "illustration_id" + case imageUris = "image_uris" + case loyalty + case manaCost = "mana_cost" + case name + case oracleText = "oracle_text" + case power + case printedName = "printed_name" + case printedText = "printed_text" + case printedTypeLine = "printed_type_line" + case toughness + case typeLine = "type_line" + case watermark + } + public init( artist: String? = nil, colorIndicator: [Card.Color]? = nil, From d6f66d4860fb6802795d9e6632a35b46a699a4f7 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Mon, 10 Feb 2025 11:04:12 -0500 Subject: [PATCH 09/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 13d01e2..a2aff43 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -35,7 +35,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A link to where you can begin paginating all re/prints for this card on Scryfall’s API. public var printsSearchUri: String? /// A link to this card’s rulings list on Scryfall’s API. - public var rulingsUri: String? + public var rulingsUri: String /// A link to this card’s permapage on Scryfall’s website. public var scryfallUri: String? /// A link to this card object on Scryfall’s API. @@ -52,7 +52,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// An array of colors representing this card's color identity. /// /// Color identity is used to determine what cards are legal in a Commander deck. See the [comprehensive rules](https://magic.wizards.com/en/rules) for more information - public var colorIdentity: [Color]? + public var colorIdentity: [Color] /// An array of the colors in this card’s color indicator or nil if it doesn't have one /// /// Color indicators are used to specify the color of a card that has no mana symbols @@ -269,13 +269,13 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { oracleId: String, lang: String, printsSearchUri: String? = nil, - rulingsUri: String? = nil, + rulingsUri: String, scryfallUri: String? = nil, uri: String, allParts: [RelatedCard]? = nil, cardFaces: [Face]? = nil, cmc: Double, - colorIdentity: [Color]? = nil, + colorIdentity: [Color], colorIndicator: [Color]? = nil, colors: [Color]? = nil, edhrecRank: Int? = nil, From 767ec9f24c2dc47ae7330013e104fbff91044fb4 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Mon, 10 Feb 2025 11:08:36 -0500 Subject: [PATCH 10/12] Update Card.swift --- Sources/ScryfallKit/Models/Card/Card.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index a2aff43..6a1db4e 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -37,7 +37,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A link to this card’s rulings list on Scryfall’s API. public var rulingsUri: String /// A link to this card’s permapage on Scryfall’s website. - public var scryfallUri: String? + public var scryfallUri: String /// A link to this card object on Scryfall’s API. public var uri: String @@ -174,7 +174,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A link to this card's set object on the Scryfall API public var setUri: String /// A unique ID that identifies what set the card came from. - public var setId: String? + public var setId: String /// This card's set code public var set: String /// True if this was a story spotlight card @@ -270,7 +270,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { lang: String, printsSearchUri: String? = nil, rulingsUri: String, - scryfallUri: String? = nil, + scryfallUri: String, uri: String, allParts: [RelatedCard]? = nil, cardFaces: [Face]? = nil, @@ -330,6 +330,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { setSearchUri: URL, setType: MTGSet.`Type`, setUri: String, + setId: String, set: String, storySpotlight: Bool, textless: Bool, @@ -410,6 +411,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { self.setSearchUri = setSearchUri self.setType = setType self.setUri = setUri + self.setId = setId self.set = set self.storySpotlight = storySpotlight self.textless = textless From 1b403669c30ac7b607fb7259efa57d1b635e1220 Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Tue, 18 Feb 2025 16:31:12 -0500 Subject: [PATCH 11/12] Getting things working --- .../ScryfallKit/Models/Card/Card+Face.swift | 18 ++--- Sources/ScryfallKit/Models/Card/Card.swift | 74 +------------------ Sources/ScryfallKit/Models/Enums.swift | 4 + 3 files changed, 17 insertions(+), 79 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card+Face.swift b/Sources/ScryfallKit/Models/Card/Card+Face.swift index 8fdb56a..1f5028a 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Face.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Face.swift @@ -59,21 +59,21 @@ extension Card { enum CodingKeys: String, CodingKey { case artist - case colorIndicator = "color_indicator" + case colorIndicator //= "color_indicator" case colors - case flavorText = "flavor_text" - case illustrationId = "illustration_id" - case imageUris = "image_uris" + case flavorText //= "flavor_text" + case illustrationId// = "illustration_id" + case imageUris //= "image_uris" case loyalty - case manaCost = "mana_cost" + case manaCost //= "mana_cost" case name - case oracleText = "oracle_text" + case oracleText// = "oracle_text" case power case printedName = "printed_name" - case printedText = "printed_text" - case printedTypeLine = "printed_type_line" + case printedText// = "printed_text" + case printedTypeLine //= "printed_type_line" case toughness - case typeLine = "type_line" + case typeLine //= "type_line" case watermark } diff --git a/Sources/ScryfallKit/Models/Card/Card.swift b/Sources/ScryfallKit/Models/Card/Card.swift index 6a1db4e..916ddbc 100644 --- a/Sources/ScryfallKit/Models/Card/Card.swift +++ b/Sources/ScryfallKit/Models/Card/Card.swift @@ -130,7 +130,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// True if this card's art is larger than normal public var fullArt: Bool /// A description of what security stamp the card has - for Unfinity cards, will be "acorn", for normal rares, "oval" - public var securityStamp: String? + public var securityStamp: SecurityStamp? /// An array of the games this card has been released in public var games: [Game] /// True if Scryfall has a high-res image of this card @@ -160,7 +160,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// A dictionary of links to other MTG resources public var relatedUris: [String: String] /// This card's release date - public var releasedAt: String + public var releasedAt: String? /// True if this card has been printed before public var reprint: Bool /// Link to this card's set on Scryfall @@ -190,72 +190,6 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { /// An object with information on when this card was previewed and by whom public var preview: Preview? - enum CodingKeys: String, CodingKey { - case id - case oracleId = "oracle_id" - case multiverseIds = "multiverse_ids" - case mtgoId = "mtgo_id" - case arenaId = "arena_id" - case tcgplayerId = "tcgplayer_id" - case cardMarketId = "cardmarket_id" - case name - case lang - case releasedAt = "released_at" - case uri - case scryfallUri = "scryfall_uri" - case layout - case highresImage = "highres_image" - case imageStatus = "image_status" - case imageUris = "image_uris" - case manaCost = "mana_cost" - case cardFaces = "card_faces" - case cmc - case typeLine = "type_line" - case oracleText = "oracle_text" - case power - case toughness - case colors - case colorIdentity = "color_identity" - case keywords - case legalities - case games - case reserved - case finishes - case oversized - case promo - case promoTypes = "promo_types" - case reprint - case variation - case setId = "set_id" - case set - case setName = "set_name" - case setType = "set_type" - case setUri = "set_uri" - case setSearchUri = "set_search_uri" - case scryfallSetUri = "scryfall_set_uri" - case rulingsUri = "rulings_uri" - case printsSearchUri = "prints_search_uri" - case collectorNumber = "collector_number" - case digital - case rarity - case cardBackId = "card_back_id" - case artist - case artistIds = "artist_ids" - case illustrationId = "illustration_id" - case borderColor = "border_color" - case frame - case frameEffects = "frame_effects" - case securityStamp = "security_stamp" - case fullArt = "full_art" - case textless - case booster - case storySpotlight = "story_spotlight" - case edhrecRank = "edhrec_rank" - case prices - case relatedUris = "related_uris" - case purchaseUris = "purchase_uris" - } - // swiftlint:disable function_body_length public init( arenaId: Int? = nil, @@ -308,7 +242,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { frameEffects: [FrameEffect]? = nil, frame: Frame, fullArt: Bool, - securityStamp: String? = nil, + securityStamp: SecurityStamp? = nil, games: [Game], highresImage: Bool, illustrationId: UUID? = nil, @@ -323,7 +257,7 @@ public struct Card: Codable, Identifiable, Hashable, Sendable { purchaseUris: [String: String]? = nil, rarity: Card.Rarity, relatedUris: [String: String], - releasedAt: String, + releasedAt: String? = nil, reprint: Bool, scryfallSetUri: String, setName: String, diff --git a/Sources/ScryfallKit/Models/Enums.swift b/Sources/ScryfallKit/Models/Enums.swift index a0e49e0..3920ea5 100644 --- a/Sources/ScryfallKit/Models/Enums.swift +++ b/Sources/ScryfallKit/Models/Enums.swift @@ -39,3 +39,7 @@ public enum Format: String, CaseIterable, Sendable { public enum Currency: String, CaseIterable, Sendable { case usd, eur, tix, usdFoil } + +public enum SecurityStamp: String, Codable, Sendable { + case oval, triangle, acorn, circle, arena, heart +} From e161bad89ef28d76878bd7e337a06ed52883b42d Mon Sep 17 00:00:00 2001 From: Luke Solomon Date: Thu, 20 Feb 2025 12:27:14 -0500 Subject: [PATCH 12/12] Update Card+Face.swift --- .../ScryfallKit/Models/Card/Card+Face.swift | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/Sources/ScryfallKit/Models/Card/Card+Face.swift b/Sources/ScryfallKit/Models/Card/Card+Face.swift index 1f5028a..b0f0f61 100644 --- a/Sources/ScryfallKit/Models/Card/Card+Face.swift +++ b/Sources/ScryfallKit/Models/Card/Card+Face.swift @@ -57,26 +57,6 @@ extension Card { /// This card's watermark, if any public var watermark: String? - enum CodingKeys: String, CodingKey { - case artist - case colorIndicator //= "color_indicator" - case colors - case flavorText //= "flavor_text" - case illustrationId// = "illustration_id" - case imageUris //= "image_uris" - case loyalty - case manaCost //= "mana_cost" - case name - case oracleText// = "oracle_text" - case power - case printedName = "printed_name" - case printedText// = "printed_text" - case printedTypeLine //= "printed_type_line" - case toughness - case typeLine //= "type_line" - case watermark - } - public init( artist: String? = nil, colorIndicator: [Card.Color]? = nil,