Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#24 - PKMItemHolderPokemonVersionDetail class Change DTO data type #25

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PokemonAPI/Classes/Items.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ open class PKMItemHolderPokemon: Codable, SelfDecodable {
open class PKMItemHolderPokemonVersionDetail: Codable {

/// How often this Pokémon holds this item in this version
open var rarity: String?
open var rarity: Int?

/// The version that this item is held in by the Pokémon
open var version: PKMNamedAPIResource<PKMVersion>?
Expand Down
78 changes: 77 additions & 1 deletion PokemonAPI/Classes/Pokemon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,77 @@ open class PKMPokemonStat: Codable, SelfDecodable {
}()
}

//MARK: - Other
open class Other: Codable,SelfDecodable {

open var dreamWorld: DreamWorld?
open var home: Home?
open var officialArtwork: OfficialArtwork?
open var showdown: Showdown?


public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}

// MARK: - DreamWorld
open class DreamWorld: Codable,SelfDecodable {
open var frontDefault, frontFemale: String?


public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}

// MARK: - Home
open class Home: Codable,SelfDecodable {
open var frontDefault: String?
open var frontFemale: String?
open var frontShiny: String?
open var frontShinyFemale: String?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}

// MARK: - OfficialArtwork
open class OfficialArtwork: Codable,SelfDecodable {
open var frontDefault, frontShiny: String?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}

// MARK: - Showdown
open class Showdown: Codable, SelfDecodable {
open var backDefault: String?
open var backFemale: String?
open var backShiny: String?
open var backShinyFemale: String?
open var frontDefault: String?
open var frontFemale: String?
open var frontShiny: String?
open var frontShinyFemale: String?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
return decoder
}()
}


/// Pokemon Sprites
open class PKMPokemonSprites: Codable, SelfDecodable {
Expand All @@ -580,9 +651,12 @@ open class PKMPokemonSprites: Codable, SelfDecodable {
/// The female depiction of this Pokémon from the back in battle
open var backFemale: String?


/// The shiny female depiction of this Pokémon from the back in battle
open var backShinyFemale: String?

open var other:Other?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
Expand Down Expand Up @@ -702,6 +776,8 @@ open class PKMPokemonFormSprites: Codable, SelfDecodable {
/// The shiny depiction of this Pokémon form from the back in battle
open var backShiny: String?

open var other:Other?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
Expand Down Expand Up @@ -889,7 +965,7 @@ open class PKMPokemonSpeciesDexEntry: Codable, SelfDecodable {
open var entryNumber: Int?

/// The Pokédex the referenced Pokémon species can be found in
open var name: PKMNamedAPIResource<PKMName>?
open var pokedex: PKMNamedAPIResource<PKMName>?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
Expand Down
2 changes: 2 additions & 0 deletions PokemonAPI/Classes/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ open class PKMFlavorText: Codable, SelfDecodable {
/// The language this name is in
open var language: PKMName?

open var version:PKMVersion?

public static var decoder: JSONDecoder = {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
Expand Down